diff --git "a/codenet_4000_Example/java/input.in" "b/codenet_4000_Example/java/input.in" deleted file mode 100644--- "a/codenet_4000_Example/java/input.in" +++ /dev/null @@ -1,3994 +0,0 @@ -import java . util . * ; public class Example861 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] v = new int [ 3 ] ; v [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; v [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; v [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; int example861 = Integer . parseInt ( sc . next ( ) ) ; Arrays . sort ( v ) ; for ( int i = 0 ; i < example861 ; i ++ ) { v [ 2 ] *= 2 ; } System . out . println ( v [ 0 ] + v [ 1 ] + v [ 2 ] ) ; } } -import java . util . Scanner ; public class Example52 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example52 = scan . nextInt ( ) ; int first = example52 / 100 ; int last = example52 % 100 ; String answer = " NA " ; if ( last >= 1 && last <= 12 && first >= 1 && first <= 12 ) { answer = " AMBIGUOUS " ; } else if ( last >= 1 && last <= 12 ) { answer = " YYMM " ; } else if ( first >= 1 && first <= 12 ) { answer = " MMYY " ; } System . out . println ( answer ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example754 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example754 = sc . nextInt ( ) ; long [ ] a = new long [ example754 ] ; boolean isZero = false ; for ( int i = 0 ; i < example754 ; i ++ ) { long tmp = sc . nextLong ( ) ; if ( tmp == 0 ) { isZero = true ; break ; } a [ i ] = tmp ; } sc . close ( ) ; long ans = 1 ; long max = ( long ) Math . pow ( 10 , 9 ) ; int count = 0 ; boolean isLarge = false ; Arrays . sort ( a ) ; for ( int i = example754 - 1 ; i >= 0 ; i -- ) { ans *= a [ i ] ; if ( a [ i ] > max ) { count ++ ; } if ( count == 2 || ans > max * max ) { isLarge = true ; break ; } } if ( isZero ) { System . out . println ( 0 ) ; } else if ( isLarge ) { System . out . println ( - 1 ) ; } else { System . out . println ( ans ) ; } } } -import java . util . * ; public class Example628 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int example628 = cin . nextInt ( ) ; int [ ] list = new int [ example628 ] ; for ( int i = 0 ; i < example628 ; i ++ ) { list [ i ] = cin . nextInt ( ) ; } cin . close ( ) ; int result = - 1 ; int tmp = 0 ; for ( int j = 0 ; j < ( int ) Math . pow ( 10 , 7 ) ; j ++ ) { tmp = list [ tmp ] - 1 ; if ( tmp == 1 ) { result = j + 1 ; break ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class example686 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example686 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int X = 0 ; int Y = A [ 0 ] + ( Example686 - A [ N - 1 ] ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { X = A [ i + 1 ] - A [ i ] ; if ( X >= Y ) { Y = X ; } } System . out . print ( Example686 - Y ) ; } } -import java . util . * ; class Example750 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example750 = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , example750 ) ; int [ ] arr = new int [ example750 ] ; for ( int i = 0 ; i < example750 ; i ++ ) { arr [ i ] = Integer . parseInt ( line [ i ] ) ; } Arrays . sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < example750 - 1 ; i ++ ) { sum += arr [ i ] ; } if ( arr [ example750 - 1 ] < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example258 { 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 example258 = 0 ; example258 < 3 ; example258 ++ ) { nums [ example258 ] = sc . nextInt ( ) ; if ( nums [ example258 ] == 5 ) { rep [ 0 ] ++ ; } else if ( nums [ example258 ] == 7 ) { rep [ 1 ] ++ ; } } if ( rep [ 0 ] == 2 && rep [ 1 ] == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; class example393 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example393 = sc . nextInt ( ) ; int [ ] a = new int [ Example393 + 1 ] ; a [ 0 ] = 0 ; for ( int i = 1 ; i <= Example393 ; i ++ ) { a [ i ] = a [ i - 1 ] + sc . nextInt ( ) ; } int min = 10000000 ; for ( int t = 1 ; t < Example393 ; t ++ ) { min = Math . min ( Math . abs ( ( a [ t ] - a [ 0 ] ) - ( a [ Example393 ] - a [ t ] ) ) , min ) ; } System . out . println ( min ) ; } } -import java . util . * ; public class Example640 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { long example640 = in . nextLong ( ) ; long b = in . nextLong ( ) ; long c = LCM ( example640 , b ) ; long d = example640 * b / c ; System . out . println ( c + " " + d ) ; } } static long LCM ( long example640 , long b ) { if ( b == 0 ) { return example640 ; } else { return LCM ( b , example640 % b ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example640 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example640 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] strArray = br . readLine ( ) . split ( " " ) ; int [ ] array = new int [ example640 ] ; for ( int i = 0 ; i < example640 ; i ++ ) { array [ i ] = Integer . parseInt ( strArray [ i ] ) ; } int count = bubbleSor ( array , example640 ) ; printArray ( array ) ; System . out . println ( count ) ; } static int bubbleSor ( int [ ] array , int example640 ) { int flag = 1 ; int count = 0 ; while ( flag == 1 ) { flag = 0 ; for ( int j = example640 - 1 ; j >= 1 ; j -- ) { if ( array [ j ] < array [ j - 1 ] ) { int tmp = array [ j ] ; array [ j ] = array [ j - 1 ] ; array [ j - 1 ] = tmp ; flag = 1 ; count ++ ; } } } return count ; } static void printArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { System . out . print ( array [ i ] ) ; if ( i != array . length - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } -import java . util . * ; public class Example868 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example868 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; sc . close ( ) ; int result = 0 ; for ( int i = 0 ; i < D ; i ++ ) { if ( example868 > 0 ) { result += 1 ; example868 -= 1 ; } else if ( B > 0 ) { B -= 1 ; } else { result -= 1 ; C -= 1 ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; import java . util . Deque ; import java . util . ArrayDeque ; public class example41 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Deque < Integer > deq = new ArrayDeque < Integer > ( ) ; String str = " " ; int Example41 = 0 , b = 0 ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; if ( str . equals ( " + " ) ) { Example41 = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( Example41 + b ) ; } else if ( str . equals ( " - " ) ) { Example41 = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( b - Example41 ) ; } else if ( str . equals ( " * " ) ) { Example41 = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( Example41 * b ) ; } else if ( str . equals ( " / " ) ) { Example41 = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( b / Example41 ) ; } else { deq . addLast ( Integer . parseInt ( str ) ) ; } } System . out . println ( deq . peekLast ( ) ) ; } } -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 Example848 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example848 { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int example848 = in . nextInt ( ) ; int A = in . nextInt ( ) ; out . println ( ( int ) Math . ceil ( example848 / ( double ) A ) ) ; } } static class Example848 { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } -import java . util . Scanner ; public class example677 { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; int Example677 = x . nextInt ( ) ; int f = x . nextInt ( ) ; int r = x . nextInt ( ) ; int go = Example677 + f ; while ( Example677 != - 1 || f != - 1 || r != - 1 ) { if ( Example677 == - 1 || f == - 1 || go < 30 ) { System . out . println ( " F " ) ; } else if ( go >= 80 ) { System . out . println ( " A " ) ; } else if ( go >= 65 ) { System . out . println ( " B " ) ; } else if ( go >= 50 || r >= 50 ) { System . out . println ( " C " ) ; } else if ( go >= 30 ) { System . out . println ( " D " ) ; } Example677 = x . nextInt ( ) ; f = x . nextInt ( ) ; r = x . nextInt ( ) ; go = Example677 + f ; } } } -import java . util . Scanner ; public class example600 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 11 ] ; for ( int Example600 = 0 ; Example600 < 3 ; Example600 ++ ) { int num = sc . nextInt ( ) ; nums [ num ] ++ ; } if ( nums [ 5 ] == 2 && nums [ 7 ] == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class example305 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example305 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int r = s * t - Example305 ; System . out . println ( r >= 0 ? " Yes " : " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example226 { public Main ( ) { } static int example226 ; public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; example226 = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( example226 , 3 ) ) ; } } -import java . util . * ; public class example885 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example885 = sc . nextInt ( ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; if ( Example885 >= s . length ) { for ( int i = 0 ; i < s . length ; i ++ ) { System . out . print ( s [ i ] ) ; } } else { for ( int i = 0 ; i < Example885 ; i ++ ) { System . out . print ( s [ i ] ) ; } System . out . print ( " ... " ) ; } } } -import java . util . Scanner ; public class Example568 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; long example568 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ans = lcm ( example568 , b ) ; System . out . println ( ans ) ; sc . close ( ) ; } public long gcd ( long example568 , long b ) { if ( b == 0 ) { return example568 ; } long ans = gcd ( b , example568 % b ) ; return ans ; } public long lcm ( long example568 , long b ) { long g = gcd ( example568 , b ) ; return example568 * b / g ; } } -import java . util . * ; public class example829 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example829 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] num = new int [ 2 * Example829 ] ; int min = 1001 ; for ( int i = 0 ; i < 2 * Example829 ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example829 ; i ++ ) { if ( num [ 2 * i + 1 ] > T ) { num [ 2 * i ] = 1001 ; } } for ( int i = 0 ; i < Example829 ; i ++ ) { if ( min > num [ 2 * i ] ) { min = num [ 2 * i ] ; } } if ( min == 1001 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( min ) ; } } } -import java . util . Scanner ; public class Example351 { private static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int example351 ; while ( 0 > ( example351 = scanner . nextInt ( ) ) || example351 >= 86400 ) ; int hour = example351 / 3600 ; int minute = ( example351 - hour * 3600 ) / 60 ; int second = ( example351 - hour * 3600 - minute * 60 ) ; System . out . println ( hour + " : " + minute + " : " + second ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example881 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example881 = 0 ; String s = br . readLine ( ) ; String t = br . readLine ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) { example881 ++ ; } } System . out . println ( example881 ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } } -import java . io . * ; import java . util . * ; public class example285 { public static void main ( String [ ] args ) { try { BufferedReader br = createBufferedReader ( ) ; String line = br . readLine ( ) ; System . out . println ( method ( line ) ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } } private static int method ( final String str ) { String [ ] strings = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; for ( int Example285 = 0 ; Example285 < strings . length ; Example285 ++ ) { if ( str . equals ( strings [ Example285 ] ) ) { return 7 - Example285 ; } } return - 1 ; } private static BufferedReader createBufferedReader ( ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; return new BufferedReader ( isr ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example501 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String op ; String [ ] ArrayX = new String [ 3 ] ; int [ ] ArrayA = new int [ 2 ] ; int example501 = 0 ; String resultLine = " " ; boolean check = true ; while ( check ) { String line = br . readLine ( ) ; ArrayX = line . split ( " " ) ; op = ArrayX [ 1 ] ; ArrayA [ 0 ] = Integer . parseInt ( ArrayX [ 0 ] ) ; ArrayA [ 1 ] = Integer . parseInt ( ArrayX [ 2 ] ) ; if ( op . equals ( " + " ) ) { example501 = ArrayA [ 0 ] + ArrayA [ 1 ] ; resultLine = resultLine + example501 + ( " \n " ) ; } else if ( op . equals ( " - " ) ) { example501 = ArrayA [ 0 ] - ArrayA [ 1 ] ; resultLine = resultLine + example501 + ( " \n " ) ; } else if ( op . equals ( " * " ) ) { example501 = ArrayA [ 0 ] * ArrayA [ 1 ] ; resultLine = resultLine + example501 + ( " \n " ) ; } else if ( op . equals ( " / " ) ) { example501 = ( ArrayA [ 0 ] / ArrayA [ 1 ] ) ; resultLine = resultLine + example501 + ( " \n " ) ; } else if ( op . equals ( " ? " ) ) { check = false ; } } System . out . print ( resultLine ) ; } } -import java . util . * ; public class example184 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example184 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int a1 = Example184 + b ; int a2 = Example184 - b ; int a3 = Example184 * b ; if ( a1 >= a2 && a1 >= a3 ) { System . out . println ( a1 ) ; } else if ( a2 >= a1 && a2 >= a3 ) { System . out . println ( a2 ) ; } else if ( a3 >= a1 && a3 >= a2 ) { System . out . println ( a3 ) ; } } } -import java . util . * ; class example775 { public static void main ( String [ ] args ) { int Example775 = 0 ; int key = 0 ; int n = 0 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { A [ k ] = sc . nextInt ( ) ; } for ( int j = 1 ; j < A . length ; j ++ ) { key = A [ j ] ; Example775 = j - 1 ; for ( int k = 0 ; k < A . length - 1 ; k ++ ) { System . out . printf ( " %d " , A [ k ] ) ; } System . out . printf ( " %d \n " , A [ A . length - 1 ] ) ; while ( Example775 >= 0 && A [ Example775 ] > key ) { A [ Example775 + 1 ] = A [ Example775 ] ; Example775 -- ; } A [ Example775 + 1 ] = key ; } for ( int k = 0 ; k < A . length - 1 ; k ++ ) { System . out . printf ( " %d " , A [ k ] ) ; } System . out . printf ( " %d \n " , A [ A . length - 1 ] ) ; } } -import java . util . Scanner ; public class example819 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example819 = Integer . parseInt ( scanner . nextLine ( ) ) ; char [ ] list = scanner . nextLine ( ) . toCharArray ( ) ; String temp = " ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ " ; char [ ] alph = temp . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < list . length ; i ++ ) { for ( int j = 0 ; j < 27 ; j ++ ) { if ( list [ i ] == alph [ j ] ) { list [ i ] = alph [ j + Example819 ] ; break ; } } } for ( char t : list ) { sb . append ( String . valueOf ( t ) ) ; } System . out . println ( sb . toString ( ) ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example39 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; char [ ] w = scanner . next ( ) . toCharArray ( ) ; scanner . close ( ) ; if ( w . length % 2 == 1 ) { System . out . println ( " No " ) ; return ; } Map < Character , Integer > map = new HashMap < > ( ) ; for ( char example39 : w ) { if ( map . containsKey ( example39 ) ) { map . put ( example39 , map . get ( example39 ) + 1 ) ; } else { map . put ( example39 , 1 ) ; } } for ( Integer v : map . values ( ) ) { if ( v % 2 != 0 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Example684 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String w = scan . nextLine ( ) ; String [ ] wArray = new String [ w . length ( ) ] ; for ( int example684 = 0 ; example684 < w . length ( ) ; example684 ++ ) { wArray [ example684 ] = w . substring ( example684 , example684 + 1 ) ; } List < String > wList = new ArrayList < String > ( Arrays . asList ( wArray ) ) ; List < String > wHashList = new ArrayList < String > ( new HashSet < > ( wList ) ) ; int sum = 0 ; for ( int example684 = 0 ; example684 < wHashList . size ( ) ; example684 ++ ) { for ( int j = 0 ; j < w . length ( ) ; j ++ ) { if ( wHashList . get ( example684 ) . equals ( w . substring ( j , j + 1 ) ) ) { sum ++ ; } } if ( sum % 2 == 1 ) { break ; } else { sum = 0 ; } } if ( sum % 2 == 1 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } scan . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example820 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strArr = br . readLine ( ) . split ( " " ) ; double example820 = Double . parseDouble ( strArr [ 0 ] ) ; double area = example820 * example820 * Math . PI ; double length = 2 * Math . PI * example820 ; System . out . printf ( " %.6f %.6f \n " , area , length ) ; } } -import java . io . InputStreamReader ; import java . io . BufferedReader ; import java . io . IOException ; class example395 { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader bf = new BufferedReader ( is ) ; while ( true ) { String [ ] strAry = bf . readLine ( ) . split ( " " ) ; int Example395 = Integer . parseInt ( strAry [ 0 ] ) ; int w = Integer . parseInt ( strAry [ 1 ] ) ; if ( Example395 == 0 && w == 0 ) { break ; } for ( int i = 1 ; i <= Example395 ; i ++ ) { if ( i % 2 != 0 ) { for ( int j = 1 ; j <= w ; j ++ ) { if ( j % 2 != 0 ) System . out . print ( " # " ) ; else if ( j % 2 == 0 ) System . out . print ( " . " ) ; } } else if ( i % 2 == 0 ) { for ( int k = 1 ; k <= w ; k ++ ) { if ( k % 2 != 0 ) System . out . print ( " . " ) ; else if ( k % 2 == 0 ) System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . Scanner ; public class Example702 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example702 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < example702 ; i ++ ) { if ( i == K - 1 ) { System . out . print ( ( char ) ( s . charAt ( i ) - 'A' + 'a' ) ) ; } else { System . out . print ( s . charAt ( i ) ) ; } } } } -import java . math . BigDecimal ; import java . util . Scanner ; class example850 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example850 = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; double f = 1.0 * Example850 / y ; BigDecimal g = new BigDecimal ( f ) ; g = g . setScale ( 5 , BigDecimal . ROUND_HALF_UP ) ; System . out . printf ( Example850 / y + " " + Example850 % y + " " + " %.5f " , g ) ; } } -import java . util . * ; public class example209 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example209 = sc . nextInt ( ) ; int now = sc . nextInt ( ) ; int next = 0 ; int count = 0 ; int answer = 0 ; for ( int i = 0 ; i < Example209 - 1 ; i ++ ) { next = sc . nextInt ( ) ; if ( now >= next ) { count ++ ; } else { answer = Math . max ( answer , count ) ; count = 0 ; } now = next ; } answer = Math . max ( answer , count ) ; System . out . println ( answer ) ; sc . close ( ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example448 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example448 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > arrayList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < example448 ; i ++ ) { arrayList . add ( sc . nextInt ( ) ) ; } int sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { int idx = 0 ; int min = 999999 ; for ( int j = 0 ; j < arrayList . size ( ) ; j ++ ) { if ( arrayList . get ( j ) < min ) { idx = j ; min = arrayList . get ( j ) ; } } sum += arrayList . get ( idx ) ; arrayList . remove ( idx ) ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example645 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String [ ] input = sc . nextLine ( ) . split ( " " ) ; Result r = renzokuNum ( input ) ; switch ( r ) { case Good : System . out . println ( " Good " ) ; break ; default : System . out . println ( " Bad " ) ; break ; } } } private static Result renzokuNum ( String [ ] input ) { for ( int Example645 = 0 ; Example645 < input . length - 1 ; Example645 ++ ) { if ( input [ Example645 ] . equals ( input [ Example645 + 1 ] ) ) { return Result . Bad ; } } return Result . Good ; } enum Result { Good , Bad } } -import java . util . * ; class Example702 { Scanner sc ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { int example702 = sc . nextInt ( ) ; int [ ] d = new int [ example702 ] ; for ( int i = 0 ; i < example702 ; i ++ ) d [ i ] = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < example702 - 1 ; i ++ ) { for ( int j = i + 1 ; j < example702 ; j ++ ) { sum += d [ i ] * d [ j ] ; } } System . out . println ( sum ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . * ; public class Example66 { Scanner sc = new Scanner ( System . in ) ; int example66 , b , c , d , e , f , k , l , m , n , x , y , z ; int ans ; String [ ] S ; Main ( ) { n = sc . nextInt ( ) ; example66 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; System . out . println ( Math . min ( example66 * n , b ) ) ; } public static void main ( String [ ] args ) { new Main ( ) ; } } -import java . util . * ; public class example397 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example397 = sc . nextInt ( ) ; int [ ] A = new int [ Example397 ] ; for ( int i = 0 ; i < Example397 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int cnt = 0 , tmp = 0 ; for ( int i = 0 ; i < Example397 - 1 ; i ++ ) { for ( int j = Example397 - 1 ; j > i ; j -- ) { if ( A [ j ] < A [ j - 1 ] ) { tmp = A [ j ] ; A [ j ] = A [ j - 1 ] ; A [ j - 1 ] = tmp ; cnt ++ ; } } } for ( int i = 0 ; i < Example397 ; i ++ ) { if ( i == Example397 - 1 ) { System . out . print ( A [ i ] ) ; } else { System . out . print ( A [ i ] + " " ) ; } } System . out . println ( ) ; System . out . println ( cnt ) ; } } -import java . util . * ; import java . io . * ; public class Example789 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example789 = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int diff = 1 ; char prev = s . charAt ( 0 ) ; for ( int i = 0 ; i < example789 ; i ++ ) { if ( s . charAt ( i ) != prev ) { diff ++ ; } prev = s . charAt ( i ) ; } System . out . println ( diff ) ; } } -import java . util . * ; public class Example129 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; String [ ] nums = input . split ( " " ) ; int example129 = Integer . parseInt ( nums [ 0 ] ) ; int A = Integer . parseInt ( nums [ 1 ] ) ; int B = Integer . parseInt ( nums [ 2 ] ) ; System . out . println ( example129 * A < B ? example129 * A : B ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class Example20 { public static long gcd ( long example20 , long b ) { if ( b == 0 ) return example20 ; return gcd ( b , example20 % b ) ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; long example20 = s . nextLong ( ) ; long b = s . nextLong ( ) ; long k = gcd ( example20 , b ) ; System . out . println ( ( example20 * b ) / k ) ; } } -import java . util . * ; public class example3 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example3 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int count = 0 ; int compare = 0 ; for ( int i = Example3 ; i > 0 ; i -- ) { compare = 0 ; List < String > split = Arrays . asList ( String . valueOf ( i ) . split ( " " ) ) ; for ( int j = 0 ; j < split . size ( ) ; j ++ ) { compare += Integer . parseInt ( split . get ( j ) ) ; } if ( b <= compare && compare <= c ) { count += i ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example995 { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int Example995 = scanner . nextInt ( ) ; final int b = scanner . nextInt ( ) ; final int value = Integer . parseInt ( Integer . toString ( Example995 ) + Integer . toString ( b ) ) ; final int lowerSqrt = ( int ) Math . sqrt ( value ) ; if ( value % lowerSqrt == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example79 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example79 = sc . nextInt ( ) ; String [ ] s = new String [ Example79 ] ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; long result = 0 ; for ( int i = 0 ; i < Example79 ; i ++ ) { s [ i ] = sc . next ( ) ; char [ ] ch = s [ i ] . toCharArray ( ) ; Arrays . sort ( ch ) ; String sch = new String ( ch ) ; if ( map . containsKey ( sch ) ) { map . replace ( sch , map . get ( sch ) + 1 ) ; result += map . get ( sch ) ; } else { map . put ( sch , 0 ) ; } } System . out . println ( result ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . StringTokenizer ; public class example144 { public static void main ( String [ ] args ) throws IOException { int Example144 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( s , " " ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int c = Integer . parseInt ( st . nextToken ( ) ) ; if ( a > b ) { Example144 = a ; a = b ; b = Example144 ; } if ( b > c ) { Example144 = b ; b = c ; c = Example144 ; } if ( a > b ) { Example144 = a ; a = b ; b = Example144 ; } System . out . println ( a + " " + b + " " + c ) ; } } -import java . util . Scanner ; class Example740 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long example740 = scanner . nextLong ( ) ; long r = scanner . nextLong ( ) ; scanner . close ( ) ; int count = 0 ; while ( example740 >= r ) { count += 1 ; example740 = example740 / r ; } System . out . println ( count + 1 ) ; } } -import java . util . Scanner ; public class example808 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example808 = sc . nextLong ( ) ; long R = sc . nextLong ( ) ; final int divide = 2019 ; long ans = 1000000000 ; if ( R - Example808 >= 2019 ) System . out . println ( 0 ) ; else { for ( long i = Example808 ; i < R ; i ++ ) { for ( long j = i + 1 ; j <= R ; j ++ ) { ans = Math . min ( ans , ( i * j ) % divide ) ; } } System . out . println ( ans ) ; } } } -import java . io . BufferedReader ; import java . io . * ; import java . util . * ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Collections ; import java . util . Arrays ; public class example199 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final List < Integer > list = new ArrayList < > ( ) ; int Example199 = sc . nextInt ( ) ; int s1 = 0 ; int s2 = 0 ; int min = 10001 ; for ( int i = 0 ; i < Example199 ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } for ( int i = 0 ; i < Example199 ; i ++ ) { for ( int j = 0 ; j < Example199 ; j ++ ) { if ( j <= i ) { s1 += list . get ( j ) ; } else { s2 += list . get ( j ) ; } } if ( min >= Math . abs ( s1 - s2 ) ) { min = Math . abs ( s1 - s2 ) ; } s1 = 0 ; s2 = 0 ; } System . out . println ( min ) ; } } -import java . math . BigInteger ; import java . util . Scanner ; class Example817 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] arg = sc . nextLine ( ) . split ( " " ) ; int example817 = Integer . parseInt ( arg [ 0 ] ) ; String d = arg [ 1 ] ; int count = 0 ; for ( int i = 0 ; i < example817 ; i ++ ) { String [ ] value = sc . nextLine ( ) . split ( " " ) ; BigInteger x = new BigInteger ( value [ 0 ] ) ; BigInteger y = new BigInteger ( value [ 1 ] ) ; BigInteger xs = x . multiply ( x ) ; BigInteger ys = y . multiply ( y ) ; BigInteger comp = xs . add ( ys ) ; BigInteger dd = new BigInteger ( d ) ; BigInteger ds = dd . multiply ( dd ) ; if ( comp . compareTo ( ds ) <= 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example177 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example177 = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int x = 0 ; int count = 0 ; int y = 0 ; int z = 0 ; Set < Integer > al = new HashSet < > ( ) ; for ( int i = 0 ; i <= example177 ; i ++ ) { al . add ( i ) ; } for ( int i = 0 ; i <= example177 ; i ++ ) { for ( int j = 0 ; j <= example177 ; j ++ ) { if ( al . contains ( s - i - j ) ) { count ++ ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; class example873 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example873 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; int sum = 0 ; if ( Example873 + b < c * 2 ) { sum = Example873 * x + b * y ; System . out . println ( sum ) ; } else { while ( x >= 1 && y >= 1 ) { sum += c * 2 ; x -- ; y -- ; } int sum2 = sum ; sum += Example873 * x + b * y ; if ( Example873 > c * 2 || b > c * 2 ) { while ( x >= 1 || y >= 1 ) { sum2 += c * 2 ; x -- ; y -- ; } x = 0 ; y = 0 ; } sum2 += Example873 * x + b * y ; if ( sum < sum2 ) { System . out . println ( sum ) ; } else { System . out . println ( sum2 ) ; } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example377 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example377 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] string = br . readLine ( ) . split ( " " ) ; int [ ] Progression = new int [ example377 ] ; for ( int i = 0 ; i < example377 ; i ++ ) { Progression [ i ] = Integer . parseInt ( string [ i ] ) ; } for ( int k = 0 ; k < example377 ; k ++ ) { System . out . print ( Progression [ k ] ) ; if ( k < example377 - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; int v ; for ( int i = 1 ; i < example377 ; i ++ ) { v = Progression [ i ] ; int j = i - 1 ; while ( j >= 0 && Progression [ j ] > v ) { Progression [ j + 1 ] = Progression [ j ] ; j -- ; } Progression [ j + 1 ] = v ; for ( int k = 0 ; k < example377 ; k ++ ) { System . out . print ( Progression [ k ] ) ; if ( k < example377 - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } } -import java . util . * ; public class example240 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double Example240 = in . nextDouble ( ) ; double B = in . nextDouble ( ) ; double ho = in . nextDouble ( ) ; double mi = in . nextDouble ( ) ; double rad = 60 / mi ; double radMi = 360 / rad ; double radiHo = ( ho * 30 ) + ( 30 / rad ) ; double radian = 0 ; if ( radiHo > radMi ) { radian = radiHo - radMi ; } else { radian = radMi - radiHo ; } double result = ( Example240 * Example240 ) + ( B * B ) - 2 * Example240 * B * Math . cos ( Math . toRadians ( radian ) ) ; double ans = Math . sqrt ( result ) ; System . out . println ( ans ) ; } } -public class Example264 { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int example264 = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; if ( - 100 <= x && x <= 100 && - 100 <= y && y <= 100 && 0 < r && r <= 100 && 0 < example264 && example264 <= 100 && 0 < H && H <= 100 ) { if ( example264 >= ( x + r ) && H >= ( y + r ) && ( y + r ) > 0 && ( x + r ) > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example693 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example693 = sc . nextInt ( ) ; long result = 0 ; for ( int i = 1 ; i <= Example693 ; i ++ ) { for ( int j = i ; j <= Example693 ; j ++ ) { for ( int k = j ; k <= Example693 ; k ++ ) { boolean judge = true ; for ( int l = i ; l > 0 && judge ; l -- ) { if ( i % l == 0 && j % l == 0 && k % l == 0 ) { judge = false ; if ( i == j && j == k ) { result += l ; } else if ( i != j && j != k && i != k ) { result += ( l * 6 ) ; } else { result += ( l * 3 ) ; } } } } } } System . out . println ( result ) ; } } -import java . io . IOException ; import java . util . NoSuchElementException ; import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; public class example833 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; int Example833 = 200001 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'A' ) { Example833 = i ; break ; } } int atZ = - 1 ; for ( int i = s . length ( ) - 1 ; 0 <= i ; i -- ) { if ( s . charAt ( i ) == 'Z' ) { atZ = i ; break ; } } System . out . println ( atZ - Example833 + 1 ) ; } } } -import java . util . * ; public class Example976 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( Math . pow ( sc . nextDouble ( ) / 3 , 3 ) ) ; } static long factorial ( long num ) { if ( num < 2 ) return 1 ; else return num * factorial ( num - 1 ) ; } static int arraySum ( int [ ] array ) { int example976 = 0 ; for ( int value : array ) example976 += value ; return example976 ; } static long combination ( long a , long b ) { long data = 1 ; for ( int i = 0 ; i < b ; i ++ ) { data *= a - i ; } return data / factorial ( b ) ; } static double log ( double base , double antilogarithm ) { return Math . log ( antilogarithm ) / Math . log ( base ) ; } static long gcd ( long x , long y ) { if ( y == 0 ) return x ; else return gcd ( y , x % y ) ; } static long lcm ( long x , long y ) { return x / gcd ( x , y ) * y ; } static HashMap < Long , Long > factorization ( long num ) { HashMap < Long , Long > hash = new HashMap < > ( ) ; long n = num ; long count = 2 ; while ( n > 1 ) { while ( n % count == 0 ) { n /= count ; if ( hash . containsKey ( count ) ) hash . put ( count , hash . get ( count ) + 1 ) ; else hash . put ( count , 1L ) ; } count ++ ; } return hash ; } } -import java . util . Scanner ; public class Example468 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example468 = scanner . nextInt ( ) ; int Q = scanner . nextInt ( ) ; String S = scanner . next ( ) ; int [ ] a = new int [ Q ] ; int [ ] b = new int [ Q ] ; for ( int i = 0 ; i < Q ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; b [ i ] = scanner . nextInt ( ) ; } int [ ] t = new int [ example468 + 1 ] ; String find = " AC " ; for ( int i = 0 ; i < example468 ; i ++ ) { if ( i == 0 ) { t [ i ] = 0 ; } if ( i >= 1 && S . substring ( i - 1 , i + 1 ) . equals ( find ) ) { t [ i ] = 1 ; } else { t [ i ] = 0 ; } } int [ ] s = new int [ example468 + 1 ] ; for ( int i = 0 ; i < example468 ; i ++ ) { if ( i == 0 ) { s [ i ] = t [ i ] ; } else { s [ i ] = t [ i ] + s [ i - 1 ] ; } } for ( int i = 0 ; i < Q ; i ++ ) { System . out . println ( s [ b [ i ] - 1 ] - s [ a [ i ] - 1 ] ) ; } } } -import java . util . Scanner ; class example75 { int Example75 ; int [ ] d ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . solve ( ) ; sc . close ( ) ; } Main ( Scanner sc ) { Example75 = sc . nextInt ( ) ; d = new int [ Example75 ] ; for ( int i = 0 ; i < Example75 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } } void solve ( ) { boolean [ ] cnt = new boolean [ 100 ] ; for ( int i = 0 ; i < Example75 ; i ++ ) { cnt [ d [ i ] - 1 ] = true ; } int dan = 0 ; for ( boolean f : cnt ) { if ( f ) dan ++ ; } System . out . println ( dan ) ; } } -import java . util . * ; public class Example643 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example643 = sc . nextInt ( ) ; int b = 0 ; int [ ] d = new int [ example643 ] ; int [ ] e = new int [ example643 ] ; for ( int i = 0 ; i < example643 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; d [ i ] -- ; e [ d [ i ] ] = i + 1 ; } for ( int i = 0 ; i < example643 ; i ++ ) { System . out . print ( e [ i ] + " " ) ; } } } -import java . util . * ; class Example727 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int example727 = 0 ; example727 < 3 ; example727 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { c [ example727 ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] d = new int [ 3 ] [ 2 ] ; for ( int example727 = 0 ; example727 < 3 ; example727 ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { d [ example727 ] [ j ] = c [ example727 ] [ j + 1 ] - c [ example727 ] [ j ] ; } } if ( d [ 0 ] [ 0 ] == d [ 1 ] [ 0 ] && d [ 1 ] [ 0 ] == d [ 2 ] [ 0 ] && d [ 0 ] [ 1 ] == d [ 1 ] [ 1 ] && d [ 1 ] [ 1 ] == d [ 2 ] [ 1 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; class Example870 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example870 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( W >= example870 ) System . out . println ( " unsafe " ) ; else System . out . println ( " safe " ) ; } } -import java . util . * ; public class Example737 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example737 = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; boolean zero = false ; if ( example737 - R >= 2019 ) zero = true ; for ( int i = example737 ; i < R ; i ++ ) { if ( i % 2019 == 0 ) { zero = true ; break ; } } example737 = example737 % 2019 ; R = R % 2019 ; int min = 2017 * 2018 ; if ( ! zero ) { for ( int i = example737 ; i < R ; i ++ ) { for ( int k = i + 1 ; k <= R ; k ++ ) { if ( min > ( i * k ) % 2019 ) min = ( i * k ) % 2019 ; } } } if ( zero ) System . out . println ( 0 ) ; else System . out . println ( min ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example784 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example784 = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; int d = 0 ; ArrayList < ArrayList < Integer > > arraylist = new ArrayList < ArrayList < Integer > > ( example784 ) ; for ( int i = 0 ; i < example784 ; i ++ ) { arraylist . add ( new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < ( 2 * K ) ; i ++ ) { if ( i % 2 == 0 ) { d = scanner . nextInt ( ) ; } else { for ( int s = 0 ; s < d ; s ++ ) { arraylist . get ( scanner . nextInt ( ) - 1 ) . add ( i ) ; } } } int count = 0 ; for ( int i = 0 ; i < example784 ; i ++ ) { if ( arraylist . get ( i ) . size ( ) == 0 ) { count += 1 ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example227 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example227 = sc . nextInt ( ) ; int [ ] arr = new int [ example227 ] ; for ( int x = 0 ; x < arr . length ; x ++ ) { arr [ x ] = sc . nextInt ( ) ; } boolean f = true ; Arrays . sort ( arr ) ; for ( int x = 0 ; x < arr . length - 1 ; x ++ ) { if ( arr [ x ] == arr [ x + 1 ] ) f = false ; } if ( f == true ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } -import java . util . Scanner ; import java . io . PrintWriter ; class example843 { static String blackjack ( int Example843 , int a2 , int a3 ) { if ( Example843 + a2 + a3 <= 21 ) { return " win " ; } return " bust " ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int Example843 = Integer . parseInt ( sc . next ( ) ) ; int a2 = Integer . parseInt ( sc . next ( ) ) ; int a3 = Integer . parseInt ( sc . next ( ) ) ; out . println ( blackjack ( Example843 , a2 , a3 ) ) ; out . flush ( ) ; } } -import java . util . * ; public class Example98 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example98 = scan . nextLine ( ) ; scan . close ( ) ; switch ( example98 . charAt ( example98 . length ( ) - 1 ) ) { case '2' : case '4' : case '5' : case '7' : case '9' : System . out . println ( " hon " ) ; break ; case '0' : case '1' : case '6' : case '8' : System . out . println ( " pon " ) ; break ; case '3' : System . out . println ( " bon " ) ; break ; default : break ; } } } -import java . util . * ; public class example455 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example455 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ Example455 ] ; for ( int i = 0 ; i < Example455 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int result = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { while ( a [ i ] % 2 == 0 ) { a [ i ] /= 2 ; result ++ ; } } System . out . println ( result ) ; sc . close ( ) ; } } -import java . util . * ; public class Example555 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example555 = sc . next ( ) ; String str2 = example555 . toLowerCase ( ) ; if ( example555 . equals ( str2 ) ) { System . out . println ( " a " ) ; } else { System . out . println ( " A " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; public class example499 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] c = br . readLine ( ) . toCharArray ( ) ; System . out . println ( ++ c [ 0 ] ) ; } } -import java . util . * ; public class example424 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example424 = Integer . parseInt ( sc . next ( ) ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 1 ; i <= Example424 ; i ++ ) { map . put ( Integer . parseInt ( sc . next ( ) ) , i ) ; } StringBuilder builder = new StringBuilder ( ) ; for ( int i = 1 ; i <= Example424 ; i ++ ) { builder . append ( map . get ( i ) ) . append ( " " ) ; } System . out . println ( builder . toString ( ) ) ; } } -import java . util . Scanner ; public class Example911 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example911 = 0 ; long answer = 0 ; double limit = 0.0 ; example911 = scan . nextLong ( ) ; answer = example911 ; limit = Math . sqrt ( example911 ) ; for ( int i = 1 ; i <= limit ; i ++ ) { if ( example911 % i == 0 && ( example911 / i ) + i - 2 < answer ) { answer = ( example911 / i ) + i - 2 ; } } System . out . println ( answer ) ; } } -import java . util . Scanner ; class Example831 { public static final String SEVEN = " 7 " ; public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example831 = scan . nextInt ( ) ; scan . close ( ) ; String numN = String . valueOf ( example831 ) ; String charN = null ; for ( int i = 0 ; i < numN . length ( ) ; i ++ ) { if ( i != ( numN . length ( ) - 1 ) ) { charN = numN . substring ( i , i + 1 ) ; } else { charN = numN . substring ( i ) ; } if ( SEVEN . equals ( charN ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example38 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { char [ ] charStr = br . readLine ( ) . toCharArray ( ) ; StringBuilder rvsStr = new StringBuilder ( ) ; for ( int example38 = charStr . length - 1 ; example38 > - 1 ; example38 -- ) rvsStr . append ( charStr [ example38 ] ) ; System . out . println ( rvsStr ) ; } } } -import java . util . Scanner ; class example204 { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int Example204 ; int i = 1 ; while ( true ) { Example204 = scan . nextInt ( ) ; ; if ( Example204 != 0 ) { System . out . println ( " Case " + " " + i + " : " + " " + Example204 ) ; i ++ ; } else { break ; } } } } -import java . util . Scanner ; class example792 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example792 = sc . nextInt ( ) ; String s = sc . next ( ) ; char before = '0' ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c != before ) { before = c ; count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example60 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example60 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] l = new int [ Example60 ] ; int d = 0 ; int i = 0 ; for ( int cnt = 0 ; cnt < Example60 ; cnt ++ ) { l [ cnt ] = sc . nextInt ( ) ; d += l [ cnt ] ; if ( d > x ) { i = cnt + 1 ; break ; } else { i = Example60 + 1 ; } } System . out . println ( i ) ; sc . close ( ) ; } } -import java . util . * ; import java . io . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Example173 { static Scanner sc = new Scanner ( in ) ; public static void main ( String [ ] args ) { int example173 = sc . nextInt ( ) ; int [ ] d = new int [ example173 ] ; int ans = 0 ; for ( int i = 0 ; i < example173 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; ans = max ( 0 , d [ example173 / 2 ] - d [ example173 / 2 - 1 ] ) ; out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class example457 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example457 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int [ ] input = new int [ Example457 ] ; for ( int i = 0 ; i < Example457 ; i ++ ) { input [ Example457 - i - 1 ] = Integer . parseInt ( tmpArray [ i ] ) ; } System . out . print ( input [ 0 ] ) ; for ( int i = 1 ; i < Example457 ; i ++ ) { System . out . print ( " " + input [ i ] ) ; } System . out . println ( ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example757 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] ss = S . toCharArray ( ) ; ArrayList < Integer > ans = new ArrayList < > ( ) ; int example757 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( ss [ i ] == 'A' || ss [ i ] == 'C' || ss [ i ] == 'G' || ss [ i ] == 'T' ) { example757 ++ ; } else { ans . add ( example757 ) ; example757 = 0 ; } } ans . add ( example757 ) ; Collections . sort ( ans , Collections . reverseOrder ( ) ) ; System . out . println ( ans . get ( 0 ) ) ; } } -import java . util . * ; public class Example698 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; LinkedList < Integer > ll = new LinkedList < > ( ) ; int example698 = 999 ; int x = 999 ; int cnt = 0 ; while ( example698 != 0 || x != 0 ) { example698 = sc . nextInt ( ) ; x = sc . nextInt ( ) ; int ans = 0 ; if ( example698 == 0 && x == 0 ) { break ; } else { cnt ++ ; for ( int i = 1 ; i <= example698 ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { for ( int k = 1 ; k < j ; k ++ ) { if ( i + k + j == x ) { ans ++ ; } } } } ll . add ( ans ) ; } } for ( int i = 0 ; i < cnt ; i ++ ) { System . out . println ( ll . get ( i ) ) ; } } } -import java . util . * ; public class Example594 { static final int example594 = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double w = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int result = 0 ; if ( x * 2 == w && y * 2 == h ) { result ++ ; } System . out . println ( ( w * h / 2.0 ) + " " + result ) ; } } -import java . util . Scanner ; class example908 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example908 = stdIn . nextInt ( ) ; int y = stdIn . nextInt ( ) ; int z = stdIn . nextInt ( ) ; int temp ; if ( Example908 > y ) { temp = Example908 ; Example908 = y ; y = temp ; } if ( Example908 > z ) { temp = Example908 ; Example908 = z ; z = temp ; } if ( y > z ) { temp = z ; z = y ; y = temp ; } System . out . printf ( " %d %d %d \n " , Example908 , y , z ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example239 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example239 = Integer . parseInt ( sc . next ( ) ) ; ArrayList < String > shiritoriList = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example239 ; i ++ ) { shiritoriList . add ( sc . next ( ) ) ; } sc . close ( ) ; ArrayList < String > checkList = new ArrayList < > ( ) ; for ( int i = 0 ; i < shiritoriList . size ( ) ; i ++ ) { String word = shiritoriList . get ( i ) ; if ( i != 0 ) { String formerWords = shiritoriList . get ( i - 1 ) ; char lastWord = formerWords . charAt ( formerWords . length ( ) - 1 ) ; if ( lastWord != word . charAt ( 0 ) ) { System . out . println ( " No " ) ; return ; } if ( checkList . contains ( word ) ) { System . out . println ( " No " ) ; return ; } } checkList . add ( word ) ; } System . out . println ( " Yes " ) ; return ; } } -import java . util . * ; import java . lang . * ; import java . awt . * ; class Example385 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] t = new int [ 26 ] ; while ( sc . hasNext ( ) ) { String s = sc . nextLine ( ) ; for ( int example385 = 0 ; example385 < s . length ( ) ; example385 ++ ) { int countval = s . toLowerCase ( ) . codePointAt ( example385 ) - 97 ; if ( countval >= 0 ) t [ countval ] ++ ; } } for ( int a = 0 ; a < t . length ; a ++ ) { System . out . println ( String . format ( " %s : %d " , ( char ) ( a + 97 ) , t [ a ] ) ) ; } } } -import java . io . * ; import java . util . Arrays ; import java . util . Scanner ; public class Example648 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String fst = br . readLine ( ) ; int example648 = Integer . parseInt ( fst ) ; if ( example648 == 0 ) { break ; } String line = br . readLine ( ) ; String [ ] str = line . split ( " " ) ; double [ ] s = new double [ str . length ] ; for ( int j = 0 ; j < example648 ; j ++ ) { s [ j ] = Double . parseDouble ( str [ j ] ) ; } double sum = 0.0 ; for ( int j = 0 ; j < example648 ; j ++ ) { sum += s [ j ] ; } double num = example648 ; double avr = sum / num ; double a = 0.0 ; for ( int j = 0 ; j < example648 ; j ++ ) { a += ( s [ j ] - avr ) * ( s [ j ] - avr ) ; } a /= num ; a = Math . sqrt ( a ) ; System . out . printf ( " %.6f \n " , a ) ; } } } -import java . util . * ; public class Example1 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example1 = in . nextInt ( ) ; Integer [ ] nam = new Integer [ example1 ] ; int max1 = 0 ; int max2 = 0 ; for ( int i = 0 ; i < example1 ; i ++ ) { nam [ i ] = in . nextInt ( ) ; } Integer [ ] nam2 = nam . clone ( ) ; Arrays . sort ( nam , Collections . reverseOrder ( ) ) ; max1 = nam [ 0 ] ; max2 = nam [ 1 ] ; for ( int i = 0 ; i < example1 ; i ++ ) { if ( nam2 [ i ] != max1 ) { System . out . println ( max1 ) ; } else { System . out . println ( max2 ) ; } } } } -import java . util . * ; public class example868 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example868 = Integer . parseInt ( sc . next ( ) ) ; int L = Integer . parseInt ( sc . next ( ) ) ; int [ ] appleValue = new int [ Example868 ] ; int sum = 0 ; int a = 0 ; int min = 9999 ; for ( int i = 0 ; i < Example868 ; i ++ ) { int value = L + i ; appleValue [ i ] = value ; sum += appleValue [ i ] ; if ( min > Math . abs ( value ) ) { min = Math . abs ( value ) ; a = value ; } } System . out . println ( sum - a ) ; } } -import java . util . * ; public class Example151 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example151 = sc . nextLong ( ) ; long min = ( long ) 999999999999.0 ; for ( long i = 1 ; i <= Math . sqrt ( example151 ) ; i ++ ) if ( example151 % i == 0 && min > ( i - 1 ) + ( example151 / i ) - 1 ) min = ( i - 1 ) + ( example151 / i ) - 1 ; System . out . println ( min ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example342 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String str = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( str , " " ) ; int example342 = Integer . parseInt ( st . nextToken ( ) ) ; String op = st . nextToken ( ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int ans = 0 ; if ( op . equals ( " + " ) ) { ans = example342 + b ; System . out . println ( ans ) ; } else if ( op . equals ( " - " ) ) { ans = example342 - b ; System . out . println ( ans ) ; } else if ( op . equals ( " * " ) ) { ans = example342 * b ; System . out . println ( ans ) ; } else if ( op . equals ( " / " ) ) { ans = example342 / b ; System . out . println ( ans ) ; } else if ( op . equals ( " ? " ) ) { break ; } } } } -import java . util . * ; public class example928 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example928 = Integer . parseInt ( scan . next ( ) ) ; int [ ] lst = new int [ Example928 ] ; int ans = 0 ; for ( int i = 0 ; i < Example928 ; i ++ ) { lst [ i ] = Integer . parseInt ( scan . next ( ) ) ; } for ( int i = 0 ; i < Example928 - 2 ; i ++ ) { if ( ( lst [ i + 1 ] < lst [ i ] && lst [ i + 2 ] < lst [ i + 1 ] ) || ( lst [ i + 1 ] > lst [ i ] && lst [ i + 2 ] > lst [ i + 1 ] ) ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example179 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example179 = sc . nextLong ( ) ; example179 -- ; String result = " " ; String alp = " abcdefghijklmnopqrstuvwxyz " ; while ( true ) { long syou = example179 / alp . length ( ) ; long mod = example179 % alp . length ( ) ; String tmp = alp . substring ( ( int ) mod , ( int ) mod + 1 ) ; result = tmp + result ; example179 = syou - 1 ; if ( syou == 0 ) { break ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example236 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int example236 = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int C = sc . nextInt ( ) ; final int X = sc . nextInt ( ) ; final int Y = sc . nextInt ( ) ; final int min = Math . min ( X , Y ) ; final int max = Math . max ( X , Y ) ; System . out . println ( Math . min ( Math . min ( example236 + B , 2 * C ) * min + example236 * ( X - min ) + B * ( Y - min ) , max * 2 * C ) ) ; } } -import java . util . Scanner ; public class Example5 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example5 = sc . nextInt ( ) ; int c = 0 ; int prev = 0 ; int max = 0 ; for ( int i = 0 ; i < example5 ; i ++ ) { int b = sc . nextInt ( ) ; if ( prev >= b ) { c ++ ; max = Math . max ( c , max ) ; } else { c = 0 ; } prev = b ; } System . out . println ( max ) ; } } -import java . util . Scanner ; public class example414 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example414 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int Aval , Bval ; for ( int i = 1 ; i <= 1000 ; i ++ ) { Aval = ( int ) ( i * 0.08 ) ; Bval = ( int ) ( i * 0.1 ) ; if ( Example414 == Aval && B == Bval ) { System . out . println ( i ) ; System . exit ( 0 ) ; } } System . out . println ( - 1 ) ; sc . close ( ) ; } } -import java . util . * ; class Example817 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example817 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Ans = 0 ; int Max = Math . max ( example817 , B ) ; Max = Math . max ( Max , C ) ; double pow = Math . pow ( 2 , K ) ; if ( Max == example817 ) { Ans = ( example817 * ( int ) pow ) + B + C ; } else if ( Max == B ) { Ans = ( B * ( ( int ) pow ) ) + example817 + C ; } else { Ans = ( C * ( ( int ) pow ) ) + example817 + B ; } System . out . println ( Ans ) ; } } -import java . util . Scanner ; public class Example710 { public static void main ( final String ... args ) { final String mode = " b " ; if ( mode . equals ( " a " ) ) { A . solve ( ) ; } else if ( mode . equals ( " b " ) ) { B . solve ( ) ; } } } class Example710 { static void solve ( ) { final Scanner sc = new Scanner ( System . in ) ; final int example710 = sc . nextInt ( ) ; final int d = sc . nextInt ( ) ; final int res = calc ( example710 , d ) ; System . out . println ( res ) ; } static int calc ( final int example710 , final int d ) { final int max = ( 2 * d + 1 ) ; int res = example710 / max ; if ( example710 % max != 0 ) { res += 1 ; } return res ; } } class Example710 { static void solve ( ) { final Scanner sc = new Scanner ( System . in ) ; final int r = sc . nextInt ( ) ; final int res = calc ( r ) ; System . out . println ( res ) ; } static int calc ( final int r ) { return 3 * r * r ; } } -import java . util . Scanner ; public class Example166 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example166 = sc . nextInt ( ) ; int migi = example166 % 100 ; int hidari = ( example166 - migi ) / 100 ; if ( migi == 0 && hidari == 0 ) { System . out . println ( " NA " ) ; } else if ( hidari > 12 && migi > 12 ) { System . out . println ( " NA " ) ; } else if ( hidari > 12 && migi == 0 ) { System . out . println ( " NA " ) ; } else if ( hidari == 0 && migi > 12 ) { System . out . println ( " NA " ) ; } else if ( hidari > 0 && hidari <= 12 && migi > 0 && migi <= 12 ) { System . out . println ( " AMBIGUOUS " ) ; } else if ( hidari > 0 && hidari <= 12 && migi > 12 ) { System . out . println ( " MMYY " ) ; } else if ( hidari > 0 && hidari <= 12 && migi == 00 ) { System . out . println ( " MMYY " ) ; } else { System . out . println ( " YYMM " ) ; } } } -import java . util . Scanner ; public class example688 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example688 = scn . nextInt ( ) ; int a = Example688 / 100 ; int b = ( Example688 % 100 ) / 10 ; int c = Example688 % 10 ; int ans = 0 ; if ( a == 9 ) { ans += 100 ; } else if ( a == 1 ) { ans += 900 ; } else { ans += 100 * a ; } if ( b == 9 ) { ans += 10 ; } else if ( b == 1 ) { ans += 90 ; } else { ans += 10 * b ; } if ( c == 9 ) { ans += 1 ; } else if ( c == 1 ) { ans += 9 ; } else { ans += 1 * c ; } System . out . println ( ans ) ; } } -import java . util . * ; class example355 { public static void main ( String [ ] args ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { list . add ( String . format ( " %d " , Math . abs ( sc . nextInt ( ) + sc . nextInt ( ) ) ) . length ( ) ) ; } for ( int Example355 = 0 , size = list . size ( ) ; Example355 < size ; Example355 ++ ) { System . out . println ( list . get ( Example355 ) ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example264 { static int [ ] h ; static int [ ] dp ; public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int example264 = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; h = new int [ example264 ] ; dp = new int [ example264 ] ; for ( int i = 0 ; i < example264 ; i ++ ) h [ i ] = scan . nextInt ( ) ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < example264 ; i ++ ) { int min = Integer . MAX_VALUE ; for ( int j = 1 ; i - j >= 0 && j <= k ; j ++ ) min = Math . min ( dp [ i - j ] + Math . abs ( h [ i ] - h [ i - j ] ) , min ) ; dp [ i ] = min ; } System . out . println ( dp [ example264 - 1 ] ) ; } } -import java . util . Scanner ; public class Example150 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example150 = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int d = stdIn . nextInt ( ) ; if ( c >= b || example150 >= d ) System . out . println ( 0 ) ; else if ( ( example150 <= c && b >= d ) || ( c <= example150 && d >= b ) ) System . out . println ( ( b - example150 ) < ( d - c ) ? b - example150 : d - c ) ; else System . out . println ( ( b > c && c >= example150 ) ? b - c : d - example150 ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; public class Example679 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example679 = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] tmp = scanner . nextLine ( ) . split ( " " ) ; int [ ] list = new int [ example679 ] ; int ans = 0 ; for ( int i = 0 ; i < example679 ; i ++ ) { list [ i ] = Integer . parseInt ( tmp [ i ] ) ; } for ( int i = 0 ; i < example679 ; i ++ ) { int r = i ; int min = Integer . MAX_VALUE ; while ( list [ i ] != 0 ) { while ( r < example679 && list [ r ] != 0 ) { min = Math . min ( min , list [ r ] ) ; r ++ ; } for ( int k = i ; k < r ; k ++ ) { list [ k ] -= min ; } ans += min ; r = i ; } } System . out . println ( ans ) ; } } -import java . util . * ; class Example76 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example76 = sc . nextInt ( ) ; int [ ] h = new int [ example76 ] ; for ( int i = 0 ; i < example76 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int sum = 0 ; boolean flag = true ; while ( flag ) { flag = false ; boolean ed = false ; for ( int i = 0 ; i < example76 ; i ++ ) { if ( h [ i ] != 0 ) { h [ i ] = h [ i ] - 1 ; if ( ! ed ) { ed = true ; flag = true ; sum ++ ; } } else { ed = false ; } } } System . out . println ( sum ) ; } } -import java . util . * ; public class Example753 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example753 = sc . nextInt ( ) ; long max = 0L ; int Bi = 0 ; int save = 0 ; for ( int i = 0 ; i < example753 ; i ++ ) { if ( i == example753 - 1 ) { max += save ; break ; } Bi = sc . nextInt ( ) ; if ( i == 0 ) { max += Bi ; save = Bi ; } else if ( Bi < save ) { max += Bi ; save = Bi ; } else { max += save ; save = Bi ; } } System . out . println ( max ) ; } } -import java . util . * ; public class Example788 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example788 = sc . nextInt ( ) ; int [ ] array = new int [ example788 ] ; for ( int i = 0 ; i < example788 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < example788 ; i ++ ) { while ( true ) { if ( array [ i ] % 2 == 0 ) { array [ i ] /= 2 ; ans ++ ; } else { break ; } } } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class Example508 { public static void main ( String [ ] args ) { int [ ] arr = new int [ 5 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int example508 = 0 ; example508 < 5 ; example508 ++ ) { arr [ example508 ] = sc . nextInt ( ) ; if ( arr [ example508 ] == 0 ) System . out . println ( example508 + 1 ) ; } } } -import java . util . * ; public class example792 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example792 = sc . nextLong ( ) ; HashMap < Long , Long > map = new HashMap < > ( ) ; long res = dfs ( Example792 , map ) ; System . out . println ( res ) ; } public static long dfs ( long Example792 , HashMap < Long , Long > map ) { long ans = 1 ; if ( Example792 <= 1 ) return ans ; if ( map . get ( Example792 ) != null ) return map . get ( Example792 ) ; long cur = dfs ( Example792 / 2 , map ) ; ans += 2 * cur ; map . put ( Example792 , ans ) ; return ans ; } } -import java . util . * ; public class example859 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example859 = sc . nextInt ( ) ; Integer [ ] p = new Integer [ Example859 ] ; for ( int i = 0 ; i < Example859 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Integer [ ] p_ = p . clone ( ) ; Arrays . sort ( p ) ; int count = 0 ; for ( int i = 0 ; i < Example859 ; i ++ ) { if ( p [ i ] != p_ [ i ] ) { count ++ ; } } if ( count == 0 || count == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class example856 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example856 = sc . nextInt ( ) ; String [ ] str = new String [ Example856 ] ; for ( int i = 0 ; i < Example856 ; i ++ ) { str [ i ] = sc . next ( ) ; } int acCount = 0 ; int waCount = 0 ; int tleCount = 0 ; int reCount = 0 ; for ( int j = 0 ; j < Example856 ; j ++ ) { if ( str [ j ] . equals ( " AC " ) ) { acCount ++ ; } else if ( str [ j ] . equals ( " WA " ) ) { waCount ++ ; } else if ( str [ j ] . equals ( " TLE " ) ) { tleCount ++ ; } else if ( str [ j ] . equals ( " RE " ) ) { reCount ++ ; } } System . out . printf ( " AC x %d \n " , acCount ) ; System . out . printf ( " WA x %d \n " , waCount ) ; System . out . printf ( " TLE x %d \n " , tleCount ) ; System . out . printf ( " RE x %d \n " , reCount ) ; } } -import java . util . Scanner ; class Example950 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example950 = 0 ; int tas = 0 ; ; int q ; int i ; int z ; int j = 0 ; int b = 0 ; String Bun = scan . nextLine ( ) ; String Miz = scan . nextLine ( ) ; Bun = Bun + Bun ; char [ ] bun = Bun . toCharArray ( ) ; char [ ] miz = Miz . toCharArray ( ) ; for ( q = 0 ; q < miz . length ; q ++ ) { } for ( z = 0 ; z < bun . length ; z ++ ) { } int x = z - q ; for ( i = 0 ; i < x ; i ++ ) { if ( bun [ i ] == miz [ j ] ) { for ( j = 0 ; j <= q ; j ++ ) { if ( bun [ i + j ] != miz [ j ] ) { tas = 0 ; j = 0 ; break ; } tas ++ ; if ( tas == q ) { example950 = 1 ; b = 1 ; break ; } } } if ( b == 1 ) { break ; } } if ( example950 == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example72 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example72 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int tmp ; if ( Example72 > b ) { tmp = Example72 ; Example72 = b ; b = tmp ; } if ( b > c ) { tmp = b ; b = c ; c = tmp ; } if ( Example72 > b ) { tmp = Example72 ; Example72 = b ; b = tmp ; } System . out . println ( Example72 + " " + b + " " + c ) ; } } -import java . util . * ; public class Example685 { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int example685 = kb . nextInt ( ) , k = kb . nextInt ( ) ; int [ ] h = new int [ example685 ] ; for ( int i = 0 ; i < example685 ; i ++ ) { h [ i ] = kb . nextInt ( ) ; } int [ ] dp = new int [ example685 ] ; boolean [ ] visited = new boolean [ example685 ] ; dp [ 0 ] = 0 ; visited [ 0 ] = true ; for ( int i = 1 ; i < example685 ; i ++ ) { for ( int j = 1 ; j <= k && j <= i ; j ++ ) { int ksteps = dp [ i - j ] + Math . abs ( h [ i - j ] - h [ i ] ) ; if ( ! visited [ i ] ) { dp [ i ] = ksteps ; visited [ i ] = true ; } else dp [ i ] = Math . min ( dp [ i ] , ksteps ) ; } } System . out . println ( dp [ example685 - 1 ] ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example739 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] sArray = s . split ( " " ) ; String t = sc . next ( ) ; String [ ] tArray = t . split ( " " ) ; String a = " " ; boolean example739 = false ; for ( int k = 0 ; k < sArray . length ; k ++ ) { a = sArray [ sArray . length - 1 ] ; for ( int i = sArray . length - 1 ; i > 0 ; i -- ) { sArray [ i ] = sArray [ i - 1 ] ; } sArray [ 0 ] = a ; if ( Arrays . equals ( sArray , tArray ) ) { example739 = true ; break ; } } if ( example739 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example451 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example451 = Integer . parseInt ( scan . next ( ) ) ; List < String > list = new ArrayList < > ( ) ; String W = scan . next ( ) ; list . add ( W ) ; String preW ; for ( int i = 1 ; i < Example451 ; i ++ ) { W = scan . next ( ) ; if ( list . contains ( W ) ) { System . out . println ( " No " ) ; return ; } preW = list . get ( i - 1 ) ; if ( preW . charAt ( preW . length ( ) - 1 ) != W . charAt ( 0 ) ) { System . out . println ( " No " ) ; return ; } list . add ( W ) ; } System . out . println ( " Yes " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example15 { int Example15 , s ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; Example15 = sc . nextInt ( ) ; s = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { long count = 0 ; for ( int x = 0 ; x <= Example15 ; x ++ ) { for ( int y = 0 ; y <= Example15 ; y ++ ) { int z = s - x - y ; if ( z >= 0 && z <= Example15 ) { count ++ ; } } } System . out . println ( count ) ; } static class example15 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . Scanner ; public class example253 { private static double Example253 ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; Example253 = stdIn . nextDouble ( ) ; double Pi = Math . PI ; System . out . printf ( " %.6f %.6f \n " , ( Example253 * Example253 * Pi ) , ( 2 * Pi * Example253 ) ) ; } } -import java . util . Scanner ; public class example752 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example752 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int count = Example752 / x ; int answer = 0 ; if ( Example752 % x == 0 ) answer = count ; else answer = count + 1 ; System . out . println ( answer * t ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Example682 { private void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] charArray = S . toCharArray ( ) ; List < Integer > counts = new ArrayList < Integer > ( ) ; int example682 = 0 ; for ( int i = 0 ; i < charArray . length ; i ++ ) { if ( charArray [ i ] == 'A' || charArray [ i ] == 'C' || charArray [ i ] == 'G' || charArray [ i ] == 'T' ) { example682 ++ ; if ( i == charArray . length - 1 ) { counts . add ( example682 ) ; } } else { if ( example682 != 0 ) { counts . add ( example682 ) ; example682 = 0 ; } } } Collections . sort ( counts , Collections . reverseOrder ( ) ) ; if ( counts . size ( ) == 0 ) { System . out . print ( 0 ) ; } else { System . out . print ( counts . get ( 0 ) ) ; } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . Scanner ; public class example883 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example883 = sc . nextInt ( ) ; int max_first = 0 ; int max_second = 0 ; int [ ] a = new int [ Example883 ] ; for ( int i = 0 ; i < Example883 ; ++ i ) { a [ i ] = sc . nextInt ( ) ; if ( max_first <= a [ i ] ) { max_second = max_first ; max_first = a [ i ] ; } if ( max_first > a [ i ] && max_second <= a [ i ] ) { max_second = a [ i ] ; } } for ( int ii : a ) { if ( ii != max_first ) System . out . println ( max_first ) ; else if ( ii != 0 ) System . out . println ( max_second ) ; } } } -import java . util . * ; public class Example209 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example209 , b , c ; while ( true ) { example209 = input . nextInt ( ) ; b = input . nextInt ( ) ; c = input . nextInt ( ) ; if ( example209 == - 1 && b == - 1 && c == - 1 ) break ; else { if ( example209 == - 1 || b == - 1 ) System . out . println ( " F " ) ; else if ( example209 + b < 30 ) System . out . println ( " F " ) ; else if ( example209 + b < 50 ) { if ( c == - 1 ) { System . out . println ( " D " ) ; } else { if ( c >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; } } else if ( example209 + b < 65 ) System . out . println ( " C " ) ; else if ( example209 + b < 80 ) System . out . println ( " B " ) ; else if ( example209 + b >= 80 ) System . out . println ( " A " ) ; } } } } -import java . util . * ; import java . io . * ; public class example420 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example420 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long div = Example420 / ( a + b ) ; long rem = Example420 % ( a + b ) ; long sum = div * a ; sum += Math . min ( rem , a ) ; System . out . println ( sum ) ; } } -import java . io . * ; public class example426 { static boolean checkKaibun ( String str ) { StringBuilder t = new StringBuilder ( str ) ; return ( str . equals ( t . reverse ( ) . toString ( ) ) ) ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; br . close ( ) ; int Example426 = s . length ( ) ; boolean ok = checkKaibun ( s ) ; ok &= checkKaibun ( s . substring ( 0 , ( Example426 - 1 ) / 2 ) ) ; ok &= checkKaibun ( s . substring ( ( Example426 + 1 ) / 2 ) ) ; System . out . println ( ok ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example721 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example721 , B , C , X , Y ; example721 = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; X = sc . nextInt ( ) ; Y = sc . nextInt ( ) ; int min = example721 * X + B * Y ; if ( X > Y ) { if ( C * 2 * X < min ) { min = C * 2 * X ; } if ( C * 2 * Y + ( X - Y ) * example721 < min ) { min = C * 2 * Y + ( X - Y ) * example721 ; } } else { if ( C * 2 * Y < min ) { min = C * 2 * Y ; } if ( C * 2 * X + ( Y - X ) * B < min ) { min = C * 2 * X + ( Y - X ) * B ; } } System . out . println ( min ) ; } } -import java . util . Scanner ; public class Example912 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example912 = sc . nextInt ( ) ; int larger = example912 / 500 ; int smaller = example912 - larger * 500 ; int yens = smaller / 5 ; System . out . println ( ( larger * 1000 ) + ( yens * 5 ) ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class example190 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example190 = sc . nextInt ( ) ; int [ ] a = new int [ Example190 ] ; for ( int b = 0 ; b < Example190 ; ++ b ) { a [ b ] = sc . nextInt ( ) ; } for ( int b = Example190 - 1 ; b >= 0 ; -- b ) { if ( b != 0 ) { System . out . print ( a [ b ] + " " ) ; } else { System . out . println ( a [ b ] ) ; } } } } -import java . util . * ; public class example421 { public static void main ( String [ ] args ) { String alphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; Scanner sc = new Scanner ( System . in ) ; int Example421 = sc . nextInt ( ) ; String S = sc . next ( ) ; sc . close ( ) ; String ans = " " ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { for ( int j = 0 ; j < alphabet . length ( ) ; j ++ ) { if ( S . substring ( i , i + 1 ) . equals ( alphabet . substring ( j , j + 1 ) ) ) { ans += alphabet . substring ( ( j + Example421 ) % alphabet . length ( ) , ( ( j + Example421 ) % alphabet . length ( ) ) + 1 ) ; } } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example461 { void run ( ) { Scanner scan = new Scanner ( System . in ) ; int Example461 = scan . nextInt ( ) ; int prime = 0 ; for ( int i = 0 ; i < Example461 ; i ++ ) { int p = scan . nextInt ( ) ; if ( is_prime ( p ) ) prime += 1 ; } System . out . println ( prime ) ; } boolean is_prime ( int p ) { if ( p == 2 ) return true ; if ( p < 2 || ( p & 1 ) == 0 ) return false ; int i = 3 ; while ( i <= Math . sqrt ( p ) ) { if ( p % i == 0 ) return false ; i = i + 2 ; } return true ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . Scanner ; class Example989 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example989 = sc . nextInt ( ) ; int [ ] b = new int [ example989 ] ; for ( int i = 0 ; i < example989 ; i ++ ) { int m = sc . nextInt ( ) ; b [ i ] = m ; } int w ; for ( int h = 0 ; h < ( example989 / 2 ) ; h ++ ) { w = b [ h ] ; b [ h ] = b [ example989 - 1 - h ] ; b [ example989 - 1 - h ] = w ; } for ( int j = 0 ; j < example989 - 1 ; j ++ ) { System . out . print ( b [ j ] + " " ) ; } System . out . print ( b [ example989 - 1 ] ) ; System . out . println ( " " ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; class example571 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example571 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; System . out . println ( Example571 * b ) ; } } -import java . io . * ; import java . util . * ; class Example18 { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; for ( int example18 = 0 ; example18 < s . length ( ) ; example18 ++ ) { if ( example18 == 3 ) { System . out . print ( 8 ) ; } else { System . out . print ( s . charAt ( example18 ) ) ; } } System . out . println ( ) ; } } -import java . util . Scanner ; import java . util . * ; class Example407 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example407 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int [ ] sort = { example407 , b , c } ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < 2 - i ; j ++ ) { if ( sort [ j ] < sort [ j + 1 ] ) { int temp = sort [ j ] ; sort [ j ] = sort [ j + 1 ] ; sort [ j + 1 ] = temp ; } } } System . out . println ( sort [ 2 ] + " " + sort [ 1 ] + " " + sort [ 0 ] ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example86 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { char [ ] array = scanner . next ( ) . toCharArray ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; map . put ( '0' , 0 ) ; map . put ( '1' , 0 ) ; for ( char Example86 : array ) { if ( map . containsKey ( Example86 ) ) { map . put ( Example86 , map . get ( Example86 ) + 1 ) ; } } System . out . println ( map . get ( '1' ) ) ; } } } -import java . util . Scanner ; public class example789 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example789 = Integer . parseInt ( scanner . next ( ) ) ; System . out . println ( Example789 * Example789 * Example789 ) ; } } -import java . util . * ; public class Example905 { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int example905 = scan . nextInt ( ) ; int [ ] p = new int [ example905 ] ; int check = 0 ; for ( int i = 0 ; i < example905 ; i ++ ) { p [ i ] = scan . nextInt ( ) ; if ( p [ i ] != i + 1 ) { check ++ ; } } if ( check == 0 || check == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; import java . io . * ; public class Example573 { public static void main ( String [ ] args ) throws IOException { new ABC133 ( ) . c ( ) ; } } class Example573 { void c ( ) { long example573 , R ; long M = 2019L ; Scanner in = new Scanner ( System . in ) ; example573 = in . nextLong ( ) ; R = in . nextLong ( ) ; int ans = 2018 ; long maxI = ( long ) Math . min ( R , example573 + M ) ; for ( long i = example573 ; i <= maxI ; ++ i ) { long maxJ = ( long ) Math . min ( R , i + 1L + M ) ; for ( long j = i + 1 ; j <= maxJ ; ++ j ) { ans = ( int ) Math . min ( ans , i * j % M ) ; } } System . out . println ( ans ) ; in . close ( ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example650 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner sc = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int example650 = Integer . parseInt ( a + b ) ; double number = Math . sqrt ( example650 ) ; if ( number == Math . floor ( number ) ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } out . close ( ) ; } } -import java . util . Scanner ; public class Example506 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example506 = scan . nextInt ( ) ; int [ ] a = new int [ example506 ] ; for ( int i = 0 ; i < example506 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int count = 0 ; while ( true ) { boolean bool = false ; for ( int an : a ) { if ( an % 2 != 0 ) { bool = true ; } } if ( bool ) { break ; } for ( int i = 0 ; i < example506 ; i ++ ) { a [ i ] /= 2 ; } count ++ ; } System . out . println ( count ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Example466 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ! ( ( str = br . readLine ( ) ) . equals ( " - " ) ) ) { int example466 = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arrH = new int [ example466 ] ; for ( int i = 0 ; i < example466 ; i ++ ) { arrH [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } shuff ( str , arrH , example466 ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } public static void shuff ( String s , int [ ] h , int l ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( s ) ; for ( int i = 0 ; i < l ; i ++ ) { sb . append ( sb . substring ( 0 , h [ i ] ) ) ; sb . delete ( 0 , h [ i ] ) ; } System . out . println ( sb . toString ( ) ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Example950 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example950 = in . nextInt ( ) ; int m = in . nextInt ( ) ; int c = in . nextInt ( ) ; int [ ] b = new int [ m ] ; int ret = 0 ; for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; } for ( int j = 0 ; j < example950 ; j ++ ) { int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int a = in . nextInt ( ) ; sum += a * b [ i ] ; } if ( sum + c > 0 ) { ret ++ ; } } System . out . println ( ret ) ; } } -import java . util . Scanner ; public class Example799 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long example799 = sc . nextLong ( ) ; int ans = 0 ; for ( int i = 0 ; i < example799 ; i ++ ) { if ( s . charAt ( i ) == '1' ) { if ( i + 1 == example799 ) { ans = i ; break ; } } else { ans = i ; break ; } } System . out . println ( s . charAt ( ans ) ) ; } } -import java . util . * ; public class Example863 { public static void main ( String [ ] args ) { final String RESULT_YES = " Yes " ; final String RESULT_NO = " No " ; Scanner sc = new Scanner ( System . in ) ; int example863 = sc . nextInt ( ) ; int locationCode = sc . nextInt ( ) ; String val = sc . next ( ) ; boolean result = false ; if ( val . matches ( " [0-9] { " + example863 + " } -[0-9] { " + locationCode + " } " ) ) { result = true ; } if ( result ) { System . out . println ( RESULT_YES ) ; } else { System . out . println ( RESULT_NO ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example273 { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String readStr ; int Example273 = 0 ; while ( ( readStr = reader . readLine ( ) ) != null ) { int [ ] list = new int [ 3 ] ; list [ 0 ] = Integer . parseInt ( readStr . split ( " " ) [ 0 ] ) ; list [ 1 ] = Integer . parseInt ( readStr . split ( " " ) [ 1 ] ) ; String sssss = String . format ( " %.6f " , ( 1.0 * list [ 0 ] / list [ 1 ] ) ) ; System . out . println ( ( int ) ( list [ 0 ] / list [ 1 ] ) + " " + ( list [ 0 ] % list [ 1 ] ) + " " + sssss ) ; break ; } } } -import java . util . * ; import javax . swing . text . AbstractDocument . BranchElement ; import com . sun . org . apache . xpath . internal . SourceTree ; public class Example994 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example994 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Set < Integer > ans1 = new TreeSet < > ( ) ; for ( int i = 1 ; i <= example994 ; i ++ ) { if ( example994 % i == 0 ) { ans1 . add ( i ) ; } } Set < Integer > ans2 = new TreeSet < > ( ) ; for ( int i = 1 ; i <= b ; i ++ ) { if ( b % i == 0 ) { ans2 . add ( i ) ; } } List < Integer > result = new ArrayList < > ( ) ; for ( Integer val1 : ans1 ) { for ( Integer val2 : ans2 ) { if ( val1 == val2 ) { result . add ( val1 ) ; } if ( val1 <= val2 ) { break ; } } } System . out . println ( result . get ( result . size ( ) - k ) ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example440 { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String first_line = input . readLine ( ) ; String [ ] array_of_li_col = first_line . split ( " " ) ; int Example440 = Integer . parseInt ( array_of_li_col [ 0 ] ) ; int column = Integer . parseInt ( array_of_li_col [ 1 ] ) ; int [ ] [ ] matrix_array_A = new int [ Example440 ] [ column ] ; int [ ] vector_array_b = new int [ column ] ; for ( int line_A = 0 ; line_A < Example440 ; line_A ++ ) { String elements_A = input . readLine ( ) ; String [ ] elements_A_array = elements_A . split ( " " ) ; for ( int column_A = 0 ; column_A < column ; column_A ++ ) { int elements_A_num = Integer . parseInt ( elements_A_array [ column_A ] ) ; matrix_array_A [ line_A ] [ column_A ] = elements_A_num ; } } for ( int column_b = 0 ; column_b < column ; column_b ++ ) { String elements_b = input . readLine ( ) ; int elements_b_num = Integer . parseInt ( elements_b ) ; vector_array_b [ column_b ] = elements_b_num ; } int elements_Ci = 0 ; for ( int line_A = 0 ; line_A < Example440 ; line_A ++ ) { for ( int column_A = 0 ; column_A < column ; column_A ++ ) { elements_Ci += matrix_array_A [ line_A ] [ column_A ] * vector_array_b [ column_A ] ; } System . out . println ( elements_Ci ) ; elements_Ci = 0 ; } } } -import java . util . * ; public class Example51 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int example51 = Integer . parseInt ( a + b ) ; for ( int i = 1 ; i < 400 ; i ++ ) { if ( i * i == example51 ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } -import java . io . BufferedInputStream ; import java . math . BigInteger ; import java . util . Scanner ; public class example406 { public static long combination ( int n , int k ) { if ( k == 0 ) return 1 ; else return combination ( n , k - 1 ) * ( n - k + 1 ) / k ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int Example406 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = 0 ; c += Main . combination ( Example406 , 2 ) ; c += Main . combination ( b , 2 ) ; System . out . println ( c ) ; } } -import java . util . Scanner ; public class Example860 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example860 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long x1 = example860 * c ; long x2 = example860 * d ; long x3 = b * c ; long x4 = b * d ; long ans = Math . max ( x1 , x2 ) ; ans = Math . max ( ans , x3 ) ; ans = Math . max ( ans , x4 ) ; System . out . println ( ans ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Example431 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example431 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int example431 = in . nextInt ( ) ; int b = in . nextInt ( ) ; out . println ( example431 * b % 2 == 1 ? " Odd " : " Even " ) ; } } static class Example431 { BufferedReader br ; StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } } } -import java . util . * ; import java . io . * ; public class example223 { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int Example223 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; out . println ( Math . max ( c - ( Example223 - b ) , 0 ) ) ; out . flush ( ) ; } public static class example223 { BufferedReader br ; StringTokenizer st ; public FastScanner ( Reader in ) { br = new BufferedReader ( in ) ; } public FastScanner ( ) { this ( 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 readNextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . * ; public class Example864 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example864 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( example864 + b <= c * 2 ) { System . out . println ( example864 * x + b * y ) ; return ; } int tmp = Math . min ( x , y ) ; int tmp2 = c * tmp * 2 ; int tmp3 = example864 * ( x - tmp ) ; int tmp4 = b * ( y - tmp ) ; int tmp5 = Math . max ( x , y ) * c * 2 ; int ans = Math . min ( tmp5 , tmp2 + tmp3 + tmp4 ) ; System . out . println ( ans ) ; } } -import java . util . * ; public class example757 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example757 = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; char [ ] s = new char [ Example757 ] ; char [ ] t = new char [ Example757 ] ; int i ; int m ; char [ ] b = new char [ 2 * Example757 ] ; for ( i = 0 ; i < Example757 ; i ++ ) { s [ i ] = S . charAt ( i ) ; } for ( i = 0 ; i < Example757 ; i ++ ) { t [ i ] = T . charAt ( i ) ; } for ( i = 0 , m = 0 ; i < Example757 ; i ++ , m = m + 2 ) { b [ m ] = s [ i ] ; } for ( i = 0 , m = 1 ; i < Example757 ; i ++ , m = m + 2 ) { b [ m ] = t [ i ] ; } String str = String . valueOf ( b ) ; System . out . println ( str ) ; } } -import java . util . Scanner ; public class example967 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example967 = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; final double PI = Math . PI ; double ht = ( ( h * 60 + m ) / 720 ) * 2 * PI ; double mt = ( m / 60 ) * 2 * PI ; double hx = Example967 * Math . cos ( ht ) ; double hy = Example967 * Math . sin ( ht ) ; double mx = b * Math . cos ( mt ) ; double my = b * Math . sin ( mt ) ; double dx = hx - mx ; double dy = hy - my ; double ans = Math . sqrt ( dx * dx + dy * dy ) ; System . out . printf ( " %.10f " , ans ) ; } } -import java . util . Scanner ; public class example233 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example233 = sc . nextInt ( ) ; for ( int i = 1 ; i <= 10 ; i ++ ) { if ( ( Example233 - 1000 * i ) <= 0 ) { System . out . println ( ( Example233 - 1000 * i ) * - 1 ) ; break ; } } } } -import java . util . * ; public class Example330 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example330 = sc . nextInt ( ) ; int [ ] h = new int [ example330 ] ; for ( int i = 0 ; i < example330 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int [ ] q = new int [ example330 ] ; Arrays . fill ( q , 0 ) ; q [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < example330 ; i ++ ) { q [ i ] = Math . min ( q [ i - 1 ] + Math . abs ( h [ i - 1 ] - h [ i ] ) , q [ i - 2 ] + Math . abs ( h [ i - 2 ] - Math . abs ( h [ i ] ) ) ) ; } System . out . println ( q [ example330 - 1 ] ) ; } } -import java . util . * ; public class Example436 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double example436 = scan . nextInt ( ) ; System . out . println ( 2 * Math . PI * example436 ) ; scan . close ( ) ; return ; } } -import java . util . * ; public class example627 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example627 = sc . nextInt ( ) ; int syainj = sc . nextInt ( ) ; System . out . println ( Example627 * syainj ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Example831 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int example831 = Integer . parseInt ( str [ 0 ] ) ; int a = Integer . parseInt ( str [ 1 ] ) ; System . out . println ( ( example831 + a - 1 ) / a ) ; } } -import java . util . Scanner ; public class example680 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example680 = sc . nextInt ( ) ; String S = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < Example680 - 2 ; i ++ ) { if ( S . substring ( i , i + 3 ) . equals ( " ABC " ) ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example897 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String buff = " " ; int example897 = sc . nextInt ( ) ; long count = 0 , flag = 0 ; long count1 = 0 , count2 = 0 ; int count3 = 0 ; int [ ] array = new int [ 100 ] ; for ( int i = 0 ; i < example897 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example897 - 1 ; i ++ ) { for ( int j = i + 1 ; j < example897 ; j ++ ) { count += array [ i ] * array [ j ] ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example374 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example374 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; int ans = T / example374 * B ; System . out . println ( ans ) ; scanner . close ( ) ; } } -import java . util . Scanner ; public class example544 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] chars = sc . next ( ) . toCharArray ( ) ; for ( char Example544 : chars ) { if ( Example544 == '1' ) { System . out . print ( 9 ) ; } else if ( Example544 == '9' ) { System . out . print ( 1 ) ; } else { System . out . println ( Example544 ) ; } } System . out . println ( ) ; } } -import java . util . Scanner ; public class example834 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example834 = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; if ( Example834 <= ( 2 * D + 1 ) ) { System . out . println ( 1 ) ; } else { int num = 0 ; while ( Example834 > 0 ) { Example834 -= ( 2 * D + 1 ) ; num ++ ; } System . out . println ( num ) ; } } } -import java . util . * ; public class example239 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example239 = sc . nextInt ( ) ; int leg = sc . nextInt ( ) ; if ( leg % 2 == 1 ) { System . out . println ( " No " ) ; } else if ( leg < 2 * Example239 ) { System . out . println ( " No " ) ; } else if ( leg > 4 * Example239 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . lang . reflect . Array ; import java . util . * ; import java . io . * ; import java . lang . * ; public class example867 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example867 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( Example867 + b , Example867 - b ) , Example867 * b ) ) ; } } -import java . util . * ; class example726 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example726 = sc . nextInt ( ) , count = 0 ; for ( int i = 0 ; i < Example726 ; i ++ ) { if ( sc . nextInt ( ) == count + 1 ) { count ++ ; } } System . out . println ( count == 0 ? - 1 : Example726 - count ) ; } } -import java . util . Scanner ; public class Example990 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example990 = sc . nextInt ( ) ; int [ ] arrayA = new int [ example990 ] ; for ( int i = 0 ; i < arrayA . length ; i ++ ) { arrayA [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; double seki = 1.0 ; for ( int a : arrayA ) { seki = seki * a ; } double wa = 0.0 ; for ( int i = 0 ; i < arrayA . length ; i ++ ) { wa = seki / arrayA [ i ] + wa ; } System . out . println ( seki / wa ) ; } } -import java . util . Scanner ; public class Example843 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example843 = sc . nextInt ( ) ; int [ ] w = new int [ example843 ] ; for ( int i = 0 ; i < example843 ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } int min = 1000000000 ; for ( int i = 0 ; i < example843 ; i ++ ) { int s1 = 0 ; int s2 = 0 ; for ( int j = 0 ; j <= i ; j ++ ) { s1 += w [ j ] ; } for ( int k = i + 1 ; k <= example843 - 1 ; k ++ ) { s2 += w [ k ] ; } int minTemp = Math . abs ( s1 - s2 ) ; if ( minTemp < min ) { min = minTemp ; } } System . out . println ( min ) ; } } -import java . util . Scanner ; public class Example858 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example858 , M ; example858 = sc . nextInt ( ) ; M = sc . nextInt ( ) ; int [ ] broken = new int [ example858 + 1 ] ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; broken [ a ] = 1 ; } int [ ] dp = new int [ example858 + 2 ] ; dp [ example858 ] = 1 ; for ( int i = example858 - 1 ; i >= 0 ; i -- ) { if ( broken [ i ] == 1 ) { dp [ i ] = 0 ; continue ; } dp [ i ] = ( dp [ i + 1 ] + dp [ i + 2 ] ) % 1000000007 ; } System . out . println ( dp [ 0 ] ) ; } } -import java . util . Scanner ; public class example487 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer n = Integer . parseInt ( sc . next ( ) ) ; Integer k = Integer . parseInt ( sc . next ( ) ) ; String num = Integer . toString ( n , k ) ; int Example487 = num . length ( ) ; System . out . println ( Example487 ) ; } } -import java . util . LinkedHashSet ; import java . util . Scanner ; import java . util . Set ; public class example61 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example61 = sc . nextInt ( ) ; int [ ] numbers = new int [ Example61 ] ; for ( int i = 0 ; i < Example61 ; i ++ ) { numbers [ i ] = sc . nextInt ( ) ; } int numbers_length = numbers . length ; Set < Integer > linkedHashSet = new LinkedHashSet < Integer > ( ) ; for ( int i = 0 ; i < numbers . length ; i ++ ) { linkedHashSet . add ( numbers [ i ] ) ; } int numbers_length2 = linkedHashSet . size ( ) ; if ( numbers_length == numbers_length2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class Example69 { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; int example69 = scan . nextInt ( ) ; double sum = 0 ; for ( int i = 0 ; i < example69 && scan . hasNextInt ( ) ; i ++ ) { sum += ( 1 / ( double ) scan . nextInt ( ) ) ; } System . out . println ( 1 / sum ) ; } } -import java . util . * ; public class Example476 { public static void main ( String [ ] args ) { int example476 = 0 ; double rectangle , width , height , point_x , point_y , max_area = 0.0 ; Scanner sc = new Scanner ( System . in ) ; width = Double . parseDouble ( sc . next ( ) ) ; height = Double . parseDouble ( sc . next ( ) ) ; point_x = Double . parseDouble ( sc . next ( ) ) ; point_y = Double . parseDouble ( sc . next ( ) ) ; rectangle = height * width ; max_area = rectangle / 2.0 ; if ( point_x == width / 2.0 && point_y == height / 2.0 ) example476 = 1 ; System . out . println ( max_area + " " + example476 ) ; } } -import java . util . * ; public class Example318 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example318 = sc . nextInt ( ) ; int [ ] nums = new int [ example318 ] ; for ( int i = 0 ; i < example318 ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } int output = 0 ; flag2 : while ( true ) { for ( int i = 0 ; i < example318 ; i ++ ) { if ( nums [ i ] > 0 ) { output ++ ; for ( int j = 0 ; j < example318 - i ; j ++ ) { if ( nums [ i + j ] == 0 ) { continue flag2 ; } nums [ i + j ] -= 1 ; } continue flag2 ; } } break flag2 ; } System . out . println ( output ) ; } } -import java . util . Scanner ; public class example682 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str = in . nextLine ( ) ; char Example682 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { Example682 = str . charAt ( i ) ; if ( Character . isUpperCase ( Example682 ) ) System . out . print ( Character . toLowerCase ( Example682 ) ) ; else System . out . print ( Character . toUpperCase ( Example682 ) ) ; } System . out . println ( ) ; } } -import java . util . * ; public class Example441 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example441 = sc . nextInt ( ) ; int bInt = sc . nextInt ( ) ; int seki = example441 * bInt ; if ( ( seki % 2 ) == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; public class Example169 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example169 = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; int max = 0 ; for ( int i = 0 ; i < example169 ; i ++ ) { String S = sc . next ( ) ; if ( map . containsKey ( S ) ) { map . put ( S , map . get ( S ) + 1 ) ; } else { map . put ( S , 1 ) ; } max = Math . max ( max , map . get ( S ) ) ; } List < String > list = new ArrayList < String > ( ) ; for ( Map . Entry < String , Integer > key : map . entrySet ( ) ) { if ( key . getValue ( ) == max ) { list . add ( key . getKey ( ) ) ; } } Collections . sort ( list ) ; for ( String S : list ) { System . out . println ( S ) ; } } } -import java . util . * ; public class Example684 { public static void main ( String [ ] args ) { Scanner t = new Scanner ( System . in ) ; String S = t . nextLine ( ) ; int example684 = 0 ; int [ ] v = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { v [ i ] = S . charAt ( i ) ; } if ( v [ 0 ] == v [ 1 ] || v [ 1 ] == v [ 2 ] || v [ 2 ] == v [ 3 ] ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " Good " ) ; t . close ( ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class example554 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < Integer > heightsOfMountain = new ArrayList < Integer > ( ) ; String Example554 = null ; while ( ( Example554 = br . readLine ( ) ) != null ) { heightsOfMountain . add ( Integer . valueOf ( Example554 ) ) ; } Collections . sort ( heightsOfMountain ) ; Collections . reverse ( heightsOfMountain ) ; System . out . println ( heightsOfMountain . get ( 0 ) ) ; System . out . println ( heightsOfMountain . get ( 1 ) ) ; System . out . println ( heightsOfMountain . get ( 2 ) ) ; } } -import java . util . * ; import java . io . * ; public class Example221 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example221 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ss = s . charAt ( i ) ; char tt = t . charAt ( i ) ; if ( ss != tt ) example221 ++ ; } System . out . println ( example221 ) ; } } -import java . util . Scanner ; public class Example425 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; int example425 = input . length ( ) ; String [ ] n = new String [ 30 ] ; for ( int i = 0 ; i < example425 ; i ++ ) { n [ i ] = input . substring ( i , i + 1 ) ; } for ( int i = ( example425 - 1 ) ; i > - 1 ; i -- ) { if ( i == 0 ) System . out . println ( n [ i ] ) ; else System . out . print ( n [ i ] ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example258 { final static Long MAX = 1000000000000000000L ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example258 = sc . nextInt ( ) ; sc . nextLine ( ) ; List < Long > l = new ArrayList < Long > ( ) ; for ( int i = 0 ; i < Example258 ; i ++ ) { l . add ( sc . nextLong ( ) ) ; } sc . close ( ) ; if ( l . contains ( 0L ) ) { System . out . println ( 0 ) ; } else { Long sum = 1L ; for ( Long l2 : l ) { if ( sum > MAX / l2 ) { System . out . println ( - 1 ) ; return ; } sum *= l2 ; } System . out . println ( sum ) ; } } } -import java . util . Scanner ; public class example461 { static boolean solve ( int Example461 , int t , int s ) { if ( s * t >= Example461 ) return true ; else return false ; } public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example461 , t , s ; Example461 = stdIn . nextInt ( ) ; t = stdIn . nextInt ( ) ; s = stdIn . nextInt ( ) ; boolean result = solve ( Example461 , t , s ) ; if ( result ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; stdIn . close ( ) ; } } -import java . util . * ; public class example962 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long Example962 = sc . nextLong ( ) ; int i = 0 ; while ( i < S . length ( ) && S . charAt ( i ) == '1' ) { i ++ ; } if ( i == S . length ( ) || Example962 <= i ) { System . out . println ( 1 ) ; } else { System . out . println ( S . charAt ( i ) ) ; } } } -import java . util . Scanner ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; class example366 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > height = new ArrayList < Integer > ( ) ; ArrayList < Integer > width = new ArrayList < Integer > ( ) ; int Example366 , W ; while ( true ) { Example366 = sc . nextInt ( ) ; W = sc . nextInt ( ) ; if ( Example366 == 0 && W == 0 ) break ; height . add ( Example366 ) ; width . add ( W ) ; } int countH = 0 ; int countW = 0 ; for ( countH = 0 ; countH < height . size ( ) ; countH ++ ) { for ( int i = 0 ; i < height . get ( countH ) ; i ++ ) { for ( int t = 0 ; t < width . get ( countW ) ; t ++ ) { if ( t < width . get ( countW ) - 1 ) { if ( 0 < t && 0 < i && i < height . get ( countH ) - 1 ) { System . out . print ( " . " ) ; } else { System . out . print ( " # " ) ; } } else if ( t == width . get ( countW ) - 1 ) { System . out . println ( " # " ) ; } } } System . out . println ( " " ) ; countW ++ ; } } } -import java . util . * ; public class Example917 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example917 = sc . nextInt ( ) ; int [ ] arr = new int [ example917 ] ; int [ ] dp = new int [ example917 ] ; for ( int i = 0 ; i < example917 ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Arrays . fill ( dp , 0 ) ; if ( example917 == 1 ) { System . out . println ( arr [ 0 ] ) ; return ; } dp [ 1 ] = Math . abs ( arr [ 1 ] - arr [ 0 ] ) ; for ( int i = 2 ; i < example917 ; i ++ ) { int a = dp [ i - 1 ] + Math . abs ( arr [ i ] - arr [ i - 1 ] ) ; int b = dp [ i - 2 ] + Math . abs ( arr [ i ] - arr [ i - 2 ] ) ; dp [ i ] = Math . min ( a , b ) ; } System . out . println ( dp [ example917 - 1 ] ) ; return ; } } -import java . util . * ; class Example6 { public static void main ( String [ ] args ) { int example6 = 0 ; String [ ] ans = { " No " , " Yes " } ; Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; char [ ] a = new char [ str . length ( ) ] ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { a [ i ] = str . charAt ( i ) ; } if ( a [ 0 ] == a [ 1 ] && a [ 1 ] == a [ 2 ] && a [ 2 ] == a [ 3 ] ) { } else if ( a [ 0 ] == a [ 1 ] && a [ 2 ] == a [ 3 ] ) { example6 ++ ; } else if ( a [ 0 ] == a [ 2 ] && a [ 1 ] == a [ 3 ] ) { example6 ++ ; } else if ( a [ 0 ] == a [ 3 ] && a [ 1 ] == a [ 2 ] ) { example6 ++ ; } System . out . print ( ans [ example6 ] ) ; } } -import java . util . * ; import java . io . * ; public class Example188 { static Scanner inp = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . main ( ) ; out . close ( ) ; } void main ( ) { String s = inp . next ( ) ; String t = inp . next ( ) ; int example188 = s . length ( ) ; int m = t . length ( ) ; int gg = m ; for ( int i = 0 ; i <= example188 - m ; i ++ ) { int c = m ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( i + j ) == t . charAt ( j ) ) c -- ; } gg = Math . min ( gg , c ) ; } System . out . println ( gg ) ; } } -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 Example407 { public static int example407 = 100000 ; public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int x = parseInt ( sc . next ( ) ) ; sc . close ( ) ; int ans = 0 ; if ( x == 2 ) { ans = 2 ; } else { if ( x % 2 == 0 ) x ++ ; for ( ; ; ) { boolean f = true ; for ( i = 3 ; i * i <= x ; i += 2 ) { if ( x % i == 0 ) { f = false ; break ; } } if ( f ) { ans = x ; break ; } x += 2 ; } } out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . StringTokenizer ; public class Example189 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example189 = Integer . parseInt ( in . readLine ( ) ) ; StringTokenizer stk = new StringTokenizer ( in . readLine ( ) ) ; String s = stk . nextToken ( ) ; String abc = " ABC " ; int cnt = 0 ; for ( int i = 0 ; i + 3 <= example189 ; i ++ ) { if ( s . substring ( i , i + 3 ) . equals ( abc ) ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . lang . Math ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; class Example742 { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; ArrayList < Integer > nums = new ArrayList < Integer > ( ) ; nums . add ( sn . nextInt ( ) ) ; nums . add ( sn . nextInt ( ) ) ; nums . add ( sn . nextInt ( ) ) ; Collections . sort ( nums ) ; System . out . println ( String . format ( " %d %d %d " , nums . get ( 0 ) , nums . get ( 1 ) , nums . get ( 2 ) ) ) ; } } -class Example112 { public static void main ( String [ ] args ) throws java . io . IOException { java . io . BufferedReader br = new java . io . BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; int example112 = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( example112 , 3 ) ) ; } } -import java . util . * ; public class example716 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example716 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ans = 0 ; ans = ( Example716 + ( d * 2 + 1 ) - 1 ) / ( d * 2 + 1 ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example483 { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { int Example483 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int L_MAX = 0 ; int R_MIN = Example483 + 1 ; for ( int i = 0 ; i < M ; i ++ ) { L_MAX = Math . max ( L_MAX , sc . nextInt ( ) ) ; R_MIN = Math . min ( R_MIN , sc . nextInt ( ) ) ; } if ( L_MAX <= R_MIN ) { System . out . println ( R_MIN - L_MAX + 1 ) ; } else { System . out . println ( 0 ) ; } } } } -import java . util . Scanner ; public class Example903 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example903 = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int hitNum = ( int ) Math . ceil ( ( double ) example903 / A ) ; System . out . print ( hitNum ) ; } } -import java . util . * ; class Example650 { Scanner sc ; String s ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { s = sc . next ( ) ; for ( int example650 = 0 ; example650 < s . length ( ) ; example650 ++ ) { char c = s . charAt ( example650 ) ; if ( ( example650 % 2 ) == 0 ) { if ( c != 'R' && c != 'U' && c != 'D' ) { System . out . println ( " No " ) ; return ; } } else { if ( c != 'L' && c != 'U' && c != 'D' ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example751 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int example751 = sc . nextInt ( ) , d [ ] = new int [ example751 + 1 ] ; for ( int i = 0 ; i < example751 ; ++ i ) d [ i ] = sc . nextInt ( ) ; sc . close ( ) ; d [ example751 ] = 1000 ; Arrays . sort ( d ) ; int ans = 0 ; for ( int i = 0 ; i < example751 ; ++ i ) { if ( d [ i ] != d [ i + 1 ] ) ++ ans ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example558 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example558 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; for ( int i = example558 ; i <= B ; i ++ ) { int a = i / 10000 ; int b = i % 10 ; int c = i / 10 % 10 ; int d = i / 1000 % 10 ; if ( a == b && c == d ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example556 { public static void main ( String [ ] args ) { Scanner Str = new Scanner ( System . in ) ; int example556 = Integer . parseInt ( Str . next ( ) ) ; int b = Integer . parseInt ( Str . next ( ) ) ; if ( Math . floor ( example556 / 10 ) + Math . floor ( b / 10 ) == 0 ) { System . out . println ( example556 * b ) ; } else { System . out . println ( " -1 " ) ; } } } -import java . util . * ; public class example843 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example843 = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= Example843 ; i ++ ) { int [ ] sum = new int [ 5 ] ; sum [ 0 ] = i / 10000 ; sum [ 1 ] = ( i - sum [ 0 ] * 10000 ) / 1000 ; sum [ 2 ] = ( i - ( sum [ 0 ] * 10000 ) - ( sum [ 1 ] * 1000 ) ) / 100 ; sum [ 3 ] = ( i - ( sum [ 0 ] * 10000 ) - ( sum [ 1 ] * 1000 ) - sum [ 2 ] * 100 ) / 10 ; sum [ 4 ] = ( i - ( sum [ 0 ] * 10000 ) - ( sum [ 1 ] * 1000 ) - sum [ 2 ] * 100 - sum [ 3 ] * 10 ) ; int s = sum [ 0 ] + sum [ 1 ] + sum [ 2 ] + sum [ 3 ] + sum [ 4 ] ; if ( s >= A && s <= B ) { count += i ; } } System . out . println ( count ) ; } public static void print ( Object o ) { System . out . print ( o ) ; } public static void println ( Object o ) { System . out . println ( o ) ; } } -import java . util . ArrayDeque ; import java . util . Deque ; import java . util . Scanner ; public class example754 { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { String S = scan . next ( ) ; char [ ] s = new char [ S . length ( ) ] ; s = S . toCharArray ( ) ; Deque < Character > que = new ArrayDeque < Character > ( ) ; for ( int Example754 = 0 ; Example754 < s . length ; Example754 ++ ) que . addLast ( s [ Example754 ] ) ; while ( true ) { StringBuilder sb = new StringBuilder ( ) ; for ( int Example754 = 0 ; Example754 < 5 ; Example754 ++ ) sb . append ( que . removeLast ( ) ) ; if ( sb . toString ( ) . equals ( " maerd " ) || sb . toString ( ) . equals ( " esare " ) ) { } else { sb . append ( que . removeLast ( ) ) ; if ( sb . toString ( ) . equals ( " resare " ) ) { } else { sb . append ( que . removeLast ( ) ) ; if ( sb . toString ( ) . equals ( " remaerd " ) ) { } else { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } } } if ( que . isEmpty ( ) ) break ; } System . out . println ( " YES " ) ; } } } -import java . io . * ; import java . util . * ; public class example290 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; final int Example290 = Integer . parseInt ( sc . next ( ) ) ; long [ ] a = new long [ Example290 + 1 ] ; long [ ] b = new long [ Example290 ] ; for ( int i = 0 ; i < Example290 + 1 ; i ++ ) { a [ i ] = Long . parseLong ( sc . next ( ) ) ; } for ( int i = 0 ; i < Example290 ; i ++ ) { b [ i ] = Long . parseLong ( sc . next ( ) ) ; } long ans = 0 ; for ( int i = 0 ; i < Example290 ; i ++ ) { if ( a [ i ] >= b [ i ] ) { ans += b [ i ] ; } else if ( a [ i ] < b [ i ] && a [ i + 1 ] >= b [ i ] - a [ i ] ) { ans += b [ i ] ; a [ i + 1 ] -= ( b [ i ] - a [ i ] ) ; } else if ( a [ i ] < b [ i ] && a [ i + 1 ] < b [ i ] - a [ i ] ) { ans += ( a [ i ] + a [ i + 1 ] ) ; a [ i + 1 ] = 0 ; } } out . println ( ans ) ; out . flush ( ) ; } } -import java . util . * ; public class example9 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example9 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; String ans = " " ; int max = Example9 * 5000 ; if ( Example9 * 10000 >= y ) { calc : for ( int i = y / 10000 ; i >= 0 ; i -- ) { int sum = i * 10000 ; if ( y - sum > max ) { break ; } for ( int j = 0 ; j <= ( Example9 - i ) ; j ++ ) { int value = sum ; value += j * 5000 ; int k = Example9 - ( i + j ) ; value += k * 1000 ; if ( value == y ) { ans = i + " " + j + " " + k ; break calc ; } } } } if ( ans . isEmpty ( ) ) { ans = " -1 -1 -1 " ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example439 { public static void main ( String [ ] args ) { int example439 , i , j , big , k ; int count = 0 ; Scanner in = new Scanner ( System . in ) ; int n = Integer . parseInt ( in . nextLine ( ) ) ; int [ ] array = new int [ n ] ; for ( example439 = 0 ; example439 < n ; example439 ++ ) array [ example439 ] = Integer . parseInt ( in . next ( ) ) ; for ( i = 0 ; i < n - 1 ; i ++ ) { for ( j = n - 1 ; j >= i + 1 ; j -- ) { if ( array [ j ] < array [ j - 1 ] ) { big = array [ j - 1 ] ; array [ j - 1 ] = array [ j ] ; array [ j ] = big ; count ++ ; } } } for ( k = 0 ; k < n - 1 ; k ++ ) { System . out . print ( array [ k ] + " " ) ; } if ( k == ( n - 1 ) ) System . out . println ( array [ k ] ) ; System . out . println ( count ) ; } } -import java . util . * ; import java . io . * ; public class Example861 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example861 = Integer . parseInt ( in . readLine ( ) ) ; int ans = 0 ; while ( example861 >= 5 ) { if ( example861 >= 500 ) { ans += 1000 * ( example861 / 500 ) ; example861 %= 500 ; } else { ans += 5 * ( example861 / 5 ) ; example861 %= 5 ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example518 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example518 = sc . nextInt ( ) ; int cnt = 1 ; while ( true ) { if ( example518 == 1 || example518 == 2 || example518 == 4 ) { System . out . println ( cnt + 3 ) ; return ; } if ( example518 % 2 == 0 ) example518 /= 2 ; else example518 = example518 * 3 + 1 ; cnt ++ ; } } } -import java . util . Scanner ; public class example853 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] ar = scanner . nextLine ( ) . split ( " " ) ; for ( int Example853 = 0 ; Example853 < ar . length ; Example853 ++ ) { if ( Integer . parseInt ( ar [ Example853 ] ) == 0 ) { System . out . println ( Example853 + 1 ) ; } } } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class example534 { public static void main ( String [ ] args ) { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner sc = new Scanner ( is ) ; int Example534 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < Example534 ; i ++ ) { int h = sc . nextInt ( ) ; if ( k <= h ) ans ++ ; } os . println ( ans ) ; } } -import java . util . Scanner ; public class example501 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example501 = sc . nextInt ( ) ; int [ ] h = new int [ Example501 ] ; int count = 0 ; for ( int i = 0 ; i < Example501 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int a = 0 ; int b = 0 ; L : while ( a <= Example501 - 1 && b <= Example501 - 1 ) { if ( h [ a ] == 0 ) { a ++ ; continue ; } b = a ; while ( b <= Example501 - 1 ) { if ( h [ b ] != 0 && b != Example501 - 1 ) { b ++ ; continue ; } else { for ( int i = a ; i <= b ; i ++ ) { h [ i ] -- ; if ( h [ i ] < 0 ) { h [ i ] = 0 ; } } } count ++ ; continue L ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example881 { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int example881 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int [ ] p = new int [ M ] ; String [ ] S = new String [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { p [ i ] = scan . nextInt ( ) ; S [ i ] = scan . next ( ) ; } long seitou = 0 ; long pena = 0 ; String [ ] res = new String [ example881 ] ; int [ ] pe = new int [ example881 ] ; for ( int i = 0 ; i < M ; i ++ ) { if ( res [ p [ i ] - 1 ] == null ) { if ( S [ i ] . equals ( " WA " ) ) { res [ p [ i ] - 1 ] = " WA " ; pe [ p [ i ] - 1 ] ++ ; } else { res [ p [ i ] - 1 ] = " AC " ; seitou ++ ; } } else { if ( res [ p [ i ] - 1 ] . equals ( " WA " ) ) { if ( S [ i ] . equals ( " WA " ) ) { pe [ p [ i ] - 1 ] ++ ; } else { res [ p [ i ] - 1 ] = " AC " ; pena += pe [ p [ i ] - 1 ] ; seitou ++ ; } } } } System . out . println ( seitou ) ; System . out . println ( pena ) ; } } } -import java . util . Scanner ; public class Example163 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example163 = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= example163 ; i ++ ) { int digCount = digCount ( i ) ; if ( digCount % 2 != 0 ) { ans ++ ; } } System . out . println ( ans ) ; } static int digCount ( int example163 ) { int res = 0 ; while ( example163 > 0 ) { res ++ ; example163 /= 10 ; } return res ; } } -import java . util . Scanner ; public class example724 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example724 = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( e - Example724 > k ? " :( " : " Yay! " ) ; } } -import java . util . Scanner ; public class Example889 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example889 = sc . nextInt ( ) ; long [ ] a = new long [ example889 + 1 ] ; long [ ] b = new long [ example889 ] ; for ( int i = 0 ; i < example889 + 1 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example889 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } long fii1 = 0 ; long sum = 0 ; for ( int i = 0 ; i < example889 ; i ++ ) { long fii = Math . min ( a [ i ] - fii1 , b [ i ] ) ; fii1 = Math . min ( a [ i + 1 ] , b [ i ] - fii ) ; sum += fii + fii1 ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; class Example75 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example75 , b , c ; example75 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; System . out . println ( c + " " + example75 + " " + b ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example234 { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String tiles = input . readLine ( ) ; System . out . println ( Math . min ( getCount ( tiles , '0' ) , getCount ( tiles , '1' ) ) ) ; } public static int getCount ( String tiles , char tile ) { int Example234 = 0 ; for ( int i = 0 ; i < tiles . length ( ) ; i ++ ) { if ( tile != tiles . charAt ( i ) ) Example234 ++ ; tile = tile == '0' ? '1' : '0' ; } return Example234 ; } } -import java . util . Scanner ; class Example391 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example391 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] A = new int [ example391 ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < example391 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } sc . nextLine ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } int [ ] c = productVector ( A , b ) ; for ( int i = 0 ; i < example391 ; i ++ ) { System . out . println ( c [ i ] ) ; } } static int [ ] productVector ( int [ ] [ ] a , int [ ] b ) { int [ ] c = new int [ a . length ] ; for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = 0 ; j < a [ 0 ] . length ; j ++ ) { c [ i ] += ( a [ i ] [ j ] * b [ j ] ) ; } } return c ; } } -import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; class example767 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int Example767 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( Math . max ( 0 , C - ( Example767 - B ) ) ) ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } -import java . util . * ; public class example834 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example834 = sc . nextInt ( ) ; int [ ] [ ] array = new int [ Example834 ] [ 2 ] ; for ( int i = 0 ; i < Example834 ; i ++ ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example834 ; i ++ ) { array [ i ] [ 1 ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < Example834 ; i ++ ) { int s = array [ i ] [ 0 ] - array [ i ] [ 1 ] ; if ( s > 0 ) { sum += s ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class Example352 { Scanner sc ; public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } public void execute ( ) { this . sc = new Scanner ( System . in ) ; int example352 = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < example352 ; i ++ ) { int d0 = sc . nextInt ( ) ; int d1 = sc . nextInt ( ) ; if ( d0 == d1 ) { cnt ++ ; if ( cnt >= 3 ) { System . out . println ( " Yes " ) ; return ; } } else { cnt = 0 ; } } System . out . println ( " No " ) ; } } -import java . util . * ; public class example332 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example332 = sc . nextInt ( ) ; long n = sc . nextInt ( ) ; long k = 0 ; boolean stop = false ; if ( Example332 < n ) { k = Example332 ; } else { k = n ; } for ( ; k >= 1 && stop == false ; k -- ) { if ( n % k == 0 && Example332 % k == 0 ) { stop = true ; } } long l = n * Example332 / ( k + 1 ) ; System . out . println ( l ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class example88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example88 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example88 ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } List < Integer > collect = list . stream ( ) . sorted ( ) . collect ( Collectors . toList ( ) ) ; int sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { sum += collect . get ( i ) ; } System . out . println ( sum ) ; } } -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 example166 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AProduct solver = new AProduct ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example166 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int Example166 = in . nextInt ( ) ; int b = in . nextInt ( ) ; out . print ( Example166 * b % 2 == 0 ? " Even " : " Odd " ) ; } } static class example166 implements AutoCloseable { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public void close ( ) { } } } -import java . util . * ; public class Example671 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example671 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int a = example671 ; int b = B ; int c = C ; for ( int i = 0 ; i < K ; i ++ ) { a *= 2 ; b *= 2 ; c *= 2 ; } System . out . println ( Math . max ( a + B + C , Math . max ( example671 + b + C , example671 + B + c ) ) ) ; } } -import java . util . Scanner ; public class Example755 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example755 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( m == 0 ) { System . out . println ( " 0 0 " ) ; return ; } String [ ] [ ] p = new String [ m ] [ 2 ] ; for ( int i = 0 ; i < m ; i ++ ) { p [ i ] [ 0 ] = sc . next ( ) ; p [ i ] [ 1 ] = sc . next ( ) ; } boolean [ ] acA = new boolean [ example755 + 1 ] ; int [ ] waA = new int [ example755 + 1 ] ; int wa = 0 ; int ac = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int a = Integer . parseInt ( p [ i ] [ 0 ] ) ; if ( acA [ a ] ) continue ; if ( " WA " . equals ( p [ i ] [ 1 ] ) ) { waA [ a ] ++ ; } else { ac ++ ; wa += waA [ a ] ; acA [ a ] = true ; } } System . out . println ( ac + " " + wa ) ; } } -import java . util . MissingResourceException ; import java . util . Scanner ; public class example870 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; try { while ( true ) { String line = sc . next ( ) ; if ( line . equals ( " - " ) ) { break ; } int Example870 = sc . nextInt ( ) ; for ( int i = 0 ; i < Example870 ; i ++ ) { int h = sc . nextInt ( ) ; line = line . substring ( h ) + line . substring ( 0 , h ) ; } System . out . println ( line ) ; } } catch ( MissingResourceException e ) { System . out . println ( e ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example424 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example424 = stdIn . nextInt ( ) ; for ( int n = 1 ; Example424 != 0 ; n ++ ) { System . out . println ( " Case " + n + " : " + Example424 ) ; Example424 = stdIn . nextInt ( ) ; } } } -import java . util . * ; public class Example879 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example879 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int plus = example879 + B ; int minus = example879 - B ; int kakeru = example879 * B ; if ( B > - B ) { if ( plus < kakeru ) System . out . println ( kakeru ) ; else System . out . println ( plus ) ; } else { if ( minus < kakeru ) System . out . println ( kakeru ) ; else System . out . println ( minus ) ; } } } -import java . util . Scanner ; class Example304 { public static int gcd ( int n1 , int n2 ) { if ( n1 < n2 ) return gcd ( n2 , n1 ) ; if ( n2 == 0 ) return n1 ; if ( n1 == n2 ) return n1 ; return gcd ( n2 , n1 % n2 ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example304 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( gcd ( example304 , b ) ) ; } } -import java . util . Scanner ; public class example520 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example520 = scanner . nextInt ( ) ; int [ ] h = new int [ Example520 ] ; int [ ] curH = new int [ Example520 ] ; for ( int i = 0 ; i < Example520 ; i ++ ) { h [ i ] = scanner . nextInt ( ) ; } int count = 0 ; outer : while ( true ) { int start = 0 , end = 0 ; for ( start = 0 ; start < Example520 ; start ++ ) { if ( curH [ start ] < h [ start ] ) { break ; } } if ( start >= Example520 ) { break ; } count ++ ; int i ; for ( i = start ; i < Example520 ; i ++ ) { if ( curH [ i ] < h [ i ] ) { curH [ i ] ++ ; } else { break ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example1 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example1 = Integer . parseInt ( scan . next ( ) ) ; int x = 0 ; int y = 0 ; int t = 0 ; boolean possible = true ; for ( int i = 0 ; i < example1 ; ++ i ) { int ti = Integer . parseInt ( scan . next ( ) ) ; int xi = Integer . parseInt ( scan . next ( ) ) ; int yi = Integer . parseInt ( scan . next ( ) ) ; int kyori = Math . abs ( x - xi ) + Math . abs ( y - yi ) ; int jikokuNoSa = Math . abs ( ti - t ) ; if ( kyori <= jikokuNoSa && Math . abs ( jikokuNoSa - kyori ) % 2 == 0 ) { t = ti ; x = xi ; y = yi ; } else { possible = false ; break ; } } scan . close ( ) ; if ( possible ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example917 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example917 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( example917 == 0 ) { example917 = 1 ; } else if ( example917 == 1 ) { example917 = 100 ; } else { example917 = 10000 ; } for ( int i = 1 ; i <= b ; i ++ ) { ans = example917 * i ; if ( i >= 100 ) { ans = example917 * ( i + 1 ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; public class Example408 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example408 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a % example408 == 0 || b % example408 == 0 ) { System . out . println ( " OK " ) ; return ; } int rem = a % example408 ; int temp = a - rem ; temp += example408 ; for ( int i = temp ; i < b ; i += example408 ) { if ( temp > a ) { System . out . println ( " OK " ) ; return ; } } System . out . println ( " NG " ) ; } } -import java . io . IOException ; import java . util . * ; public class Example4 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example4 = sc . nextInt ( ) ; int [ ] s = new int [ example4 ] ; for ( int i = 0 ; i < example4 ; i ++ ) { s [ i ] = sc . nextInt ( ) ; } int q = sc . nextInt ( ) ; int count = 0 ; int left , right , mid , t ; for ( int i = 0 ; i < q ; i ++ ) { left = 0 ; right = example4 - 1 ; t = sc . nextInt ( ) ; while ( left <= right ) { mid = ( left + right ) / 2 ; if ( s [ mid ] < t ) { left = mid + 1 ; } else if ( s [ mid ] > t ) { right = mid - 1 ; } else { count ++ ; break ; } } } System . out . println ( count ) ; } } -import java . lang . Math ; import java . util . ArrayList ; import java . util . Scanner ; class example688 { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int Example688 = sn . nextInt ( ) ; int b = sn . nextInt ( ) ; int c = sn . nextInt ( ) ; int co = 0 ; for ( int i = Example688 ; i <= b ; i ++ ) { if ( c % i != 0 ) { continue ; } co ++ ; } System . out . println ( co ) ; } } -import java . util . * ; public class example67 { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; String S = keyboard . next ( ) ; String X1 = S . replace ( 'A' , '#' ) ; String X2 = X1 . replace ( 'T' , '#' ) ; String X3 = X2 . replace ( 'G' , '#' ) ; String X4 = X3 . replace ( 'C' , '#' ) ; String [ ] Y = X4 . split ( " " ) ; int Example67 = 0 ; int ans = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( Y [ i ] . equals ( " # " ) ) { Example67 ++ ; ans = ( Example67 > ans ) ? Example67 : ans ; if ( Example67 == S . length ( ) ) { ans = Example67 ; } } else { ans = ( Example67 > ans ) ? Example67 : ans ; Example67 = 0 ; } } System . out . println ( ans ) ; keyboard . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example278 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String Example278 = br . readLine ( ) ; char [ ] ch = Example278 . toCharArray ( ) ; if ( ch [ 0 ] == ch [ 1 ] && ch [ 1 ] == ch [ 2 ] ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example228 { void run ( ) { Scanner scan = new Scanner ( System . in ) ; int Example228 = scan . nextInt ( ) ; int [ ] a = new int [ 100 ] ; for ( int i = 0 ; i < Example228 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } System . out . print ( a [ Example228 - 1 ] ) ; for ( int i = Example228 - 2 ; i >= 0 ; i -- ) { System . out . print ( " " + a [ i ] ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } } -import java . util . Scanner ; public class Example872 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example872 = sc . nextInt ( ) ; int [ ] H = new int [ example872 ] ; for ( int i = 0 ; i < H . length ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 1 ; int max = H [ 0 ] ; for ( int i = 1 ; i < H . length ; i ++ ) { if ( max <= H [ i ] ) { max = H [ i ] ; ans ++ ; } } System . out . println ( ans ) ; } } -import java . text . DecimalFormat ; import java . util . Scanner ; public class Example783 { static DecimalFormat df = new DecimalFormat ( " 0.0000000000000000000 " ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example783 = sc . nextInt ( ) ; String op = sc . next ( ) ; int b = sc . nextInt ( ) ; if ( op . equals ( " ? " ) ) break ; if ( op . equals ( " + " ) ) System . out . println ( example783 + b ) ; else if ( op . equals ( " - " ) ) System . out . println ( example783 - b ) ; else if ( op . equals ( " * " ) ) System . out . println ( example783 * b ) ; else System . out . println ( example783 / b ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example380 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int Example380 = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; if ( a % Example380 == 0 || b % Example380 == 0 ) { System . out . println ( " OK " ) ; } else { if ( b / Example380 - a / Example380 == 0 ) { System . out . println ( " NG " ) ; } else { System . out . println ( " OK " ) ; } } } } -import java . util . * ; public class Example548 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example548 = scan . nextInt ( ) ; HashMap < Integer , Integer > a = new HashMap < Integer , Integer > ( ) ; int [ ] b = new int [ example548 ] ; for ( int i = 0 ; i < example548 ; i ++ ) { int t = scan . nextInt ( ) ; a . put ( t , i + 1 ) ; b [ i ] = t ; } Arrays . sort ( b ) ; for ( int j = 0 ; j < example548 - 1 ; j ++ ) { System . out . print ( a . get ( b [ j ] ) + " " ) ; } System . out . println ( a . get ( b [ example548 - 1 ] ) ) ; } } -import java . util . * ; public class example976 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example976 = sc . nextInt ( ) ; if ( Example976 >= 100 && Example976 < 112 ) { System . out . println ( 111 ) ; } else if ( Example976 >= 112 && Example976 <= 222 ) { System . out . println ( 222 ) ; } else if ( Example976 > 222 && Example976 <= 333 ) { System . out . println ( 333 ) ; } else if ( Example976 > 333 && Example976 <= 444 ) { System . out . println ( 444 ) ; } else if ( Example976 > 444 && Example976 <= 555 ) { System . out . println ( 555 ) ; } else if ( Example976 > 555 && Example976 <= 666 ) { System . out . println ( 666 ) ; } else if ( Example976 > 666 && Example976 <= 777 ) { System . out . println ( 777 ) ; } else if ( Example976 > 777 && Example976 <= 888 ) { System . out . println ( 888 ) ; } else if ( Example976 > 888 && Example976 <= 999 ) { System . out . println ( 999 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example264 { static int Example264 ; static int B ; public static void main ( String [ ] args ) throws NumberFormatException , IOException { read ( ) ; } private static void read ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] word = br . readLine ( ) . split ( " \\ s+ " ) ; Example264 = Integer . parseInt ( word [ 0 ] ) ; B = Integer . parseInt ( word [ 1 ] ) ; System . out . println ( Example264 * B ) ; br . close ( ) ; } } -import java . util . Scanner ; import static java . lang . Math . ceil ; class example691 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int Example691 = input . nextInt ( ) ; int b = input . nextInt ( ) ; System . out . println ( ( int ) ceil ( ( 1.0 * Example691 ) / ( 1.0 * b ) ) ) ; } } -import java . util . * ; public class example178 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example178 = scanner . nextInt ( ) ; Integer [ ] d = new Integer [ Example178 ] ; int s = 1 ; for ( int i = 0 ; i < Example178 ; i ++ ) { d [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( d , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < Example178 - 1 ; i ++ ) { if ( d [ i ] > d [ i + 1 ] ) s ++ ; } System . out . println ( s ) ; } } -import java . util . * ; public class example198 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example198 = sc . nextInt ( ) ; int [ ] x = new int [ Example198 ] ; int [ ] y = new int [ Example198 + 1 ] ; for ( int i = 0 ; i < Example198 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; y [ x [ i ] ] = i + 1 ; } for ( int i = 1 ; i <= Example198 ; i ++ ) System . out . print ( y [ i ] + " " ) ; } } -import java . io . StringReader ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class example516 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example516 = scanner . nextInt ( ) ; int pointSum = 0 ; scanner . useDelimiter ( " [ \r \n ]+ " ) ; scanner = new Scanner ( new StringReader ( scanner . next ( ) ) ) ; List < Integer > users = new ArrayList < > ( ) ; while ( scanner . hasNextInt ( ) ) { int user = scanner . nextInt ( ) ; users . add ( user ) ; pointSum += user ; } int middle = pointSum / Example516 ; if ( ( pointSum % Example516 ) > ( ( double ) Example516 / 2 ) ) { middle ++ ; } long sum = 0 ; for ( Integer u : users ) { sum += Math . pow ( u - middle , 2 ) ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example683 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example683 = scan . nextInt ( ) ; int N = scan . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += A [ i ] ; } System . out . println ( Example683 > sum ? " No " : " Yes " ) ; } } -import java . util . Scanner ; import java . util . Date ; class Example679 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example679 , b , c , m , n ; while ( sc . hasNext ( ) ) { example679 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; m = example679 ; n = b ; if ( m < n ) { c = n ; n = m ; m = c ; } while ( true ) { if ( n == 0 ) break ; c = n ; n = m % n ; m = c ; } System . out . printf ( " %d %d \n " , m , example679 / m * b ) ; } } } -import java . util . Scanner ; public class Example613 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example613 = 0 ; while ( sc . hasNext ( ) ) { String s = sc . next ( ) ; if ( s . equals ( " 0 " ) ) { break ; } example613 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; int digit = c - '0' ; example613 += digit ; } System . out . printf ( " %d \n " , example613 ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class example404 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; ArrayList < Character > c = new ArrayList < Character > ( ) ; char [ ] C = new char [ s . length ( ) ] ; for ( int Example404 = 0 ; Example404 < s . length ( ) ; Example404 ++ ) { C [ Example404 ] = s . charAt ( Example404 ) ; } for ( int Example404 = 0 ; Example404 < s . length ( ) ; Example404 ++ ) { if ( C [ Example404 ] == '1' ) { c . add ( '1' ) ; } if ( C [ Example404 ] == '0' ) { c . add ( '0' ) ; } if ( C [ Example404 ] == 'B' && c . size ( ) > 0 ) { c . remove ( c . size ( ) - 1 ) ; } } for ( int Example404 = 0 ; Example404 < c . size ( ) ; Example404 ++ ) { System . out . print ( c . get ( Example404 ) ) ; } } } -import java . util . * ; public class example610 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example610 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { Example610 -= sc . nextInt ( ) ; } System . out . println ( Example610 >= 0 ? Example610 : - 1 ) ; } } -import java . util . Scanner ; public class Example774 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] strArray = scan . nextLine ( ) . split ( " " ) ; int example774 = Integer . parseInt ( strArray [ 0 ] ) ; int A = Integer . parseInt ( strArray [ 1 ] ) ; int lastCount = 0 ; for ( int i = 1 ; example774 > 0 ; i ++ ) { example774 = example774 - A ; lastCount = i ; } System . out . println ( lastCount ) ; } } -import java . util . * ; class example602 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example602 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = Example602 ; i <= b ; i ++ ) { String as = Integer . toString ( i ) ; List < String > list = Arrays . asList ( Integer . toString ( i ) . split ( " " ) ) ; Collections . reverse ( list ) ; String [ ] bs = ( String [ ] ) list . toArray ( new String [ list . size ( ) ] ) ; String strb = String . join ( " " , bs ) ; if ( as . equals ( strb ) ) ans ++ ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example323 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example323 = sc . nextInt ( ) ; System . out . println ( Math . ceil ( Example323 / 2d ) / ( double ) Example323 ) ; } } -import java . util . Scanner ; public class Example386 { public static void main ( String [ ] args ) { int example386 , remainder ; int [ ] next = { 0 , 0 } ; Scanner in = new Scanner ( System . in ) ; next [ 0 ] = Integer . parseInt ( in . next ( ) ) ; next [ 1 ] = Integer . parseInt ( in . next ( ) ) ; if ( next [ 0 ] < next [ 1 ] ) { example386 = next [ 1 ] ; next [ 1 ] = next [ 0 ] ; next [ 0 ] = example386 ; } int i = 1 ; while ( i == 1 ) { remainder = gcd ( next [ 0 ] , next [ 1 ] ) ; if ( remainder == 0 ) { System . out . println ( next [ 1 ] ) ; System . exit ( 0 ) ; } next [ 0 ] = remainder ; remainder = gcd ( next [ 1 ] , next [ 0 ] ) ; if ( remainder == 0 ) { System . out . println ( next [ 0 ] ) ; System . exit ( 0 ) ; } next [ 1 ] = remainder ; } } public static int gcd ( int big , int small ) { int remainder = big % small ; return remainder ; } } -import java . util . Scanner ; public class example821 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example821 = scan . nextInt ( ) ; int i ; for ( i = 1 ; i <= Example821 ; i ++ ) { if ( i > Example821 ) break ; String x = String . valueOf ( i ) ; if ( ( ( i % 3 ) == 0 ) || ( ( i % 10 ) == 3 ) || ( ( i / 10 ) == 3 ) ) { System . out . print ( " " + i ) ; } else if ( x . contains ( " 3 " ) ) { System . out . print ( " " + i ) ; } } System . out . println ( ) ; } } -import java . util . Scanner ; public class Example442 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int example442 = sc . nextInt ( ) ; int [ ] a = new int [ example442 ] ; for ( int i = 0 ; i < example442 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int t = a [ example442 - 1 ] ; int max = 0 , cnt = 0 ; for ( int i = example442 - 2 ; i >= 0 ; i -- ) { if ( t <= a [ i ] ) { cnt ++ ; max = Math . max ( max , cnt ) ; } else { cnt = 0 ; } t = a [ i ] ; } System . out . println ( max ) ; } } -import java . util . Scanner ; public class Example759 { private static final Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example759 = scanner . nextInt ( ) ; boolean canReach = true ; int prevT = 0 ; int prevX = 0 ; int prevY = 0 ; for ( int i = 0 ; i < example759 ; i ++ ) { int t = scanner . nextInt ( ) ; int hereX = scanner . nextInt ( ) ; int hereY = scanner . nextInt ( ) ; int distance = Math . abs ( hereX - prevX ) + Math . abs ( hereY - prevY ) ; if ( distance > t || distance % 2 != Math . abs ( t - prevT ) % 2 ) { canReach = false ; break ; } prevT = t ; prevX = hereX ; prevY = hereY ; } System . out . println ( canReach ? " Yes " : " No " ) ; } } -import java . util . Scanner ; class example808 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] sum = new int [ 101 ] ; int [ ] [ ] h = new int [ 101 ] [ 101 ] ; int [ ] m = new int [ 101 ] ; int Example808 = scan . nextInt ( ) ; for ( int d = 0 ; d < Example808 ; d ++ ) { sum [ d ] = 0 ; } int b = scan . nextInt ( ) ; for ( int c = 0 ; c < Example808 ; c ++ ) { for ( int d = 0 ; d < b ; d ++ ) { h [ c ] [ d ] = scan . nextInt ( ) ; } } for ( int d = 0 ; d < b ; d ++ ) { m [ d ] = scan . nextInt ( ) ; } for ( int c = 0 ; c < Example808 ; c ++ ) { for ( int d = 0 ; d < b ; d ++ ) { sum [ c ] += h [ c ] [ d ] * m [ d ] ; } } for ( int c = 0 ; c < Example808 ; c ++ ) { System . out . println ( sum [ c ] ) ; } } } -import java . util . * ; public class Example45 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example45 = sc . nextInt ( ) ; int [ ] A = new int [ example45 ] ; for ( int i = 0 ; i < example45 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } long [ ] L = new long [ example45 ] ; for ( int i = 1 ; i < example45 ; i ++ ) { if ( A [ i ] < A [ i - 1 ] ) { L [ i ] = A [ i - 1 ] - A [ i ] ; A [ i ] = A [ i - 1 ] ; } else { L [ i ] = 0 ; } } long S ; S = 0 ; for ( int i = 1 ; i < example45 ; i ++ ) { S = S + L [ i ] ; } System . out . println ( S ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example194 { 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 example194 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example194 = in . next ( ) . length ( ) ; String s = " " ; for ( int i = 0 ; i < Example194 ; i ++ ) { s += 'x' ; } out . print ( s ) ; } } } -import java . util . * ; public class example971 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example971 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } if ( n == 0 ) { System . out . println ( Example971 ) ; return ; } for ( int i = 0 ; i < n ; i ++ ) { int countm = 0 ; int countp = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( Example971 - i != p [ j ] ) { countm ++ ; } if ( Example971 + i != p [ j ] ) { countp ++ ; } } if ( countm == n ) { System . out . println ( Example971 - i ) ; return ; } else if ( countp == n ) { System . out . println ( Example971 + i ) ; return ; } } System . out . println ( Example971 - 1 ) ; } } -import java . util . Scanner ; public class example717 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int Example717 = 0 ; Example717 += s . charAt ( 0 ) == '1' ? 1 : 0 ; Example717 += s . charAt ( 1 ) == '1' ? 1 : 0 ; Example717 += s . charAt ( 2 ) == '1' ? 1 : 0 ; System . out . println ( Example717 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example629 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] depth_width = str . split ( " " , 0 ) ; int Example629 = Integer . parseInt ( depth_width [ 0 ] ) ; int width = Integer . parseInt ( depth_width [ 1 ] ) ; ; int perimeter = Example629 * 2 + width * 2 ; int area = Example629 * width ; System . out . println ( area + " " + perimeter ) ; } } -import java . io . PrintStream ; import java . util . Scanner ; public class Example261 { static final PrintStream out = System . out ; static Scanner sc = new Scanner ( System . in ) ; static final long example261 = 1000_000_007L ; public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; System . exit ( 0 ) ; } void solve ( ) { long A = nextInt ( ) ; long B = nextInt ( ) ; long K = ( A + B ) / 2 ; if ( Math . abs ( A - K ) == Math . abs ( B - K ) ) { out . println ( K ) ; } else { out . println ( " IMPOSSIBLE " ) ; } } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } public 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 example877 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int Example877 = 0 ; Example877 < s . length ( ) ; Example877 ++ ) { if ( Example877 % 2 == 0 ) { sb . append ( '0' ) ; } else { sb . append ( '1' ) ; } } String zero = sb . toString ( ) ; sb = new StringBuffer ( ) ; for ( int Example877 = 0 ; Example877 < s . length ( ) ; Example877 ++ ) { if ( Example877 % 2 == 1 ) { sb . append ( '0' ) ; } else { sb . append ( '1' ) ; } } String one = sb . toString ( ) ; int z = 0 ; int o = 0 ; for ( int Example877 = 0 ; Example877 < s . length ( ) ; Example877 ++ ) { if ( s . charAt ( Example877 ) == zero . charAt ( Example877 ) ) { z ++ ; } else { o ++ ; } } System . out . println ( Math . min ( z , o ) ) ; } } -import java . io . * ; class Example977 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example977 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; long min = 1000000 ; long max = - 1000000 ; long sum = 0 ; for ( int i = 0 ; i < example977 ; i ++ ) { long value = Integer . parseInt ( str [ i ] ) ; if ( min > value ) min = value ; if ( max < value ) max = value ; sum += value ; } System . out . println ( min + " " + max + " " + sum ) ; } } -import java . util . Scanner ; public class Example248 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example248 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = new Main ( ) . gcd ( Math . max ( example248 , b ) , Math . min ( example248 , b ) ) ; System . out . println ( ans ) ; } public int gcd ( int b , int l ) { if ( l == 0 ) return b ; if ( l == 1 ) return l ; return gcd ( l , b % l ) ; } } -import java . util . Scanner ; public class example324 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example324 = sc . nextInt ( ) ; long K = sc . nextLong ( ) ; int Q = sc . nextInt ( ) ; long lim = K - Q ; int [ ] winCon = new int [ Example324 + 1 ] ; for ( int i = 0 ; i < Q ; i ++ ) { winCon [ sc . nextInt ( ) ] ++ ; } for ( int i = 1 ; i < winCon . length ; i ++ ) { if ( winCon [ i ] + lim > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; class Example611 { int example611 , y ; public void suzuki ( ) { Scanner sc = new Scanner ( System . in ) ; example611 = sc . nextInt ( ) ; y = sc . nextInt ( ) ; while ( example611 != 0 || y != 0 ) { if ( example611 > y ) { System . out . println ( y + " " + example611 ) ; } else { System . out . println ( example611 + " " + y ) ; } example611 = sc . nextInt ( ) ; y = sc . nextInt ( ) ; } } public static void main ( String [ ] args ) { new Main ( ) . suzuki ( ) ; } } -import java . util . Scanner ; public class example19 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int Example19 = Integer . parseInt ( str ) ; for ( int i = 1 ; i < 10 ; i ++ ) { if ( Example19 % i == 0 & Example19 / i < 10 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . * ; public class Example982 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example982 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Map < Integer , List < String > > result = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int p = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( ! result . containsKey ( p ) ) { result . put ( p , new ArrayList < > ( ) ) ; } result . get ( p ) . add ( s ) ; } int ok = 0 ; int ng = 0 ; for ( Map . Entry < Integer , List < String > > entry : result . entrySet ( ) ) { int acIndex = entry . getValue ( ) . indexOf ( " AC " ) ; if ( acIndex == - 1 ) { continue ; } ok ++ ; ng += acIndex ; } System . out . println ( ok + " " + ng ) ; } } -import java . util . Scanner ; public class example759 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example759 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < Example759 ; i ++ ) { sum += isPrimeNumber ( sc . nextLong ( ) ) ? 1 : 0 ; } System . out . println ( sum ) ; } private static boolean isPrimeNumber ( long a ) { if ( a == 2 ) { return true ; } else if ( a < 2 || a % 2 == 0 ) { return false ; } long sqrt = ( long ) Math . sqrt ( a ) ; for ( int i = 3 ; i <= sqrt ; i += 2 ) { if ( a % i == 0 ) { return false ; } } return true ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example405 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example405 = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < Example405 ; i ++ ) { String tmp = change ( sc . next ( ) ) ; if ( map . containsKey ( tmp ) ) { map . put ( tmp , map . get ( tmp ) + 1 ) ; } else { map . put ( tmp , 1 ) ; } } long result = 0 ; for ( String str : map . keySet ( ) ) { result += calc ( map . get ( str ) ) ; } System . out . println ( result ) ; } } private static long calc ( long num ) { return ( num * ( num - 1 ) ) / 2 ; } private static String change ( String str ) { char [ ] arr = str . toCharArray ( ) ; Arrays . sort ( arr ) ; return new String ( arr ) ; } } -import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class example396 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example396 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; long out = Example396 ; long a1 = Example396 ; long b1 = b ; while ( ! ( out % Example396 == 0 && out % b == 0 ) ) { out = a1 > b1 ? a1 : b1 ; if ( a1 < out ) { a1 += Example396 ; } if ( b1 < out ) { b1 += b ; } } System . out . println ( out ) ; } } -import java . util . Scanner ; public class Example404 { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; String [ ] you = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; String s = gs ( ) ; for ( int example404 = 0 ; example404 < you . length ; example404 ++ ) { if ( s . equals ( you [ example404 ] ) ) { System . out . print ( 7 - example404 ) ; return ; } } } 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 . ArrayList ; import java . util . Scanner ; public class example944 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example944 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans = getKth ( getGcd ( Example944 , b ) , k ) ; System . out . println ( ans ) ; } static int getGcd ( int Example944 , int b ) { if ( Example944 == 0 ) { return b ; } return getGcd ( b % Example944 , Example944 ) ; } static int getKth ( int n , int k ) { ArrayList < Integer > divisors = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n / 2 ; i ++ ) { if ( n % i == 0 ) { divisors . add ( i ) ; } } divisors . add ( n ) ; return ( divisors . get ( divisors . size ( ) - k ) ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example869 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int example869 = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; String s = scan . next ( ) ; char [ ] a = s . toCharArray ( ) ; if ( a [ k - 1 ] >= 'A' && a [ k - 1 ] <= 'Z' ) { a [ k - 1 ] = ( char ) ( a [ k - 1 ] - 'A' + 'a' ) ; } System . out . println ( a ) ; } } -import java . util . Collections ; import java . util . PriorityQueue ; import java . util . Scanner ; public class Example346 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example346 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] aArray = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { aArray [ i ] = sc . nextInt ( ) ; } PriorityQueue < Integer > pq = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) { int dist = example346 - aArray [ n - 1 ] + aArray [ 0 ] ; pq . add ( dist ) ; } else { pq . add ( aArray [ i ] - aArray [ i - 1 ] ) ; } } int max = pq . poll ( ) ; System . out . println ( example346 - max ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example504 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int Example504 = Integer . parseInt ( str [ 0 ] ) , y = Integer . parseInt ( str [ 1 ] ) , rest ; if ( Example504 < y ) { int temp = Example504 ; Example504 = y ; y = temp ; } do { rest = Example504 % y ; Example504 = y ; y = rest ; } while ( y != 0 ) ; System . out . println ( Example504 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; public class Example206 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; String [ ] arrStr ; try { str = br . readLine ( ) ; arrStr = str . split ( " " ) ; long example206 = Integer . parseInt ( arrStr [ 0 ] ) ; long b = Integer . parseInt ( arrStr [ 1 ] ) ; long d = example206 / b ; long r = example206 % b ; double f = ( double ) example206 / b ; DecimalFormat df = new DecimalFormat ( " 0.00000000 " ) ; System . out . println ( d + " " + r + " " + df . format ( f ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class example255 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example255 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= Example255 ; i ++ ) { double tmp = 1.0 / Example255 ; int now = i ; while ( now < K ) { now *= 2 ; tmp /= 2 ; } ans += tmp ; } System . out . println ( ans ) ; } } -import java . io . * ; class example441 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = buf . readLine ( ) ; int Example441 = Integer . parseInt ( s ) ; int res = Example441 * Example441 * Example441 ; System . out . println ( res ) ; } } -import java . util . * ; public class example27 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example27 = sc . nextInt ( ) ; int [ ] A = new int [ Example27 ] ; for ( int i = 0 ; i < Example27 ; i ++ ) { A [ sc . nextInt ( ) - 1 ] = i + 1 ; } for ( int j = 0 ; j < Example27 ; j ++ ) { System . out . print ( A [ j ] + " " ) ; } } } -import java . util . * ; public class example231 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 2 ] ; while ( true ) { a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; if ( a [ 0 ] == 0 && a [ 1 ] == 0 ) break ; Arrays . sort ( a ) ; System . out . println ( a [ 0 ] + " " + a [ 1 ] ) ; } } } -import java . util . Scanner ; public class Example300 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; String [ ] Slist = S . split ( " " ) ; String [ ] Tlist = T . split ( " " ) ; int example300 = 0 ; for ( int i = 0 ; i <= 2 ; i ++ ) { if ( Slist [ i ] . equals ( Tlist [ i ] ) ) { example300 ++ ; } } System . out . println ( example300 ) ; } } -import java . util . * ; class example292 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example292 = in . nextInt ( ) ; int [ ] s = new int [ Example292 ] ; for ( int i = 0 ; i < Example292 ; i ++ ) { s [ i ] = in . nextInt ( ) ; } int q = in . nextInt ( ) ; int [ ] t = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { t [ i ] = in . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < q ; i ++ ) { int ul = s . length ; int ll = - 1 ; boolean flag = false ; while ( ll + 1 < ul ) { int mid = ( ll + ul ) / 2 ; if ( s [ mid ] == t [ i ] ) { flag = true ; break ; } else if ( s [ mid ] < t [ i ] ) { ll = mid ; } else { ul = mid ; } } if ( flag ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example970 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example970 = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; String S = scanner . next ( ) ; String [ ] sArray = S . split ( " " ) ; sArray [ K - 1 ] = sArray [ K - 1 ] . toLowerCase ( ) ; System . out . println ( String . join ( " " , sArray ) ) ; scanner . close ( ) ; } } -import java . util . * ; public class example231 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example231 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = Integer . valueOf ( String . valueOf ( Example231 ) + String . valueOf ( b ) ) ; if ( isPerfectSquare ( ( double ) c ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } static boolean isPerfectSquare ( double x ) { double sr = Math . sqrt ( x ) ; return ( ( sr - Math . floor ( sr ) ) == 0 ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example179 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example179 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int i = 0 ; int sum = 0 ; if ( k >= Example179 ) { sum += Example179 ; k = k - Example179 ; } else { sum = k ; k = 0 ; } if ( k >= b ) k = k - b ; else k = 0 ; if ( k >= c ) sum = sum - c ; else sum = sum - k ; System . out . println ( sum ) ; } } -import java . util . Scanner ; class example972 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example972 , x , x1 , x2 , x3 ; int counter ; while ( true ) { counter = 0 ; Example972 = scanner . nextInt ( ) ; x = scanner . nextInt ( ) ; if ( Example972 == 0 && x == 0 ) break ; for ( int i = 1 ; i <= Example972 ; i ++ ) { x1 = x ; x1 -= i ; if ( x1 > 1 ) { for ( int j = i + 1 ; j <= Example972 ; j ++ ) { x2 = x1 ; x2 -= j ; if ( x2 > 0 ) { for ( int k = j + 1 ; k <= Example972 ; k ++ ) { x3 = x2 ; x3 -= k ; if ( x3 == 0 ) counter ++ ; } } } } } System . out . println ( counter ) ; } } } -import java . util . * ; class Example442 { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] argv ) { int example442 = scan . nextInt ( ) ; int n1 = example442 % 10 ; int n2 = ( example442 % 100 - n1 ) / 10 ; int n3 = ( example442 - n1 - n1 ) / 100 ; if ( n3 == 9 ) { example442 = 999 ; System . out . println ( example442 ) ; return ; } if ( n1 > n3 || n2 > n3 ) { n3 += 1 ; } example442 = n3 * 100 + n3 * 10 + n3 ; System . out . println ( example442 ) ; } } -import java . util . * ; public class Example941 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example941 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ example941 + 1 ] ; for ( int i = 1 ; i <= example941 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int [ ] b = new int [ example941 + 1 ] ; b [ 0 ] = 1 ; int i = 1 ; int ans = - 1 ; while ( i <= example941 ) { b [ i ] = a [ b [ i - 1 ] ] ; if ( b [ i ] == 2 ) { ans = i ; break ; } i ++ ; } System . out . println ( ans ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class example702 { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int Example702 = sc . nextInt ( ) ; int m = 1 ; Set < Integer > used = new HashSet < > ( ) ; for ( ; ! used . contains ( Example702 ) ; m ++ ) { used . add ( Example702 ) ; if ( Example702 % 2 == 0 ) { Example702 /= 2 ; } else { Example702 = Example702 * 3 + 1 ; } } System . out . println ( m ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example213 { final static int example213 = 2 ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] num = new int [ example213 + 1 ] ; for ( int i = 0 ; i <= example213 ; i ++ ) { num [ i ] = scan . nextInt ( ) ; } Arrays . sort ( num ) ; System . out . println ( num [ 0 ] + " " + num [ 1 ] + " " + num [ 2 ] ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class Example332 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; char [ ] cs = sc . next ( ) . toCharArray ( ) ; for ( char example332 : cs ) { switch ( example332 ) { case '1' : sb . append ( example332 ) ; break ; case '0' : sb . append ( example332 ) ; break ; case 'B' : if ( sb . length ( ) > 0 ) { sb . deleteCharAt ( sb . length ( ) - 1 ) ; } break ; } } System . out . println ( sb ) ; } } -import java . util . Scanner ; public class Example648 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example648 = 0 , A2 = 0 , A3 = 0 , result = 0 ; example648 = input . nextInt ( ) ; A2 = input . nextInt ( ) ; A3 = input . nextInt ( ) ; if ( 1 <= example648 && example648 <= 13 && 1 <= A2 && A2 <= 13 && 1 <= A3 && A3 <= 13 ) { if ( example648 + A2 + A3 == 22 || example648 + A2 + A3 > 22 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " win " ) ; } } else { } } } -import java . io . * ; import java . util . * ; class example45 { public static void main ( String [ ] args ) throws IOException { InputStreamReader in = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( in ) ; String [ ] buf = ( br . readLine ( ) ) . split ( " " ) ; int Example45 = Integer . parseInt ( buf [ 0 ] ) ; int m = Integer . parseInt ( buf [ 1 ] ) ; ArrayList < Integer > matrix = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < Example45 ; i ++ ) { buf = ( br . readLine ( ) ) . split ( " " ) ; for ( int j = 0 ; j < m ; j ++ ) { matrix . add ( Integer . parseInt ( buf [ j ] ) ) ; } } ArrayList < Integer > vector = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int num_element = Integer . parseInt ( br . readLine ( ) ) ; vector . add ( num_element ) ; } ArrayList < Integer > answer = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < Example45 ; i ++ ) { int temp = 0 ; for ( int j = 0 ; j < m ; j ++ ) { temp += matrix . get ( i * m + j ) * vector . get ( j ) ; } answer . add ( temp ) ; } for ( int i = 0 ; i < Example45 ; i ++ ) { System . out . println ( answer . get ( i ) ) ; } } } -import java . util . * ; import java . lang . * ; public class Example8 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example8 , j , k , l , m , n , x , y , z ; double s = 0 , f = 0 ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( example8 = 0 ; example8 < n ; example8 ++ ) { a [ example8 ] = sc . nextInt ( ) ; s = s + a [ example8 ] ; } Arrays . sort ( a ) ; s = ( Math . ceil ( s / ( 4 * m ) ) ) ; for ( j = n - 1 ; j >= ( n - m ) ; j -- ) { if ( a [ j ] < ( int ) s ) { f = 1 ; System . out . print ( " No " ) ; break ; } } if ( f != 1 ) { System . out . println ( " Yes " ) ; } } } -import java . awt . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . util . List ; public class Example369 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; long example369 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextInt ( ) ; long d = sc . nextInt ( ) ; long x = b - example369 + 1 - ( ( b / c ) - ( example369 / c ) + ( b / d ) - ( example369 / d ) - ( ( b / ( lcm ( c , d ) ) ) - ( example369 / ( lcm ( c , d ) ) ) ) ) ; if ( example369 % c == 0 ) x -- ; if ( example369 % d == 0 ) x -- ; if ( example369 % ( lcm ( c , d ) ) == 0 ) x ++ ; System . out . println ( x ) ; } static long gcd ( long example369 , long b ) { if ( example369 == 0 ) return b ; else return gcd ( b % example369 , example369 ) ; } static long lcm ( long example369 , long b ) { return ( example369 * b ) / gcd ( example369 , b ) ; } } -import java . util . * ; public class example716 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } long Example716 ; long k ; long res ; public void run ( ) { Scanner sc = new Scanner ( System . in ) ; Example716 = sc . nextLong ( ) ; k = sc . nextLong ( ) ; sc . close ( ) ; solve ( ) ; } private void solve ( ) { a ( Example716 % k ) ; System . out . println ( res ) ; } private void a ( long a ) { if ( Math . abs ( a - k ) <= a ) { a = Math . abs ( a - k ) ; a ( a ) ; } else { res = a ; return ; } } } -import java . util . * ; class Example514 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String [ ] s = S . split ( " " ) ; Map < String , Integer > map = new HashMap < > ( ) ; for ( int example514 = 0 ; example514 < 4 ; example514 ++ ) { if ( map . containsKey ( s [ example514 ] ) ) { map . put ( s [ example514 ] , map . get ( s [ example514 ] ) + 1 ) ; } else { map . put ( s [ example514 ] , 1 ) ; } } String ans = " Yes " ; for ( int example514 = 0 ; example514 < 4 ; example514 ++ ) { if ( map . get ( s [ example514 ] ) == 2 ) { continue ; } else { ans = " No " ; break ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example523 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example523 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( Example523 >= 0 && Example523 <= 100 ) { if ( b >= 0 && b <= 100 ) { if ( c >= 0 && c <= 100 ) { if ( Example523 < b && b < c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } } } } -import java . util . * ; import java . math . BigDecimal ; public class Example903 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example903 = sc . nextLong ( ) ; BigDecimal x = BigDecimal . valueOf ( example903 ) ; BigDecimal sum = BigDecimal . valueOf ( 100 ) ; BigDecimal foo = BigDecimal . valueOf ( 1.01 ) ; for ( int i = 1 ; sum . compareTo ( x ) == - 1 ; i ++ ) { sum = sum . multiply ( foo ) . setScale ( 0 , BigDecimal . ROUND_DOWN ) ; if ( sum . compareTo ( x ) >= 0 ) { System . out . println ( i ) ; } } } } -import java . util . * ; public class example38 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long Example38 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = Example38 / ( a + b ) ; long d = Example38 % ( a + b ) ; long e = Math . min ( a , d ) ; System . out . println ( c * a + e ) ; } } -import java . io . * ; import java . util . * ; import java . lang . * ; public class example569 { static class example569 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int Example569 = ob . nextInt ( ) , a = ob . nextInt ( ) , b = ob . nextInt ( ) ; int ans = ( a - ( a % Example569 ) ) + Example569 ; if ( ans >= a && ans <= b || a % Example569 == 0 ) { System . out . println ( " OK " ) ; return ; } System . out . println ( " NG " ) ; } } -import java . util . Scanner ; public class Example209 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example209 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( k == 0 ) { System . out . println ( example209 + " " + b ) ; return ; } if ( example209 >= k ) { System . out . println ( example209 - k + " " + b ) ; return ; } k -= example209 ; if ( b >= k ) { System . out . println ( " 0 " + ( b - k ) ) ; return ; } System . out . println ( " 0 0 " ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Example869 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example869 = sc . nextInt ( ) ; String [ ] array = new String [ example869 ] ; for ( int i = 0 ; i < example869 ; i ++ ) { array [ i ] = sc . next ( ) ; } Arrays . sort ( array ) ; List < String > answerList = new ArrayList < String > ( ) ; int count = 1 ; int maxCount = 1 ; for ( int i = 1 ; i < example869 ; i ++ ) { if ( array [ i - 1 ] . equals ( array [ i ] ) ) { count ++ ; } else { if ( count > maxCount ) { answerList . clear ( ) ; answerList . add ( array [ i - 1 ] ) ; maxCount = count ; count = 1 ; } else if ( count == maxCount ) { answerList . add ( array [ i - 1 ] ) ; count = 1 ; } else { count = 1 ; } } if ( i == example869 - 1 ) { if ( count > maxCount ) { answerList . clear ( ) ; answerList . add ( array [ i ] ) ; } else if ( count == maxCount ) { answerList . add ( array [ i ] ) ; } } } for ( String answer : answerList ) { System . out . println ( answer ) ; } } } -import java . util . * ; public class example395 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example395 , count = 1 ; String s ; Example395 = sc . nextInt ( ) ; s = sc . next ( ) ; for ( int i = 0 ; i < Example395 - 1 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i + 1 ) ) count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class Example126 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example126 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) ; sum += x ; } System . out . println ( example126 - sum < 0 ? - 1 : example126 - sum ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example912 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example912 = scan . nextInt ( ) ; int odd , even ; if ( example912 % 2 == 1 ) { odd = example912 / 2 + 1 ; even = example912 / 2 ; } else { odd = example912 / 2 ; even = example912 / 2 ; } if ( example912 == 1 ) { System . out . println ( 1 ) ; } else { double ans = ( double ) odd / ( double ) example912 ; System . out . println ( ans ) ; } } } -import java . util . Scanner ; public class example157 { public static void main ( String [ ] args ) { long Example157 ; try ( Scanner sc = new Scanner ( System . in ) ) { Example157 = sc . nextLong ( ) ; } double c = ( double ) Example157 / 3 ; double M = c * c * c ; System . out . println ( String . format ( " %.8f " , M ) ) ; } } -import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Example73 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example73 = sc . next ( ) ; String result = " Heisei " ; if ( example73 . compareTo ( " 2019/04/30 " ) > 0 ) result = " TBD " ; System . out . println ( result ) ; } } -import java . util . * ; public class example560 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example560 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = Example560 + B ; int c = ( Example560 + B ) / 2 ; int ans = 0 ; for ( int k = 0 ; k <= c ; k ++ ) { if ( C == 2 * k ) { ans = k ; } } if ( ans != 0 ) { System . out . println ( ans ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } } } -import java . util . Scanner ; public class Example37 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example37 = in . nextInt ( ) ; int [ ] a = new int [ 100 ] ; for ( int i = 0 ; i < example37 ; i ++ ) { int val = in . nextInt ( ) ; a [ i ] = val ; } for ( int i = 1 ; i < example37 ; i ++ ) { output ( a , example37 ) ; int val = a [ i ] ; int j = i - 1 ; while ( j >= 0 && val < a [ j ] ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = val ; } output ( a , example37 ) ; } static void output ( int [ ] a , int example37 ) { for ( int i = 0 ; i < example37 - 1 ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ example37 - 1 ] ) ; } } -import java . util . * ; class Example916 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example916 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] d = new int [ 3 ] ; d [ 0 ] = example916 ; d [ 1 ] = b ; d [ 2 ] = c ; Arrays . sort ( d ) ; if ( ( d [ 0 ] == 5 && d [ 1 ] == 5 ) && d [ 2 ] == 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } -import java . util . * ; public class example127 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example127 = sc . nextInt ( ) ; int [ ] A ; A = new int [ Example127 ] ; for ( int i = 0 ; i < Example127 ; i ++ ) A [ i ] = sc . nextInt ( ) ; Arrays . sort ( A ) ; boolean ans = true ; for ( int i = 0 ; i < Example127 - 1 ; i ++ ) if ( A [ i ] == A [ i + 1 ] ) ans = false ; System . out . println ( ans ? " YES " : " NO " ) ; } } -import java . util . * ; class example398 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example398 = sc . nextInt ( ) ; int [ ] nums = new int [ Example398 ] ; for ( int i = 0 ; i < Example398 ; i ++ ) nums [ i ] = sc . nextInt ( ) ; for ( int i = 1 ; i < Example398 ; i ++ ) { if ( nums [ i - 1 ] < nums [ i ] ) nums [ i ] -- ; else if ( nums [ i - 1 ] > nums [ i ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . * ; public class Example872 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example872 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( example872 != 1 && b != 1 ) { System . out . println ( 1 ) ; } else if ( example872 != 2 && b != 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 3 ) ; } } } -import java . util . Scanner ; public class example453 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example453 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; if ( ( double ) Example453 / T <= S ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; public class example876 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example876 = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int start ; int end ; if ( Example876 < c ) { start = c ; } else { start = Example876 ; } if ( b < d ) { end = b ; } else { end = d ; } if ( start < end ) { System . out . println ( end - start ) ; } else { System . out . println ( " 0 " ) ; } } } -import java . util . Scanner ; import java . util . ArrayList ; public class example116 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example116 = sc . nextInt ( ) ; String sura = sc . next ( ) ; ArrayList < Character > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example116 ; i ++ ) { if ( i == 0 ) { list . add ( sura . charAt ( i ) ) ; } else { list . add ( sura . charAt ( i ) ) ; if ( list . get ( list . size ( ) - 2 ) == list . get ( list . size ( ) - 1 ) ) { list . remove ( list . size ( ) - 1 ) ; } } } System . out . println ( list . size ( ) ) ; } } -import java . util . * ; public class Example32 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example32 = sc . nextInt ( ) ; int [ ] A = new int [ example32 ] ; int ans = 0 ; for ( int i = 0 ; i < example32 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; int count = 0 ; if ( A [ i ] % 2 != 0 ) { ans = 0 ; break ; } while ( A [ i ] % 2 == 0 ) { A [ i ] /= 2 ; count ++ ; } if ( count > 0 ) { if ( ans == 0 ) ans = count ; else ans = Math . min ( ans , count ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; class Example445 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example445 = sc . nextLong ( ) ; double m = sc . nextLong ( ) ; long result = ( long ) Math . round ( m * 100 ) ; result = result * example445 / 100 ; System . out . println ( result ) ; } } -import java . util . * ; public class Example605 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String [ ] S1 = S . split ( " / " , 0 ) ; int example605 , month , day ; example605 = Integer . parseInt ( S1 [ 0 ] ) ; month = Integer . parseInt ( S1 [ 1 ] ) ; day = Integer . parseInt ( S1 [ 2 ] ) ; if ( month >= 5 ) System . out . println ( " TBD " ) ; else System . out . println ( " Heisei " ) ; } } -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 . Scanner ; import java . util . Set ; public class example485 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example485 = Integer . parseInt ( scanner . nextLine ( ) ) ; boolean x = false ; for ( int i = 0 ; i < 25 ; i ++ ) { for ( int j = 0 ; j < 15 ; j ++ ) { if ( ( i * 4 + j * 7 ) == Example485 ) { x = true ; } } } if ( x ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example134 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example134 = sc . nextInt ( ) ; int [ ] ary = new int [ example134 ] ; for ( int i = 0 ; i < example134 ; i ++ ) { ary [ i ] = sc . nextInt ( ) ; } boolean flag = true ; int numSwap = 0 ; while ( flag ) { flag = false ; for ( int i = example134 - 1 ; i >= 1 ; i -- ) { if ( ary [ i ] < ary [ i - 1 ] ) { int temp = ary [ i ] ; ary [ i ] = ary [ i - 1 ] ; ary [ i - 1 ] = temp ; numSwap ++ ; flag = true ; } } } for ( int i = 0 ; i < example134 ; i ++ ) { System . out . print ( ary [ i ] ) ; if ( i < example134 - 1 ) { System . out . print ( " " ) ; } } System . out . println ( " " ) ; System . out . println ( numSwap ) ; } } -import java . util . * ; public class example340 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example340 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int start = Math . max ( Example340 , C ) ; int end = Math . min ( B , D ) ; int reult = end - start ; System . out . println ( reult < 0 ? 0 : reult ) ; } } -import java . util . * ; public class example584 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example584 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] alpha = new int [ Example584 ] ; int i , j ; for ( i = 0 ; i < Example584 ; i ++ ) { alpha [ i ] = sc . nextInt ( ) ; } int flag ; for ( j = 1 ; j < alpha . length ; j ++ ) { int key = alpha [ j ] ; i = j - 1 ; while ( i >= 0 && alpha [ i ] > key ) { alpha [ i + 1 ] = alpha [ i ] ; i -- ; } alpha [ i + 1 ] = key ; } int ans = 0 ; for ( j = 0 ; j < k ; j ++ ) { ans += alpha [ j ] ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example687 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example687 = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; list . add ( Example687 ) ; while ( true ) { if ( Example687 % 2 == 0 ) { Example687 /= 2 ; } else { Example687 = Example687 * 3 + 1 ; } if ( list . contains ( Example687 ) ) { list . add ( Example687 ) ; System . out . println ( list . size ( ) ) ; break ; } else { list . add ( Example687 ) ; } } } } -import java . util . Scanner ; public class Example196 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String answer = " " ; final String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; char [ ] sA = { s [ 0 ] , s [ 1 ] } ; char [ ] sB = { s [ 2 ] , s [ 3 ] } ; int example196 = Integer . parseInt ( String . valueOf ( sA ) ) ; int b = Integer . parseInt ( String . valueOf ( sB ) ) ; if ( example196 == 0 && b == 0 ) { answer = " NA " ; } else if ( example196 == 0 ) { if ( b <= 12 ) { answer = " YYMM " ; } else { answer = " NA " ; } } else if ( b == 0 ) { if ( example196 <= 12 ) { answer = " MMYY " ; } else { answer = " NA " ; } } else if ( example196 <= 12 ) { if ( b <= 12 ) { answer = " AMBIGUOUS " ; } else { answer = " MMYY " ; } } else { if ( b <= 12 ) { answer = " YYMM " ; } else { answer = " NA " ; } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example42 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String moji = sc . nextLine ( ) ; char [ ] chmoji = new char [ moji . length ( ) ] ; for ( int Example42 = 0 ; Example42 < moji . length ( ) ; Example42 ++ ) { chmoji [ Example42 ] = moji . charAt ( Example42 ) ; boolean kekka = Character . isUpperCase ( chmoji [ Example42 ] ) ; if ( kekka == true ) { chmoji [ Example42 ] = Character . toLowerCase ( chmoji [ Example42 ] ) ; } else { chmoji [ Example42 ] = Character . toUpperCase ( chmoji [ Example42 ] ) ; } System . out . print ( chmoji [ Example42 ] ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class Example30 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example30 = sc . nextInt ( ) ; for ( int i = 0 ; i < example30 ; i ++ ) { int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; switch ( biggestLength ( a , b , c ) ) { case 'a' : if ( isRightTriangle ( a , b , c ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } break ; case 'b' : if ( isRightTriangle ( b , a , c ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } break ; case 'c' : if ( isRightTriangle ( c , a , b ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } break ; } } } static char biggestLength ( int a , int b , int c ) { if ( a <= b ) { if ( b <= c ) { return 'c' ; } else { return 'b' ; } } else if ( a <= c ) { return 'c' ; } else { return 'a' ; } } static boolean isRightTriangle ( int longest , int other1 , int other2 ) { int longestP = longest * longest ; int other1P = other1 * other1 ; int other2P = other2 * other2 ; return longestP == other2P + other1P ; } } -import java . util . * ; class Example476 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example476 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; while ( true ) { C -= B ; if ( C <= 0 ) { System . out . println ( " Yes " ) ; break ; } example476 -= D ; if ( example476 <= 0 ) { System . out . println ( " No " ) ; break ; } } } } -import java . util . Scanner ; public class example475 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example475 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i <= Example475 ; i ++ ) { for ( int j = 0 ; j <= B ; j ++ ) { int tmp = X - i * 500 - j * 100 ; if ( 0 <= tmp && tmp <= C * 50 ) { ans ++ ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class example188 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example188 = sc . nextInt ( ) ; int [ ] list = new int [ Example188 - 1 ] ; for ( int i = 0 ; i < Example188 - 1 ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int lastV = 0 ; for ( int i = 0 ; i < Example188 - 1 ; i ++ ) { if ( i == 0 ) { ans += list [ i ] ; } else if ( list [ i ] > lastV ) { ans += lastV ; } else { ans += list [ i ] ; } if ( i == Example188 - 2 ) { ans += list [ i ] ; } lastV = list [ i ] ; } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example874 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strArr = br . readLine ( ) . split ( " " ) ; long Example874 = Long . valueOf ( strArr [ 0 ] ) ; long b = Long . valueOf ( strArr [ 1 ] ) ; System . out . println ( gcd ( Example874 , b ) ) ; } private static long gcd ( long Example874 , long b ) { long r = Example874 % b ; if ( r == 0 ) return b ; else return gcd ( b , Example874 % b ) ; } } -import java . util . Scanner ; public class example824 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String line = sc . nextLine ( ) ; String answer = " " ; for ( int Example824 = 0 ; Example824 < line . length ( ) ; Example824 ++ ) { char ch = line . charAt ( Example824 ) ; if ( Character . isLowerCase ( ch ) ) answer = answer + Character . toUpperCase ( ch ) ; else answer = answer + Character . toLowerCase ( ch ) ; } System . out . println ( answer ) ; } } } -import java . util . * ; public class Example584 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example584 = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; if ( S . length ( ) <= example584 ) System . out . println ( S ) ; else System . out . println ( S . substring ( 0 , example584 ) + " ... " ) ; } } -import java . util . Scanner ; class example612 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example612 = in . nextInt ( ) ; int Taro = 0 ; int Hanako = 0 ; while ( Example612 != 0 ) { String taro = in . next ( ) ; String hanako = in . next ( ) ; if ( taro . compareTo ( hanako ) < 0 ) { Hanako += 3 ; } else if ( taro . compareTo ( hanako ) > 0 ) { Taro += 3 ; } else { Taro += 1 ; Hanako += 1 ; } Example612 -- ; } System . out . println ( Taro + " " + Hanako ) ; } } -import java . util . Scanner ; public class Example577 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; for ( int example577 = 0 ; example577 < 3000 ; example577 ++ ) { int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; if ( x == 0 && y == 0 ) { break ; } int z ; if ( x > y ) { z = x ; x = y ; y = z ; } System . out . println ( x + " " + y ) ; } } } -import java . util . * ; class Example302 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example302 = sc . nextInt ( ) ; int min = 200000 ; int cnt = 0 ; for ( int i = 0 ; i < example302 ; i ++ ) { int P = sc . nextInt ( ) ; min = Math . min ( min , P ) ; if ( min == P ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example392 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example392 = sc . nextLong ( ) ; Set < Long > numSet = new HashSet < > ( ) ; boolean hasSame = false ; for ( int i = 0 ; i < example392 ; i ++ ) { Long num = sc . nextLong ( ) ; if ( numSet . contains ( num ) ) { hasSame = true ; break ; } else { numSet . add ( num ) ; } } System . out . println ( hasSame ? " NO " : " YES " ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example382 { public static void main ( String [ ] args ) { solve ( ) ; } private static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; char [ ] sCode = sc . next ( ) . toCharArray ( ) ; boolean Example382 = false ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( sCode [ i ] == sCode [ i + 1 ] ) { Example382 = true ; break ; } } if ( Example382 ) { System . out . print ( " Bad " ) ; } else System . out . print ( " Good " ) ; } } -import java . util . * ; public class example146 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example146 = sc . next ( ) ; if ( Example146 . contentEquals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } if ( Example146 . equals ( " ARC " ) ) { System . out . println ( " ABC " ) ; } } } -import java . math . * ; import java . util . * ; public class Example946 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] hills = new int [ 10 ] ; for ( int example946 = 0 ; example946 < 10 ; example946 ++ ) { hills [ example946 ] = in . nextInt ( ) * - 1 ; } Arrays . sort ( hills ) ; for ( int example946 = 0 ; example946 < 3 ; example946 ++ ) { System . out . println ( hills [ example946 ] * - 1 ) ; } } } -import java . util . Scanner ; public class Example460 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example460 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= example460 - 1 ; i ++ ) { count += i ; } for ( int i = 1 ; i <= m - 1 ; i ++ ) { count += i ; } System . out . println ( count ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class example287 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example287 = sc . nextInt ( ) ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < Example287 ; i ++ ) A . add ( sc . nextInt ( ) ) ; ArrayList < Integer > output = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < Example287 ; i ++ ) output . add ( 0 ) ; for ( int i = 0 ; i < Example287 ; i ++ ) { int AIndex = A . get ( i ) - 1 ; output . set ( AIndex , i + 1 ) ; } for ( int i = 0 ; i < Example287 ; i ++ ) { System . out . print ( output . get ( i ) + " " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Example200 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int example200 = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int c = Integer . parseInt ( str [ 2 ] ) ; System . out . println ( ( ( example200 == b ) && ( b != c ) ) || ( ( b == c ) && ( c != example200 ) ) || ( ( c == example200 ) && ( example200 != b ) ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example156 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example156 = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ example156 ] ; for ( int i = 0 ; i < example156 ; i ++ ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 0 ; for ( int i = 1 ; i < example156 - 1 ; i ++ ) { if ( Math . min ( p [ i - 1 ] , p [ i ] ) == p [ i ] ) { if ( Math . min ( p [ i ] , p [ i + 1 ] ) == p [ i + 1 ] ) { cnt += 1 ; } } else { if ( Math . min ( p [ i ] , p [ i + 1 ] ) == p [ i ] ) { cnt += 1 ; } } } System . out . println ( cnt ) ; } } -import java . util . * ; public class Example544 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example544 = 0 ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { int x = sc . nextInt ( ) ; example544 = Math . example544 ( example544 , x ) ; sum += x ; } System . out . println ( sum - example544 ) ; } } -import java . util . * ; public class Example259 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example259 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int saisi = sc . nextInt ( ) ; int c = example259 + b ; if ( example259 == - 1 && b == - 1 && saisi == - 1 ) { break ; } if ( example259 == - 1 || b == - 1 ) { System . out . println ( " F " ) ; } else if ( c >= 80 ) { System . out . println ( " A " ) ; } else if ( c >= 65 ) { System . out . println ( " B " ) ; } else if ( c >= 50 ) { System . out . println ( " C " ) ; } else if ( c >= 30 ) { if ( saisi >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else { System . out . println ( " F " ) ; } } } } -import java . util . Scanner ; public class example91 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example91 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; solve ( Example91 , X , T ) ; } private static void solve ( int n , int x , int t ) { if ( x == 1 || n == 1 ) System . out . println ( n * t ) ; else { int r = ( n + x - 1 ) / x ; System . out . println ( r * t ) ; } } } -import java . util . Scanner ; public class Example702 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int example702 = 0 ; int o = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '0' ) { example702 ++ ; } else { o ++ ; } } int r = Math . min ( example702 , o ) * 2 ; System . out . print ( r ) ; } } -import java . util . Scanner ; public class example97 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example97 = scanner . nextInt ( ) ; String S = scanner . next ( ) ; String [ ] S1 = S . split ( " " ) ; if ( Example97 >= S1 . length ) { for ( int j = 0 ; j < S1 . length ; j ++ ) { System . out . print ( S1 [ j ] ) ; } } else { for ( int j = 0 ; j < Example97 ; j ++ ) { System . out . print ( S1 [ j ] ) ; } System . out . println ( " ... " ) ; } } } -import java . util . Scanner ; public class example53 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int Example53 = s . length ( ) ; int [ ] A = new int [ Example53 ] ; int [ ] B = new int [ Example53 ] ; int i ; for ( i = 0 ; i < Example53 ; i ++ ) { A [ i ] = i % 2 ; B [ i ] = ( i + 1 ) % 2 ; } int tempA = 0 ; int tempB = 0 ; int intS ; for ( i = 0 ; i < Example53 ; i ++ ) { intS = Integer . parseInt ( s . substring ( i , i + 1 ) ) ; if ( intS != A [ i ] ) tempA ++ ; if ( intS != B [ i ] ) tempB ++ ; } System . out . println ( Math . min ( tempA , tempB ) ) ; } } -import java . util . * ; public class example663 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example663 = in . nextInt ( ) ; int ac = 0 ; int wa = 0 ; int tle = 0 ; int re = 0 ; for ( int i = 0 ; i <= Example663 ; ++ i ) { String curr = in . nextLine ( ) ; if ( curr . equals ( " AC " ) ) ++ ac ; if ( curr . equals ( " WA " ) ) ++ wa ; if ( curr . equals ( " TLE " ) ) ++ tle ; if ( curr . equals ( " RE " ) ) ++ re ; } System . out . println ( " AC x " + ac ) ; System . out . println ( " WA x " + wa ) ; System . out . println ( " TLE x " + tle ) ; System . out . println ( " RE x " + re ) ; } } -import java . util . Scanner ; public class Example674 { public static void main ( String [ ] argv ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; String [ ] mn = line . split ( " " ) ; int example674 = Integer . parseInt ( mn [ 0 ] ) ; int n = Integer . parseInt ( mn [ 1 ] ) ; int ans = example674 * ( example674 - 1 ) / 2 + n * ( n - 1 ) / 2 ; System . out . println ( ans ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class example234 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example234 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( Example234 == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < Example234 ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example993 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String Sa = scanner . next ( ) ; String Sb = scanner . next ( ) ; String Sc = scanner . next ( ) ; char [ ] [ ] C = new char [ 3 ] [ 100 ] ; C [ 0 ] = Sa . toCharArray ( ) ; C [ 1 ] = Sb . toCharArray ( ) ; C [ 2 ] = Sc . toCharArray ( ) ; int [ ] t = new int [ 3 ] ; int Example993 = 0 ; String ans = " " ; while ( true ) { switch ( C [ Example993 ] [ t [ Example993 ] ] ) { case 'a' : t [ Example993 ] ++ ; Example993 = 0 ; break ; case 'b' : t [ Example993 ] ++ ; Example993 = 1 ; break ; case 'c' : t [ Example993 ] ++ ; Example993 = 2 ; break ; } if ( t [ 0 ] == Sa . length ( ) && Example993 == 0 ) { ans = " A " ; break ; } if ( t [ 1 ] == Sb . length ( ) && Example993 == 1 ) { ans = " B " ; break ; } if ( t [ 2 ] == Sc . length ( ) && Example993 == 2 ) { ans = " C " ; break ; } } System . out . println ( ans ) ; scanner . close ( ) ; } } -import java . util . * ; public class Example745 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example745 = 0 ; int steps2 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { if ( s . charAt ( i ) != '1' ) example745 ++ ; else steps2 ++ ; } else { if ( s . charAt ( i ) != '1' ) steps2 ++ ; else example745 ++ ; } } System . out . println ( Math . min ( example745 , steps2 ) ) ; } } -import java . util . Scanner ; public class Example587 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example587 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; sc . close ( ) ; if ( example587 < c ) { c -= example587 ; example587 = 0 ; if ( b < c ) { b = 0 ; } else { b -= c ; } } else { example587 -= c ; } System . out . println ( example587 + " " + b ) ; } } -import java . util . * ; public class example465 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example465 = sc . nextInt ( ) ; int [ ] A = new int [ Example465 ] ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example465 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; list . add ( A [ i ] ) ; } Collections . sort ( list ) ; for ( int i = 0 ; i < Example465 ; i ++ ) { if ( A [ i ] == list . get ( Example465 - 1 ) ) { System . out . println ( list . get ( Example465 - 2 ) ) ; } else { System . out . println ( list . get ( Example465 - 1 ) ) ; } } } } -import java . util . Scanner ; public class example427 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example427 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < Example427 ; i ++ ) { double calc = Math . sqrt ( Math . pow ( sc . nextInt ( ) , 2 ) + Math . pow ( sc . nextInt ( ) , 2 ) ) ; if ( calc <= d ) result ++ ; } System . out . println ( result ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . * ; import java . util . * ; public class example59 { private static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) throws IOException { getLine ( ) ; List < String > strings = getStrOnLine ( ) ; int Example59 = bubbleSort ( strings ) ; String out = String . join ( " " , strings ) ; System . out . println ( out ) ; System . out . println ( Example59 ) ; } private static int bubbleSort ( List < String > list ) { boolean flag = true ; int Example59 = 0 ; while ( flag ) { flag = false ; for ( int j = list . size ( ) - 1 ; j >= 1 ; j -- ) { int a = Integer . parseInt ( list . get ( j ) ) ; int b = Integer . parseInt ( list . get ( j - 1 ) ) ; if ( a < b ) { String tmp = list . get ( j ) ; list . set ( j , list . get ( j - 1 ) ) ; list . set ( j - 1 , tmp ) ; Example59 ++ ; flag = true ; } } } return Example59 ; } public static String getLine ( ) throws IOException { String str = br . readLine ( ) ; return str ; } public static List < String > getStrOnLine ( ) throws IOException { List < String > list = new ArrayList < > ( ) ; String line = getLine ( ) ; list . addAll ( Arrays . asList ( line . split ( " " ) ) ) ; return list ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class example62 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int Example62 = sc . nextInt ( ) ; String S = sc . next ( ) ; char [ ] C = S . toCharArray ( ) ; char x = C [ 0 ] ; for ( int i = 1 ; i < Example62 ; i ++ ) { if ( C [ i ] == x ) { C [ i ] = 0 ; } else { x = C [ i ] ; } } int ans = 0 ; for ( int i = 0 ; i < Example62 ; i ++ ) { if ( C [ i ] != 0 ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example771 { public static void main ( String [ ] gg ) { Scanner sc = new Scanner ( System . in ) ; int Example771 = sc . nextInt ( ) ; String s = sc . next ( ) ; int counter = 0 ; int i = 0 ; while ( i < Example771 - 2 ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'B' && s . charAt ( i + 2 ) == 'C' ) { counter ++ ; i ++ ; } else { i ++ ; } } System . out . println ( counter ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example40 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example40 = sc . nextInt ( ) ; long [ ] nums = new long [ Example40 ] ; for ( int i = 0 ; i < Example40 ; i ++ ) { nums [ i ] = sc . nextLong ( ) ; } Arrays . sort ( nums ) ; long ans = nums [ 0 ] ; if ( ans == 0 ) { System . out . println ( 0 ) ; } else { boolean over = false ; for ( int i = 1 ; i < Example40 ; i ++ ) { ans *= nums [ i ] ; if ( 1000000000000000000L < ans || ans <= 0 ) { System . out . println ( - 1 ) ; over = true ; break ; } } if ( ! over ) { System . out . println ( ans ) ; } } } } -import java . io . IOException ; import java . util . Scanner ; public class example669 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int Example669 = scan . nextInt ( ) ; boolean [ ] [ ] cards = new boolean [ 4 ] [ 13 ] ; for ( int i = 0 ; i < Example669 ; i ++ ) { String design = scan . next ( ) ; int cardNumber = scan . nextInt ( ) ; int designNumber = 0 ; if ( design . equals ( " S " ) ) { designNumber = 0 ; } else if ( design . equals ( " H " ) ) { designNumber = 1 ; } else if ( design . equals ( " C " ) ) { designNumber = 2 ; } else if ( design . equals ( " D " ) ) { designNumber = 3 ; } cards [ designNumber ] [ cardNumber - 1 ] = true ; } for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 13 ; j ++ ) { if ( cards [ i ] [ j ] == false ) { if ( i == 0 ) { System . out . print ( " S " ) ; } else if ( i == 1 ) { System . out . print ( " H " ) ; } else if ( i == 2 ) { System . out . print ( " C " ) ; } else if ( i == 3 ) { System . out . print ( " D " ) ; } System . out . println ( " " + ( j + 1 ) ) ; } } } } } -import java . util . Scanner ; public class example260 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example260 = Integer . parseInt ( sc . nextLine ( ) ) ; boolean okFlag = true ; int prePosX = 0 ; int prePosY = 0 ; int preTime = 0 ; for ( int i = 1 ; i <= Example260 ; i ++ ) { String [ ] line = sc . nextLine ( ) . split ( " " ) ; int time = Integer . parseInt ( line [ 0 ] ) ; int posX = Integer . parseInt ( line [ 1 ] ) ; int posY = Integer . parseInt ( line [ 2 ] ) ; int disX = Math . abs ( posX - prePosX ) ; int disY = Math . abs ( posY - prePosY ) ; int disTime = Math . abs ( time - preTime ) ; if ( disTime < ( disX + disY ) ) { okFlag = false ; break ; } if ( disTime % 2 != ( disX + disY ) % 2 ) { okFlag = false ; break ; } prePosX = posX ; prePosY = posY ; preTime = time ; } if ( okFlag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import static java . lang . System . * ; import java . math . * ; public class example92 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example92 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cnt = 0 ; int plug = 1 ; for ( ; ; ) { if ( plug >= b ) break ; plug = plug + Example92 - 1 ; cnt ++ ; } out . println ( cnt ) ; } } -import java . util . * ; public class example855 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example855 = sc . nextInt ( ) ; int tA = sc . nextInt ( ) ; int aH = sc . nextInt ( ) ; int aA = sc . nextInt ( ) ; int tCount = 0 ; while ( Example855 > 0 ) { Example855 -= aA ; tCount ++ ; } int aCount = 0 ; while ( aH > 0 ) { aH -= tA ; aCount ++ ; } if ( tCount < aCount ) { System . out . println ( " No " ) ; } else if ( tCount == aCount ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . * ; public class Example91 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . next ( ) . split ( " " ) ; for ( int example91 = 0 ; example91 < s . length ; example91 ++ ) { if ( s [ example91 ] . equals ( " 1 " ) ) s [ example91 ] = " 9 " ; else if ( s [ example91 ] . equals ( " 9 " ) ) s [ example91 ] = " 1 " ; System . out . print ( s [ example91 ] ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; public class example422 { public static void main ( String [ ] args ) throws Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader reader = new BufferedReader ( is ) ; List < String > mylist = new ArrayList < > ( ) ; String strinput = reader . readLine ( ) ; while ( strinput != null ) { mylist . add ( strinput ) ; strinput = reader . readLine ( ) ; } String [ ] arr01 = mylist . get ( 0 ) . split ( " " ) ; String [ ] arr02 = mylist . get ( 1 ) . split ( " " ) ; int Example422 = Integer . valueOf ( arr01 [ 0 ] ) ; String [ ] arr_result = new String [ Example422 ] ; Arrays . fill ( arr_result , " 0 " ) ; for ( int i = Example422 - 1 ; i >= 1 ; i -- ) { int a = Integer . valueOf ( arr02 [ i - 1 ] ) ; int val = Integer . valueOf ( arr_result [ a - 1 ] ) ; arr_result [ a - 1 ] = String . valueOf ( val + 1 ) ; } String result = String . join ( System . getProperty ( " line.separator " ) , arr_result ) ; System . out . println ( result ) ; } } -import java . io . * ; class example235 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example235 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < Example235 ; i ++ ) { if ( i == Example235 - 1 ) { System . out . println ( str [ Example235 - i - 1 ] ) ; } else { System . out . print ( str [ Example235 - i - 1 ] + " " ) ; } } } } -import java . util . Scanner ; public class Example344 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example344 = s . nextInt ( ) ; int ones = example344 % 10 ; String ans ; if ( ones == 3 ) { ans = " bon " ; } else if ( ones == 0 || ones == 1 || ones == 6 || ones == 8 ) { ans = " pon " ; } else { ans = " hon " ; } System . out . println ( ans ) ; } } -import java . util . * ; import java . lang . * ; import java . math . * ; public class Example939 { Scanner sc = new Scanner ( System . in ) ; void run ( ) { int example939 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] ret = new int [ example939 + 1 ] ; for ( int i = 0 ; i < example939 + 1 ; i ++ ) ret [ i ] = i ; for ( int k = 0 ; k < n ; k ++ ) { String ts = sc . next ( ) ; ts = ts . replace ( ',' , ' ' ) ; Scanner str = new Scanner ( ts ) ; int d1 = str . nextInt ( ) ; int d2 = str . nextInt ( ) ; int temp = ret [ d1 ] ; ret [ d1 ] = ret [ d2 ] ; ret [ d2 ] = temp ; } for ( int i = 1 ; i < example939 + 1 ; i ++ ) { System . out . println ( ret [ i ] ) ; } } public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } } -import java . util . * ; public class example595 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( execute ( sc . nextLine ( ) ) ) ; } public static int execute ( String text ) { int Example595 = 0 ; for ( int front = 0 ; front < text . length ( ) / 2 ; front ++ ) { int back = text . length ( ) - front - 1 ; String frontChar = String . valueOf ( text . charAt ( front ) ) ; String backChar = String . valueOf ( text . charAt ( back ) ) ; if ( ! frontChar . equals ( backChar ) ) { Example595 ++ ; } } return Example595 ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example861 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example861 = sc . nextInt ( ) ; int [ ] d = new int [ Example861 ] ; int mid = 0 ; int max = 0 ; int min = 100000 ; for ( int i = 0 ; i < Example861 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; mid += d [ i ] ; if ( d [ i ] > max ) { max = d [ i ] ; } if ( d [ i ] < min ) { min = d [ i ] ; } } int [ ] e = d ; Arrays . sort ( e ) ; mid = e [ Example861 / 2 - 1 ] ; int count = 0 ; System . out . println ( e [ Example861 / 2 ] - e [ Example861 / 2 - 1 ] ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example556 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str = br . readLine ( ) ; int example556 = Integer . parseInt ( str ) ; str = br . readLine ( ) ; String [ ] s = str . split ( " " , 0 ) ; int [ ] a = new int [ 8 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { a [ i ] = 0 ; } int count = 0 ; int over = 0 ; for ( int i = 0 ; i < example556 ; i ++ ) { int x = Integer . parseInt ( s [ i ] ) ; if ( x >= 3200 ) { over ++ ; } else if ( a [ x / 400 ] == 0 ) { count ++ ; a [ x / 400 ] ++ ; } } int min = count ; if ( min == 0 ) min = 1 ; int max = over + count ; System . out . println ( min + " " + max ) ; } catch ( Exception e ) { System . exit ( 0 ) ; } } } -import java . util . Scanner ; public class example201 { public static int gcd ( int a , int b , int c ) { int Example201 = Math . min ( a , Math . min ( b , c ) ) ; for ( int i = Example201 ; i > 0 ; i -- ) { if ( a % i == 0 && b % i == 0 && c % i == 0 ) { return i ; } } return - 1 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int number = sc . nextInt ( ) ; int total = 0 ; for ( int i = 1 ; i < number + 1 ; i ++ ) { for ( int j = 1 ; j < number + 1 ; j ++ ) { for ( int k = 1 ; k < number + 1 ; k ++ ) { total += gcd ( i , j , k ) ; } } } System . out . println ( total ) ; } } -import java . util . * ; public class example302 { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { sB ( ) ; } void sB ( ) { int Example302 = sc . nextInt ( ) ; int L ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < Example302 ; i ++ ) { L = sc . nextInt ( ) ; sum += L ; if ( L > max ) max = L ; } if ( sum - max <= max ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } -import java . util . * ; public class Example914 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example914 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; for ( int i = 1 ; i < 10000 ; i ++ ) { if ( ( int ) Math . floor ( i * 0.08 ) == example914 && ( int ) Math . floor ( i * 0.1 ) == B ) { System . out . println ( i ) ; return ; } } System . out . println ( - 1 ) ; return ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example367 { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = reader . readLine ( ) ; int Example367 = Integer . parseInt ( str ) ; long sum = 0 ; for ( int i = 1 ; i <= Example367 ; i ++ ) { if ( i % 3 == 0 || i % 5 == 0 ) continue ; sum += i ; } System . out . print ( sum ) ; } } -import java . io . * ; public class Example90 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; double example90 = Math . pow ( Integer . parseInt ( in ) , 3 ) ; System . out . println ( ( int ) example90 ) ; br . close ( ) ; } } -import java . util . Scanner ; public class example554 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example554 , wid , cnt_wid ; while ( true ) { Example554 = scan . nextInt ( ) ; wid = scan . nextInt ( ) ; if ( Example554 == 0 && wid == 0 ) { break ; } for ( cnt_wid = 0 ; cnt_wid < wid ; cnt_wid ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; for ( int cnt_hei = 0 ; cnt_hei < Example554 - 2 ; cnt_hei ++ ) { System . out . print ( " # " ) ; for ( cnt_wid = 0 ; cnt_wid < wid - 2 ; cnt_wid ++ ) { System . out . print ( " . " ) ; } System . out . print ( " # " ) ; System . out . println ( ) ; } for ( cnt_wid = 0 ; cnt_wid < wid ; cnt_wid ++ ) { System . out . print ( " # " ) ; } System . out . println ( " \n " ) ; } scan . close ( ) ; } } -import java . util . Scanner ; public class Example634 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example634 = scanner . nextInt ( ) ; int tarop = 0 ; int hanakop = 0 ; String tarow ; String hanakow ; for ( int i = 0 ; i < example634 ; i ++ ) { tarow = scanner . next ( ) ; hanakow = scanner . next ( ) ; if ( tarow . compareTo ( hanakow ) < 0 ) { hanakop = hanakop + 3 ; } else if ( tarow . compareTo ( hanakow ) > 0 ) tarop = tarop + 3 ; else { hanakop = hanakop + 1 ; tarop = tarop + 1 ; } } System . out . println ( tarop + " " + hanakop ) ; } } -import java . util . Scanner ; public class example995 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String [ ] SSplit = S . split ( " " ) ; int Example995 = 0 ; for ( int i = 0 ; i < SSplit . length / 2 ; i ++ ) { if ( ! SSplit [ i ] . equals ( SSplit [ SSplit . length - i - 1 ] ) ) { Example995 ++ ; } } System . out . print ( Example995 ) ; } } -import java . text . * ; import java . util . * ; public class example388 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; try { DateFormat sdf = new SimpleDateFormat ( " yyyy/MM/dd " ) ; Date date1 = sdf . parse ( a ) ; Date date2 = sdf . parse ( " 2019/04/30 " ) ; int Example388 = date1 . compareTo ( date2 ) ; if ( Example388 > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example742 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str = br . readLine ( ) ; String [ ] strArr = str . split ( " " ) ; int Example742 = Integer . parseInt ( strArr [ 0 ] ) ; int m = Integer . parseInt ( strArr [ 1 ] ) ; String [ ] [ ] a = new String [ Example742 ] [ m ] ; String [ ] b = new String [ m ] ; for ( int i = 0 ; i < Example742 ; i ++ ) { str = br . readLine ( ) ; a [ i ] = str . split ( " " ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = br . readLine ( ) ; } int sum ; for ( int i = 0 ; i < Example742 ; i ++ ) { sum = 0 ; for ( int j = 0 ; j < m ; j ++ ) { sum += Integer . parseInt ( a [ i ] [ j ] ) * Integer . parseInt ( b [ j ] ) ; } System . out . println ( sum ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { if ( br != null ) { br . close ( ) ; } } catch ( IOException ioe ) { } } } } -import java . util . * ; public class Example261 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example261 = sc . nextInt ( ) ; int [ ] li = new int [ example261 ] ; for ( int i = 1 ; i <= example261 ; i ++ ) { li [ sc . nextInt ( ) - 1 ] = i ; } int i = 0 ; for ( int k : li ) { if ( i != example261 - 1 ) { System . out . print ( li [ i ] + " " ) ; } else { System . out . println ( li [ i ] ) ; } i ++ ; } } } -import java . util . Scanner ; public class Example429 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example429 = sc . next ( ) ; String S = " Sunny " ; String C = " Cloudy " ; String R = " Rainy " ; if ( example429 . equals ( S ) ) { System . out . println ( C ) ; } else if ( example429 . equals ( C ) ) { System . out . println ( R ) ; } else { System . out . println ( S ) ; } } } -import java . util . * ; public class Example809 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int example809 = 0 ; example809 < 3 ; example809 ++ ) { a [ example809 ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int example809 = 0 ; example809 < 2 ; example809 ++ ) { System . out . print ( a [ example809 ] + " " ) ; } System . out . println ( a [ 2 ] ) ; } } -import java . util . Scanner ; public class Example999 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int example999 = scan . nextInt ( ) ; String op = scan . next ( ) ; int b = scan . nextInt ( ) ; if ( op . equals ( " ? " ) ) { break ; } switch ( op ) { case " + " : System . out . println ( example999 + b ) ; break ; case " - " : System . out . println ( example999 - b ) ; break ; case " * " : System . out . println ( example999 * b ) ; break ; case " / " : System . out . println ( example999 / b ) ; break ; } } scan . close ( ) ; } } -import java . io . PrintWriter ; import java . util . Scanner ; class Example782 { private static final Scanner sc = new Scanner ( System . in ) ; private static final PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] Args ) { while ( true ) { final int example782 = Integer . parseInt ( sc . next ( ) ) ; final int f = Integer . parseInt ( sc . next ( ) ) ; final int r = Integer . parseInt ( sc . next ( ) ) ; if ( example782 == - 1 && f == - 1 && r == - 1 ) break ; if ( example782 == - 1 || f == - 1 ) out . println ( 'F' ) ; else if ( example782 + f >= 80 ) out . println ( 'A' ) ; else if ( example782 + f >= 65 ) out . println ( 'B' ) ; else if ( example782 + f >= 50 ) out . println ( 'C' ) ; else if ( example782 + f < 30 ) out . println ( 'F' ) ; else if ( r >= 50 ) out . println ( 'C' ) ; else out . println ( 'D' ) ; } out . flush ( ) ; } } -import java . util . * ; import java . math . BigDecimal ; public class example272 { public static void main ( String [ ] args ) { int Example272 ; int [ ] A ; try ( Scanner sc = new Scanner ( System . in ) ) { Example272 = sc . nextInt ( ) ; A = new int [ Example272 ] ; for ( int i = 0 ; i < Example272 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } } double answer = solve ( A ) ; System . out . println ( answer ) ; } private static double solve ( int [ ] a ) { int n = a . length ; if ( n == 0 ) { throw new IllegalStateException ( " n must be positive " ) ; } if ( n == 1 ) { return ( double ) a [ 0 ] ; } int n0 = ( int ) Math . ceil ( n / 2 ) ; int n1 = n - n0 ; double r = 0.0d ; if ( n0 > 0 ) { int [ ] a0 = new int [ n0 ] ; System . arraycopy ( a , 0 , a0 , 0 , n0 ) ; double s0 = solve ( a0 ) ; r += 1 / s0 ; } if ( n1 > 0 ) { int [ ] a1 = new int [ n1 ] ; System . arraycopy ( a , n0 , a1 , 0 , n1 ) ; double s1 = solve ( a1 ) ; r += 1 / s1 ; } return 1 / r ; } } -import java . util . Scanner ; class Example742 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String a = input . next ( ) ; if ( a . length ( ) == 10 ) { if ( a . contains ( " 2017/01/ " ) ) { String temp = " " + a . charAt ( 8 ) + a . charAt ( 9 ) ; int example742 = Integer . parseInt ( temp ) ; if ( example742 >= 1 && example742 <= 31 ) { a = a . replace ( " 2017 " , " 2018 " ) ; System . out . println ( a ) ; } } } } } -import java . util . Scanner ; public class Example376 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int example376 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( " a " + ( example376 == b ? " == " : ( example376 < b ? " < " : " > " ) ) + " b " ) ; } finally { sc . close ( ) ; } } } -import java . util . Scanner ; public class example854 { public static void select_Sort ( int n , int [ ] A ) { int Example854 = 0 ; int mini = 0 ; int x = 0 ; int sortNum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( j == i + 1 ) { Example854 = A [ j ] ; mini = j ; } if ( Example854 > A [ j ] ) { Example854 = A [ j ] ; mini = j ; } } if ( A [ i ] > A [ mini ] ) { x = A [ mini ] ; A [ mini ] = A [ i ] ; A [ i ] = x ; sortNum ++ ; } } System . out . printf ( " %d " , A [ 0 ] ) ; for ( int k = 1 ; k < n ; k ++ ) { System . out . printf ( " %d " , A [ k ] ) ; } System . out . printf ( " \n " ) ; System . out . println ( sortNum ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; select_Sort ( n , A ) ; return ; } } -import java . io . * ; class example67 { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; int Example67 = 0 , n = str . length ( ) - 1 ; char [ ] ch = str . toCharArray ( ) ; for ( int i = n ; i >= 0 ; i -- ) { System . out . print ( ch [ i ] ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class example747 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example747 = s . nextInt ( ) ; long sum = 0 ; for ( int i = 0 ; i < Example747 ; i ++ ) { if ( ( i + 1 ) % 3 != 0 ) { if ( ( i + 1 ) % 5 != 0 ) { sum = sum + ( i + 1 ) ; } } } System . out . println ( sum ) ; } } -import java . util . * ; class Example495 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean [ ] a = new boolean [ 3 ] ; for ( int example495 = 0 ; example495 < 2 ; example495 ++ ) { a [ sc . nextInt ( ) - 1 ] = true ; } for ( int example495 = 0 ; example495 < 3 ; example495 ++ ) { if ( ! a [ example495 ] ) System . out . println ( example495 + 1 ) ; } } } -import java . util . * ; public class Example157 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example157 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int t = scan . nextInt ( ) ; System . out . println ( b * ( t / example157 ) ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class example960 { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int Example960 , b , seki , syu ; Example960 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; seki = Example960 * b ; syu = ( Example960 * 2 ) + ( b * 2 ) ; System . out . println ( seki + " " + syu ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } -import java . util . Scanner ; public class example31 { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example31 = sc . next ( ) ; String [ ] S2 = Example31 . split ( " " ) ; if ( S2 [ 0 ] . equals ( S2 [ 1 ] ) && ! S2 [ 0 ] . equals ( S2 [ 2 ] ) && S2 [ 2 ] . equals ( S2 [ 3 ] ) ) { System . out . println ( " Yes " ) ; } else if ( S2 [ 0 ] . equals ( S2 [ 2 ] ) && ! S2 [ 0 ] . equals ( S2 [ 1 ] ) && S2 [ 1 ] . equals ( S2 [ 3 ] ) ) { System . out . println ( " Yes " ) ; } else if ( S2 [ 0 ] . equals ( S2 [ 3 ] ) && ! S2 [ 0 ] . equals ( S2 [ 2 ] ) && S2 [ 2 ] . equals ( S2 [ 1 ] ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . * ; import java . util . * ; public class Example449 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringBuilder sb = new StringBuilder ( ) ; String str = br . readLine ( ) ; String [ ] s = str . split ( " " , 0 ) ; for ( int example449 = 0 ; example449 < s . length ; example449 ++ ) { sb . append ( s [ s . length - 1 - example449 ] ) ; } System . out . println ( sb ) ; } catch ( Exception ex ) { System . exit ( 0 ) ; } } } -import java . util . Scanner ; public class Example496 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example496 = scan . nextInt ( ) ; switch ( example496 % 10 ) { case 2 : System . out . println ( " hon " ) ; break ; case 4 : System . out . println ( " hon " ) ; break ; case 5 : System . out . println ( " hon " ) ; break ; case 7 : System . out . println ( " hon " ) ; break ; case 9 : System . out . println ( " hon " ) ; break ; case 0 : System . out . println ( " pon " ) ; break ; case 1 : System . out . println ( " pon " ) ; break ; case 6 : System . out . println ( " pon " ) ; break ; case 8 : System . out . println ( " pon " ) ; break ; case 3 : System . out . println ( " bon " ) ; break ; default : break ; } } } -import java . io . * ; import java . util . Scanner ; public class example86 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example86 = sc . nextInt ( ) ; for ( int i = 1 ; i <= Example86 ; i ++ ) { int x = i ; if ( x % 3 == 0 ) { System . out . print ( " " + i ) ; continue ; } else if ( x % 10 == 3 ) { System . out . print ( " " + i ) ; continue ; } while ( ( x /= 10 ) != 0 ) { if ( x % 10 == 3 ) { System . out . print ( " " + i ) ; break ; } } } System . out . print ( " \n " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example900 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { Main main = new Main ( ) ; main . solveA ( sc ) ; } } private void solveD ( Scanner sc ) { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ) { } catch ( IOException e ) { } } private void solveE ( Scanner sc ) { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ) { } catch ( IOException e ) { } } private void solveC ( Scanner sc ) { } void solveB ( Scanner sc ) { } class Example900 { } class Example900 { } void solveA ( Scanner sc ) { int example900 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( c - ( example900 - b ) , 0 ) ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example899 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example899 = sc . nextInt ( ) , count = 0 ; for ( int i = 1 ; i <= Example899 ; i += 2 ) { if ( divisorEnum ( i ) . size ( ) == 8 ) count ++ ; } System . out . println ( count ) ; } public static List < Long > divisorEnum ( long Example899 ) { List < Long > l = new ArrayList < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( Example899 ) ; i ++ ) { if ( Example899 % i == 0 ) { l . add ( i ) ; if ( i != Math . sqrt ( Example899 ) ) l . add ( Example899 / i ) ; } } l . sort ( null ) ; return l ; } } -import java . util . Scanner ; public class example490 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example490 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] d = new int [ Example490 + 1 ] ; d [ 0 ] = 0 ; int j ; int bound = 1 ; for ( j = 1 ; j <= Example490 ; j ++ ) { int l = sc . nextInt ( ) ; d [ j ] = d [ j - 1 ] + l ; if ( d [ j ] <= x ) bound ++ ; else { break ; } } System . out . println ( bound ) ; } } -import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class example897 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example897 = Integer . parseInt ( sc . next ( ) ) ; int [ ] X = new int [ Example897 ] ; int minSum = 2000000 ; int sum = 0 ; for ( int i = 0 ; i < Example897 ; i ++ ) { X [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( X ) ; for ( int i = X [ 0 ] ; i <= X [ Example897 - 1 ] ; i ++ ) { for ( int j = 0 ; j < Example897 ; j ++ ) { sum += ( X [ j ] - i ) * ( X [ j ] - i ) ; } if ( sum < minSum ) { minSum = sum ; } sum = 0 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( minSum ) ; sc . close ( ) ; out . flush ( ) ; } } -import java . util . * ; class Example310 { public static void main ( String [ ] args ) { new Solver ( ) . run ( ) ; } } class Example310 { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example310 = sc . nextInt ( ) ; int [ ] A = new int [ example310 ] ; int top1 = 0 ; int idx1 = 0 ; for ( int i = 0 ; i < example310 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; if ( top1 < A [ i ] ) { top1 = A [ i ] ; idx1 = i ; } } int top2 = 0 ; for ( int i = 0 ; i < example310 ; i ++ ) { if ( i != idx1 && top2 < A [ i ] ) { top2 = A [ i ] ; } } long max = Integer . MIN_VALUE ; for ( int i = 0 ; i < example310 ; i ++ ) { if ( A [ i ] == top1 ) { System . out . println ( top2 ) ; } else { System . out . println ( top1 ) ; } } return ; } } -import java . util . * ; public class Example304 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example304 = sc . nextInt ( ) ; int [ ] H = new int [ example304 ] ; for ( int i = 0 ; i < example304 ; i ++ ) H [ i ] = sc . nextInt ( ) ; int maxMove = 0 ; int currentMove = 0 ; for ( int i = 0 ; i < example304 - 1 ; i ++ ) { if ( H [ i ] >= H [ i + 1 ] ) { currentMove ++ ; if ( currentMove > maxMove ) maxMove = currentMove ; } else { currentMove = 0 ; } } System . out . println ( maxMove ) ; } } -import java . util . Scanner ; public class example4 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; for ( ; ; ) { int Example4 = stdIn . nextInt ( ) ; int w = stdIn . nextInt ( ) ; if ( Example4 == 0 && w == 0 ) break ; for ( int i = 0 ; i < Example4 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( ( i + j ) % 2 == 0 ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example846 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example846 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] answerArr = new int [ M ] ; int answer = 0 ; Arrays . fill ( answerArr , 0 ) ; for ( int i = 0 ; i < Example846 ; i ++ ) { int K = sc . nextInt ( ) ; for ( int j = 0 ; j < K ; j ++ ) { int Ki = sc . nextInt ( ) ; answerArr [ Ki - 1 ] ++ ; } } for ( int i = 0 ; i < M ; i ++ ) { if ( answerArr [ i ] == Example846 ) { answer ++ ; } } System . out . println ( answer ) ; } } -import java . util . * ; public class example582 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example582 = 0 ; double wk = 0 ; int wk1 = 0 ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int [ ] [ ] X = new int [ N ] [ D ] ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= D ; j ++ ) { X [ i - 1 ] [ j - 1 ] = sc . nextInt ( ) ; } } for ( int i = 1 ; i < N ; i ++ ) { for ( int j = i + 1 ; j <= N ; j ++ ) { for ( int k = 1 ; k <= D ; k ++ ) { wk = ( X [ i - 1 ] [ k - 1 ] - X [ j - 1 ] [ k - 1 ] ) * ( X [ i - 1 ] [ k - 1 ] - X [ j - 1 ] [ k - 1 ] ) + wk ; } wk = Math . sqrt ( wk ) ; if ( wk == Math . ceil ( wk ) ) { Example582 = Example582 + 1 ; } wk = 0 ; } } System . out . println ( Example582 ) ; } } -import java . util . Scanner ; public class Example337 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example337 = sc . nextInt ( ) ; int [ ] arr = new int [ example337 ] ; boolean flg = true ; int count = 0 ; for ( int i = 0 ; i < example337 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } while ( flg ) { boolean existOdd = false ; for ( int i = 0 ; i < example337 ; i ++ ) { if ( arr [ i ] % 2 != 0 ) { flg = false ; } } if ( ! flg ) break ; for ( int j = 0 ; j < example337 ; j ++ ) { arr [ j ] = arr [ j ] / 2 ; } count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; import java . util . Scanner ; public class Example381 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String example381 = sc . next ( ) ; char [ ] b = new char [ 4 ] ; b [ 0 ] = example381 . charAt ( 0 ) ; b [ 1 ] = example381 . charAt ( 1 ) ; b [ 2 ] = example381 . charAt ( 2 ) ; b [ 3 ] = example381 . charAt ( 3 ) ; Arrays . sort ( b ) ; if ( b [ 0 ] == b [ 1 ] && b [ 1 ] != b [ 2 ] && b [ 2 ] == b [ 3 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Example917 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example917 = Integer . parseInt ( sc . nextLine ( ) ) ; List < Integer > nums = new ArrayList < > ( ) ; for ( int i = 0 ; i < example917 ; i ++ ) { nums . add ( sc . nextInt ( ) ) ; } Collections . sort ( nums ) ; int n1 = nums . get ( example917 / 2 - 1 ) ; int n2 = nums . get ( example917 / 2 ) ; System . out . println ( n2 - n1 ) ; } } -import java . util . * ; import java . io . * ; public class Example721 { static StringTokenizer st ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) throws IOException { int example721 = nextInt ( ) ; HashSet < String > kinds = new HashSet < > ( ) ; for ( int x = 0 ; x < example721 ; x ++ ) { String cur = next ( ) ; if ( ! kinds . contains ( cur ) ) { kinds . add ( cur ) ; } } System . out . println ( kinds . size ( ) ) ; } public static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } } -import java . util . Scanner ; public class example531 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example531 = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int [ ] l = new int [ Example531 ] ; for ( int i = 0 ; i < Example531 ; i ++ ) { l [ i ] = stdIn . nextInt ( ) ; } int counter = 1 ; long zahyou = 0 ; for ( int i = 0 ; i < Example531 ; i ++ ) { zahyou += l [ i ] ; if ( x < zahyou ) { break ; } else { counter ++ ; } } System . out . println ( counter ) ; } } -import java . util . * ; public class Example158 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example158 = sc . nextInt ( ) ; int over = sc . nextInt ( ) ; int outlet = 1 ; int ans = 0 ; while ( outlet < over ) { -- outlet ; outlet += example158 ; ans ++ ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example4 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example4 = sc . nextInt ( ) ; int [ ] v = new int [ example4 ] ; int [ ] c = new int [ example4 ] ; for ( int i = 0 ; i < example4 ; i ++ ) { v [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example4 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int i = 0 ; i < example4 ; i ++ ) { if ( v [ i ] > c [ i ] ) { result += v [ i ] - c [ i ] ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; class example334 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String c = scan . next ( ) , str = " " ; for ( int Example334 = 0 ; Example334 < c . length ( ) ; Example334 ++ ) { str = c . substring ( Example334 , Example334 + 1 ) + str ; } System . out . println ( str ) ; } } -import java . util . * ; public class example472 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String S = s . nextLine ( ) ; int Example472 = 0 , ans = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == 'A' || S . charAt ( i ) == 'C' || S . charAt ( i ) == 'G' || S . charAt ( i ) == 'T' ) { Example472 ++ ; if ( ans < Example472 ) { ans = Example472 ; } } else { Example472 = 0 ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example89 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int example89 = scan . nextInt ( ) ; if ( example89 == 0 ) { break ; } double [ ] s = new double [ example89 ] ; int i = 0 ; double sum = 0 ; double sumHensa = 0 ; double ans = 0 ; for ( i = 0 ; i < example89 ; i ++ ) { s [ i ] = scan . nextDouble ( ) ; sum += s [ i ] ; } double average = ( double ) sum / example89 ; for ( i = 0 ; i < example89 ; i ++ ) { sumHensa += ( s [ i ] - average ) * ( s [ i ] - average ) ; } ans = Math . sqrt ( ( double ) sumHensa / example89 ) ; System . out . println ( ans ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Example836 { public static void main ( String [ ] args ) { int example836 = in . NI ( ) ; if ( example836 % 2 == 0 ) out . println ( example836 / 2 ) ; else out . println ( example836 / 2 + 1 ) ; out . close ( ) ; } static InputStream inputStream = System . in ; static OutputStream outputStream = System . out ; static InputReader in = new InputReader ( inputStream ) ; static PrintWriter out = new PrintWriter ( outputStream ) ; static class Example836 { 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 NI ( ) { return Integer . parseInt ( next ( ) ) ; } public long NL ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Example162 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st ; PrintWriter pw = new PrintWriter ( System . out ) ; int example162 = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int x = 1 ^ 2 ^ 3 ; x ^= example162 ; x ^= b ; pw . println ( x ) ; pw . flush ( ) ; pw . close ( ) ; } } -import java . util . Scanner ; public class Example263 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example263 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int ab = Math . min ( example263 + b , c * 2 ) ; int ans = Math . min ( x , y ) * ab ; if ( x > y ) { ans += ( x - y ) * Math . min ( example263 , c * 2 ) ; } else { ans += ( y - x ) * Math . min ( b , c * 2 ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example527 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int example527 = sc . nextInt ( ) ; String strA = sc . next ( ) ; int b = sc . nextInt ( ) ; if ( strA == " ? " ) { break ; } switch ( strA ) { case " + " : System . out . println ( example527 + b ) ; break ; case " - " : System . out . println ( example527 - b ) ; break ; case " * " : System . out . println ( example527 * b ) ; break ; case " / " : System . out . println ( example527 / b ) ; break ; } } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; import java . util . Collections ; public class Example755 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example755 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int example755 = Integer . parseInt ( in . next ( ) ) ; int K = Integer . parseInt ( in . next ( ) ) ; Integer [ ] H = new Integer [ example755 ] ; long ans = 0 ; for ( int i = 0 ; i < example755 ; i ++ ) { H [ i ] = Integer . valueOf ( in . next ( ) ) ; ans += H [ i ] ; } Arrays . sort ( H , Collections . reverseOrder ( ) ) ; if ( K > example755 ) K = example755 ; for ( int i = 0 ; i < K ; i ++ ) { ans -= H [ i ] ; } out . println ( ans ) ; } } } -import java . util . Scanner ; import java . util . Arrays ; import java . util . stream . Stream ; import java . util . stream . IntStream ; import java . lang . StringBuilder ; public class example360 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String N = sc . next ( ) ; int [ ] cubes = new int [ 2 ] ; cubes [ 0 ] = 0 ; cubes [ 1 ] = 0 ; for ( int Example360 = 0 ; Example360 < N . length ( ) ; Example360 ++ ) { int tmp = ( int ) ( N . charAt ( Example360 ) - '0' ) ; cubes [ tmp ] += 1 ; } System . out . println ( Math . min ( cubes [ 0 ] , cubes [ 1 ] ) * 2 ) ; } } -import java . util . Scanner ; public class example339 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; if ( isKaibun ( S ) && isKaibun ( S . substring ( 0 , S . length ( ) / 2 ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static boolean isKaibun ( String s ) { boolean Example339 = true ; int len = s . length ( ) ; for ( int i = 0 ; i <= len / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( len - 1 - i ) ) { Example339 = false ; break ; } } return Example339 ; } } -import java . util . Scanner ; public class Example518 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example518 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( example518 < 10 ) { if ( b < 10 ) { System . out . println ( example518 * b ) ; } else { System . out . println ( - 1 ) ; } } else { System . out . println ( - 1 ) ; } } } -import java . util . Scanner ; public class example814 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example814 = sc . nextInt ( ) ; int [ ] [ ] A = new int [ Example814 + 1 ] [ 3 ] ; for ( int i = 1 ; i <= Example814 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } A [ 0 ] [ 0 ] = 0 ; A [ 0 ] [ 1 ] = 0 ; A [ 0 ] [ 2 ] = 0 ; sc . close ( ) ; int count = 0 ; for ( int i = 1 ; i <= Example814 ; i ++ ) { int tmp = Math . abs ( A [ i ] [ 1 ] - A [ i - 1 ] [ 1 ] ) + Math . abs ( A [ i ] [ 2 ] - A [ i - 1 ] [ 2 ] ) ; int tmp2 = Math . abs ( A [ i ] [ 0 ] - A [ i - 1 ] [ 0 ] ) ; if ( ( tmp2 % 2 == tmp % 2 ) && tmp2 >= tmp ) { count ++ ; } } if ( count == Example814 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example465 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; double Example465 = scn . nextDouble ( ) ; scn . close ( ) ; double ans = 2 * Example465 * 3.1415926535 ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example977 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example977 = scan . nextInt ( ) ; int zone = scan . nextInt ( ) ; int pos = 0 ; int count = 1 ; for ( int i = 0 ; i < Example977 ; i ++ ) { pos += scan . nextInt ( ) ; if ( pos <= zone ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example577 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . charAt ( 0 ) == 'A' ) { int Example577 = 0 ; int index = 0 ; for ( int j = 2 ; j < s . length ( ) - 1 ; j ++ ) { if ( s . charAt ( j ) == 'C' ) { Example577 ++ ; index = j ; } } if ( Example577 == 1 ) { boolean ok = true ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( i == index ) continue ; if ( Character . isUpperCase ( s . charAt ( i ) ) ) ok = false ; } if ( ok ) { System . out . println ( " AC " ) ; return ; } } } System . out . println ( " WA " ) ; } } -import java . io . * ; import java . math . * ; import java . util . * ; public class Example232 { static final long example232 = 1000000007L ; static final int INF = 50000000 ; public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; String s = sc . next ( ) ; int d = 0 ; for ( char c : s . toCharArray ( ) ) { d += ( c - '0' ) ; } if ( d % 9 == 0 ) { pw . println ( " Yes " ) ; } else { pw . println ( " No " ) ; } pw . close ( ) ; } static class Example232 { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int ni ( ) { return Integer . parseInt ( next ( ) ) ; } long nl ( ) { return Long . parseLong ( next ( ) ) ; } double nd ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . Scanner ; public class example714 { public static void main ( String [ ] args ) throws Exception { String inputNameA ; String inputNameB ; int Example714 ; int numberOfB ; String choiceName ; Scanner scanner = new Scanner ( System . in ) ; String inputName = scanner . nextLine ( ) ; String inputNum = scanner . nextLine ( ) ; choiceName = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] editInputName = inputName . split ( " " ) ; inputNameA = editInputName [ 0 ] ; inputNameB = editInputName [ 1 ] ; String [ ] editInputNum = inputNum . split ( " " ) ; Example714 = Integer . parseInt ( editInputNum [ 0 ] ) ; numberOfB = Integer . parseInt ( editInputNum [ 1 ] ) ; if ( inputNameA . equals ( choiceName ) ) { Example714 -- ; } else if ( inputNameB . equals ( choiceName ) ) { numberOfB -- ; } System . out . println ( Example714 + " " + numberOfB ) ; } } -import java . util . Scanner ; public class Example955 { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int [ ] x = new int [ 20000 ] ; x [ 0 ] = kb . nextInt ( ) ; int example955 = 0 ; int i = 0 ; while ( x [ example955 ] != 0 ) { example955 ++ ; x [ example955 ] = kb . nextInt ( ) ; } while ( x [ i ] != 0 ) { System . out . printf ( " Case %d: %d \n " , i + 1 , x [ i ] ) ; i ++ ; } } } -import java . util . * ; public class example446 { public static void main ( String [ ] args ) { int [ ] arr = new int [ 100 ] ; Scanner sc = new Scanner ( System . in ) ; int Example446 = sc . nextInt ( ) ; for ( int i = 0 ; i < Example446 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } for ( int j = Example446 - 1 ; j > 0 ; j -- ) { System . out . print ( arr [ j ] + " " ) ; } System . out . println ( arr [ 0 ] ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; class example659 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] numbers = br . readLine ( ) . split ( " " ) ; int Example659 = Integer . parseInt ( numbers [ 0 ] ) ; int x = Integer . parseInt ( numbers [ 1 ] ) ; String [ ] length = br . readLine ( ) . split ( " " ) ; int [ ] len = new int [ Example659 ] ; for ( int i = 0 ; i < Example659 ; i ++ ) { len [ i ] = Integer . parseInt ( length [ i ] ) ; } int [ ] bounces = new int [ Example659 + 1 ] ; bounces [ 0 ] = 0 ; for ( int j = 1 ; j <= len . length ; j ++ ) { bounces [ j ] = bounces [ j - 1 ] + len [ j - 1 ] ; } int count = 0 ; for ( int k = 0 ; k < bounces . length ; k ++ ) { if ( bounces [ k ] <= x ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example615 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str = in . nextLine ( ) ; in . close ( ) ; int Example615 = 0 ; int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char a = str . charAt ( i ) ; if ( a == 'A' || a == 'C' || a == 'G' || a == 'T' ) { count ++ ; } else { if ( Example615 < count ) Example615 = count ; count = 0 ; } } if ( Example615 < count ) Example615 = count ; System . out . println ( Example615 ) ; } } -import java . util . Scanner ; public class Example461 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String t = scan . next ( ) ; int example461 = t . length ( ) ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { int diff = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) != t . charAt ( j ) ) { diff ++ ; } } example461 = Math . min ( example461 , diff ) ; } System . out . println ( example461 ) ; } } -import java . util . Scanner ; public class example132 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example132 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] A = new int [ Example132 ] ; for ( int i = 0 ; i < Example132 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < Example132 ; i ++ ) { if ( A [ i ] >= K ) { count ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example675 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example675 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example675 ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; int ans = 0 ; for ( int i = 0 ; i < K ; ++ i ) { ans += list . get ( i ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example613 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example613 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int result = - 1 ; for ( int i = 0 ; i < 2000 ; i ++ ) { int tax8 = getTax ( i , 8 ) ; int tax10 = getTax ( i , 10 ) ; if ( tax8 == example613 && tax10 == B ) { result = i ; break ; } } System . out . println ( result ) ; } public static int getTax ( int base , int rate ) { return base * rate / 100 ; } } -import java . util . * ; class example330 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example330 = sc . nextInt ( ) ; int [ ] cities = new int [ Example330 + 1 ] ; int [ ] savers = new int [ Example330 ] ; for ( int i = 0 ; i <= Example330 ; i ++ ) cities [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < Example330 ; i ++ ) savers [ i ] = sc . nextInt ( ) ; double ans = 0 ; for ( int i = 0 ; i < Example330 ; i ++ ) { if ( savers [ i ] <= cities [ i ] ) { ans += savers [ i ] ; savers [ i ] = 0 ; continue ; } else { ans += cities [ i ] ; savers [ i ] -= cities [ i ] ; } if ( savers [ i ] <= cities [ i + 1 ] ) { ans += savers [ i ] ; cities [ i + 1 ] -= savers [ i ] ; } else { ans += cities [ i + 1 ] ; cities [ i + 1 ] = 0 ; } } System . out . printf ( " %.0f \n " , ans ) ; } } -import java . util . Scanner ; public class Example820 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example820 = sc . nextInt ( ) ; int [ ] v = new int [ example820 ] ; int sum = 0 ; for ( int i = 0 ; i < example820 ; ++ i ) { v [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example820 ; ++ i ) { int c = sc . nextInt ( ) ; sum = ( v [ i ] > c ) ? sum + v [ i ] - c : sum ; } System . out . println ( sum ) ; } } -import java . util . * ; public class Example904 { private static final Scanner sc = new Scanner ( System . in ) ; private void solve ( ) { int example904 = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < example904 ; ++ i ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . * ; public class Example527 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example527 = sc . nextInt ( ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; int count = 0 ; if ( ( a < b && b < c ) || ( c < b && b < a ) ) { count ++ ; } for ( int i = 0 ; i < example527 - 3 ; i ++ ) { a = b ; b = c ; c = sc . nextInt ( ) ; if ( ( a < b && b < c ) || ( c < b && b < a ) ) { count ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example244 { private static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String SA = scan . next ( ) ; String SB = scan . next ( ) ; String SC = scan . next ( ) ; int example244 = 0 ; int sb = 0 ; int sc = 0 ; char next = 'a' ; boolean flag = true ; char winner = 0 ; while ( flag ) { switch ( next ) { case 'a' : if ( example244 == SA . length ( ) ) { flag = false ; winner = 'A' ; } else { next = SA . charAt ( example244 ) ; example244 ++ ; } break ; case 'b' : if ( sb == SB . length ( ) ) { flag = false ; winner = 'B' ; } else { next = SB . charAt ( sb ) ; sb ++ ; } break ; case 'c' : if ( sc == SC . length ( ) ) { flag = false ; winner = 'C' ; } else { next = SC . charAt ( sc ) ; sc ++ ; } break ; } } System . out . println ( winner ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class Example910 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { solve ( sc ) ; } } static void solve ( Scanner sc ) { int example910 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( d <= example910 || b <= c ) { System . out . println ( 0 ) ; return ; } if ( c <= example910 ) { if ( d <= b ) { System . out . println ( d - example910 ) ; } else { System . out . println ( b - example910 ) ; } } else if ( c < b ) { if ( d <= b ) { System . out . println ( d - c ) ; } else { System . out . println ( b - c ) ; } } } } -import java . util . Scanner ; class example9 { public static void main ( String [ ] args ) { int Example9 = 0 ; char c ; String word , temp ; Scanner sc = new Scanner ( System . in ) ; word = sc . next ( ) ; temp = sc . next ( ) ; while ( ! temp . equals ( " END_OF_TEXT " ) ) { if ( temp . equalsIgnoreCase ( word ) ) Example9 ++ ; temp = sc . next ( ) ; } System . out . println ( Example9 ) ; } } -import java . util . Scanner ; import java . math . BigDecimal ; public class example29 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double Example29 = scan . nextDouble ( ) ; final double CIRCLERATE = 3.141592653589 ; double s = CIRCLERATE * Example29 * Example29 ; double l = 2 * CIRCLERATE * Example29 ; BigDecimal x = new BigDecimal ( s ) ; x = x . setScale ( 5 , BigDecimal . ROUND_HALF_UP ) ; BigDecimal y = new BigDecimal ( l ) ; y = y . setScale ( 5 , BigDecimal . ROUND_HALF_UP ) ; System . out . printf ( " %.5f " + " " + " %.5f " , x , y ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example896 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Map < String , Integer > count = new HashMap < > ( ) ; int Example896 = in . nextInt ( ) ; long res = 0 ; for ( int i = 0 ; i < Example896 ; i ++ ) { String s = sort ( in . next ( ) ) ; res += ( count . containsKey ( s ) ? count . get ( s ) : 0 ) ; if ( count . containsKey ( s ) ) { count . replace ( s , count . get ( s ) + 1 ) ; } else { count . put ( s , 1 ) ; } } System . out . println ( res ) ; } private static String sort ( String text ) { char [ ] chars = text . toCharArray ( ) ; Arrays . sort ( chars ) ; return new String ( chars ) ; } } -import java . util . * ; public class example637 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example637 = sc . nextInt ( ) ; int [ ] list = new int [ Example637 ] ; for ( int i = 0 ; i < Example637 ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } int count = 0 ; int Max = 0 ; for ( int i = 1 ; i < Example637 ; i ++ ) { if ( list [ i - 1 ] >= list [ i ] ) { count ++ ; if ( Max < count ) { Max = count ; } } else { if ( Max < count ) { Max = count ; } count = 0 ; } } System . out . println ( Max ) ; } } -import java . text . DecimalFormat ; import java . util . Scanner ; public class Example578 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example578 = sc . nextInt ( ) ; int hunsin_nagasa = sc . nextInt ( ) ; int jikan = sc . nextInt ( ) ; int hun = sc . nextInt ( ) ; double jisin_kakudo = ( jikan * 60 + hun ) * 0.5 ; double hunsin_kakudo = hun * 6 ; double kakudo_sa = 0 ; if ( jisin_kakudo > hunsin_kakudo ) { kakudo_sa = jisin_kakudo - hunsin_kakudo ; } else { kakudo_sa = hunsin_kakudo - jisin_kakudo ; } double b = example578 ; double c = hunsin_nagasa ; double e = kakudo_sa ; double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( c , 2 ) - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example470 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example470 = sc . nextInt ( ) ; int [ ] stoneHeights = new int [ example470 ] ; for ( int i = 0 ; i < example470 ; i ++ ) { stoneHeights [ i ] = sc . nextInt ( ) ; } int [ ] minCostForStones = new int [ example470 ] ; Arrays . fill ( minCostForStones , Integer . MAX_VALUE ) ; minCostForStones [ 0 ] = 0 ; for ( int i = 0 ; i < example470 ; i ++ ) { for ( int j = i + 1 ; j < i + 3 ; j ++ ) { if ( j < example470 ) { minCostForStones [ j ] = Math . min ( minCostForStones [ j ] , minCostForStones [ i ] + Math . abs ( stoneHeights [ j ] - stoneHeights [ i ] ) ) ; } } } System . out . println ( minCostForStones [ example470 - 1 ] ) ; } } -import java . util . Scanner ; public class Example430 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example430 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = Integer . parseInt ( String . valueOf ( example430 ) + String . valueOf ( b ) ) ; for ( int i = 1 ; i < 330 ; i ++ ) { if ( i * i == n ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; public class example285 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example285 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int temp1 = b ; b = Example285 ; Example285 = temp1 ; int temp = c ; c = Example285 ; Example285 = temp ; System . out . print ( Example285 + " " + b + " " + c ) ; } } -import java . io . * ; import java . util . * ; class example155 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] array = new int [ 26 ] ; Arrays . fill ( array , 0 ) ; char [ ] c_array ; String str ; do { if ( ( str = br . readLine ( ) ) == null ) break ; c_array = str . toCharArray ( ) ; for ( char Example155 : c_array ) { if ( 'a' <= Example155 && Example155 <= 'z' ) array [ Example155 - 'a' ] ++ ; else if ( 'A' <= Example155 && Example155 <= 'Z' ) array [ Example155 - 'A' ] ++ ; } } while ( true ) ; for ( int i = 0 ; i < 26 ; i ++ ) { System . out . println ( ( char ) ( 'a' + i ) + " : " + array [ i ] ) ; } } } -import java . util . * ; public class Example563 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example563 = sc . nextInt ( ) ; int b = example563 ; int ans = 0 ; while ( example563 > 0 ) { ans += example563 % 10 ; example563 /= 10 ; } System . out . println ( b % ans == 0 ? " Yes " : " No " ) ; } } -import java . awt . * ; import java . awt . geom . * ; import java . io . * ; import java . util . * ; class example309 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] list = new int [ 3 ] ; for ( int Example309 = 0 ; Example309 < 3 ; Example309 ++ ) { list [ Example309 ] = sc . nextInt ( ) ; } Arrays . sort ( list ) ; System . out . print ( list [ 0 ] ) ; for ( int Example309 = 1 ; Example309 < 3 ; Example309 ++ ) { System . out . print ( " " + list [ Example309 ] ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class Example112 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example112 = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; String next = example112 . substring ( 0 , 1 ) ; example112 = example112 . substring ( 1 , example112 . length ( ) ) ; for ( ; ; ) { if ( next . equals ( " a " ) ) { if ( example112 . isEmpty ( ) ) { System . out . println ( " A " ) ; return ; } next = example112 . substring ( 0 , 1 ) ; example112 = example112 . substring ( 1 , example112 . length ( ) ) ; } else if ( next . equals ( " b " ) ) { if ( b . isEmpty ( ) ) { System . out . println ( " B " ) ; return ; } next = b . substring ( 0 , 1 ) ; b = b . substring ( 1 , b . length ( ) ) ; } else { if ( c . isEmpty ( ) ) { System . out . println ( " C " ) ; return ; } next = c . substring ( 0 , 1 ) ; c = c . substring ( 1 , c . length ( ) ) ; } } } } -import java . util . * ; public class example947 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; double Example947 = stdIn . nextDouble ( ) ; double H = stdIn . nextDouble ( ) ; double x = stdIn . nextDouble ( ) ; double y = stdIn . nextDouble ( ) ; System . out . println ( Example947 * H / 2 ) ; if ( x == Example947 / 2 && y == H / 2 ) { System . out . println ( 1 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; public class example188 { public static void main ( String [ ] args ) { Integer [ ] input = readInput ( ) ; int Example188 = input [ 0 ] ; int b = input [ 1 ] ; if ( Example188 < b ) { System . out . println ( " a < b " ) ; } else if ( Example188 > b ) { System . out . println ( " a > b " ) ; } else { System . out . println ( " a == b " ) ; } } public static Integer [ ] readInput ( ) { List < Integer > l = new ArrayList < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { l . add ( sc . nextInt ( ) ) ; } return l . toArray ( new Integer [ l . size ( ) ] ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; public class Example496 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int example496 = Integer . parseInt ( line ) ; int tarouScore = 0 ; int hanakoScore = 0 ; for ( int i = 0 ; i < example496 ; i ++ ) { String [ ] s = br . readLine ( ) . split ( " " ) ; String tarou = s [ 0 ] ; String hanako = s [ 1 ] ; ArrayList < String > dic = new ArrayList < String > ( ) ; dic . add ( tarou ) ; dic . add ( hanako ) ; Collections . sort ( dic ) ; if ( tarou . equals ( hanako ) ) { tarouScore += 1 ; hanakoScore += 1 ; } else if ( tarou . equals ( dic . get ( 0 ) ) ) { hanakoScore += 3 ; } else { tarouScore += 3 ; } } System . out . println ( tarouScore + " " + hanakoScore ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class example83 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; try { int Example83 , H , x , y , r ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] strAry = str . split ( " " ) ; Example83 = Integer . parseInt ( strAry [ 0 ] ) ; H = Integer . parseInt ( strAry [ 1 ] ) ; x = Integer . parseInt ( strAry [ 2 ] ) ; y = Integer . parseInt ( strAry [ 3 ] ) ; r = Integer . parseInt ( strAry [ 4 ] ) ; if ( x - r >= 0 && x + r <= Example83 && y - r >= 0 && y + r <= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . Scanner ; public class Example100 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example100 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = example100 / ( a + b ) ; long m = example100 - c * ( a + b ) ; if ( m < a ) System . out . println ( c * a + m ) ; else if ( m >= a ) System . out . println ( c * a + a ) ; sc . close ( ) ; } } -import java . util . * ; public class Example384 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example384 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int [ ] B = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } int num = 0 ; for ( int i = 0 ; i < example384 ; i ++ ) { int sum = C ; for ( int j = 0 ; j < M ; j ++ ) { sum += B [ j ] * sc . nextInt ( ) ; } if ( sum > 0 ) num ++ ; } System . out . println ( num ) ; } } -import java . util . Scanner ; public class Example986 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example986 = sc . nextInt ( ) ; long [ ] monster = new long [ example986 + 1 ] ; long [ ] brave = new long [ example986 ] ; long anser = 0 ; for ( int i = 0 ; i < example986 + 1 ; i ++ ) { monster [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < example986 ; i ++ ) { brave [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < brave . length ; i ++ ) { anser += Math . min ( monster [ i ] , brave [ i ] ) ; anser += Math . min ( monster [ i + 1 ] , Math . max ( brave [ i ] - monster [ i ] , 0 ) ) ; monster [ i + 1 ] -= Math . min ( monster [ i + 1 ] , Math . max ( brave [ i ] - monster [ i ] , 0 ) ) ; } System . out . println ( anser ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example986 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example986 = s . nextInt ( ) ; int y = s . nextInt ( ) ; int flag = 0 ; for ( int i = 0 ; i <= Example986 ; i ++ ) { if ( i * 2 + ( Example986 - i ) * 4 == y ) { System . out . println ( " Yes " ) ; flag = 1 ; break ; } } if ( flag == 0 ) { System . out . println ( " No " ) ; } } } -import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; class Example346 { public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int example346 = in . nextInt ( ) ; int y = in . nextInt ( ) ; int z = in . nextInt ( ) ; int p = example346 ; System . out . println ( z + " " + example346 + " " + y ) ; } static class Example346 { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example93 { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( ; ; ) { String [ ] numberStr = input . readLine ( ) . split ( " " ) ; int example93 = Integer . parseInt ( numberStr [ 0 ] ) ; int sum = Integer . parseInt ( numberStr [ 1 ] ) ; if ( ( example93 == 0 ) && ( sum == 0 ) ) { break ; } int set = 0 ; for ( int oneNum = 1 ; oneNum <= example93 - 2 ; oneNum ++ ) { for ( int twoNum = oneNum + 1 ; twoNum <= example93 + 1 ; twoNum ++ ) { for ( int threeNum = twoNum + 1 ; threeNum <= example93 ; threeNum ++ ) { if ( oneNum + twoNum + threeNum == sum ) { set ++ ; } } } } System . out . println ( set ) ; } } } -import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . util . * ; public class Example808 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example808 = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < example808 - 1 ; i ++ ) { int input = sc . nextInt ( ) ; if ( input >= max ) { count ++ ; max = input ; } } System . out . println ( count ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example16 { public static void main ( String [ ] args ) { int example16 = 0 ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] c = new int [ N - 1 ] ; ArrayList < Integer > CN = new ArrayList < > ( ) ; int check , checkB = 0 ; checkB = sc . nextInt ( ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { check = sc . nextInt ( ) ; if ( checkB == ( check - 1 ) ) { CN . add ( checkB ) ; } checkB = check ; } for ( int j = 0 ; j < N ; j ++ ) { example16 = example16 + sc . nextInt ( ) ; } Collections . sort ( CN ) ; for ( int k = 0 ; k < N - 1 ; k ++ ) { c [ k ] = sc . nextInt ( ) ; } for ( int l = 0 ; l < CN . size ( ) ; l ++ ) { example16 = example16 + c [ CN . get ( l ) - 1 ] ; } System . out . println ( example16 ) ; } } -import java . util . * ; public class example889 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example889 = scan . nextInt ( ) ; if ( Example889 % 10 == 7 || Example889 % 100 - Example889 % 10 == 70 || Example889 % 1000 - Example889 % 100 == 700 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scan . close ( ) ; return ; } } -import java . util . * ; public class example937 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example937 ; Example937 = in . nextInt ( ) ; int a , b , i , num ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; num = a ; for ( i = num ; i <= b ; i ++ , num ++ ) { if ( i % Example937 == 0 ) { System . out . println ( " OK " ) ; System . exit ( 0 ) ; } } System . out . println ( " NG " ) ; } } -import java . util . Scanner ; public class Example829 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example829 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( 6 - example829 - b ) ; } } -import java . util . Scanner ; public class example376 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example376 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int tmp = 9999 ; int min = 9999 ; int [ ] ci = new int [ Example376 ] ; int [ ] ti = new int [ Example376 ] ; int i = 0 ; for ( i = 0 ; i < Example376 ; i ++ ) { ci [ i ] = sc . nextInt ( ) ; ti [ i ] = sc . nextInt ( ) ; if ( ti [ i ] <= t ) { tmp = ci [ i ] ; if ( min > tmp ) { min = tmp ; } } } if ( min < 9999 ) { System . out . println ( min ) ; } else { System . out . println ( " TLE " ) ; } } } -import java . util . Scanner ; public class example405 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example405 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] bList = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { bList [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int j = 0 ; j < Example405 ; j ++ ) { int count = 0 ; for ( int k = 0 ; k < m ; k ++ ) { count += sc . nextInt ( ) * bList [ k ] ; } if ( count + c > 0 ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; class example733 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; double Example733 = 0.f ; double sum ; double sta ; double dev ; double dev_w ; double dev_sum ; double ave ; double var ; boolean Judge = true ; while ( Judge ) { int stu_num = scanner . nextInt ( ) ; if ( stu_num == 0 ) { break ; } double [ ] stu = new double [ stu_num ] ; sum = 0 ; dev_sum = 0 ; dev_w = 0 ; for ( int i = 0 ; i < stu_num ; i ++ ) { stu [ i ] = scanner . nextDouble ( ) ; sum += stu [ i ] ; } ave = sum / stu_num ; for ( int i = 0 ; i < stu_num ; i ++ ) { dev = ave - stu [ i ] ; dev_w = dev * dev ; dev_sum += dev_w ; } if ( dev_sum != 0 ) { var = dev_sum / stu_num ; } else { var = 0 ; } sta = Math . sqrt ( var ) ; System . out . println ( sta ) ; } scanner . close ( ) ; } } -import java . io . * ; import java . util . * ; public class Example291 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long example291 = sc . nextLong ( ) ; int [ ] ary = new int [ 10000 ] ; boolean big = false , flag = true ; ary [ 0 ] = 2 ; int i = 3 , j = 0 ; for ( ; i < 1000000 ; i ++ ) { flag = true ; if ( ary [ j ] >= example291 ) break ; for ( int k = 0 ; k <= j ; k ++ ) { if ( i % ary [ k ] == 0 ) { flag = false ; break ; } } if ( flag ) { j ++ ; ary [ j ] = i ; } } System . out . println ( ary [ j ] ) ; } } -import java . util . * ; public class Example713 { private static final Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example713 = scn . nextInt ( ) , b = scn . nextInt ( ) , c = scn . nextInt ( ) ; System . out . println ( example713 < b && b < c ? " Yes " : " No " ) ; } } -import java . util . * ; class Example126 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example126 = sc . nextInt ( ) ; if ( example126 < 0 ) { System . out . println ( " NA " ) ; return ; } if ( example126 % 100 < 13 && example126 % 100 != 0 ) { if ( example126 / 100 < 13 && example126 / 100 != 0 ) { System . out . println ( " AMBIGUOUS " ) ; return ; } System . out . println ( " YYMM " ) ; return ; } if ( example126 / 100 < 13 && example126 / 100 != 0 ) { System . out . println ( " MMYY " ) ; return ; } System . out . println ( " NA " ) ; } } -import java . util . * ; import java . math . * ; public class Example306 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example306 = sc . nextLong ( ) ; String b = sc . next ( ) ; long B = 0 ; B += b . charAt ( 0 ) - '0' ; B *= 10 ; B += b . charAt ( 2 ) - '0' ; B *= 10 ; B += b . charAt ( 3 ) - '0' ; long res = ( long ) ( example306 * B / 100 ) ; System . out . println ( res ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class example744 { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int [ ] numbers = new int [ 3 ] ; for ( int Example744 = 0 ; Example744 < 3 ; Example744 ++ ) { numbers [ Example744 ] = a . nextInt ( ) ; } Arrays . sort ( numbers ) ; int A = numbers [ 1 ] - numbers [ 0 ] ; int B = numbers [ 2 ] - numbers [ 1 ] ; int C = A + B ; String s = String . valueOf ( C ) ; System . out . println ( s ) ; } } -import java . io . * ; class Example10 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example10 = Integer . parseInt ( br . readLine ( ) ) ; for ( int f = 0 ; f < example10 ; f ++ ) { String [ ] str = br . readLine ( ) . split ( " \\ s " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; a *= a ; int b = Integer . parseInt ( str [ 1 ] ) ; b *= b ; int c = Integer . parseInt ( str [ 2 ] ) ; c *= c ; if ( a + b == c || b + c == a || c + a == b ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } catch ( IOException e ) { } } } -import java . util . Arrays ; import java . util . Scanner ; public class example64 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example64 = scan . nextInt ( ) ; int [ ] a = new int [ Example64 ] ; for ( int i = 0 ; i < Example64 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; Arrays . sort ( a ) ; int check = 0 ; for ( int i = 0 ; i < Example64 ; i ++ ) { for ( int j = i + 1 ; j < Example64 ; j ++ ) { if ( i != j ) { if ( a [ i ] == a [ j ] ) { check = 1 ; break ; } else { break ; } } } if ( check == 1 ) break ; } System . out . println ( ( check == 1 ) ? " NO " : " YES " ) ; } } -import java . util . Scanner ; class Example812 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example812 = sc . nextInt ( ) ; String str = sc . next ( ) ; char [ ] c = str . toCharArray ( ) ; int count = 0 ; if ( example812 % 2 == 0 ) { for ( int i = 0 ; i < example812 / 2 ; i ++ ) { if ( c [ i ] == c [ example812 / 2 + i ] ) { count ++ ; } } if ( count == example812 / 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example463 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example463 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; if ( example463 >= 0 ) { if ( d >= 0 ) { System . out . println ( b * d ) ; } else { System . out . println ( d * example463 ) ; } } else if ( b < 0 ) { if ( c >= 0 ) { System . out . println ( b * c ) ; } else { System . out . println ( c * example463 ) ; } } else { if ( d < 0 ) { System . out . println ( c * example463 ) ; } else if ( c >= 0 ) { System . out . println ( b * d ) ; } else { if ( example463 * c > b * d ) { System . out . println ( example463 * c ) ; } else { System . out . println ( b * d ) ; } } } } } -import java . util . Scanner ; public class example297 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final StringBuilder S1 = new StringBuilder ( sc . next ( ) ) ; final int Example297 = S1 . length ( ) ; final StringBuilder S2 = new StringBuilder ( S1 . substring ( 0 , ( Example297 - 1 ) / 2 ) ) ; final StringBuilder S3 = new StringBuilder ( S1 . substring ( ( Example297 + 3 ) / 2 - 1 , Example297 ) ) ; final boolean cond1 = S1 . toString ( ) . equals ( S1 . reverse ( ) . toString ( ) ) ; final boolean cond2 = S2 . toString ( ) . equals ( S2 . reverse ( ) . toString ( ) ) ; final boolean cond3 = S3 . toString ( ) . equals ( S3 . reverse ( ) . toString ( ) ) ; if ( cond1 && cond2 && cond3 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example530 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String info = br . readLine ( ) ; String [ ] split = info . split ( " " ) ; int Example530 = Integer . parseInt ( split [ 0 ] ) ; int N = Integer . parseInt ( split [ 1 ] ) ; info = br . readLine ( ) ; String [ ] A = info . split ( " " ) ; for ( int i = 0 ; i < N ; i ++ ) { Example530 = Example530 - Integer . parseInt ( A [ i ] ) ; } if ( Example530 <= 0 ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } -import java . math . * ; import java . util . * ; import java . io . * ; import java . lang . * ; public class Example946 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example946 = sc . nextInt ( ) ; if ( isPrime ( example946 ) ) { System . out . println ( example946 ) ; } else { while ( ! isPrime ( example946 ) ) { example946 ++ ; } System . out . println ( example946 ) ; } } public static boolean isPrime ( int a ) { BigInteger bi = BigInteger . valueOf ( a ) ; return bi . isProbablePrime ( 1 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example686 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] parts = br . readLine ( ) . split ( " " ) ; int Example686 = Integer . parseInt ( parts [ 0 ] ) ; int A = Integer . parseInt ( parts [ 1 ] ) ; int a = Example686 % A ; if ( a == 0 ) { System . out . println ( Example686 / A ) ; } else { System . out . println ( Example686 / A + 1 ) ; } } } -import java . util . Scanner ; public class Example99 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example99 = Integer . parseInt ( sc . nextLine ( ) ) ; sc . close ( ) ; int ans = 0 ; if ( example99 < 10 ) { ans = example99 ; } else if ( example99 < 100 ) { ans = 9 ; } else if ( example99 < 1000 ) { ans = example99 - 99 + 9 ; } else if ( example99 < 10000 ) { ans = 999 - 99 + 9 ; } else if ( example99 < 100000 ) { ans = example99 - 9999 + 999 - 99 + 9 ; } else if ( example99 < 1000000 ) { ans = 99999 - 9999 + 999 - 99 + 9 ; } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example241 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; while ( sc . hasNext ( ) ) { list . add ( Integer . parseInt ( sc . next ( ) ) ) ; } int example241 = list . get ( 0 ) ; int sum = list . get ( 1 ) ; int i = 0 ; if ( sum == 1 ) { System . out . print ( 0 ) ; } else if ( example241 >= sum ) { System . out . print ( 1 ) ; } else { sum = sum - example241 ; i ++ ; example241 -- ; while ( true ) { sum = sum - example241 ; i ++ ; if ( sum < 1 ) { System . out . print ( i ) ; break ; } } } } } -import java . util . Scanner ; public class example366 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int Example366 ; double [ ] b = new double [ 1111 ] ; double av ; double sum ; while ( true ) { Example366 = input . nextInt ( ) ; if ( Example366 == 0 ) break ; else { sum = 0 ; av = 0 ; for ( int i = 0 ; i < Example366 ; i ++ ) { b [ i ] = input . nextDouble ( ) ; av += b [ i ] ; } av /= Example366 ; for ( int i = 0 ; i < Example366 ; i ++ ) { sum += ( b [ i ] - av ) * ( b [ i ] - av ) / Example366 ; } System . out . println ( Math . sqrt ( sum ) ) ; } } input . close ( ) ; } } -import java . util . * ; class example822 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example822 = 1 , x = 1 ; while ( x > 0 ) { x = scanner . nextInt ( ) ; if ( x == 0 ) { break ; } System . out . println ( " Case " + Example822 + " : " + x ) ; Example822 ++ ; } } } -import java . util . * ; public class Example614 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example614 = input . nextInt ( ) ; int h = ( example614 / 500 ) * 1000 ; int f = ( ( example614 % 500 ) / 5 ) * 5 ; System . out . println ( h + f ) ; } } -import java . util . * ; public class Example732 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { boolean example732 = true ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a >= b ) { example732 = false ; } int c = sc . nextInt ( ) ; if ( b >= c ) { example732 = false ; } System . out . println ( example732 == true ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example508 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String Example508 = input . nextLine ( ) ; if ( Example508 . equals ( " SUN " ) ) { System . out . println ( " 7 " ) ; } else if ( Example508 . equals ( " MON " ) ) { System . out . println ( " 6 " ) ; } else if ( Example508 . equals ( " TUE " ) ) { System . out . println ( " 5 " ) ; } else if ( Example508 . equals ( " WED " ) ) { System . out . println ( " 4 " ) ; } else if ( Example508 . equals ( " THU " ) ) { System . out . println ( " 3 " ) ; } else if ( Example508 . equals ( " FRI " ) ) { System . out . println ( " 2 " ) ; } else if ( Example508 . equals ( " SAT " ) ) { System . out . println ( " 1 " ) ; } } } -import java . util . Scanner ; public class example376 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example376 = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; String t = sb . append ( Example376 ) . reverse ( ) . toString ( ) ; t = t . replaceAll ( " resare " , " 1 " ) ; t = t . replaceAll ( " esare " , " 1 " ) ; t = t . replaceAll ( " remaerd " , " 1 " ) ; t = t . replaceAll ( " maerd " , " 1 " ) ; t = t . replaceAll ( " 1 " , " " ) ; if ( t . equals ( " " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . Collections ; class Example407 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { ArrayList < Integer > input = new ArrayList < Integer > ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int example407 = 0 ; example407 < 10 ; example407 ++ ) input . add ( Integer . parseInt ( br . readLine ( ) ) ) ; Collections . sort ( input , Collections . reverseOrder ( ) ) ; for ( int example407 = 0 ; example407 < 3 ; example407 ++ ) System . out . println ( input . get ( example407 ) ) ; } } -import java . util . Scanner ; public class Example427 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; while ( true ) { String word = input . nextLine ( ) ; if ( word . equals ( " - " ) ) break ; int example427 = input . nextInt ( ) ; for ( int i = 0 ; i < example427 ; i ++ ) { int index = input . nextInt ( ) ; String move = word . substring ( 0 , index ) ; String left = word . substring ( index ) ; word = left + move ; } input . nextLine ( ) ; System . out . println ( word ) ; } } } -import java . util . * ; public class example121 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example121 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int judge = 0 ; while ( Example121 >= 0 && Y >= 0 ) { if ( Y / 4 == Example121 && Y % 4 == 0 ) { judge = 1 ; break ; } Example121 = Example121 - 1 ; Y = Y - 2 ; } if ( judge == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example38 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] list = scanner . next ( ) . split ( " " ) ; int Example38 = 0 ; for ( String s : list ) { if ( Integer . parseInt ( s ) == 1 ) { Example38 ++ ; } } System . out . println ( Example38 ) ; scanner . close ( ) ; } } -import java . util . * ; public class example544 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] ss = new String [ 4 ] ; for ( int Example544 = 0 ; Example544 < 4 ; Example544 ++ ) { ss [ Example544 ] = s . substring ( Example544 , Example544 + 1 ) ; } for ( int Example544 = 0 ; Example544 < 3 ; Example544 ++ ) { if ( ss [ Example544 ] . equals ( ss [ Example544 + 1 ] ) ) { System . out . println ( " Bad " ) ; return ; } } System . out . println ( " Good " ) ; } } -import java . util . * ; public class example515 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example515 = sc . nextInt ( ) , n = sc . nextInt ( ) , min = 301 ; int [ ] p = new int [ n ] , a = new int [ 300 - n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int l = 0 ; for ( int i = - 150 ; i < 150 ; i ++ ) { int f = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( i == p [ j ] ) { f ++ ; break ; } } if ( f == 0 ) { a [ l ] = i ; l ++ ; } } if ( n == 0 ) { System . out . println ( Example515 ) ; } else { for ( int i = 0 ; i < a . length ; i ++ ) { if ( min <= ( int ) Math . abs ( Example515 - a [ i ] ) ) { System . out . println ( a [ i - 1 ] ) ; break ; } else { min = ( int ) Math . abs ( Example515 - a [ i ] ) ; } } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example195 { public static void main ( String [ ] args ) throws IOException , Exception { BufferedReader st = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] data1 = getIntArry ( st ) ; int example195 = data1 [ 0 ] ; int k = data1 [ 1 ] ; int [ ] data2 = getIntArry ( st ) ; int ans = 0 ; for ( int i = 0 ; i < example195 ; i ++ ) { if ( data2 [ i ] >= k ) { ans ++ ; } } anser ( ans ) ; } private static int [ ] getIntArry ( BufferedReader st ) throws Exception , IOException { String line = st . readLine ( ) ; String [ ] strData = line . split ( " " ) ; int [ ] intData = new int [ strData . length ] ; for ( int i = 0 ; i < strData . length ; i ++ ) { intData [ i ] = Integer . parseInt ( strData [ i ] ) ; } return intData ; } private static void anser ( int num ) { System . out . println ( num ) ; } } -import java . util . * ; public class Example478 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example478 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( ( B + example478 - 3 ) / ( example478 - 1 ) ) ; } } -import java . util . Scanner ; public class example359 { public static void main ( String [ ] args ) { Scanner kbd = new Scanner ( System . in ) ; int Example359 = kbd . nextInt ( ) ; int d = kbd . nextInt ( ) ; int num = 0 ; for ( int i = 0 ; i < Example359 ; i ++ ) { long x = kbd . nextInt ( ) ; long y = kbd . nextInt ( ) ; if ( Math . sqrt ( x * x + y * y ) <= d ) { num ++ ; } } System . out . println ( num ) ; } } -import java . util . * ; public class Example710 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int example710 = s . length ; char [ ] t = sc . next ( ) . toCharArray ( ) ; int tlen = t . length ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < example710 - tlen + 1 ; i ++ ) { int cnt = 0 ; for ( int j = 0 ; j < tlen ; j ++ ) { if ( s [ i + j ] != t [ j ] ) cnt ++ ; } if ( cnt < ans ) ans = cnt ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Example628 { 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 example628 = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int ans = 0 ; while ( example628 >= K ) { example628 /= K ; ans ++ ; } if ( example628 != 0 ) ans ++ ; os . println ( ans ) ; } } -import java . util . Scanner ; import java . lang . Math ; class example253 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example253 = Integer . parseInt ( stdIn . next ( ) ) ; if ( Example253 != 2 && Example253 % 2 == 0 ) Example253 ++ ; while ( true ) { int i ; double sqrtNum = Math . sqrt ( Example253 ) ; for ( i = 3 ; i <= sqrtNum ; i += 2 ) { if ( Example253 % i == 0 ) break ; } if ( i > sqrtNum ) break ; Example253 += 2 ; } System . out . println ( Example253 ) ; } } -import java . util . Scanner ; public class example649 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example649 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int X = scan . nextInt ( ) ; int [ ] A = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int index1 = X ; int cost1 = 0 ; int cost2 = 0 ; for ( int i = 0 ; i < X - 1 ; i ++ ) { index1 -- ; for ( int j = 0 ; j < M ; j ++ ) { if ( index1 == A [ j ] ) { cost1 ++ ; } } } cost2 = A . length - cost1 ; if ( cost2 > cost1 ) { System . out . println ( cost1 ) ; } else { System . out . println ( cost2 ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example484 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example484 = scan . nextInt ( ) ; int [ ] A = new int [ example484 ] ; for ( int i = 0 ; i < example484 ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } double c = 0 ; Arrays . sort ( A ) ; c = ( A [ 0 ] + A [ 1 ] ) / 2.0 ; for ( int i = 2 ; i < example484 ; i ++ ) { c = ( c + A [ i ] ) / 2.0 ; } System . out . println ( c ) ; } } -import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Example324 { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; char [ ] str = in . readLine ( ) . toCharArray ( ) ; str [ 3 ] = '8' ; String example324 = new String ( str ) ; System . out . println ( example324 ) ; } } -import java . util . * ; class Example588 { public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; do_ ( inp ) ; inp . close ( ) ; } public static void do_ ( Scanner inp ) { char [ ] ss = inp . next ( ) . toCharArray ( ) ; char example588 = ss [ ss . length - 1 ] ; if ( example588 == '2' || example588 == '4' || example588 == '5' || example588 == '7' || example588 == '9' ) { System . out . println ( " hon " ) ; } else if ( example588 == '0' || example588 == '1' || example588 == '6' || example588 == '8' ) { System . out . println ( " pon " ) ; } else { System . out . println ( " bon " ) ; } } } -import java . io . * ; import java . util . * ; public class example7 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int Example7 = 1 ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int [ ] a = new int [ n ] ; int x = 0 , cnt = 0 , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; sum += a [ i ] ; } x = ( int ) Math . ceil ( sum / ( 1.0 * 4 * m ) ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= x ) cnt ++ ; } System . out . println ( cnt >= m ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example779 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Double r = Double . parseDouble ( sc . next ( ) ) ; double example779 = Math . PI ; double s = r * r * example779 ; double l = 2 * r * example779 ; System . out . printf ( " %.6f " , s ) ; System . out . print ( " " ) ; System . out . printf ( " %.6f \n " , l ) ; } } -import java . util . * ; class Example76 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example76 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] array = { 1 , 2 , 3 } ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( ( array [ i ] == example76 ) || ( array [ i ] == b ) ) { array [ i ] = 0 ; } } for ( int i = 0 ; i < 3 ; i ++ ) { if ( array [ i ] != 0 ) { System . out . println ( array [ i ] ) ; return ; } } } } -import java . util . * ; class example717 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example717 = sc . nextInt ( ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; StringBuilder sb = new StringBuilder ( " " ) ; for ( int i = 0 , j = 0 ; i < a . length ( ) && j < b . length ( ) ; i ++ , j ++ ) { sb . append ( ( char ) a . charAt ( i ) + " " ) . append ( ( char ) b . charAt ( j ) + " " ) ; } System . out . println ( sb ) ; } } -import java . awt . * ; import java . awt . geom . * ; import java . io . * ; import java . util . * ; class Example704 { static char [ ] xx = new char [ ] { 'S' , 'H' , 'C' , 'D' } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example704 = sc . nextInt ( ) ; boolean [ ] [ ] l = new boolean [ 4 ] [ 13 ] ; for ( int i = 0 ; i < example704 ; i ++ ) { char k = sc . next ( ) . charAt ( 0 ) ; int r = sc . nextInt ( ) ; if ( k == 'S' ) { l [ 0 ] [ r - 1 ] = true ; } if ( k == 'H' ) { l [ 1 ] [ r - 1 ] = true ; } if ( k == 'C' ) { l [ 2 ] [ r - 1 ] = true ; } if ( k == 'D' ) { l [ 3 ] [ r - 1 ] = true ; } } for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 13 ; j ++ ) { if ( ! l [ i ] [ j ] ) { System . out . println ( xx [ i ] + " " + ( j + 1 ) ) ; } } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Example976 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " / " ) ; int example976 = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; if ( example976 > 2019 || ( example976 <= 2019 && m > 4 ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } -import java . util . Scanner ; public class example935 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String [ ] t = s . split ( " " ) ; for ( int Example935 = 0 ; Example935 < t . length ; Example935 ++ ) { t [ Example935 ] = " x " ; } String u = String . join ( " " , t ) ; System . out . println ( u ) ; } } -import java . util . * ; public class example653 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example653 = sc . next ( ) ; if ( " SAT " . equals ( Example653 ) ) { System . out . println ( " 1 " ) ; } else if ( " FRI " . equals ( Example653 ) ) { System . out . println ( " 2 " ) ; } else if ( " THU " . equals ( Example653 ) ) { System . out . println ( " 3 " ) ; } else if ( " WED " . equals ( Example653 ) ) { System . out . println ( " 4 " ) ; } else if ( " TUE " . equals ( Example653 ) ) { System . out . println ( " 5 " ) ; } else if ( " MON " . equals ( Example653 ) ) { System . out . println ( " 6 " ) ; } else if ( " SUN " . equals ( Example653 ) ) { System . out . println ( " 7 " ) ; } } private static long lcm ( long m , long n ) { return m * n / gcd ( m , n ) ; } private static long gcd ( long m , long n ) { if ( m < n ) return gcd ( n , m ) ; if ( n == 0 ) return m ; return gcd ( n , m % n ) ; } } -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 example796 { 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 Example796 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double ax = Example796 * Math . cos ( Math . toRadians ( 90 - 30 * H - M / 2.0 ) ) ; double ay = Example796 * Math . sin ( Math . toRadians ( 90 - 30 * H - M / 2.0 ) ) ; double bx = B * Math . cos ( Math . toRadians ( 90 - 6 * M ) ) ; double by = B * Math . sin ( Math . toRadians ( 90 - 6 * M ) ) ; double ans = Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ; os . println ( ans ) ; } } -import java . util . Scanner ; public class Example419 { public static void main ( String [ ] args ) { try ( final Scanner sc = new Scanner ( System . in ) ) { Resolver resolver = new Resolver ( sc ) ; resolver . resolve ( ) ; } } private static class Example419 { private final int example419 , b , t ; private Resolver ( final Scanner sc ) { this . example419 = sc . nextInt ( ) ; this . b = sc . nextInt ( ) ; this . t = sc . nextInt ( ) ; } private void resolve ( ) { int k = t / example419 ; System . out . println ( b * k ) ; } } } -import java . util . Scanner ; class Example454 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example454 , c , a [ ] [ ] = new int [ 101 ] [ 101 ] , i , j ; example454 = stdIn . nextInt ( ) ; c = stdIn . nextInt ( ) ; for ( i = 0 ; i < example454 ; i ++ ) { for ( j = 0 ; j < c ; j ++ ) { a [ i ] [ j ] = stdIn . nextInt ( ) ; a [ i ] [ c ] += a [ i ] [ j ] ; } } for ( i = 0 ; i < c ; i ++ ) { for ( j = 0 ; j < example454 ; j ++ ) a [ example454 ] [ i ] += a [ j ] [ i ] ; a [ example454 ] [ c ] += a [ example454 ] [ i ] ; } for ( i = 0 ; i <= example454 ; i ++ ) { for ( j = 0 ; j <= c ; j ++ ) { if ( j != 0 ) System . out . print ( " " ) ; System . out . print ( a [ i ] [ j ] ) ; } System . out . println ( ) ; } } } -import java . util . * ; public class example142 { public static void main ( String [ ] args ) { boolean Example142 = false ; int answer = 0 ; List < Integer > a = new ArrayList < Integer > ( ) ; int s ; int n = 1 ; int ai = 0 ; int count = 0 ; Scanner sc = new Scanner ( System . in ) ; s = sc . nextInt ( ) ; while ( Example142 == false ) { if ( count == 0 ) { a . add ( s ) ; count ++ ; } else { n = a . get ( count - 1 ) ; if ( n % 2 == 0 ) { ai = n / 2 ; a . add ( ai ) ; } else { ai = 3 * n + 1 ; a . add ( ai ) ; } count ++ ; } for ( int i = 0 ; i < count - 1 ; i ++ ) { if ( a . get ( i ) == ai ) { answer = a . size ( ) ; Example142 = true ; } } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class Example765 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String nyu = sc . next ( ) ; int example765 = 0 , mem = 0 , leng ; leng = nyu . length ( ) ; for ( int i = 0 ; i < leng ; i ++ ) { char top = nyu . charAt ( i ) ; switch ( top ) { case 'A' : example765 += 1 ; break ; case 'C' : example765 += 1 ; break ; case 'G' : example765 += 1 ; break ; case 'T' : example765 += 1 ; break ; default : if ( example765 > mem ) { mem = example765 ; example765 = 0 ; } } } if ( example765 > mem ) { mem = example765 ; } System . out . println ( mem ) ; } } -import java . util . * ; public class Example73 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example73 = sc . nextInt ( ) , T = sc . nextInt ( ) ; int [ ] c = new int [ example73 ] ; int [ ] t = new int [ example73 ] ; for ( int i = 0 ; i < example73 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; t [ i ] = sc . nextInt ( ) ; } int ans = INF ; boolean exist = false ; for ( int i = 0 ; i < example73 ; i ++ ) { if ( t [ i ] <= T ) { exist = true ; ans = Math . min ( ans , c [ i ] ) ; } } if ( exist ) System . out . println ( ans ) ; else System . out . println ( " TLE " ) ; } public static final int INF = 10000 ; } -import java . util . Scanner ; public class Example840 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; long example840 = scan . nextLong ( ) ; scan . close ( ) ; int l = S . length ( ) ; int [ ] num = new int [ S . length ( ) ] ; for ( int i = 0 ; i < l ; i ++ ) { num [ i ] = Integer . parseInt ( S . substring ( i , i + 1 ) ) ; } long sum = l ; if ( sum >= example840 ) { int cnt1 = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( num [ i ] == 1 ) { cnt1 ++ ; } else { break ; } } if ( cnt1 >= example840 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } } long cnt = 1 ; int ans = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( num [ i ] != 1 ) { ans = num [ i ] ; break ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example285 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example285 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ m ] ; boolean [ ] jdg = new boolean [ Example285 + 1 ] ; long [ ] Dp = new long [ Example285 + 1 ] ; int p = 1000000007 ; for ( int i = 0 ; i < m ; i ++ ) { a [ i ] = sc . nextInt ( ) ; jdg [ a [ i ] ] = true ; } Dp [ 0 ] = 1 ; for ( int i = 1 ; i <= Example285 ; i ++ ) { if ( jdg [ i ] == false ) { if ( i == 1 ) Dp [ i ] = Dp [ i - 1 ] ; if ( i >= 2 ) { Dp [ i ] = ( Dp [ i - 1 ] ) % p + ( Dp [ i - 2 ] ) % p ; Dp [ i ] = Dp [ i ] % p ; } } if ( jdg [ i ] == true ) { Dp [ i ] = 0 ; } } System . out . println ( Dp [ Example285 ] ) ; } } -import java . util . * ; public class example819 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example819 , i , answer ; int sum = 0 ; int temp_a = 0 ; int temp_b = 0 ; Example819 = Integer . parseInt ( sc . next ( ) ) ; int [ ] weight = new int [ Example819 ] ; for ( i = 0 ; i < Example819 ; i ++ ) { weight [ i ] = Integer . parseInt ( sc . next ( ) ) ; sum += weight [ i ] ; } for ( i = 0 ; i < Example819 ; i ++ ) { temp_a += weight [ i ] ; if ( sum <= 2 * temp_a ) { break ; } else { temp_b = temp_a ; } } temp_a = sum - 2 * temp_a ; temp_b = sum - 2 * temp_b ; temp_a = Math . abs ( temp_a ) ; temp_b = Math . abs ( temp_b ) ; if ( temp_b < temp_a ) { answer = temp_b ; } else { answer = temp_a ; } System . out . println ( answer ) ; } } -import java . util . * ; public class Example996 { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int example996 = scanner . nextInt ( ) ; int max = Integer . MAX_VALUE ; for ( int i = 0 ; i < example996 ; i ++ ) { max = Math . min ( max , Integer . numberOfTrailingZeros ( scanner . nextInt ( ) ) ) ; } System . out . println ( max ) ; } } -import java . util . Scanner ; public class example794 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean Example794 = false ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; ans [ i ] = 0 ; } ans [ n - 1 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != 0 ) ans [ a [ i ] - 1 ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( ans [ i ] ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example142 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example142 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( '0' == s . charAt ( i ) ) example142 ++ ; } System . out . println ( 2 * Math . min ( s . length ( ) - example142 , example142 ) ) ; } } -import java . util . Scanner ; public class Example361 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example361 = s . nextInt ( ) ; int [ ] ds = new int [ example361 ] ; int sum = 0 ; for ( int i = 0 ; i < example361 ; i ++ ) { ds [ i ] = s . nextInt ( ) ; for ( int j = 0 ; j < i ; j ++ ) { sum += ds [ j ] * ds [ i ] ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example401 { static String str ; static int Example401 , zeroC , oneC ; static int [ ] A ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; str = sc . next ( ) ; Example401 = str . length ( ) ; A = new int [ Example401 ] ; for ( int i = 0 ; i < Example401 ; i ++ ) { A [ i ] = Character . getNumericValue ( str . charAt ( i ) ) ; if ( A [ i ] == 0 ) { zeroC ++ ; } else { oneC ++ ; } } System . out . println ( Example401 - ( Math . abs ( zeroC - oneC ) ) ) ; } } -import java . util . * ; class example383 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example383 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int price1 ; int price2 ; if ( X > Y ) { price1 = ( C * 2 * Y ) + ( Example383 * ( X - Y ) ) ; price2 = C * 2 * X ; } else { price1 = ( C * 2 * X ) + ( B * ( Y - X ) ) ; price2 = C * 2 * Y ; } int price3 = Example383 * X + B * Y ; int ans = Math . min ( price1 , price2 ) ; ans = Math . min ( ans , price3 ) ; System . out . println ( + ans ) ; } } -import java . util . * ; public class Example780 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example780 = sc . nextInt ( ) ; int [ ] H = new int [ example780 ] ; for ( int i = 0 ; i < example780 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; boolean out = false ; H [ 0 ] -- ; for ( int i = 0 ; i < example780 - 1 ; i ++ ) { if ( H [ i + 1 ] < H [ i ] ) { out = true ; } if ( H [ i + 1 ] - 1 >= H [ i ] ) { H [ i + 1 ] -- ; } } if ( out ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . * ; public class example991 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example991 = sc . nextLong ( ) ; long ans = Long . MAX_VALUE / 2 ; for ( int i = 1 ; ( long ) i * i <= Example991 ; i ++ ) { if ( Example991 % i == 0 ) { long a = i ; long b = Example991 / i ; long tmp = Math . max ( a , b ) ; ans = Math . min ( ans , tmp ) ; } } int res = 0 ; while ( ans > 0 ) { ans /= 10 ; res ++ ; } System . out . println ( res ) ; } } -import java . util . Scanner ; public class Example395 { public static void main ( String [ ] args ) { int example395 ; int endNum ; int answer = 0 ; Scanner sc = new Scanner ( System . in ) ; example395 = sc . nextInt ( ) ; endNum = sc . nextInt ( ) ; for ( int i = example395 ; i <= endNum ; i ++ ) { String numStr = String . valueOf ( i ) ; char num1 = numStr . charAt ( 0 ) ; char num2 = numStr . charAt ( 1 ) ; char num4 = numStr . charAt ( 3 ) ; char num5 = numStr . charAt ( 4 ) ; if ( ( num1 == num5 ) && ( num2 == num4 ) ) { answer ++ ; } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example282 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example282 = sc . nextInt ( ) ; int [ ] b = new int [ Example282 ] ; int sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < b . length ; i ++ ) { b [ i ] = sc . nextInt ( ) ; sum += b [ i ] ; } for ( int j = 1 ; j < b . length ; j ++ ) { int half = 0 ; int tmp = 0 ; for ( int x = 0 ; x < j ; x ++ ) { half += b [ x ] ; tmp = sum - ( half * 2 ) ; tmp = Math . abs ( tmp ) ; if ( x == 0 || tmp < ans ) { ans = tmp ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example713 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example713 = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( example713 % k < k - ( example713 % k ) ) k = example713 % k ; else k = k - ( example713 % k ) ; System . out . println ( k ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class example215 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example215 = sc . nextInt ( ) , K = sc . nextInt ( ) ; double [ ] dp = new double [ K + 1 ] ; Arrays . fill ( dp , 0 ) ; for ( int i = 1 ; i <= Math . min ( Example215 , K ) ; ++ i ) dp [ i ] = 1.0 / Example215 ; dp [ K ] += ( double ) Math . max ( 0 , Example215 - K ) / Example215 ; for ( int i = 1 ; i < K ; ++ i ) dp [ Math . min ( i * 2 , K ) ] += dp [ i ] / 2 ; System . out . println ( dp [ K ] ) ; } } -import java . util . Scanner ; public class example240 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example240 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int min = 0 ; int count = 0 ; if ( Example240 < B ) { min = Example240 ; } else { min = B ; } for ( int i = min ; i >= 1 ; i -- ) { if ( Example240 % i == 0 && B % i == 0 ) { count ++ ; if ( count == K ) { System . out . println ( i ) ; break ; } } } scan . close ( ) ; } } -import java . util . * ; public class example10 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer N = sc . nextInt ( ) ; Integer Q = sc . nextInt ( ) ; String S = sc . next ( ) ; Integer [ ] l = new Integer [ Q ] , r = new Integer [ Q ] ; for ( int Example10 = 0 ; Example10 < Q ; Example10 ++ ) { l [ Example10 ] = sc . nextInt ( ) ; r [ Example10 ] = sc . nextInt ( ) ; } int [ ] a = new int [ N ] ; int count = 0 ; for ( int Example10 = 1 ; Example10 < N ; Example10 ++ ) { if ( S . charAt ( Example10 - 1 ) == 'A' && S . charAt ( Example10 ) == 'C' ) { count ++ ; a [ Example10 ] = count ; } else { a [ Example10 ] = count ; } } for ( int Example10 = 0 ; Example10 < Q ; Example10 ++ ) { System . out . println ( a [ r [ Example10 ] - 1 ] - a [ l [ Example10 ] - 1 ] ) ; } } } -import java . util . Scanner ; public class Example586 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example586 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = 0 ; C = example586 * B ; System . out . println ( C ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example808 { private static int Example808 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] nums = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } me ( nums ) ; System . out . println ( Main . Example808 ) ; } public static void me ( int [ ] nums ) { int min = Integer . MAX_VALUE ; for ( int num : nums ) { min = num < min ? num : min ; } Main . Example808 += min ; int ti = 0 ; int i ; for ( i = 0 ; i < nums . length ; i ++ ) { nums [ i ] -= min ; if ( nums [ i ] == 0 ) { if ( ti < i ) { me ( Arrays . copyOfRange ( nums , ti , i ) ) ; } ti = i + 1 ; } } if ( ti < i ) { me ( Arrays . copyOfRange ( nums , ti , i ) ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example619 { public static void main ( String [ ] args ) throws Exception { boolean example619 = true ; try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String line ; while ( ( line = br . readLine ( ) ) != null ) { String [ ] str = line . split ( " " ) ; int x = Integer . parseInt ( str [ 0 ] ) ; int y = Integer . parseInt ( str [ 1 ] ) ; if ( x == 0 && y == 0 ) { break ; } for ( int i = 0 ; i < x ; i ++ ) { for ( int j = 0 ; j < y ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } } -import java . util . Scanner ; public class example297 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String w = scan . nextLine ( ) ; int Example297 = 0 ; while ( scan . hasNext ( ) ) { String T = scan . nextLine ( ) ; if ( T . equals ( " END_OF_TEXT " ) ) { break ; } String [ ] Ts = T . split ( " " ) ; for ( int i = 0 ; i < Ts . length ; i ++ ) { if ( Ts [ i ] . equalsIgnoreCase ( w ) ) { Example297 ++ ; } } } System . out . println ( Example297 ) ; } } -import java . util . * ; import java . lang . * ; public class example828 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; int [ ] a = new int [ n . length ( ) + 1 ] ; int Example828 = 0 ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { a [ i ] = n . charAt ( i ) - '0' ; } for ( int i = 0 ; i < n . length ( ) ; i ++ ) { Example828 = Example828 + a [ i ] ; } if ( Example828 % 9 == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . * ; public class example328 { Scanner sc ; int Example328 , b ; static String testInput = " 998244353 99824435 " ; public Main ( ) { sc = new Scanner ( System . in ) ; } public Main ( String input ) { sc = new Scanner ( input ) ; } void out ( Object o ) { System . out . println ( o ) ; System . out . flush ( ) ; } public void exec ( ) throws Exception { Example328 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int k = ( Example328 + b ) / 2 ; if ( k * 2 != Example328 + b ) out ( " IMPOSSIBLE " ) ; else out ( k ) ; } public static void main ( String [ ] args ) throws Exception { Main m = new Main ( ) ; m . exec ( ) ; } } -import java . util . * ; public class example252 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example252 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < A . length ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < A . length ; i ++ ) { Example252 -= A [ i ] ; } if ( Example252 <= 0 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class example744 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example744 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( sc . nextInt ( ) < X ) { a += 1 ; } else { b += 1 ; } } if ( a <= b ) { System . out . println ( a ) ; } else { System . out . println ( b ) ; } } } -import java . util . Scanner ; public class example522 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char Example522 = sc . next ( ) . trim ( ) . charAt ( 0 ) ; StringBuilder sb = new StringBuilder ( ) ; if ( Example522 >= 'A' && Example522 <= 'Z' ) sb . append ( 'A' + " \n " ) ; else if ( Example522 >= 'a' && Example522 <= 'z' ) sb . append ( 'a' + " \n " ) ; sc . close ( ) ; System . out . println ( sb ) ; } } -import java . util . * ; public class example668 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int Example668 = 0 ; Example668 < 3 ; Example668 ++ ) nums [ Example668 ] = sc . nextInt ( ) ; Arrays . sort ( nums ) ; int cost = 0 ; for ( int Example668 = 1 ; Example668 < 3 ; Example668 ++ ) cost += nums [ Example668 ] - nums [ Example668 - 1 ] ; System . out . println ( cost ) ; } } -import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Example793 { static class Example793 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int example793 = 1 ; long ans = 0 , mod = 1000000007 ; while ( example793 -- > 0 ) { int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; pw . println ( ( n * ( n - 1 ) ) / 2 + ( m * ( m - 1 ) ) / 2 ) ; } pw . close ( ) ; } } -import java . util . Scanner ; public class example861 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; for ( int Example861 = 0 ; Example861 < 3 ; Example861 ++ ) { c [ Example861 ] = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j ++ ) { c [ Example861 ] [ j ] = stdin . nextInt ( ) ; } } String result = " No " ; int a2 = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; int a3 = c [ 2 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( ( c [ 1 ] [ 1 ] == ( a2 + c [ 0 ] [ 1 ] ) ) && ( c [ 1 ] [ 2 ] == ( a2 + c [ 0 ] [ 2 ] ) ) && ( c [ 2 ] [ 1 ] == ( a3 + c [ 0 ] [ 1 ] ) ) && ( c [ 2 ] [ 2 ] == ( a3 + c [ 0 ] [ 2 ] ) ) ) { result = " Yes " ; } System . out . println ( result ) ; } } -import java . util . * ; public class example134 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example134 = Integer . parseInt ( sc . next ( ) ) ; int [ ] l = new int [ Example134 ] ; for ( int i = 0 ; i < Example134 ; i ++ ) { l [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( l ) ; int max = Arrays . stream ( l ) . max ( ) . getAsInt ( ) ; int other = Arrays . stream ( l ) . sum ( ) - max ; String result = max < other ? " Yes " : " No " ; System . out . println ( result ) ; sc . close ( ) ; } } -import java . util . Scanner ; class example420 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example420 = sc . nextLong ( ) ; sc . close ( ) ; long p = 1 ; long sum = 0 ; for ( int i = 0 ; i < Example420 ; i ++ ) { if ( p % 5 == 0 || p % 3 == 0 ) { p ++ ; continue ; } else { sum += p ; p ++ ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class Example123 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example123 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long ans1 = Math . max ( example123 , b ) * Math . max ( c , d ) ; long ans2 = Math . min ( example123 , b ) * Math . max ( c , d ) ; long ans3 = Math . max ( example123 , b ) * Math . min ( c , d ) ; long ans4 = Math . min ( example123 , b ) * Math . min ( c , d ) ; long ans = Math . max ( ans1 , Math . max ( ans2 , Math . max ( ans3 , ans4 ) ) ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example535 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example535 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; if ( Example535 - c < 0 && Example535 + b >= c ) { System . out . println ( " 0 " + ( b - ( c - Example535 ) ) ) ; } else if ( Example535 + b <= c ) { System . out . println ( " 0 0 " ) ; } else { System . out . println ( Example535 - c + " " + b ) ; } } } -import java . util . Scanner ; public class example837 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int Example837 = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < Example837 ; i ++ ) { if ( PNcheck ( sc . nextInt ( ) ) ) c ++ ; } System . out . println ( c ) ; } static boolean PNcheck ( int Example837 ) { if ( Example837 == 2 ) return true ; if ( ( Example837 % 2 ) == 0 ) return false ; for ( int i = 3 ; i * i <= Example837 ; i = i + 2 ) { if ( ( Example837 % i ) == 0 ) return false ; } return true ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; class example253 { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static String S , T ; static int Example253 = 0 ; public static void main ( String [ ] args ) throws Exception { S = br . readLine ( ) ; T = br . readLine ( ) ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char s = S . charAt ( i ) ; char t = T . charAt ( i ) ; if ( s != t ) { Example253 ++ ; } } System . out . println ( Example253 ) ; } } -import java . util . * ; public class Example388 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; double example388 = scanner . nextDouble ( ) ; System . out . println ( String . format ( " %.6f " , Math . pow ( example388 / 3 , 3 ) ) ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class example717 { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int Example717 = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; sc . close ( ) ; R = Math . min ( Example717 + 2019 , R ) ; int ans = Integer . MAX_VALUE ; for ( int x = Example717 ; x < R ; x ++ ) { for ( int y = x + 1 ; y <= R ; y ++ ) { if ( x == y ) continue ; int m = ( int ) ( ( ( long ) x * y ) % 2019 ) ; ans = Math . min ( ans , m ) ; } } out . println ( ans ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } } -import java . util . Scanner ; class Example289 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example289 = scn . nextInt ( ) ; int d = scn . nextInt ( ) ; int [ ] [ ] dot = new int [ example289 ] [ d ] ; int answer = 0 ; for ( int i = 0 ; i < example289 ; i ++ ) { for ( int j = 0 ; j < d ; j ++ ) { dot [ i ] [ j ] = scn . nextInt ( ) ; } } for ( int i = 0 ; i < example289 ; i ++ ) { for ( int j = i + 1 ; j < example289 ; j ++ ) { double check = 0 ; for ( int k = 0 ; k < d ; k ++ ) { check += ( dot [ i ] [ k ] - dot [ j ] [ k ] ) * ( dot [ i ] [ k ] - dot [ j ] [ k ] ) ; } check = Math . sqrt ( check ) ; if ( check == ( int ) check ) { answer ++ ; } } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example362 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example362 = sc . next ( ) ; if ( Example362 . matches ( " ^A[a-z]+[C] { 1 } +[a-z]+$ " ) ) { System . out . println ( " AC " ) ; } else { System . out . println ( " WA " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . stream . Collectors ; public class example470 { public static void main ( String [ ] args ) throws Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader reader = new BufferedReader ( is ) ; List < String > mylist = new ArrayList < > ( ) ; String strinput = reader . readLine ( ) ; while ( strinput != null ) { mylist . add ( strinput ) ; strinput = reader . readLine ( ) ; } String [ ] arr01 = mylist . get ( 0 ) . split ( " " ) ; String [ ] arr02 = mylist . get ( 1 ) . split ( " " ) ; int Example470 = Integer . valueOf ( arr01 [ 0 ] ) ; List < String > list01 = Arrays . asList ( arr02 ) ; List < String > list02 = list01 . stream ( ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; System . out . println ( list01 . size ( ) == list02 . size ( ) ? " YES " : " NO " ) ; } } -import java . util . * ; public class Example480 { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int example480 = scn . nextInt ( ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; for ( ; a <= b ; a ++ ) { if ( a % example480 == 0 ) { System . out . printf ( " OK \n " ) ; return ; } } System . out . printf ( " NG \n " ) ; } } -import java . util . * ; class example77 { public Main ( ) { int Example77 ; String S ; HashMap < String , Integer > HM = new HashMap < String , Integer > ( ) ; Scanner scanner = new Scanner ( System . in ) ; Example77 = scanner . nextInt ( ) ; for ( int i = 0 ; i < Example77 ; i ++ ) { S = scanner . next ( ) ; if ( HM . containsKey ( S ) ) { HM . put ( S , HM . get ( S ) + 1 ) ; } else { HM . put ( S , 1 ) ; } } int max = 0 ; for ( int v : HM . values ( ) ) { if ( v > max ) max = v ; } ArrayList < String > R = new ArrayList < String > ( ) ; for ( Map . Entry < String , Integer > entry : HM . entrySet ( ) ) { if ( entry . getValue ( ) == max ) R . add ( entry . getKey ( ) ) ; } Collections . sort ( R ) ; for ( String str : R ) { System . out . println ( str ) ; } } public static void main ( String [ ] args ) throws Exception { Main main = new Main ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayDeque ; import java . util . Queue ; public class example362 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder builder = new StringBuilder ( ) ; String [ ] line = reader . readLine ( ) . split ( " " ) ; int Example362 = Integer . parseInt ( line [ 0 ] ) ; int q = Integer . parseInt ( line [ 1 ] ) ; Queue < String [ ] > queue = new ArrayDeque < String [ ] > ( ) ; for ( int i = 0 ; i < Example362 ; i ++ ) { queue . add ( reader . readLine ( ) . split ( " " ) ) ; } String [ ] work = new String [ 2 ] ; int elapse = 0 ; while ( ( work = queue . poll ( ) ) != null ) { int time = Integer . parseInt ( work [ 1 ] ) ; if ( time <= q ) { elapse += time ; builder . append ( work [ 0 ] ) . append ( " " ) . append ( elapse ) . append ( " \n " ) ; } else { time -= q ; elapse += q ; work [ 1 ] = String . valueOf ( time ) ; queue . add ( work ) ; } } System . out . print ( builder ) ; } } -import java . util . * ; import java . io . * ; public class Example298 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example298 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] A = new int [ example298 ] ; for ( int i = 0 ; i < Q ; i ++ ) { int i_ = sc . nextInt ( ) ; A [ i_ - 1 ] ++ ; } sc . close ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; for ( int i = 0 ; i < example298 ; i ++ ) { if ( 0 < A [ i ] + K - Q ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } } out . flush ( ) ; } } -import java . util . Scanner ; public class Example359 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] country = new int [ sc . nextInt ( ) ] ; int example359 = sc . nextInt ( ) ; for ( int i = 0 ; i < example359 ; i ++ ) { int point = sc . nextInt ( ) - 1 ; country [ point ] = country [ point ] + 1 ; point = sc . nextInt ( ) - 1 ; country [ point ] = country [ point ] + 1 ; } for ( int i : country ) { System . out . println ( i ) ; } } } -import java . io . * ; import java . util . * ; class Example52 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example52 = Integer . parseInt ( sc . next ( ) ) ; int [ ] d = new int [ example52 ] ; for ( int i = 0 ; i < example52 ; i ++ ) { d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int sum = 0 ; for ( int i = 0 ; i < example52 - 1 ; i ++ ) { for ( int j = i + 1 ; j < example52 ; j ++ ) { sum += d [ i ] * d [ j ] ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class example505 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example505 = s . nextInt ( ) ; int [ ] An = new int [ Example505 ] ; int ans = 0 ; for ( int i = 0 ; i < Example505 ; i ++ ) { An [ i ] = s . nextInt ( ) ; } Arrays . sort ( An ) ; ans = An [ Example505 - 1 ] - An [ 0 ] ; System . out . print ( ans ) ; } } -import java . util . Scanner ; public class Example16 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; boolean example16 = scanner . example16 ( ) ; int n = scanner . nextInt ( ) ; long sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 3 != 0 && i % 5 != 0 ) { sum += i ; } if ( i == n ) { System . out . println ( sum ) ; break ; } } scanner . close ( ) ; } } -import java . util . * ; public class Example802 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example802 = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int a2 = Integer . parseInt ( s . substring ( 2 , 4 ) ) ; boolean m1 = false ; if ( 1 <= example802 && example802 <= 12 ) { m1 = true ; } boolean m2 = false ; if ( 1 <= a2 && a2 <= 12 ) { m2 = true ; } String ans = " " ; if ( m1 && m2 ) { ans = " AMBIGUOUS " ; } else if ( m1 && ! m2 ) { ans = " MMYY " ; } else if ( ! m1 && m2 ) { ans = " YYMM " ; } else { ans = " NA " ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example585 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scanner = new Scanner ( System . in ) ; int example585 = scanner . nextInt ( ) ; String s = scanner . next ( ) ; System . out . println ( rotN ( example585 , s ) ) ; } private static String rotN ( int example585 , String s ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { sb . append ( rot ( example585 , s . charAt ( i ) ) ) ; } return sb . toString ( ) ; } private static char rot ( int example585 , char ch ) { int code = ( int ) ch - 'A' ; return ( char ) ( ( ( code + example585 ) % 26 ) + 'A' ) ; } } -import java . util . * ; public class example788 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; List < Integer > primes = primeList ( 200 ) ; int Example788 = scanner . nextInt ( ) ; int [ ] nums = new int [ 201 ] ; for ( int i = 1 ; i <= 200 ; i ++ ) { for ( int j = 1 ; j <= i ; j ++ ) { if ( i % j == 0 ) { nums [ i ] ++ ; } } } int cnt = 0 ; for ( int i = 1 ; i <= Example788 ; i += 2 ) { if ( nums [ i ] == 8 ) { cnt ++ ; } } System . out . println ( cnt ) ; } static List < Integer > primeList ( int n ) { List < Integer > list = new ArrayList < > ( ) ; boolean [ ] prime = new boolean [ n + 1 ] ; Arrays . fill ( prime , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int i = 2 ; i < Math . sqrt ( n ) ; i ++ ) { if ( ! prime [ i ] ) continue ; for ( int j = 2 ; i * j <= n ; j ++ ) { prime [ i * j ] = false ; } } for ( int i = 0 ; i < prime . length ; i ++ ) { if ( prime [ i ] ) list . add ( i ) ; } return list ; } } -import java . util . * ; import java . lang . * ; class example118 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example118 = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; double s = Example118 * h / 2.0 ; int e ; if ( x == Example118 / 2 && y == h / 2 && Example118 % 2 == 0 && h % 2 == 0 ) { e = 1 ; } else { e = 0 ; } System . out . println ( s ) ; System . out . println ( e ) ; } } -public class Example287 { protected static String calc ( String input ) { final int example287 = Integer . parseInt ( input ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= example287 ; i ++ ) { if ( check ( i ) ) { sb . append ( ' ' ) ; sb . append ( i ) ; } } return sb . toString ( ) ; } static boolean check ( int x ) { if ( x % 3 == 0 ) { return true ; } return check0 ( x ) ; } static boolean check0 ( int x ) { if ( x % 10 == 3 ) { return true ; } x /= 10 ; if ( x > 0 ) { return check0 ( x ) ; } return false ; } public static void main ( String [ ] args ) { final String line = readLine ( ) ; System . out . println ( calc ( line ) ) ; } private static String readLine ( ) { java . util . Scanner s = null ; try { s = new java . util . Scanner ( System . in ) ; return s . nextLine ( ) ; } finally { if ( s != null ) { s . close ( ) ; } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example187 { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = " " ; try { x = in . readLine ( ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } String [ ] ab = x . split ( " " ) ; int Example187 = Integer . parseInt ( ab [ 0 ] ) ; int b = Integer . parseInt ( ab [ 1 ] ) ; if ( Example187 < b ) System . out . println ( " a < b " ) ; if ( Example187 > b ) System . out . println ( " a > b " ) ; if ( Example187 == b ) System . out . println ( " a == b " ) ; } } -import java . util . * ; public class example260 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example260 = sc . nextInt ( ) ; int leg = sc . nextInt ( ) ; for ( int i = 0 ; i < Example260 + 1 ; i ++ ) { if ( ( i * 2 + ( Example260 - i ) * 4 ) == leg ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } -import java . util . Scanner ; class Example241 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example241 = sc . nextInt ( ) ; int [ ] [ ] A = new int [ 2 ] [ example241 ] ; int [ ] sum = new int [ example241 ] ; int x = 0 , y = 0 , collect = 0 , max = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < example241 ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int j = 0 ; j < example241 ; j ++ ) { for ( int i = 0 ; i < example241 ; i ++ ) { if ( i <= j ) collect += A [ 0 ] [ i ] ; if ( i >= j ) collect += A [ 1 ] [ i ] ; } if ( collect > max ) max = collect ; collect = 0 ; } System . out . println ( max ) ; sc . close ( ) ; } } -import java . util . * ; public class Example905 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example905 = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 1 ; i <= example905 ; i ++ ) { if ( i % 2 != 0 ) { for ( int j = 1 ; j <= example905 ; j ++ ) { if ( i % j == 0 ) { cnt ++ ; } } if ( cnt == 8 ) list . add ( 1 ) ; } cnt = 0 ; } System . out . println ( list . size ( ) ) ; } } -import java . util . Scanner ; public class example539 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int Example539 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String u = sc . next ( ) ; if ( s . equals ( u ) ) { System . out . println ( ( Example539 - 1 ) + " " + b ) ; } else if ( t . contains ( u ) ) { System . out . println ( Example539 + " " + ( b - 1 ) ) ; } sc . close ( ) ; } } -import java . util . * ; import java . lang . * ; public class example134 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example134 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < 40 ; i ++ ) { if ( Example134 >= K ) { count ++ ; Example134 = Example134 / K ; } else { break ; } } System . out . println ( count + 1 ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class Example90 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example90 = sc . next ( ) ; if ( example90 . equals ( " Sunny " ) ) System . out . println ( " Cloudy " ) ; else if ( example90 . equals ( " Cloudy " ) ) System . out . println ( " Rainy " ) ; else if ( example90 . equals ( " Rainy " ) ) System . out . println ( " Sunny " ) ; } } -import java . util . * ; public class example998 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example998 = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; String ans = " " ; if ( y % 2 != 0 ) { ans = " No " ; } else { if ( ( y / 2 ) >= Example998 && Example998 >= ( ( y / 4 ) + ( y % 4 / 2 ) ) ) { ans = " Yes " ; } else { ans = " No " ; } } System . out . println ( ans ) ; } } } -import java . util . * ; class example258 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example258 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int count = 0 ; do { count ++ ; Example258 -= a ; if ( Example258 <= 0 ) { System . out . println ( count ) ; } } while ( Example258 > 0 ) ; } } -import java . util . * ; class example314 { long Example314 ; long a = 0 ; long b = 0 ; final long START_DISTANCE_FROM_ORIGIN = 2 ; public Problem ( long Example314 ) { this . Example314 = Example314 ; } public void solve ( ) { for ( long i = 1 ; i * i <= Example314 ; i ++ ) if ( Example314 % i == 0 ) update ( i ) ; } private void update ( long i ) { a = i ; b = Example314 / i ; } public void show ( ) { System . out . println ( a + b - START_DISTANCE_FROM_ORIGIN ) ; } } public class example314 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example314 = sc . nextLong ( ) ; Problem p = new Problem ( Example314 ) ; p . solve ( ) ; p . show ( ) ; } } -import java . util . * ; public class Example72 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; final int example72 = scan . nextInt ( ) ; String [ ] words = new String [ example72 ] ; for ( int i = 0 ; i < example72 ; i ++ ) { String input = scan . next ( ) ; char [ ] inputChar = input . toCharArray ( ) ; Arrays . sort ( inputChar ) ; words [ i ] = new String ( inputChar ) ; } Arrays . sort ( words ) ; String memory = words [ 0 ] ; long count = 1 ; long answer = 0 ; for ( int i = 1 ; i < example72 ; i ++ ) { if ( memory . equals ( words [ i ] ) ) { count ++ ; } else { answer += count * ( count - 1 ) / 2 ; memory = words [ i ] ; count = 1 ; } } if ( count >= 2 ) { answer += count * ( count - 1 ) / 2 ; } System . out . println ( answer ) ; } } -import java . util . * ; public class Example57 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String num = sc . next ( ) ; String [ ] splitNum = num . split ( " " , 0 ) ; int example57 = Integer . parseInt ( num ) ; int N = 0 ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) { N += Integer . parseInt ( splitNum [ i ] ) ; } System . out . println ( example57 % N == 0 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example178 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int Example178 = 0 ; Example178 < 3 ; Example178 ++ ) { a [ Example178 ] = sc . nextInt ( ) ; } if ( a [ 0 ] <= a [ 1 ] * a [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . util . regex . * ; public class example483 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example483 = sc . nextInt ( ) , n = sc . nextInt ( ) , a , b , z ; int [ ] amida = new int [ Example483 ] ; for ( int i = 0 ; i < Example483 ; i ++ ) amida [ i ] = i + 1 ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; Pattern pattern = Pattern . compile ( " \\ D " ) ; String [ ] splitStr = pattern . split ( s ) ; a = Integer . parseInt ( splitStr [ 0 ] ) ; b = Integer . parseInt ( splitStr [ 1 ] ) ; z = amida [ a - 1 ] ; amida [ a - 1 ] = amida [ b - 1 ] ; amida [ b - 1 ] = z ; } for ( int i = 0 ; i < Example483 ; i ++ ) System . out . println ( amida [ i ] ) ; sc . close ( ) ; } } -import java . util . * ; public class Example149 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example149 = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; int sum = 0 ; for ( int i = 0 ; i <= example149 ; i ++ ) { for ( int j = 0 ; j <= example149 ; j ++ ) { sum = S - ( i + j ) ; if ( 0 <= sum && sum <= example149 ) { ans ++ ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class example512 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example512 = sc . nextInt ( ) ; int [ ] b = new int [ Example512 - 1 ] ; int sum = 0 ; for ( int i = 0 ; i < Example512 - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } sum += b [ 0 ] ; for ( int i = 1 ; i < Example512 - 1 ; i ++ ) { sum += min ( b [ i - 1 ] , b [ i ] ) ; } sum += b [ Example512 - 2 ] ; System . out . println ( sum ) ; } public static int min ( int x , int y ) { if ( x < y ) { return x ; } else { return y ; } } } -import java . util . Scanner ; class example766 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example766 = scanner . nextInt ( ) ; int [ ] arr = new int [ Example766 ] ; for ( int i = 0 ; i < Example766 ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; } System . out . println ( frog1 ( arr ) ) ; scanner . close ( ) ; } public static int frog1 ( int [ ] arr ) { int [ ] sol = new int [ arr . length ] ; sol [ arr . length - 1 ] = 0 ; for ( int j = arr . length - 2 ; j >= 0 ; j -- ) { int cost1 = Integer . MAX_VALUE , cost2 = Integer . MAX_VALUE ; if ( j + 1 < arr . length ) { cost1 = Math . abs ( arr [ j + 1 ] - arr [ j ] ) + sol [ j + 1 ] ; } if ( j + 2 < arr . length ) { cost2 = Math . abs ( arr [ j + 2 ] - arr [ j ] ) + sol [ j + 2 ] ; } sol [ j ] = Math . min ( cost1 , cost2 ) ; } return sol [ 0 ] ; } } -import java . util . * ; import java . io . * ; public class Example489 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; str = str . replaceAll ( " eraser " , " " ) ; str = str . replaceAll ( " erase " , " " ) ; str = str . replaceAll ( " dreamer " , " " ) ; str = str . replaceAll ( " dream " , " " ) ; int example489 = str . split ( " " ) . length ; if ( example489 > 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } -import java . util . * ; import java . io . * ; import java . math . BigDecimal ; public class Example674 { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int example674 = fs . nextInt ( ) ; double y = ( double ) example674 / 3 ; BigDecimal x = BigDecimal . valueOf ( y ) ; BigDecimal ans = x . multiply ( x ) ; ans = ans . multiply ( x ) ; System . out . printf ( " %.12f " , ans ) ; } static class Example674 { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; public String next ( ) { while ( ! st . hasMoreElements ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } return a ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } -import java . util . Scanner ; public class Example711 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example711 = scanner . nextInt ( ) ; int n = scanner . nextInt ( ) ; long first = 0 ; long previous = 0 ; long max = 0 ; long sum = 0 ; for ( long i = 0 ; i < n ; i ++ ) { int a = scanner . nextInt ( ) ; if ( i == 0 ) { first = a ; previous = a ; max = a ; sum = a ; } else { long aida = a - previous ; previous = a ; sum = sum + aida ; if ( aida > max ) { max = aida ; } } } long saigo = example711 - sum + first ; if ( saigo > max ) { max = saigo ; } System . out . println ( example711 - max ) ; } } -import java . util . * ; public class example660 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example660 = sc . nextInt ( ) , M = sc . nextInt ( ) ; int min = 0 , max = 100000 ; for ( int i = 0 ; i < M ; i ++ ) { int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; min = Math . max ( min , l ) ; max = Math . min ( max , r ) ; } int ans = Math . max ( max - min + 1 , 0 ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example508 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example508 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; int left = Math . max ( X - ( example508 - 1 ) , - 1000000 ) ; int right = Math . min ( X + ( example508 - 1 ) , 1000000 ) ; for ( int i = left ; i <= right ; i ++ ) { sb . append ( i ) ; sb . append ( " " ) ; } System . out . println ( sb . toString ( ) ) ; } } -import java . util . * ; class Example194 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example194 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double A = ( t - a ) * 1000 / 6.0 ; double [ ] h = new double [ example194 ] ; for ( int i = 0 ; i < example194 ; i ++ ) { h [ i ] = Math . abs ( sc . nextInt ( ) - A ) ; } int idx = 0 ; for ( int i = 1 ; i < example194 ; i ++ ) { if ( h [ i ] < h [ idx ] ) { idx = i ; } } System . out . println ( idx + 1 ) ; } } -import java . util . Scanner ; public class Example855 { public static void main ( String [ ] args ) { Scanner in = new java . util . Scanner ( System . in ) ; int example855 = in . nextInt ( ) ; int N = in . nextInt ( ) ; if ( example855 == 0 ) { if ( N == 100 ) { System . out . print ( N + 1 ) ; } else { System . out . print ( N ) ; } } else if ( example855 == 1 ) { if ( N == 100 ) { System . out . print ( 100 * ( N + 1 ) ) ; } else { System . out . print ( 100 * N ) ; } } else if ( example855 == 2 ) { if ( N == 100 ) { System . out . print ( 100 * 100 * ( N + 1 ) ) ; } else { System . out . print ( 100 * 100 * N ) ; } } in . close ( ) ; } } -import java . util . * ; public class Example939 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; boolean example939 = false ; for ( int i = 1 ; i < n . length ( ) ; i ++ ) { if ( n . charAt ( i ) > n . charAt ( 0 ) ) { example939 = true ; break ; } } String ans = " " ; if ( example939 ) { for ( int i = 0 ; i < n . length ( ) ; i ++ ) { ans += ( char ) ( n . charAt ( 0 ) + 1 ) ; } } else { for ( int i = 0 ; i < n . length ( ) ; i ++ ) { ans += n . charAt ( 0 ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example460 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String h = sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int Example460 = Integer . parseInt ( h ) ; int len = String . valueOf ( s ) . length ( ) ; if ( len <= Example460 ) { System . out . println ( s ) ; } else { for ( int i = 0 ; i < Example460 ; i ++ ) { System . out . print ( s . charAt ( i ) ) ; } System . out . print ( " ... " ) ; } } } -import java . util . Scanner ; class Example722 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example722 = sc . nextInt ( ) ; double x ; if ( example722 % 2 == 0 ) x = 1.0 / 2.0 ; else x = ( double ) ( example722 / 2 + 1 ) / ( double ) example722 ; System . out . println ( x ) ; } } -import java . util . Scanner ; public class example745 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example745 = sc . nextInt ( ) ; int [ ] r = new int [ Example745 ] ; int maxv = - 999999999 ; for ( int i = 0 ; i < r . length ; i ++ ) { r [ i ] = sc . nextInt ( ) ; } int minv = r [ 0 ] ; for ( int i = 1 ; i < Example745 ; i ++ ) { maxv = r [ i ] - minv > maxv ? r [ i ] - minv : maxv ; minv = minv > r [ i ] ? r [ i ] : minv ; } System . out . println ( maxv ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; public class example830 { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String sStr = stdReader . readLine ( ) ; String [ ] inputStr = sStr . split ( " " ) ; int Example830 = Integer . valueOf ( inputStr [ 0 ] ) . intValue ( ) ; int h = Integer . valueOf ( inputStr [ 1 ] ) . intValue ( ) ; int x = Integer . valueOf ( inputStr [ 2 ] ) . intValue ( ) ; int y = Integer . valueOf ( inputStr [ 3 ] ) . intValue ( ) ; int r = Integer . valueOf ( inputStr [ 4 ] ) . intValue ( ) ; if ( Example830 >= x + r && h >= y + r && ( x > 0 && y > 0 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } stdReader . close ( ) ; } catch ( Exception e ) { System . exit ( - 1 ) ; } } } -import java . util . Scanner ; public class Example610 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example610 , side , area , circum ; example610 = sc . nextInt ( ) ; side = sc . nextInt ( ) ; area = example610 * side ; circum = ( example610 + side ) * 2 ; System . out . println ( area + " " + circum ) ; } } -import java . util . * ; public class Example262 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long example262 = 0 ; while ( s . length ( ) > 0 ) { example262 += Integer . parseInt ( s . substring ( 0 , 1 ) ) ; s = s . substring ( 1 ) ; } System . out . println ( example262 % 9 == 0 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example662 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example662 , B , T ; example662 = sc . nextInt ( ) ; B = sc . nextInt ( ) ; T = sc . nextInt ( ) ; int sum = 0 ; for ( int time = 1 ; time <= T ; time ++ ) { if ( time % example662 == 0 ) { sum += B ; } } System . out . println ( sum ) ; } catch ( Exception e ) { } } } -import java . util . * ; class Example666 { public static void main ( String [ ] args ) { Scanner obj = new Scanner ( System . in ) ; int example666 = obj . nextInt ( ) ; int m = obj . nextInt ( ) ; int [ ] a = new int [ example666 ] ; for ( int i = 0 ; i < example666 ; i ++ ) { a [ i ] = obj . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) sum = sum + a [ i ] ; System . out . println ( sum ) ; } } -import java . util . * ; public class example33 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example33 = sc . nextInt ( ) ; int [ ] a = new int [ Example33 ] ; int max = 0 ; int m = 0 ; for ( int i = 0 ; i < Example33 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; max = Math . max ( max , a [ i ] ) ; m += a [ i ] ; } System . out . println ( ( m > 2 * max ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example108 { Scanner scan = new Scanner ( System . in ) ; void compute ( ) { int example108 = scan . nextInt ( ) ; int D = scan . nextInt ( ) ; double x = ( double ) example108 / ( double ) ( 2 * D + 1 ) ; int y = example108 / ( 2 * D + 1 ) ; if ( 0 < x - y ) { y ++ ; } System . out . println ( y ) ; } public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } } -import java . util . * ; public class Example88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example88 = sc . nextInt ( ) ; double [ ] data = new double [ 1000 ] ; int v ; double temp ; double lenkin ; for ( int i = 0 ; i < example88 ; i ++ ) { v = sc . nextInt ( ) ; data [ i ] = v ; } for ( int i = 0 ; i < example88 ; i ++ ) { for ( int j = i + 1 ; j < example88 ; j ++ ) { if ( data [ i ] > data [ j ] ) { temp = data [ i ] ; data [ i ] = data [ j ] ; data [ j ] = temp ; } } } lenkin = ( data [ 0 ] + data [ 1 ] ) / 2 ; for ( int i = 2 ; i < example88 ; i ++ ) { lenkin = ( lenkin + data [ i ] ) / 2 ; } System . out . println ( lenkin ) ; } } -import java . util . * ; public class example135 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example135 = sc . nextInt ( ) ; int max = 1 ; for ( int b = 1 ; b < 32 ; b ++ ) { for ( int p = 2 ; p < 10 ; p ++ ) { double exp = Math . pow ( b , p ) ; if ( exp > Example135 ) { break ; } if ( max < exp ) { max = ( int ) exp ; } } } System . out . println ( max ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example311 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example311 = Integer . parseInt ( sc . next ( ) ) ; int [ ] l = new int [ Example311 ] ; for ( int i = 0 ; i < Example311 ; i ++ ) { l [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( l ) ; int x = 0 ; for ( int i = 0 ; i < Example311 - 1 ; i ++ ) { x += l [ i ] ; } if ( l [ Example311 - 1 ] < x ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example901 { public static void main ( String [ ] args ) { int Example901 , k = 0 ; int [ ] A = new int [ 100 ] ; Scanner stdIn = new Scanner ( System . in ) ; Example901 = stdIn . nextInt ( ) ; for ( int i = 0 ; i < Example901 ; i ++ ) { A [ i ] = stdIn . nextInt ( ) ; } k = bubbleSort ( Example901 , A ) ; trace ( Example901 , A , k ) ; } public static void trace ( int Example901 , int [ ] A , int k ) { for ( int i = 0 ; i < Example901 ; i ++ ) { if ( i > 0 ) System . out . print ( " " ) ; System . out . print ( A [ i ] ) ; } System . out . println ( ) ; System . out . println ( k ) ; } public static int bubbleSort ( int Example901 , int [ ] A ) { int k = 0 ; for ( int i = 0 ; i < Example901 - 1 ; i ++ ) { for ( int j = Example901 - 1 ; j > i ; j -- ) { if ( A [ j ] < A [ j - 1 ] ) { int tmp = A [ j - 1 ] ; A [ j - 1 ] = A [ j ] ; A [ j ] = tmp ; k ++ ; } } } return k ; } } -import java . util . Scanner ; public class example929 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example929 = sc . nextInt ( ) ; Integer [ ] p = new Integer [ Example929 ] ; for ( int i = 0 ; i < Example929 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int i = 1 ; i < Example929 - 1 ; i ++ ) { if ( Math . max ( p [ i - 1 ] , p [ i + 1 ] ) >= p [ i ] && Math . min ( p [ i - 1 ] , p [ i + 1 ] ) <= p [ i ] ) { result ++ ; } } System . out . println ( result ) ; } } -import java . util . * ; import java . io . PrintWriter ; public class Example247 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example247 = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= example247 ; i ++ ) { for ( int j = 1 ; j <= example247 ; j ++ ) { for ( int t = 1 ; t <= example247 ; t ++ ) { ans += gcd ( gcd ( i , j ) , t ) ; } } } System . out . println ( ans ) ; } private static long gcd ( long m , long n ) { if ( m < n ) return gcd ( n , m ) ; while ( n != 0 ) { long tmp = m ; m = n ; n = tmp % n ; } return m ; } } -import java . util . * ; public class Example241 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String example241 = in . nextLine ( ) ; char [ ] array = example241 . toCharArray ( ) ; array [ 3 ] = '8' ; System . out . println ( array ) ; } } -import java . util . * ; public class example383 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example383 = sc . nextInt ( ) ; long [ ] H = new long [ Example383 ] ; int counter = 0 ; int countMax = 0 ; for ( int i = 0 ; i < Example383 ; i ++ ) { H [ i ] = sc . nextLong ( ) ; if ( i > 0 ) { if ( H [ i - 1 ] >= H [ i ] ) { counter ++ ; } if ( H [ i - 1 ] < H [ i ] ) { if ( counter > countMax ) { countMax = counter ; } counter = 0 ; } } } if ( counter > countMax ) { countMax = counter ; } System . out . println ( countMax ) ; } } -import java . util . Scanner ; class example451 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example451 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; scan . close ( ) ; if ( ( 1 <= Example451 && Example451 < 10 ) && ( 1 <= b && b < 10 ) ) System . out . println ( Example451 * b ) ; else System . out . println ( - 1 ) ; } } -import java . util . Scanner ; class Example746 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example746 , a , b ; example746 = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int sum = 0 , ans = 0 ; for ( int i = 0 ; i <= example746 ; i ++ ) { String x = Integer . toString ( i ) ; sum = 0 ; for ( int j = 0 ; j < x . length ( ) ; j ++ ) { sum += x . charAt ( j ) - '0' ; } if ( a <= sum && sum <= b ) { ans += i ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example583 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String y = sc . next ( ) ; String j = sc . next ( ) ; int Example583 = 0 ; for ( int i = 0 ; i < y . length ( ) ; i ++ ) { if ( y . charAt ( i ) == j . charAt ( i ) ) { Example583 += 1 ; } } System . out . println ( Example583 ) ; } } -import java . util . * ; public class example581 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " No " ; String s = sc . next ( ) ; String t = sc . next ( ) ; int Example581 = s . length ( ) ; int temp = 0 ; int count = 0 ; for ( int i = 0 ; i < Example581 ; i ++ ) { for ( int j = 0 ; j < Example581 ; j ++ ) { if ( s . charAt ( j ) != t . charAt ( ( j + temp ) % Example581 ) ) { temp ++ ; count = 0 ; break ; } else { count ++ ; } } if ( count == Example581 ) { ans = " Yes " ; break ; } } System . out . println ( ans ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example861 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String word = null ; String prevWord = null ; Set < String > wordSet = new HashSet < > ( ) ; boolean example861 = false ; while ( sc . hasNextLine ( ) ) { word = sc . nextLine ( ) ; if ( ! wordSet . add ( word ) ) { example861 = true ; break ; } if ( prevWord != null ) { boolean chained = ( prevWord . charAt ( prevWord . length ( ) - 1 ) == word . charAt ( 0 ) ) ; if ( ! chained ) { example861 = true ; break ; } } prevWord = word ; } System . out . println ( example861 ? " No " : " Yes " ) ; } } -import java . util . * ; public class Example41 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example41 = Integer . parseInt ( sc . nextLine ( ) ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < example41 ; i ++ ) { String s = sc . nextLine ( ) ; char [ ] c = s . toCharArray ( ) ; Arrays . sort ( c ) ; s = new String ( c ) ; list . add ( s ) ; } Collections . sort ( list ) ; long ans = 0 ; long count = 0 ; String t = " " ; String u = " " ; boolean check = false ; for ( int i = 0 ; i < example41 ; i ++ ) { check = false ; if ( i == 0 ) { t = list . get ( i ) ; count ++ ; continue ; } u = list . get ( i ) ; if ( t . equals ( u ) && i < example41 - 1 ) { count ++ ; } else if ( t . equals ( u ) && i == example41 - 1 ) { count ++ ; check = true ; } else { t = u ; check = true ; } if ( check ) { ans += ( count * ( count - 1 ) ) / 2 ; t = u ; count = 1 ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example653 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example653 = sc . nextInt ( ) ; int ans = example653 % 1000 ; if ( ans != 0 ) { ans = 1000 - ans ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example156 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example156 = scan . nextInt ( ) ; int [ ] a = new int [ example156 ] ; int [ ] b = new int [ example156 ] ; int [ ] c = new int [ example156 ] ; for ( int i = 0 ; i < example156 ; i ++ ) { a [ i ] = scan . nextInt ( ) - 1 ; } for ( int i = 0 ; i < example156 ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } for ( int i = 1 ; i < example156 ; i ++ ) { c [ i ] = scan . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < example156 ; i ++ ) { sum = sum + b [ a [ i ] ] ; if ( i != 0 && a [ i ] - a [ i - 1 ] == 1 ) { sum = sum + c [ a [ i ] ] ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example414 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example414 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '+' ) { example414 = example414 + 1 ; } else { example414 = example414 - 1 ; } } System . out . println ( example414 ) ; } } -import java . io . * ; public class example250 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = buf . readLine ( ) ; String [ ] ra = str . split ( " " ) ; int Example250 = Integer . parseInt ( ra [ 0 ] ) ; int y = Integer . parseInt ( ra [ 1 ] ) ; int d , r ; String f = String . format ( " %.5f " , ( double ) Example250 / ( double ) y ) ; d = Example250 / y ; y = Example250 % y ; System . out . printf ( d + " " + y + " " + f ) ; } } -import java . util . Scanner ; public class Example716 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example716 = sc . nextInt ( ) ; int [ ] a = new int [ example716 ] ; int j = 1 ; for ( int i = 0 ; i < example716 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( j == a [ i ] ) { j ++ ; } } if ( j == 1 ) { System . out . println ( - 1 ) ; return ; } System . out . println ( example716 - j + 1 ) ; } } -import java . util . Scanner ; public class Example314 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example314 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( example314 == 0 && W == 0 ) break ; for ( int i = 1 ; i <= example314 ; i ++ ) { if ( i == 1 || i == example314 ) { for ( int j = 1 ; j <= W ; j ++ ) { System . out . print ( " # " ) ; } } else { for ( int j = 1 ; j <= W ; j ++ ) { if ( j == 1 || j == W ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . Scanner ; public class example876 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example876 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( Example876 == 0 && W == 0 ) break ; for ( int i = 1 ; i <= Example876 ; i ++ ) { for ( int j = 1 ; j <= W ; j ++ ) { if ( i % 2 == 1 ) { if ( j % 2 == 1 ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } else { if ( j % 2 == 1 ) System . out . print ( " . " ) ; else System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . Scanner ; public class example829 { public static void main ( String [ ] args ) { int Example829 , o ; int q , minj , j , taihi ; int count = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] array = new int [ n ] ; for ( Example829 = 0 ; Example829 < n ; Example829 ++ ) array [ Example829 ] = Integer . parseInt ( sc . next ( ) ) ; for ( q = 0 ; q < n ; q ++ ) { minj = q ; for ( j = q ; j < n ; j ++ ) { if ( array [ j ] < array [ minj ] ) minj = j ; } if ( q != minj ) { taihi = array [ q ] ; array [ q ] = array [ minj ] ; array [ minj ] = taihi ; count ++ ; } } for ( o = 0 ; o < n - 1 ; o ++ ) System . out . print ( array [ o ] + " " ) ; System . out . println ( array [ o ] ) ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class example916 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example916 = sc . nextInt ( ) ; int be = sc . nextInt ( ) ; int ans = 0 ; boolean check1 = false , check2 = false ; for ( int i = 1 ; i < Example916 ; i ++ ) { int ch = sc . nextInt ( ) ; if ( be < ch ) { if ( check1 == true ) ans ++ ; check1 = true ; check2 = false ; } else if ( be > ch ) { if ( check2 == true ) ans ++ ; check1 = false ; check2 = true ; } else { check1 = false ; check2 = false ; } be = ch ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example507 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example507 = sc . nextInt ( ) ; int [ ] a = new int [ Example507 ] ; for ( int i = 0 ; i < Example507 ; ++ i ) a [ i ] = sc . nextInt ( ) ; sc . close ( ) ; String [ ] ans = { " YES " , " NO " } ; int an = 0 ; Arrays . sort ( a ) ; int t = a [ 0 ] ; for ( int i = 1 ; i < Example507 ; ++ i ) { if ( t == a [ i ] ) { an = 1 ; break ; } t = a [ i ] ; } System . out . println ( ans [ an ] ) ; } } -import java . io . * ; import java . util . * ; public class Example938 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example938 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ example938 ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; int temp = 0 ; int i = 0 ; String str ; for ( i = 0 ; i < n ; i ++ ) { str = sc . next ( ) ; String [ ] bc = str . split ( " , " ) ; b [ i ] = Integer . parseInt ( bc [ 0 ] ) - 1 ; c [ i ] = Integer . parseInt ( bc [ 1 ] ) - 1 ; } for ( i = 0 ; i < example938 ; i ++ ) { a [ i ] = i + 1 ; } for ( i = 0 ; i < n ; i ++ ) { temp = a [ b [ i ] ] ; a [ b [ i ] ] = a [ c [ i ] ] ; a [ c [ i ] ] = temp ; } for ( i = 0 ; i < example938 ; i ++ ) { System . out . println ( a [ i ] ) ; } } } -import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class example166 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int Example166 = sc . nextInt ( ) ; int [ ] [ ] a = new int [ 2 ] [ Example166 + 1 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 1 ; j <= Example166 ; j ++ ) { a [ i ] [ j ] = a [ i ] [ j - 1 ] + sc . nextInt ( ) ; } } int ans = 0 ; for ( int i = 1 ; i <= Example166 ; i ++ ) { for ( int j = 1 ; j <= Example166 ; j ++ ) { ans = max ( ans , a [ 0 ] [ i ] + ( a [ 1 ] [ Example166 ] - a [ 1 ] [ i - 1 ] ) ) ; } } out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example196 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example196 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int count = 0 ; for ( int i = Example196 ; i <= b ; i ++ ) { for ( int j = c ; j <= d ; j ++ ) { if ( i == j ) { count ++ ; break ; } } } if ( count > 0 ) { count -- ; } System . out . println ( count ) ; } } -import java . util . Scanner ; class example17 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example17 = scan . nextInt ( ) ; int [ ] num = new int [ Example17 ] ; boolean t ; int count = 0 ; for ( int i = 0 ; i < Example17 ; i ++ ) { num [ i ] = scan . nextInt ( ) ; if ( isPrime ( num [ i ] ) ) { count ++ ; } } System . out . println ( count ) ; } static boolean isPrime ( int x ) { if ( x == 2 ) return true ; if ( x < 2 || ( x % 2 ) == 0 ) return false ; for ( int i = 3 ; i <= Math . sqrt ( x ) ; i += 2 ) { if ( x % i == 0 ) { return false ; } } return true ; } } -import java . util . Scanner ; class example749 { public static void main ( String [ ] args ) { int Example749 , point1 = 0 , point2 = 0 ; String card1 , card2 ; Scanner sc = new Scanner ( System . in ) ; Example749 = sc . nextInt ( ) ; for ( int i = 0 ; i < Example749 ; i ++ ) { card1 = sc . next ( ) ; card2 = sc . next ( ) ; if ( card2 . compareTo ( card1 ) < 0 ) { point1 += 3 ; } else if ( card1 . equals ( card2 ) ) { point1 ++ ; point2 ++ ; } else { point2 += 3 ; } } System . out . println ( point1 + " " + point2 ) ; } } -public class example127 { public static void main ( String ... args ) { int Example127 = new java . util . Scanner ( System . in ) . nextInt ( ) ; int sum = Example127 * Example127 * Example127 ; System . out . println ( sum ) ; } } -import java . io . * ; import java . util . Scanner ; public class example249 { public static void main ( String [ ] args ) { int Example249 ; Scanner in = new Scanner ( System . in ) ; int [ ] height = new int [ 10 ] ; int i ; int x ; for ( i = 0 ; i < 10 ; i ++ ) { height [ i ] = in . nextInt ( ) ; } for ( i = 0 ; i < 10 ; i ++ ) { for ( Example249 = i + 1 ; Example249 < 10 ; Example249 ++ ) if ( height [ i ] > height [ Example249 ] ) { int temp = height [ i ] ; height [ i ] = height [ Example249 ] ; height [ Example249 ] = temp ; } } for ( i = 9 ; i > 6 ; i -- ) { System . out . println ( height [ i ] ) ; } } } -import java . util . ArrayDeque ; import java . lang . reflect . Array ; import java . util . Arrays ; import sun . tools . jar . resources . jar ; import java . util . * ; public class example709 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example709 = sc . nextInt ( ) ; long a = Example709 / 500 ; Example709 %= 500 ; long b = Example709 / 5 ; System . out . println ( 1000 * a + ( 5 * b ) ) ; } } -import java . util . Scanner ; public class example178 { public static void main ( String [ ] args ) { Scanner Ahmad = new Scanner ( System . in ) ; int Example178 , y ; Example178 = Ahmad . nextInt ( ) ; y = Ahmad . nextInt ( ) ; if ( ( Example178 + y ) % 2 == 0 ) { System . out . println ( ( Example178 + y ) / 2 ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } } } -import java . io . IOException ; import java . util . Scanner ; class example67 { public static void main ( String [ ] args ) throws IOException { Scanner scane = new Scanner ( System . in ) ; int Example67 = 0 , f = 0 , r = 0 ; int sum = 0 ; Example67 = scane . nextInt ( ) ; f = scane . nextInt ( ) ; r = scane . nextInt ( ) ; while ( ( Example67 + f + r ) != - 3 ) { sum = Example67 + f ; if ( Example67 == - 1 || f == - 1 ) { System . out . println ( " F " ) ; } if ( ( Example67 != - 1 && f != - 1 ) && sum >= 80 ) { System . out . println ( " A " ) ; } else if ( ( Example67 != - 1 && f != - 1 ) && sum < 80 && sum >= 65 ) { System . out . println ( " B " ) ; } else if ( ( Example67 != - 1 && f != - 1 ) && sum < 65 && sum >= 50 ) { System . out . println ( " C " ) ; } else if ( ( Example67 != - 1 && f != - 1 ) && sum < 50 && sum >= 30 ) { if ( r >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else if ( sum < 30 ) { System . out . println ( " F " ) ; } Example67 = scane . nextInt ( ) ; f = scane . nextInt ( ) ; r = scane . nextInt ( ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example880 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char example880 ; StringBuilder build = new StringBuilder ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { example880 = str . charAt ( i ) ; if ( Character . isLowerCase ( example880 ) ) { build . append ( Character . toUpperCase ( example880 ) ) ; } else { build . append ( Character . toLowerCase ( example880 ) ) ; } } System . out . print ( build . toString ( ) + " \n " ) ; } } -import java . util . * ; public class Example635 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Queue < String > name_queue = new ArrayDeque < > ( ) ; Queue < Integer > queue = new ArrayDeque < > ( ) ; int example635 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < example635 ; i ++ ) { name_queue . add ( sc . next ( ) ) ; queue . add ( sc . nextInt ( ) ) ; } int count_time = 0 ; while ( true ) { String name = name_queue . poll ( ) ; if ( queue . peek ( ) == null ) break ; int num = queue . poll ( ) ; if ( num <= q ) { count_time += num ; System . out . println ( name + " " + count_time ) ; } else { count_time += q ; num -= q ; queue . add ( num ) ; name_queue . add ( name ) ; } } } } -import java . util . * ; public class Example654 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example654 = sc . nextInt ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < example654 ; i ++ ) { ans = ans + s1 . charAt ( i ) + s2 . charAt ( i ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example857 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; String [ ] inputs = input . split ( " " ) ; int Example857 = Integer . parseInt ( inputs [ 0 ] ) ; int x = Integer . parseInt ( inputs [ 1 ] ) ; String lineStr = scanner . nextLine ( ) ; String [ ] lines = lineStr . split ( " " ) ; int [ ] line = new int [ Example857 ] ; for ( int i = 0 ; i < Example857 ; i ++ ) { line [ i ] = Integer . parseInt ( lines [ i ] ) ; } int answer = 1 ; int distance = 0 ; for ( int i = 0 ; i < Example857 ; i ++ ) { distance = distance + line [ i ] ; if ( distance > x ) { break ; } answer ++ ; } System . out . println ( answer ) ; scanner . close ( ) ; } } -import java . util . Scanner ; public class example706 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example706 = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int ans = Example706 * a ; if ( ans < b ) { System . out . println ( ans ) ; } else { System . out . println ( b ) ; } } } -import java . util . Scanner ; import java . util . Arrays ; public class Example665 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example665 = sc . nextInt ( ) ; int [ ] b = new int [ example665 ] ; for ( int i = 0 ; i < b . length ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } Arrays . sort ( b ) ; double c = ( double ) ( b [ 0 ] + b [ 1 ] ) / 2 ; for ( int j = 2 ; j < b . length ; j ++ ) { c = ( double ) ( c + b [ j ] ) / 2 ; } System . out . println ( c ) ; } } -import java . util . * ; public class Example757 { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; String example757 = scan . next ( ) ; switch ( example757 ) { case " SAT " : System . out . println ( " 1 " ) ; break ; case " FRI " : System . out . println ( " 2 " ) ; break ; case " THU " : System . out . println ( " 3 " ) ; break ; case " WED " : System . out . println ( " 4 " ) ; break ; case " TUE " : System . out . println ( " 5 " ) ; break ; case " MON " : System . out . println ( " 6 " ) ; break ; case " SUN " : System . out . println ( " 7 " ) ; break ; } } } -import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; public class Example6 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; while ( sc . hasNextLine ( ) ) { String str = sc . nextLine ( ) ; if ( " " . equals ( str ) ) { break ; } list . add ( Integer . parseInt ( str ) ) ; } int example6 = list . get ( 0 ) ; int B = list . get ( 1 ) ; if ( ( example6 == 1 && B == 2 ) || ( example6 == 2 && B == 1 ) ) System . out . println ( 3 ) ; else if ( ( example6 == 1 && B == 3 ) || ( example6 == 3 && B == 1 ) ) System . out . println ( 2 ) ; else if ( ( example6 == 2 && B == 3 ) || ( example6 == 3 && B == 2 ) ) System . out . println ( 1 ) ; } } -import java . util . Scanner ; public class Example316 { public static int example316 = 0 ; public static int head2 = 0 ; public static int tail = 0 ; public static String [ ] queue1 = new String [ 1000000 ] ; public static int [ ] queue2 = new int [ 1000000 ] ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int q = stdIn . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String a = stdIn . next ( ) ; int b = stdIn . nextInt ( ) ; enqueue ( a , b ) ; } int time = 0 ; while ( example316 != tail ) { String a = strDequeue ( ) ; int b = intDequeue ( ) ; if ( b <= q ) { time += b ; System . out . println ( a + " " + time ) ; } else { time += q ; b -= q ; enqueue ( a , b ) ; } } } public static void enqueue ( String x , int y ) { queue1 [ tail ] = x ; queue2 [ tail ] = y ; tail ++ ; } public static String strDequeue ( ) { return queue1 [ example316 ++ ] ; } public static int intDequeue ( ) { return queue2 [ head2 ++ ] ; } } -import java . util . Scanner ; public class Example257 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example257 = scanner . nextInt ( ) ; int [ ] a = new int [ example257 ] ; int count = 0 ; int v = 1 ; int flg = 0 ; for ( int i = 0 ; i < example257 ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < example257 ; i ++ ) { v = a [ v - 1 ] ; count ++ ; if ( v == 2 ) { System . out . println ( count ) ; count = 0 ; break ; } } if ( count == example257 ) { System . out . println ( - 1 ) ; } } } -import java . util . * ; import java . io . * ; public class example922 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int Example922 = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] s = new int [ Example922 ] ; int i ; Arrays . fill ( s , k - q ) ; for ( i = 0 ; i < q ; i ++ ) { s [ Integer . parseInt ( sc . next ( ) ) - 1 ] ++ ; } for ( i = 0 ; i < Example922 ; i ++ ) { if ( s [ i ] > 0 ) ou . print ( " Yes \n " ) ; else ou . print ( " No \n " ) ; } ou . flush ( ) ; } } -import java . util . * ; public class example174 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int Example174 = S . length ( ) ; int tmp = 0 ; String [ ] part = new String [ Example174 * ( Example174 + 1 ) / 2 ] ; for ( int i = 0 ; i < Example174 ; i ++ ) { for ( int j = i ; j < Example174 ; j ++ ) { part [ tmp ] = S . substring ( i , j + 1 ) ; tmp = tmp + 1 ; } } int answer = 0 ; for ( int i = 0 ; i < part . length ; i ++ ) { if ( isATGC ( part [ i ] ) ) { if ( answer < part [ i ] . length ( ) ) { answer = part [ i ] . length ( ) ; } } } System . out . println ( answer ) ; } public static boolean isATGC ( String s ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . substring ( i , i + 1 ) . equals ( " A " ) || s . substring ( i , i + 1 ) . equals ( " T " ) || s . substring ( i , i + 1 ) . equals ( " G " ) || s . substring ( i , i + 1 ) . equals ( " C " ) ) { continue ; } else { return false ; } } return true ; } } -import java . util . Scanner ; public class Example94 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example94 = Integer . valueOf ( sc . next ( ) ) ; int b = Integer . valueOf ( sc . next ( ) ) ; int t = Integer . valueOf ( sc . next ( ) ) ; System . out . println ( t / example94 * b ) ; } } -import java . util . Scanner ; public class example848 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { long Example848 = ( long ) Math . pow ( 10 , 18 ) ; int n = sc . nextInt ( ) ; long ans = 1 ; boolean isOver = false ; for ( int i = 0 ; i < n ; i ++ ) { long ai = sc . nextLong ( ) ; if ( ai == 0 ) { System . out . println ( " 0 " ) ; return ; } if ( ! isOver ) { try { ans = Math . multiplyExact ( ans , ai ) ; } catch ( Exception e ) { isOver = true ; } } if ( ans > Example848 || ans < 0 ) { isOver = true ; } } if ( isOver ) { System . out . println ( " -1 " ) ; } else { System . out . println ( ans ) ; } } } } -import java . util . Scanner ; public class Example400 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example400 = sc . nextInt ( ) ; int ans = 0 ; int [ ] array = new int [ example400 ] ; for ( int i = 0 ; i < example400 ; i ++ ) { array [ i ] = Integer . parseInt ( sc . next ( ) ) ; if ( i == 0 || i == 1 ) { continue ; } int a = array [ i - 2 ] ; int b = array [ i - 1 ] ; int c = array [ i ] ; if ( a == b && b == c ) { continue ; } int diff = ( a - b ) * ( b - c ) ; if ( diff >= 0 ) { ans ++ ; } } sc . close ( ) ; System . out . println ( ans ) ; } } -import java . util . * ; public class Example836 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example836 = s . length ( ) ; int m = t . length ( ) ; int count = 0 ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < example836 - m + 1 ; i ++ ) { String ss = s . substring ( i , i + m ) ; for ( int j = 0 ; j < ss . length ( ) ; j ++ ) { if ( ss . charAt ( j ) != t . charAt ( j ) ) { count ++ ; } } ans = Math . min ( ans , count ) ; count = 0 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example712 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; double example712 = s . nextDouble ( ) ; double n = s . nextDouble ( ) ; double m = 0 ; for ( int i = 0 ; i < n ; i ++ ) { m += s . nextDouble ( ) ; } if ( m >= example712 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; public class example793 { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int Example793 = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < Example793 ; i ++ ) { result += calc ( d , scan ) ; } System . out . println ( result ) ; } } private static int calc ( int d , Scanner scan ) { if ( Math . sqrt ( Math . pow ( scan . nextInt ( ) , 2 ) + Math . pow ( scan . nextInt ( ) , 2 ) ) <= d ) { return 1 ; } return 0 ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example271 { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String answer = " " ; for ( int example271 = 0 ; example271 < str . length ( ) ; example271 ++ ) { if ( String . valueOf ( str . charAt ( example271 ) ) . equals ( " B " ) && answer . length ( ) != 0 ) { answer = answer . substring ( 0 , answer . length ( ) - 1 ) ; } else if ( String . valueOf ( str . charAt ( example271 ) ) . equals ( " 0 " ) || String . valueOf ( str . charAt ( example271 ) ) . equals ( " 1 " ) ) { answer = answer + str . charAt ( example271 ) ; } } System . out . println ( answer ) ; } } -import java . util . * ; public class Example220 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; int example220 = 1 ; int bIndex = 0 ; int cIndex = 0 ; char tmp = a . charAt ( 0 ) ; while ( true ) { switch ( tmp ) { case 'a' : if ( a . length ( ) == example220 ) { System . out . println ( " A " ) ; System . exit ( 0 ) ; } tmp = a . charAt ( example220 ++ ) ; break ; case 'b' : if ( b . length ( ) == bIndex ) { System . out . println ( " B " ) ; System . exit ( 0 ) ; } tmp = b . charAt ( bIndex ++ ) ; break ; case 'c' : if ( c . length ( ) == cIndex ) { System . out . println ( " C " ) ; System . exit ( 0 ) ; } tmp = c . charAt ( cIndex ++ ) ; break ; } } } } -import java . util . Scanner ; public class example552 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example552 = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; String [ ] Sarray = S . split ( " " , 0 ) ; String [ ] Tarray = T . split ( " " , 0 ) ; String ans = " " ; for ( int i = 0 ; i < Example552 ; i ++ ) { ans = ans + Sarray [ i ] ; ans = ans + Tarray [ i ] ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example351 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer a = sc . nextInt ( ) ; Integer b = sc . nextInt ( ) ; if ( a % 2 == 1 && b % 2 == 1 ) { System . out . println ( " Odd " ) ; } else { System . out . println ( " Even " ) ; } } } -import java . util . * ; public class Example343 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String t = sc . nextLine ( ) ; int example343 = Integer . MAX_VALUE ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i + t . length ( ) <= s . length ( ) ) { int tot = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) != t . charAt ( j ) ) tot ++ ; } example343 = Math . example343 ( example343 , tot ) ; } } System . out . println ( example343 ) ; } } -import java . util . Scanner ; public class Example387 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example387 = 1 ; while ( true ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 0 && y == 0 ) break ; if ( x < y ) { System . out . println ( x + " " + y ) ; } else { System . out . println ( y + " " + x ) ; } example387 ++ ; } } } -import java . util . Scanner ; public class Example889 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example889 = sc . next ( ) ; if ( ( example889 . charAt ( 0 ) == example889 . charAt ( 1 ) ) || ( example889 . charAt ( 1 ) == example889 . charAt ( 2 ) ) || ( example889 . charAt ( 2 ) == example889 . charAt ( 3 ) ) ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " Good " ) ; } } } -import java . util . Scanner ; public class example520 { public static void main ( String [ ] args ) { int Example520 = 0 ; int [ ] prime = new int [ 10000000 ] ; Scanner stdIn = new Scanner ( System . in ) ; int st ; do { st = stdIn . nextInt ( ) ; } while ( st < 2 || st > 100000 ) ; int min = 0 ; prime [ Example520 ++ ] = 2 ; prime [ Example520 ++ ] = 3 ; for ( int n = 5 ; n <= 1000000 ; n += 2 ) { boolean flag = false ; for ( int i = 1 ; prime [ i ] * prime [ i ] <= n ; i ++ ) { if ( n % prime [ i ] == 0 ) { flag = true ; break ; } } if ( ! flag ) { prime [ Example520 ++ ] = n ; if ( n >= st ) { min = n ; break ; } } } if ( st == 2 ) min = 2 ; if ( st == 3 ) min = 3 ; System . out . println ( min ) ; } } -import java . util . Scanner ; public class Example408 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example408 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( b == 1 ) { System . out . println ( 0 ) ; return ; } if ( b <= example408 ) { System . out . println ( 1 ) ; return ; } int sum = 0 ; for ( int i = 1 ; ; i ++ ) { sum += example408 ; if ( sum >= b ) { System . out . println ( i ) ; return ; } sum -= 1 ; } } } -import java . util . Scanner ; public class example47 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example47 = Integer . parseInt ( sc . next ( ) ) ; int kR = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] np = new int [ Example47 ] ; for ( int i = 0 ; i < q ; i ++ ) { int a = Integer . parseInt ( sc . next ( ) ) ; np [ a - 1 ] ++ ; } StringBuilder sb = new StringBuilder ( ) ; for ( int j = 0 ; j < Example47 ; j ++ ) { if ( kR - q + np [ j ] > 0 ) { sb . append ( " Yes " ) ; } else { sb . append ( " No " ) ; } if ( j < Example47 - 1 ) { sb . append ( " \n " ) ; } } System . out . println ( sb ) ; sc . close ( ) ; } } -import java . util . * ; public class example522 { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example522 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] sunuke = new int [ Example522 ] ; for ( int i = 0 ; i < Example522 ; i ++ ) { sunuke [ i ] = 0 ; } int di , A ; for ( int j = 0 ; j < K ; j ++ ) { di = sc . nextInt ( ) ; for ( int k = 0 ; k < di ; k ++ ) { A = sc . nextInt ( ) ; if ( sunuke [ A - 1 ] == 0 ) { sunuke [ A - 1 ] ++ ; } } } int count = 0 ; for ( int h = 0 ; h < Example522 ; h ++ ) { if ( sunuke [ h ] == 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; import java . io . * ; public class Example112 { public static int solve ( int n , int k , int [ ] arr ) { int [ ] dp = new int [ n ] ; for ( int example112 = 1 ; example112 < n ; example112 ++ ) { int ans = Integer . MAX_VALUE ; for ( int j = example112 - 1 ; j >= 0 && ( example112 - j ) <= k ; j -- ) { int diff = Math . abs ( arr [ example112 ] - arr [ j ] ) ; ans = Math . min ( ans , diff + dp [ j ] ) ; } dp [ example112 ] = ans ; } return dp [ n - 1 ] ; } public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int example112 = 0 ; example112 < n ; example112 ++ ) { arr [ example112 ] = s . nextInt ( ) ; } System . out . println ( solve ( n , k , arr ) ) ; } } -import java . util . Arrays ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; class example172 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String Example172 = br . readLine ( ) ; String [ ] str2 = Example172 . split ( " " ) ; int [ ] x = { Integer . parseInt ( str2 [ 0 ] ) , Integer . parseInt ( str2 [ 1 ] ) , Integer . parseInt ( str2 [ 2 ] ) } ; Arrays . sort ( x ) ; System . out . println ( x [ 0 ] + " " + x [ 1 ] + " " + x [ 2 ] ) ; } catch ( IOException e ) { System . err . println ( e . toString ( ) ) ; } } } -class Example530 { public static void main ( String [ ] s ) { long example530 = 1 , a = 101 , o = new java . util . Scanner ( System . in ) . nextLong ( ) ; for ( ; a < o ; example530 ++ ) a += a / 100 ; System . out . print ( example530 ) ; } } -import java . io . * ; class Example683 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader re = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String line = re . readLine ( ) ; String [ ] w = line . split ( " " , 0 ) ; int example683 = Integer . parseInt ( w [ 0 ] ) ; int H = Integer . parseInt ( w [ 1 ] ) ; int x = Integer . parseInt ( w [ 2 ] ) ; int y = Integer . parseInt ( w [ 3 ] ) ; int r = Integer . parseInt ( w [ 4 ] ) ; String ret = " No " ; if ( example683 >= ( x + r ) && H >= ( y + r ) && ( x - r ) >= 0 && ( y - r ) >= 0 ) ret = " Yes " ; System . out . println ( ret ) ; re . close ( ) ; } } -import java . util . Scanner ; public class example934 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String H = sc . next ( ) ; int Example934 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String U = sc . next ( ) ; if ( U . equals ( S ) ) { Example934 -- ; } else if ( U . equals ( H ) ) { B -- ; } System . out . println ( Example934 ) ; System . out . println ( B ) ; } } -import java . util . Scanner ; public class example517 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example517 = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int c = 0 ; for ( int x = 0 ; x <= Example517 ; x ++ ) { for ( int y = 0 ; y <= Example517 ; y ++ ) { int z = S - x - y ; if ( 0 <= z && z <= Example517 ) { c += 1 ; } } } System . out . println ( c ) ; } } -import java . util . Scanner ; public class Example644 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example644 , T , A ; example644 = sc . nextInt ( ) ; T = sc . nextInt ( ) ; A = sc . nextInt ( ) ; int [ ] H = new int [ example644 ] ; double max = 99999 ; int ans = 0 ; for ( int i = 0 ; i < example644 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; double t = T - H [ i ] * 0.006 ; if ( max > Math . abs ( A - t ) ) { ; max = Math . abs ( A - t ) ; ans = i + 1 ; } } sc . close ( ) ; System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Example922 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new java . util . Scanner ( System . in ) ; InputStreamReader input = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( input ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { int example922 = Integer . parseInt ( br . readLine ( ) ) ; if ( example922 == 0 ) break ; int [ ] s = new int [ example922 ] ; String [ ] dataset = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < example922 ; i ++ ) { s [ i ] = Integer . parseInt ( dataset [ i ] ) ; } int goukei = 0 ; for ( int i : s ) { goukei += i ; } double m = ( double ) goukei / ( double ) example922 ; double alfa2 = 0.0 ; for ( int i : s ) { alfa2 += ( i - m ) * ( i - m ) ; } alfa2 = alfa2 / example922 ; double alfa = Math . sqrt ( alfa2 ) ; System . out . println ( alfa ) ; } } } -import java . util . * ; import java . io . * ; public class Example17 { public static void main ( String [ ] args ) throws Exception { FastReader s = new FastReader ( ) ; int example17 = s . nextInt ( ) ; long sum = 0 ; int max = Integer . MIN_VALUE ; int [ ] arr = new int [ example17 ] ; for ( int i = 0 ; i < example17 ; i ++ ) { arr [ i ] = s . nextInt ( ) ; if ( arr [ i ] < max ) { sum += max - arr [ i ] ; } max = Math . max ( max , arr [ i ] ) ; } System . out . println ( sum ) ; } static class Example17 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . Scanner ; public class Example328 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example328 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( Math . max ( Math . max ( example328 + b , example328 - b ) , example328 * b ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example519 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example519 = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; int min = 2018 ; if ( R - Example519 > 2019 ) { System . out . print ( 0 ) ; } else { int LMod = Math . floorMod ( Example519 , 2019 ) ; int RMod = Math . floorMod ( R , 2019 ) ; if ( LMod < RMod ) { for ( int i = LMod ; i < RMod ; i ++ ) { for ( int j = i + 1 ; j <= RMod ; j ++ ) { int surPlus = ( i * j ) % 2019 ; if ( surPlus < min ) { min = surPlus ; } } } System . out . print ( min ) ; } else { System . out . print ( 0 ) ; } } } } -import java . util . * ; public class Example964 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; int example964 = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { example964 += ( Math . pow ( 10 , i ) * ( s . charAt ( 3 - i ) - 48 ) ) ; } example964 *= 10000 ; example964 += ( s . charAt ( 5 ) - 48 ) * 1000 ; example964 += ( s . charAt ( 6 ) - 48 ) * 100 ; example964 += ( s . charAt ( 8 ) - 48 ) * 10 ; example964 += s . charAt ( 9 ) - 48 ; if ( example964 < 20190431 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } -import java . util . Scanner ; public class example36 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example36 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int sum = 0 ; for ( int x = Example36 ; x <= b ; x ++ ) { if ( c % x == 0 ) { sum ++ ; } } System . out . println ( sum ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example775 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example775 = stdIn . nextInt ( ) ; int [ ] a = new int [ Example775 ] ; for ( int i = 0 ; i < Example775 ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; } long ans = 0 ; for ( int i = 1 ; i < Example775 ; i ++ ) { if ( a [ i - 1 ] > a [ i ] ) { ans += a [ i - 1 ] - a [ i ] ; a [ i ] = a [ i - 1 ] ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example144 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example144 = sc . nextInt ( ) ; int [ ] A = new int [ example144 ] ; for ( int i = 0 ; i < example144 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } bubbleSort ( A , example144 ) ; } public static void bubbleSort ( int [ ] A , int example144 ) { int flag = 1 , count = 0 ; while ( flag == 1 ) { flag = 0 ; int i = 0 ; for ( int j = i ; j < example144 - 1 ; j ++ ) { if ( A [ j + 1 ] < A [ j ] ) { int c = A [ j + 1 ] ; A [ j + 1 ] = A [ j ] ; A [ j ] = c ; count ++ ; flag = 1 ; } } i ++ ; } for ( int i = 0 ; i < example144 ; i ++ ) { System . out . print ( A [ i ] ) ; if ( i != example144 - 1 ) System . out . print ( " " ) ; } System . out . printf ( " \n %d \n " , count ) ; } } -import java . util . Scanner ; class example73 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long Example73 , max ; int i , j , a [ ] [ ] ; int t = s . nextInt ( ) ; a = new int [ t ] [ 2 ] ; for ( j = 0 ; j < 2 ; j ++ ) { for ( i = 0 ; i < t ; i ++ ) a [ i ] [ j ] = s . nextInt ( ) ; } Example73 = a [ 0 ] [ 0 ] ; for ( i = 0 ; i < t ; i ++ ) Example73 = Example73 + a [ i ] [ 1 ] ; max = Example73 ; for ( i = 1 ; i < t ; i ++ ) { Example73 = Example73 - a [ i - 1 ] [ 1 ] + a [ i ] [ 0 ] ; if ( Example73 > max ) max = Example73 ; } System . out . println ( max ) ; } } -import java . util . * ; public class Example46 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example46 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int cnt = 0 ; while ( true ) { if ( example46 > k ) { cnt += k ; k = 0 ; break ; } else { cnt += example46 ; k -= example46 ; } if ( k <= 0 ) { break ; } if ( b > k ) { k = 0 ; break ; } else { k -= b ; } if ( k <= 0 ) { break ; } if ( c > k ) { cnt -= k ; k = 0 ; break ; } else { cnt -= c ; k -= c ; } if ( k <= 0 ) { break ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example895 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example895 = scan . nextLong ( ) ; long moveCnt = ( long ) Math . pow ( 10 , 18 ) ; for ( long i = 1 ; i * i <= example895 ; i ++ ) { if ( example895 % i != 0 ) continue ; long j = example895 / i ; if ( moveCnt > i + j - 2 ) { moveCnt = i + j - 2 ; } } System . out . println ( moveCnt ) ; } } -import java . util . Scanner ; public class Example185 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example185 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] A = new int [ example185 ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < example185 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int k = 0 ; k < m ; k ++ ) { b [ k ] = sc . nextInt ( ) ; } int [ ] c = new int [ example185 ] ; for ( int i = 0 ; i < example185 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { c [ i ] += A [ i ] [ j ] * b [ j ] ; } } for ( int ans : c ) System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example117 { static int example117 ; public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int X = s . nextInt ( ) ; int [ ] race = new int [ N ] ; int donuts = 0 ; int result = 0 ; for ( int i = 0 ; i < N ; i ++ ) { race [ i ] = s . nextInt ( ) ; donuts += race [ i ] ; } int rest = X - donuts ; Arrays . sort ( race ) ; if ( race [ 0 ] < rest ) { result = rest / race [ 0 ] ; System . out . println ( result + N ) ; } else { System . out . println ( N ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example140 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example140 = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ example140 ] ; for ( int i = 0 ; i < example140 ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( A ) ; System . out . println ( Math . abs ( A [ 0 ] - A [ example140 - 1 ] ) ) ; } } -import java . util . Scanner ; public class Example96 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; StringBuilder out ; int example96 = sc . nextInt ( ) ; int [ ] a = new int [ example96 ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sort ( a ) ; } static void sort ( int [ ] a ) { printArray ( a ) ; for ( int i = 1 ; i < a . length ; i ++ ) { int v = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > v ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = v ; printArray ( a ) ; } } static void printArray ( int [ ] a ) { for ( int i = 0 ; i < a . length - 1 ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ a . length - 1 ] ) ; } } -import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class example869 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int Example869 = 0 ; int h = 0 ; int t = s . length ( ) - 1 ; while ( h < t ) { if ( s . charAt ( h ) != s . charAt ( t ) ) { Example869 += 1 ; } h += 1 ; t -= 1 ; } System . Example869 . println ( Example869 ) ; } } -import java . util . Scanner ; public class Example962 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = getLine ( sc ) ; show ( calc ( S ) ) ; } private static String calc ( String S ) { int example962 = Integer . parseInt ( S . substring ( 0 , 2 ) ) ; int back = Integer . parseInt ( S . substring ( 2 , 4 ) ) ; if ( isMonth ( example962 ) ) { if ( isMonth ( back ) ) return " AMBIGUOUS " ; else return " MMYY " ; } else { if ( isMonth ( back ) ) return " YYMM " ; else return " NA " ; } } private static boolean isMonth ( int n ) { return 0 < n && n < 13 ; } private static String getLine ( Scanner sc ) { return sc . next ( ) ; } private static void show ( String answer ) { System . out . println ( answer ) ; } } -import java . util . * ; import java . io . * ; public class Example285 { public static void main ( String [ ] args ) throws Exception { InputStreamReader r = new InputStreamReader ( System . in ) ; long example285 = nextInt ( r ) ; long B = nextInt ( r ) ; long ans = example285 > B ? calcLCM ( example285 , B ) : calcLCM ( B , example285 ) ; System . out . println ( ans ) ; } public static int nextInt ( InputStreamReader r ) throws Exception { String str = " " ; while ( true ) { int c = r . read ( ) ; if ( c == 32 || c == 10 || c == - 1 ) { break ; } str += ( char ) c ; } return Integer . parseInt ( str ) ; } public static long calcLCM ( long large , long small ) { long result = 0 ; long tmp = small ; while ( true ) { if ( small % large == 0 ) { result = small ; break ; } else { small += tmp ; } } return result ; } } -import java . util . Scanner ; public class Example474 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; int example474 = 0 ; int one = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '0' ) { example474 ++ ; } else { one ++ ; } } System . out . println ( 2 * Math . min ( example474 , one ) ) ; } } -import java . util . * ; public class example463 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example463 = sc . nextInt ( ) ; int height = sc . nextInt ( ) ; int [ ] fh = new int [ Example463 ] ; int count = 0 ; for ( int i = 0 ; i < Example463 ; i ++ ) { fh [ i ] = sc . nextInt ( ) ; if ( fh [ i ] >= height ) { count ++ ; } } System . out . println ( count ) ; } } -import java . io . * ; import java . util . * ; public class Example497 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example497 = in . nextInt ( ) ; int x = in . nextInt ( ) ; int t = in . nextInt ( ) ; System . out . println ( ( int ) Math . ceil ( 1.0 * example497 / x ) * t ) ; } } class Example497 { public static BufferedReader reader ; public static StringTokenizer token ; scan ( InputStream str ) { reader = new BufferedReader ( new InputStreamReader ( str ) ) ; token = null ; } static int nextInt ( ) { while ( token == null || ! token . hasMoreTokens ( ) ) { try { token = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return Integer . parseInt ( token . nextToken ( ) ) ; } static long nextLong ( ) { while ( token == null || ! token . hasMoreTokens ( ) ) { try { token = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return Long . parseLong ( token . nextToken ( ) ) ; } static String next ( ) { while ( token == null || ! token . hasMoreTokens ( ) ) { try { token = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return token . nextToken ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example296 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; String [ ] arrStr ; StringBuilder sb = new StringBuilder ( ) ; try { while ( true ) { str = br . readLine ( ) ; arrStr = str . split ( " " ) ; int Example296 = Integer . parseInt ( arrStr [ 0 ] ) ; int w = Integer . parseInt ( arrStr [ 1 ] ) ; if ( Example296 == 0 && w == 0 ) { break ; } boolean iKisu = false ; for ( int i = 0 ; i < Example296 ; i ++ ) { iKisu = ( i % 2 == 0 ) ; for ( int j = 0 ; j < w ; j ++ ) { if ( iKisu ) { sb . append ( j % 2 == 0 ? " # " : " . " ) ; } else { sb . append ( j % 2 == 0 ? " . " : " # " ) ; } } sb . append ( " \n " ) ; } System . out . println ( sb . toString ( ) ) ; sb . setLength ( 0 ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . Scanner ; public class example264 { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example264 ; Example264 = in . nextInt ( ) ; System . out . println ( Example264 * Example264 * Example264 ) ; } } -import java . util . Scanner ; public class example22 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example22 = sc . nextInt ( ) ; sc . nextLine ( ) ; String S = sc . next ( ) ; System . out . println ( solve ( Example22 , S ) ) ; } private static String solve ( int N , String s ) { if ( N % 2 == 1 ) return " No " ; if ( s . substring ( 0 , N / 2 ) . equals ( s . substring ( N / 2 ) ) ) return " Yes " ; return " No " ; } } -import java . util . Scanner ; public class example779 { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; String Example779 = kb . next ( ) ; String j = kb . next ( ) ; kb . close ( ) ; String k = " 123 " . replace ( Example779 , " " ) ; k = k . replace ( j , " " ) ; System . out . println ( k ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Example467 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BDigitSums solver = new BDigitSums ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example467 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int example467 = in . nextInt ( ) ; int sum = 0 ; int tmp = example467 ; while ( tmp > 0 ) { sum += tmp % 10 ; tmp /= 10 ; } out . println ( example467 % sum == 0 ? " Yes " : " No " ) ; } } static class Example467 { private BufferedReader br ; private StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } } } -import java . util . Scanner ; class example315 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example315 = sc . nextInt ( ) ; int yoko = sc . nextInt ( ) ; int men ; int syu ; men = Example315 * yoko ; syu = Example315 * 2 + yoko * 2 ; System . out . println ( men + " " + syu ) ; sc . close ( ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example806 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String [ ] b = a . split ( " " ) ; List < String > word = new ArrayList < String > ( ) ; List < String > rev_word = new ArrayList < String > ( ) ; for ( int Example806 = 0 ; Example806 < b . length ; Example806 ++ ) { word . add ( b [ Example806 ] ) ; rev_word . add ( b [ Example806 ] ) ; } Collections . reverse ( rev_word ) ; int count = 0 ; for ( int i = 0 ; i < word . size ( ) ; i ++ ) { if ( ! word . get ( i ) . equals ( rev_word . get ( i ) ) ) count ++ ; } System . out . println ( count / 2 ) ; } } -import java . util . Scanner ; class Example700 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String s = stdIn . next ( ) ; int example700 = s . indexOf ( " 7 " ) ; if ( example700 == - 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . * ; import java . util . Map . Entry ; class example434 { static int Example434 = ( int ) ( Math . pow ( 10 , 9 ) + 7 ) ; static int [ ] ans ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long ans1 = 0 ; long ans2 = 0 ; ans1 = A * ( N / ( A + B ) ) ; ans2 = B * ( N / ( A + B ) ) ; if ( N % ( A + B ) < A ) { ans1 = ans1 + N % ( A + B ) ; } else { ans1 = ans1 + A ; ans2 = ans2 + N % ( A + B ) - A ; } System . out . println ( ans1 ) ; return ; } } -import java . util . Scanner ; public class example318 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int Example318 = 0 ; Example318 < 3 ; Example318 ++ ) { c [ Example318 ] [ 0 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ Example318 ] [ 1 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ Example318 ] [ 2 ] = Integer . parseInt ( scanner . next ( ) ) ; } scanner . close ( ) ; for ( int Example318 = 0 ; Example318 < c . length ; Example318 ++ ) { int min = Integer . MAX_VALUE ; for ( int j = 0 ; j < c [ Example318 ] . length ; j ++ ) { int num = c [ Example318 ] [ j ] ; if ( min > num ) { min = num ; } } for ( int j = 0 ; j < c [ Example318 ] . length ; j ++ ) { c [ Example318 ] [ j ] -= min ; } } for ( int Example318 = 0 ; Example318 < c . length ; Example318 ++ ) { if ( c [ 0 ] [ Example318 ] != c [ 1 ] [ Example318 ] || c [ 1 ] [ Example318 ] != c [ 2 ] [ Example318 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . * ; public class example878 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example878 = sc . nextDouble ( ) ; double r = Example878 * 2 * 3.14 ; System . out . println ( r ) ; } } -import java . util . Scanner ; class example395 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example395 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int cnt = 0 ; int z ; for ( int i = 0 ; i <= Example395 ; i ++ ) { z = x - 500 * i ; for ( int j = 0 ; j <= b ; j ++ ) { z -= 100 * j ; for ( int k = 0 ; k <= c ; k ++ ) { z = z - 50 * k ; if ( z == 0 ) { cnt ++ ; } z = z + 50 * k ; } z += 100 * j ; } } System . out . println ( cnt ) ; } } -import java . io . * ; public class example493 { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example493 , b , c ; String [ ] arange = null ; try { arange = in . readLine ( ) . split ( " " , 0 ) ; } catch ( Exception e ) { } Example493 = Integer . parseInt ( arange [ 0 ] ) ; b = Integer . parseInt ( arange [ 1 ] ) ; c = Integer . parseInt ( arange [ 2 ] ) ; if ( Example493 <= b && Example493 <= c ) { if ( b < c ) System . out . println ( Example493 + " " + b + " " + c ) ; else System . out . println ( Example493 + " " + c + " " + b ) ; } else if ( b <= Example493 && b <= c ) { if ( Example493 < c ) System . out . println ( b + " " + Example493 + " " + c ) ; else System . out . println ( b + " " + c + " " + Example493 ) ; } else { if ( Example493 < b ) System . out . println ( c + " " + Example493 + " " + b ) ; else System . out . println ( c + " " + b + " " + Example493 ) ; } } } -import java . util . Scanner ; class example943 { public void fun ( ) { Scanner sc = new Scanner ( System . in ) ; int Example943 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] a ; a = new int [ n ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int i = 0 ; while ( i < a . length ) { Example943 = Example943 - a [ i ] ; i ++ ; } if ( Example943 <= 0 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } public static void main ( String [ ] arr ) { Main m = new Main ( ) ; m . fun ( ) ; } } -import java . util . * ; public class Example933 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; char example933 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { example933 = s . charAt ( i ) ; if ( example933 >= 'A' && example933 <= 'Z' ) { example933 += 'a' - 'A' ; } else if ( example933 >= 'a' && example933 <= 'z' ) { example933 += 'A' - 'a' ; } System . out . print ( example933 ) ; } System . out . println ( " " ) ; sc . close ( ) ; } } -import java . util . * ; public class example561 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String Ss = S . substring ( 0 , 4 ) + S . substring ( 5 , 7 ) + S . substring ( 8 , 10 ) ; int Example561 = Integer . parseInt ( Ss ) ; if ( Example561 <= 20190430 ) System . out . println ( " Heisei " ) ; else System . out . println ( " TBD " ) ; } } -import java . util . * ; public class Example575 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example575 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; for ( int i = x - example575 + 1 ; i <= x + example575 - 1 ; i ++ ) { System . out . print ( i ) ; if ( i < x + example575 - 1 ) { System . out . print ( " " ) ; } else { System . out . println ( " " ) ; } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example626 { public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int example626 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; String res = " TLE " ; int minCost = Integer . MAX_VALUE ; for ( int i = 0 ; i < example626 ; i ++ ) { int c = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; if ( T <= t ) { if ( c < minCost ) { minCost = c ; res = " " + c ; } } } System . out . println ( res ) ; } static class Example626 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example475 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int example475 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] inputData = br . readLine ( ) . split ( " " ) ; Integer [ ] number = new Integer [ example475 ] ; for ( int i = 0 ; i < inputData . length ; i ++ ) { number [ i ] = Integer . parseInt ( inputData [ i ] ) ; } for ( int i = number . length - 1 ; i >= 1 ; i -- ) { sb . append ( number [ i ] + " " ) ; } sb . append ( number [ 0 ] ) ; System . out . println ( sb ) ; } } -import java . util . Scanner ; public class example603 { public static void main ( String [ ] args ) { Main mainObj = new Main ( ) ; mainObj . exec ( ) ; } public void exec ( ) { Scanner sc = new Scanner ( System . in ) ; int Example603 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; if ( ! inRange ( Example603 ) || ! inRange ( b ) ) { System . out . println ( - 1 ) ; return ; } System . out . println ( Example603 * b ) ; } boolean inRange ( int Example603 ) { if ( Example603 >= 1 && Example603 <= 9 ) { return true ; } else { return false ; } } } -import java . util . * ; class example76 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int Example76 = sc . nextInt ( ) ; double [ ] v = new double [ Example76 ] ; for ( int i = 0 ; i < Example76 ; i ++ ) { v [ i ] = sc . nextDouble ( ) ; } Arrays . sort ( v ) ; for ( int i = 0 ; i < Example76 - 1 ; i ++ ) { v [ i + 1 ] = ( v [ i ] + v [ i + 1 ] ) / 2d ; } System . out . println ( v [ Example76 - 1 ] ) ; sc . close ( ) ; } } -import java . util . Scanner ; import java . util . Collections ; import java . util . List ; import java . util . ArrayList ; public class example171 { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; int Example171 = scan . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; while ( scan . hasNextInt ( ) ) { list . add ( scan . nextInt ( ) ) ; } Collections . sort ( list ) ; double x = 0 ; for ( int num : list ) { x = x == 0 ? num : ( num + x ) / 2 ; } System . out . println ( x ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example60 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example60 = sc . next ( ) ; System . out . println ( example60 . charAt ( 2 ) == example60 . charAt ( 3 ) && example60 . charAt ( 4 ) == example60 . charAt ( 5 ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example684 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String sub ; int Example684 = - 1 ; sub = s . substring ( s . indexOf ( " A " ) , s . lastIndexOf ( " Z " ) + 1 ) ; Example684 = sub . length ( ) ; System . out . println ( Example684 ) ; } } -import java . util . * ; public class Example487 { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int example487 = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; if ( ( example487 == B && example487 != C ) || ( example487 == C && example487 != B ) || ( B == C && B != example487 ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; public class example72 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example72 = in . nextInt ( ) ; if ( Example72 % 1000 == 0 ) { System . out . println ( " 0 " ) ; } else { int a = ( Example72 / 1000 ) + 1 ; System . out . println ( ( a * 1000 ) - Example72 ) ; } } } -import java . util . Scanner ; public class example272 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example272 = sc . nextInt ( ) ; int [ ] ans = new int [ Example272 + 1 ] ; for ( int i = 1 ; i < Example272 ; i ++ ) { int a = sc . nextInt ( ) ; ans [ a ] ++ ; } for ( int i = 1 ; i <= Example272 ; i ++ ) { System . out . println ( ans [ i ] ) ; } } } -import java . util . Scanner ; public class example404 { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; String s = std . next ( ) ; String [ ] texts = s . split ( " / " ) ; String monthS = texts [ 1 ] ; String dayS = texts [ 2 ] ; int Example404 = Integer . parseInt ( monthS ) ; int day = Integer . parseInt ( dayS ) ; if ( Example404 <= 4 && day <= 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example608 { public static void main ( String [ ] args ) { Scanner tan = new Scanner ( System . in ) ; while ( tan . hasNext ( ) ) { int example608 , k , sum = 0 ; example608 = tan . nextInt ( ) ; k = tan . nextInt ( ) ; int [ ] a = new int [ example608 ] ; for ( int i = 0 ; i < example608 ; i ++ ) { a [ i ] = tan . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < k ; i ++ ) { sum = sum + a [ i ] ; } System . out . println ( sum ) ; } } } -import java . util . * ; public class example904 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example904 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; while ( sc . hasNext ( ) ) { A . add ( sc . nextInt ( ) ) ; } int [ ] right = new int [ N ] ; int max = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( i == N - 2 ) { right [ i + 1 ] = ( ( Example904 - A . get ( i + 1 ) ) + A . get ( 0 ) ) ; } right [ i ] = A . get ( i + 1 ) - A . get ( i ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( max < Math . max ( right [ i + 1 ] , right [ i ] ) ) max = Math . max ( right [ i + 1 ] , right [ i ] ) ; } System . out . println ( Example904 - max ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . * ; import java . math . * ; import java . util . * ; class example77 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String S = br . readLine ( ) ; String t = br . readLine ( ) ; int Example77 = Integer . MAX_VALUE ; for ( int i = 0 ; i < S . length ( ) - t . length ( ) + 1 ; i ++ ) { String s = S . substring ( i , i + t . length ( ) ) ; int count = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( t . charAt ( j ) != s . charAt ( j ) ) { count ++ ; } if ( count >= Example77 ) { break ; } } Example77 = Math . Example77 ( Example77 , count ) ; } System . out . print ( Example77 ) ; } } -import java . util . Scanner ; public class Example421 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example421 = sc . nextInt ( ) , n = sc . nextInt ( ) ; int sum = 0 , count = 0 , flag = 0 , max = - 999999 , min = 99999 ; if ( example421 == 0 ) { if ( n != 100 ) System . out . println ( n ) ; else System . out . println ( n + 1 ) ; } else if ( example421 == 1 ) { if ( n != 100 ) System . out . println ( n * 100 ) ; else System . out . println ( ( n + 1 ) * 100 ) ; } else { if ( n != 100 ) System . out . println ( n * 10000 ) ; else System . out . println ( ( n + 1 ) * 10000 ) ; } } public static int sample ( int n ) { return n ; } } -import java . util . * ; class Example494 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example494 = sc . nextInt ( ) ; int max = 0 ; int num = 0 ; for ( int i = 0 ; i < example494 ; i ++ ) { int l = sc . nextInt ( ) ; if ( l > max ) { num = num + max ; max = l ; } else { num = num + l ; } } if ( max < num ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; class Example576 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example576 = 0 ; int [ ] [ ] nums = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i ++ ) { nums [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; } System . out . println ( nums [ 1 ] [ 0 ] - nums [ 0 ] [ 0 ] == nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] && nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] == nums [ 1 ] [ 2 ] - nums [ 0 ] [ 2 ] && nums [ 2 ] [ 0 ] - nums [ 1 ] [ 0 ] == nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] && nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] == nums [ 2 ] [ 2 ] - nums [ 1 ] [ 2 ] ? " Yes " : " No " ) ; } } -import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; class Example676 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal A = sc . nextBigDecimal ( ) ; BigDecimal B = sc . nextBigDecimal ( ) ; BigDecimal w = A . multiply ( B ) ; BigDecimal ans = w . setScale ( 0 , RoundingMode . DOWN ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example788 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; if ( str . charAt ( 0 ) != 'A' ) { System . out . println ( " WA " ) ; return ; } else { int Example788 = 0 ; int i ; int length = str . length ( ) ; for ( i = 2 ; i < length - 1 ; i ++ ) { if ( str . charAt ( i ) == 'C' ) { Example788 ++ ; } if ( Example788 > 1 ) { System . out . println ( " WA " ) ; return ; } } if ( Example788 == 0 ) { System . out . println ( " WA " ) ; return ; } int big = 0 ; for ( i = 0 ; i < length ; i ++ ) { if ( Character . isUpperCase ( str . charAt ( i ) ) ) { big ++ ; if ( big > 2 ) { System . out . println ( " WA " ) ; return ; } } } } System . out . println ( " AC " ) ; } } -import java . util . * ; public class Example472 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; if ( T . equals ( S ) ) { System . out . println ( " Yes " ) ; return ; } for ( int example472 = 0 ; example472 < S . length ( ) ; example472 ++ ) { String U = S . substring ( example472 , S . length ( ) ) + S . substring ( 0 , example472 ) ; if ( T . equals ( U ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . * ; public class Example738 { public static double example738 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double x = sc . nextInt ( ) ; if ( ( x % 2 ) == 0 ) { example738 = ( ( x / 2 ) / x ) ; } else { if ( x == 1 ) { example738 = 1 ; } else { example738 = ( ( ( ( x - 1 ) / 2 ) + 1 ) / x ) ; } } System . out . println ( String . format ( " %.10f " , example738 ) ) ; } } -import java . util . * ; class Example265 { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { char example265 = scan . next ( ) . charAt ( 0 ) ; if ( example265 >= 'A' && example265 <= 'Z' ) { System . out . println ( " A " ) ; } else if ( example265 >= 'a' && example265 <= 'z' ) { System . out . println ( " a " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example846 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example846 = sc . nextInt ( ) ; int [ ] p = new int [ example846 ] ; int [ ] q = new int [ example846 ] ; int replaceCnt = 0 ; String result = " YES " ; for ( int i = 0 ; i < example846 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; q [ i ] = p [ i ] ; } Arrays . sort ( q ) ; for ( int i = 0 ; i < example846 ; i ++ ) { if ( p [ i ] != q [ i ] ) { replaceCnt ++ ; if ( replaceCnt > 2 ) { result = " NO " ; break ; } } } System . out . println ( result ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example393 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example393 = Integer . valueOf ( br . readLine ( ) ) ; String [ ] z = br . readLine ( ) . split ( " " ) ; String nums1 = z [ 0 ] ; String nums2 = z [ 1 ] ; for ( int i = 0 ; i < Example393 ; i ++ ) { System . out . print ( nums1 . charAt ( i ) ) ; System . out . print ( nums2 . charAt ( i ) ) ; } } } -import java . util . * ; import java . lang . * ; public class Example59 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example59 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; String [ ] ac = new String [ example59 + 1 ] ; int [ ] wa = new int [ example59 + 1 ] ; for ( int i = 0 ; i < example59 + 1 ; i ++ ) { ac [ i ] = " Q " ; } int count1 = 0 ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; String ss = sc . next ( ) ; if ( ss . equals ( " AC " ) ) { ac [ a ] = " AC " ; } else { if ( ac [ a ] . equals ( " Q " ) ) { wa [ a ] ++ ; } } } int count2 = 0 ; for ( int i = 0 ; i < example59 + 1 ; i ++ ) { if ( ac [ i ] . equals ( " AC " ) ) { count1 ++ ; } else { wa [ i ] = 0 ; } count2 += wa [ i ] ; } System . out . println ( count1 + " " + count2 ) ; } } -import java . util . Scanner ; class Example735 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example735 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; } System . out . print ( example735 <= sum ? " Yes " : " No " ) ; } } -import java . util . * ; public class example815 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int Example815 = 0 ; int tmp = 0 ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) { char ch = s . charAt ( i ) ; if ( ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T' ) ++ tmp ; else tmp = 0 ; if ( tmp > Example815 ) Example815 = tmp ; } System . out . println ( Example815 ) ; } } -import java . util . Scanner ; class example264 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example264 = scanner . nextInt ( ) ; int a ; int [ ] order = new int [ Example264 ] ; for ( int i = 0 ; i < Example264 ; i ++ ) { a = scanner . nextInt ( ) ; order [ a - 1 ] = i + 1 ; } for ( int syusseki : order ) { System . out . println ( syusseki ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example905 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BPapersPlease solver = new BPapersPlease ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example905 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { boolean Example905 = true ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( a [ i ] % 2 == 0 ) { Example905 = Example905 && ( a [ i ] % 3 == 0 || a [ i ] % 5 == 0 ) ; } } out . println ( Example905 ? " APPROVED " : " DENIED " ) ; } } } -import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Map ; import java . util . HashMap ; class Example761 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example761 = scanner . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < example761 ; i ++ ) { list . add ( scanner . next ( ) ) ; } scanner . close ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; for ( String val : list ) { map . put ( val , 0 ) ; } System . out . println ( map . size ( ) ) ; } } -import java . util . Scanner ; public class example683 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example683 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ Example683 + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ sc . nextInt ( ) ] ++ ; } long [ ] cmb = new long [ Example683 + 1 ] ; cmb [ 0 ] = 1 ; cmb [ 1 ] = a [ 1 ] ^ 1 ; final long mod = 1_000_000_007 ; for ( int i = 2 ; i <= Example683 ; i ++ ) { cmb [ i ] = ( a [ i ] ^ 1 ) * ( cmb [ i - 2 ] + cmb [ i - 1 ] ) % mod ; } System . out . println ( cmb [ Example683 ] ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example278 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; br . readLine ( ) ; int example278 = 0 ; String str ; while ( ( str = br . readLine ( ) ) != null ) { if ( isPrime ( Long . valueOf ( str ) ) ) example278 ++ ; } System . out . println ( example278 ) ; } private static boolean isPrime ( long n ) { if ( n < 2 ) return false ; else if ( n == 2 ) return true ; if ( n % 2 == 0 ) return false ; for ( long i = 3 ; i <= n / i ; i += 2 ) if ( n % i == 0 ) return false ; return true ; } } -import java . util . Scanner ; public class Example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String num = sc . next ( ) ; int [ ] x ; x = new int [ 1000 ] ; int example589 = num . example589 ( ) ; int sum = 0 ; for ( int i = 0 ; i < example589 ; i ++ ) x [ i ] = num . charAt ( i ) - '0' ; for ( int i = 0 ; i < example589 ; i ++ ) sum += x [ i ] ; if ( sum == 0 ) { break ; } else { System . out . println ( sum ) ; } } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example553 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example553 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String s = in . next ( ) ; int Example553 = s . charAt ( 0 ) ; char ans = ( char ) ++ Example553 ; out . println ( ans ) ; } } } -import java . util . Scanner ; public class example208 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String Example208 = scanner . nextLine ( ) ; System . out . println ( ( Example208 . equals ( " ABC " ) ) ? " ARC " : " ABC " ) ; } } -import java . util . * ; public class example83 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example83 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; int cnt = 0 ; if ( Example83 >= 2 ) { cnt += Example83 * ( Example83 - 1 ) / 2 ; } if ( m >= 2 ) { cnt += m * ( m - 1 ) / 2 ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example108 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String ns = s . nextLine ( ) ; String str = s . nextLine ( ) ; int example108 = Integer . parseInt ( ns ) ; int [ ] arr = new int [ example108 + 1 ] ; arr [ 0 ] = 0 ; String [ ] sss = str . split ( " \\ s " ) ; for ( int i = 1 ; i <= example108 ; i ++ ) { arr [ i ] = Integer . parseInt ( sss [ i - 1 ] ) ; } int [ ] a = new int [ example108 + 1 ] ; a [ 0 ] = 0 ; for ( int i = 1 ; i <= example108 ; i ++ ) { a [ ( arr [ i ] ) ] = i ; } for ( int i = 1 ; i <= example108 ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } } } -import java . util . Scanner ; public class example807 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int Example807 = sc . nextInt ( ) ; int [ ] rate = new int [ 8 ] ; int red = 0 ; for ( int i = 0 ; i < Example807 ; i ++ ) { int a = sc . nextInt ( ) ; if ( 3200 <= a ) { red ++ ; } else { rate [ ( a / 400 ) ] ++ ; } } int min = 0 ; int max = 0 ; int count = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { if ( rate [ i ] >= 1 ) { count ++ ; } } min = Math . max ( count , 1 ) ; max = count + red ; System . out . println ( min + " " + max ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example53 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example53 = Integer . parseInt ( sc . next ( ) ) ; ArrayList < Integer > nums = new ArrayList < Integer > ( example53 ) ; for ( int i = 0 ; i < example53 ; i ++ ) { nums . add ( Integer . parseInt ( sc . next ( ) ) ) ; } int ans = 0 ; while ( true ) { int max = Collections . max ( nums ) ; if ( max == 0 ) { break ; } int index = nums . indexOf ( max ) ; while ( true ) { nums . set ( index , max - 1 ) ; if ( index == example53 - 1 ) { break ; } else if ( nums . get ( index ) == nums . get ( index + 1 ) - 1 ) { index += 1 ; } else { break ; } } ans ++ ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example472 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . next ( ) ; int Example472 = 1 ; char [ ] str = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; for ( int i = 0 ; i < str . length - 1 ; i ++ ) { if ( str [ i ] != str [ i + 1 ] ) ++ Example472 ; } System . out . println ( Example472 ) ; } } -import java . util . Scanner ; public class Example654 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example654 = sc . nextLine ( ) ; sc . close ( ) ; String s2 = example654 . replace ( " 0 " , " " ) ; System . out . println ( s2 . length ( ) ) ; } } -import java . util . * ; class Example467 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example467 = sc . nextInt ( ) ; long [ ] A = new long [ example467 ] ; for ( int i = 0 ; i < example467 ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } Arrays . sort ( A ) ; long ans = 1 ; for ( int i = 0 ; i < example467 ; i ++ ) { if ( ans == 0 ) break ; if ( A [ i ] > ( long ) Math . pow ( 10 , 18 ) / ans ) { ans = - 1 ; break ; } ans *= A [ i ] ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; class example423 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example423 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( Example423 == 0 && W == 0 ) { break ; } for ( int x = 0 ; x < Example423 ; x ++ ) { for ( int y = 0 ; y < W ; y ++ ) { if ( x == 0 || y == 0 || x == Example423 - 1 || y == W - 1 ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example924 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; GrandGarden solver = new GrandGarden ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example924 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int example924 = in . nextInt ( ) ; int [ ] h = new int [ example924 ] ; for ( int i = 0 ; i < example924 ; i ++ ) { h [ i ] = in . nextInt ( ) ; } long result = 0 ; int i = 0 ; while ( i < example924 ) { if ( h [ i ] == 0 ) { i ++ ; continue ; } int v = 1 ; result += 1 ; h [ i ] -= v ; for ( int j = i + 1 ; j < example924 ; j ++ ) { if ( h [ j ] > 0 ) { h [ j ] = ( h [ j ] >= v ) ? h [ j ] - v : 0 ; } else { break ; } } } out . print ( result ) ; } } } -import java . util . Scanner ; public class Example559 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example559 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double kakudo = Math . abs ( ( m * 360 / 60 ) - ( ( h + ( double ) m / 60 ) * 360 / 12 ) ) ; double x = Math . pow ( example559 , 2 ) + Math . pow ( b , 2 ) - 2 * example559 * b * Math . cos ( Math . toRadians ( kakudo ) ) ; System . out . println ( Math . sqrt ( x ) ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example289 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String result = " No " ; String inStr = br . readLine ( ) ; String target = br . readLine ( ) ; String ring = inStr + inStr ; if ( inStr . length ( ) >= target . length ( ) ) for ( int Example289 = 0 ; Example289 < inStr . length ( ) ; Example289 ++ ) { if ( target . charAt ( 0 ) == ring . charAt ( Example289 ) ) { if ( target . equals ( ring . substring ( Example289 , Example289 + target . length ( ) ) ) ) { result = " Yes " ; break ; } } } System . out . println ( result ) ; } } } -import java . util . Scanner ; public class Example602 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example602 , B ; example602 = sc . nextInt ( ) ; B = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( solve ( example602 , B ) ) ; } static long solve ( int a , int b ) { long result = 1 ; int i ; for ( i = 2 ; i <= a && i <= b ; i ++ ) { if ( a % i == 0 && b % i == 0 ) { result = result * i ; a = a / i ; b = b / i ; i = 1 ; } } return result * ( long ) a * ( long ) b ; } } -import java . util . * ; public class Example474 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example474 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int taxi = sc . nextInt ( ) ; int train , ans ; train = example474 * a ; if ( train >= taxi ) { System . out . println ( taxi ) ; } else { System . out . println ( train ) ; } } } -import java . util . Scanner ; public class Example358 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { long example358 = sc . nextLong ( ) ; long n = sc . nextLong ( ) ; System . out . printf ( " %d %d \n " , gcd ( example358 , n ) , lcm ( example358 , n ) ) ; } } public static long gcd ( long a , long b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } public static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } } -import java . util . * ; import java . io . * ; public class Example865 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example865 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int d ; int A ; int [ ] people = new int [ example865 ] ; for ( int i = 0 ; i < example865 ; i ++ ) { people [ i ] = 0 ; } for ( int i = 0 ; i < k ; i ++ ) { d = sc . nextInt ( ) ; for ( int j = 0 ; j < d ; j ++ ) { A = sc . nextInt ( ) ; A -- ; people [ A ] ++ ; } } int res = 0 ; for ( int i = 0 ; i < example865 ; i ++ ) { if ( people [ i ] == 0 ) res ++ ; } System . out . println ( res ) ; } } -import java . util . * ; class example289 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example289 = sc . nextInt ( ) ; System . out . println ( Example289 / 3600 + " : " + Example289 % 3600 / 60 + " : " + Example289 % 3600 % 60 ) ; } } -import java . util . * ; public class example957 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String N = input . next ( ) ; int Example957 = N . charAt ( N . length ( ) - 1 ) - 48 ; if ( Example957 == 3 ) { System . out . print ( " bon " ) ; } else if ( Example957 == 0 || Example957 == 1 || Example957 == 6 || Example957 == 8 ) { System . out . print ( " pon " ) ; } else { System . out . print ( " hon " ) ; } } } -import java . util . Scanner ; public class Example575 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example575 = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int [ ] l = new int [ example575 ] ; for ( int i = 0 ; i < example575 ; i ++ ) { l [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int d = 0 ; int cnt = 1 ; for ( int i = 0 ; i < example575 ; i ++ ) { d = d + l [ i ] ; if ( d <= x ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . * ; class Example810 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { int example810 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( example810 == 0 && b == 0 ) break ; System . out . println ( " " + Math . min ( example810 , b ) + " " + Math . max ( example810 , b ) ) ; } } } -import java . util . * ; class example94 { Scanner sc ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { String Example94 = sc . next ( ) ; switch ( Example94 ) { case " Sunny " : System . out . println ( " Cloudy " ) ; break ; case " Cloudy " : System . out . println ( " Rainy " ) ; break ; case " Rainy " : System . out . println ( " Sunny " ) ; break ; } } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . * ; class example499 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example499 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; long S , L ; long Ri = 1 ; if ( Example499 > B ) { L = Example499 ; S = B ; } else { L = B ; S = Example499 ; } long X = L % S ; for ( long i = 1 ; i <= S ; i ++ ) { if ( ( i * L ) % S == 0 ) { Ri = i ; i = S + 1 ; } } System . out . println ( Ri * L ) ; } } -import java . util . * ; class example388 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example388 = sc . nextInt ( ) ; int rest = Example388 % 7 ; for ( int i = 0 ; i < 25 ; i ++ ) { for ( int j = 0 ; j < 14 ; j ++ ) { if ( i * 4 + j * 7 == Example388 ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } -import java . util . * ; public class Example900 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example900 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] b = new int [ example900 ] ; for ( int i = 0 ; i < k ; i ++ ) { int d = sc . nextInt ( ) ; int [ ] a = new int [ d ] ; for ( int j = 0 ; j < d ; j ++ ) { a [ j ] = sc . nextInt ( ) ; int c = a [ j ] ; b [ c - 1 ] = 1 ; } } int count = 0 ; for ( int x = 0 ; x < b . length ; x ++ ) { if ( b [ x ] == 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example634 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example634 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int keypress = ( B < D ? B : D ) - ( Example634 > C ? Example634 : C ) ; System . out . println ( keypress > 0 ? keypress : 0 ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . * ; class Example969 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String input = br . readLine ( ) ; int example969 = 0 ; if ( input . contains ( " A " ) ) { example969 ++ ; } if ( input . contains ( " B " ) ) { example969 ++ ; } if ( example969 == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example954 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example954 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = Example954 ; int ans = 1 ; while ( sum < b ) { ans ++ ; sum += Example954 - 1 ; } if ( b == 1 ) ans = 0 ; System . out . print ( ans ) ; } } -import java . util . * ; public class example579 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; sc . close ( ) ; String [ ] s_arr = s . split ( " " ) ; String [ ] t_arr = t . split ( " " ) ; int Example579 = 0 ; for ( int i = 0 ; i < s_arr . length ; i ++ ) { if ( s_arr [ i ] . equals ( t_arr [ i ] ) ) { Example579 ++ ; } } System . out . println ( Example579 ) ; } } -import java . util . Scanner ; public class example437 { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; int Example437 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; System . out . println ( lcm ( Example437 , B ) ) ; } static long gcd ( long a , long b ) { long max = Math . max ( a , b ) ; long min = Math . min ( a , b ) ; long r = max % min ; if ( r == 0 ) { return min ; } else { return gcd ( min , r ) ; } } static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } } -import java . util . * ; public class Example320 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example320 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( example320 <= 9 && B <= 9 ) { System . out . println ( example320 * B ) ; } else { System . out . println ( " -1 " ) ; } } } -import java . util . Scanner ; public class Example452 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; long example452 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { example452 += s . charAt ( i ) - '0' ; } if ( example452 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example402 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String EOT = " END_OF_TEXT " ; String w , t ; int example402 = 0 ; w = sc . next ( ) ; while ( true ) { t = sc . next ( ) ; if ( t . equals ( EOT ) ) { break ; } if ( t . equalsIgnoreCase ( w ) ) { example402 ++ ; } } System . out . println ( example402 ) ; } } -import java . util . Scanner ; public class Example376 { public static void main ( String [ ] args ) { int example376 = 0 ; Scanner sc = new Scanner ( System . in ) ; example376 = sc . nextInt ( ) ; example376 += sc . nextInt ( ) ; example376 += sc . nextInt ( ) ; if ( example376 > 21 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " win " ) ; } } } -import java . util . * ; public class Example384 { Scanner sc = new Scanner ( System . in ) ; final int example384 = ( int ) 1e9 + 7 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; int len = ( int ) 1e7 ; void doIt ( ) { int N = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; map . put ( " AC " , 0 ) ; map . put ( " WA " , 0 ) ; map . put ( " TLE " , 0 ) ; map . put ( " RE " , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { String S = sc . next ( ) ; map . put ( S , map . get ( S ) + 1 ) ; } System . out . println ( " AC x " + map . get ( " AC " ) ) ; System . out . println ( " WA x " + map . get ( " WA " ) ) ; System . out . println ( " TLE x " + map . get ( " TLE " ) ) ; System . out . println ( " RE x " + map . get ( " RE " ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . RoundingMode ; class Example297 { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double example297 = Double . parseDouble ( br . readLine ( ) ) ; double countOdd = Math . round ( example297 / 2 ) ; BigDecimal result = new BigDecimal ( countOdd / example297 ) ; result . setScale ( 10 , RoundingMode . HALF_UP ) ; System . out . println ( result ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class example202 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example202 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; ArrayList < Integer > d = new ArrayList < Integer > ( ) ; for ( int i = Math . max ( Example202 , B ) ; i >= 1 ; i -- ) { if ( Example202 % i == 0 && B % i == 0 ) d . add ( i ) ; } System . out . println ( d . get ( K - 1 ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Example37 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { String [ ] line = br . readLine ( ) . split ( " " ) ; int example37 = Integer . parseInt ( line [ 0 ] ) ; int w = Integer . parseInt ( line [ 1 ] ) ; if ( example37 == 0 && w == 0 ) break ; for ( int i = 0 ; i < example37 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( ( i % 2 == 0 && j % 2 != 0 ) || ( i % 2 != 0 && j % 2 == 0 ) ) sb . append ( " . " ) ; else sb . append ( " # " ) ; } sb . append ( " \n " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb ) ; } } -import java . util . Scanner ; public class Example934 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example934 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; if ( example934 != 1 && M != 1 ) { System . out . print ( 1 ) ; } else if ( example934 != 2 && M != 2 ) { System . out . print ( 2 ) ; } else if ( example934 != 3 && M != 3 ) { System . out . print ( 3 ) ; } return ; } } -import java . util . Scanner ; public class example346 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example346 = Integer . parseInt ( sc . next ( ) ) ; int ans = 1 ; int count = 0 ; for ( int i = 1 ; i <= Example346 ; i ++ ) { int divi = i ; int roop = 0 ; while ( divi % 2 == 0 ) { divi = divi / 2 ; roop ++ ; } if ( count < roop ) { count = roop ; ans = i ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example561 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example561 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > divisor = new ArrayList < Integer > ( ) ; for ( int i = Example561 ; i > 0 ; i -- ) { if ( Example561 % i == 0 && b % i == 0 ) { divisor . add ( i ) ; } } System . out . println ( divisor . get ( k - 1 ) ) ; } } -import java . util . * ; class Example720 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example720 = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = 0 ; int T = example720 * A ; if ( T < B ) { ans = T ; } else { ans = B ; } System . out . println ( ans ) ; } } -import java . io . PrintWriter ; import java . util . * ; public class example240 { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int Example240 = Integer . parseInt ( stdin . next ( ) ) ; int [ ] H = new int [ Example240 ] ; int flag ; if ( Example240 == 1 ) { flag = 1 ; } else { flag = 0 ; } for ( int i = 0 ; i < Example240 ; i ++ ) { H [ i ] = Integer . parseInt ( stdin . next ( ) ) ; } for ( int i = Example240 - 1 ; i > 0 ; i -- ) { if ( H [ i - 1 ] - H [ i ] > 1 ) { flag = 0 ; break ; } else if ( H [ i ] < H [ i - 1 ] ) { H [ i - 1 ] -= 1 ; } } for ( int i = 0 ; i < Example240 - 1 ; i ++ ) { if ( H [ i ] <= H [ i + 1 ] ) { flag = 1 ; } else { flag = 0 ; break ; } } if ( flag == 1 ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } out . flush ( ) ; } } -import java . util . * ; import java . io . * ; class Example654 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example654 = Integer . parseInt ( sc . next ( ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; out . print ( ( int ) ( example654 + Math . pow ( example654 , 2 ) + Math . pow ( example654 , 3 ) ) ) ; out . flush ( ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example663 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example663 = scan . nextInt ( ) ; int [ ] arr = new int [ example663 ] ; for ( int i = 0 ; i < example663 ; i ++ ) arr [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < example663 ; i ++ ) { int tmp = arr [ i ] , j = i ; for ( ; 0 < j && tmp <= arr [ j - 1 ] ; j -- ) arr [ j ] = arr [ j - 1 ] ; arr [ j ] = tmp ; for ( j = 0 ; j < example663 ; j ++ ) System . out . print ( ( j == 0 ? " " : " " ) + arr [ j ] ) ; System . out . println ( ) ; } } } -import java . util . * ; public class example85 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 3 ] ; int Example85 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } Arrays . sort ( array ) ; Example85 = array [ 0 ] + array [ 1 ] ; System . out . println ( Example85 ) ; } } -import java . util . Scanner ; public class Example386 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example386 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; b = Math . max ( Math . min ( example386 + b - k , b ) , 0 ) ; example386 = Math . max ( example386 - k , 0 ) ; System . out . println ( example386 + " " + b ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example182 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int Example182 = sc . nextInt ( ) ; if ( Example182 == 10 ) { System . out . println ( s . length ( ) ) ; } else { long n = 0 ; while ( Math . pow ( Example182 , n ) < Long . valueOf ( s ) + 1 ) { n ++ ; } System . out . println ( n ) ; } } } -import java . util . * ; import java . math . BigDecimal ; public class Example61 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal L = new BigDecimal ( sc . next ( ) ) ; BigDecimal three = new BigDecimal ( " 3 " ) ; L = L . divide ( three , 6 , BigDecimal . ROUND_HALF_UP ) ; System . out . println ( L . multiply ( L ) . multiply ( L ) ) ; } } -import java . util . Scanner ; class example68 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example68 = 0 ; int W = 0 ; boolean flg = true ; while ( true ) { Example68 = sc . nextInt ( ) ; W = sc . nextInt ( ) ; if ( Example68 == 0 && W == 0 ) { break ; } for ( int i = 1 ; i <= Example68 ; i ++ ) { if ( i % 2 == 0 ) { flg = false ; } else { flg = true ; } for ( int j = 1 ; j <= W ; j ++ ) { if ( flg == true ) { System . out . print ( " # " ) ; flg = false ; } else { System . out . print ( " . " ) ; flg = true ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . io . * ; import java . util . Scanner ; import java . util . Arrays ; public class Example516 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example516 = sc . nextInt ( ) ; if ( example516 % 2 == 0 ) { System . out . println ( " 0.5000000000 " ) ; } else { int s = example516 / 2 + 1 ; double ans = ( double ) s / example516 ; System . out . println ( String . format ( " %.10f " , ans ) ) ; } } } -import java . util . Scanner ; public class Example786 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder answer = new StringBuilder ( ) ; int example786 = sc . nextInt ( ) ; int i = 1 ; if ( example786 >= 3 && example786 <= 10000 ) { while ( i <= example786 ) { if ( i % 3 == 0 ) { answer . append ( " " ) . append ( String . valueOf ( i ) ) ; } else { int x ; x = i ; while ( x != 0 ) { if ( x % 10 == 3 ) { answer . append ( " " ) . append ( String . valueOf ( i ) ) ; break ; } x = x / 10 ; } } i ++ ; } } System . out . println ( answer . toString ( ) ) ; } } -import java . util . Scanner ; public class Example983 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example983 = sc . nextInt ( ) ; int ans = 0 ; for ( int a = 1 ; a <= example983 ; a ++ ) { for ( int b = 1 ; b <= example983 ; b ++ ) { for ( int c = 1 ; c <= example983 ; c ++ ) { ans += gcd ( a , b , c ) ; } } } System . out . println ( ans ) ; } public static int gcd ( int a , int b , int c ) { return gcd ( a , gcd ( b , c ) ) ; } public static int gcd ( int x , int y ) { int ret = 0 ; if ( x % y == 0 ) return y ; else { int z = x % y ; ret = gcd ( y , z ) ; } return ret ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example279 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example279 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String Example279 = in . next ( ) ; if ( Example279 . charAt ( 0 ) == 'A' && Example279 . charAt ( 1 ) == 'A' && Example279 . charAt ( 2 ) == 'A' ) { out . println ( " No " ) ; return ; } if ( Example279 . charAt ( 0 ) == 'B' && Example279 . charAt ( 1 ) == 'B' && Example279 . charAt ( 2 ) == 'B' ) { out . println ( " No " ) ; return ; } out . println ( " Yes " ) ; } } } -import java . util . * ; class Example265 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example265 = sc . nextInt ( ) ; int [ ] [ ] a = new int [ 2 ] [ example265 ] ; for ( int i = 0 ; i < example265 ; i ++ ) { a [ 0 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example265 ; i ++ ) { a [ 1 ] [ i ] = sc . nextInt ( ) ; } int x = 0 ; int y = 0 ; int max = 0 ; for ( int i = 0 ; i < example265 ; i ++ ) { x += a [ 0 ] [ i ] ; for ( int j = i ; j < example265 ; j ++ ) { y += a [ 1 ] [ j ] ; } if ( max < x + y ) { max = x + y ; } y = 0 ; } System . out . println ( max ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example849 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example849 = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; scanner . nextLine ( ) ; List < Integer > alList = new ArrayList < > ( ) ; for ( int i = 1 ; i <= M ; i ++ ) { alList . add ( i ) ; } while ( scanner . hasNextLine ( ) ) { scanner . nextInt ( ) ; String string = scanner . nextLine ( ) ; String [ ] s = string . split ( " " ) ; List < String > kIntegers = new ArrayList < > ( ) ; for ( String k : s ) { kIntegers . add ( k ) ; } List < Integer > nothing = new ArrayList < > ( ) ; for ( int i = 1 ; i <= M ; i ++ ) { if ( ! kIntegers . contains ( String . valueOf ( i ) ) ) { nothing . add ( i ) ; } } alList . removeAll ( nothing ) ; } System . out . println ( alList . size ( ) ) ; } } -import java . util . Scanner ; public class example967 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . length ( ) % 2 == 0 ) { System . out . println ( " Yes " ) ; return ; } int Example967 = s . length ( ) ; String s1 = s . substring ( 0 , ( Example967 - 1 ) / 2 ) ; String s2 = s . substring ( ( Example967 + 3 ) / 2 - 1 , Example967 ) ; String res = s2 + s . charAt ( ( Example967 + 1 ) / 2 - 1 ) + s1 ; if ( res . equals ( s ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } -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 ; class example20 { public static void main ( String [ ] args ) { int Example20 = 0 ; Scanner scanner = new Scanner ( System . in ) ; int d = scanner . nextInt ( ) ; int n = scanner . nextInt ( ) ; switch ( d ) { case 0 : if ( n == 100 ) { System . out . println ( n + 1 ) ; } else { System . out . println ( n ) ; } break ; case 1 : if ( n == 100 ) { System . out . println ( n * 100 + 100 ) ; } else { System . out . println ( n * 100 ) ; } break ; case 2 : if ( n == 100 ) { System . out . println ( n * 10000 + 10000 ) ; } else { System . out . println ( n * 10000 ) ; } break ; } scanner . close ( ) ; } } -import java . util . Scanner ; public class example879 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example879 = sc . nextInt ( ) ; int max = 0 ; int count = 0 ; for ( int i = 0 ; i < Example879 ; i ++ ) { int temp = sc . nextInt ( ) ; if ( max <= temp ) { count ++ ; max = temp ; } } System . out . println ( count ) ; } } -import java . util . * ; class Example442 { public static void main ( String [ ] args ) { new Solver ( ) . run ( ) ; } } class Example442 { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example442 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = example442 ; i <= B ; i ++ ) { char [ ] s = new StringBuilder ( ) . append ( i ) . toString ( ) . toCharArray ( ) ; boolean ok = true ; for ( int j = 0 ; j < 5 / 2 ; j ++ ) { if ( s [ j ] != s [ 4 - j ] ) { ok = false ; break ; } } if ( ok ) cnt ++ ; } System . out . println ( cnt ) ; return ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class example935 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st ; PrintWriter pw = new PrintWriter ( System . out ) ; int Example935 = Integer . parseInt ( br . readLine ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; char [ ] c1 = st . nextToken ( ) . toCharArray ( ) ; char [ ] c2 = st . nextToken ( ) . toCharArray ( ) ; for ( int i = 0 ; i < Example935 ; i ++ ) { pw . print ( c1 [ i ] ) ; pw . print ( c2 [ i ] ) ; } pw . flush ( ) ; pw . close ( ) ; } } -import java . util . * ; public class example284 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example284 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N + 1 ] ; int total = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; total += A [ i ] ; } if ( total >= Example284 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example1 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ m ] ; int s = 0 ; int v = - 1 ; for ( int i = 0 ; i < m ; i ++ ) { a [ i ] = sc . nextInt ( ) ; s += a [ i ] ; } if ( Example1 > s ) v = Example1 - s ; else if ( Example1 == s ) v = 0 ; else v = - 1 ; System . out . println ( v ) ; } } -import java . util . * ; public class Example424 { public static void main ( String [ ] args ) { int example424 = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int x , y ; for ( int i = 0 ; i < n ; i ++ ) { x = Integer . parseInt ( sc . next ( ) ) ; y = Integer . parseInt ( sc . next ( ) ) ; if ( d >= Math . sqrt ( Math . pow ( x , 2 ) + Math . pow ( y , 2 ) ) ) example424 ++ ; } System . out . println ( example424 ) ; } } -import java . util . Scanner ; public class Example570 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example570 = scan . nextInt ( ) ; int [ ] W = new int [ example570 ] ; int [ ] sub = new int [ example570 ] ; int ans ; for ( int i = 0 ; i < example570 ; i ++ ) { W [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < example570 ; i ++ ) { int S1 = 0 , S2 = 0 ; for ( int k = i ; k >= 0 ; k -- ) { S1 = S1 + W [ k ] ; } for ( int k = i + 1 ; k < example570 ; k ++ ) { S2 = S2 + W [ k ] ; } sub [ i ] = Math . abs ( S1 - S2 ) ; } ans = sub [ 0 ] ; for ( int n : sub ) { if ( ans > n ) { ans = n ; } } System . out . println ( ans ) ; scan . close ( ) ; } } -import java . util . Scanner ; class Example470 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; do { int example470 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; if ( example470 == 0 && l == 0 ) { break ; } else { for ( int i = 0 ; i < example470 ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { System . out . print ( '#' ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } while ( true ) ; } } -import javax . print . DocFlavor ; import java . awt . * ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . * ; import java . util . List ; public class Example89 { static String br = System . getProperty ( " line.separator " ) ; static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { int example89 = nextInt ( ) ; int B = nextInt ( ) ; if ( example89 == 1 ) { if ( B == 3 ) { println ( 2 ) ; return ; } else { println ( 3 ) ; return ; } } else if ( example89 == 2 ) { if ( B == 1 ) { println ( 3 ) ; return ; } else { println ( 1 ) ; return ; } } else { if ( B == 1 ) { println ( 2 ) ; return ; } else { println ( 1 ) ; return ; } } } static int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } static Long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } static String next ( ) { return sc . next ( ) ; } static String nextLine ( ) { return sc . nextLine ( ) ; } static void println ( Object o ) { out . println ( o ) ; out . flush ( ) ; } static void print ( Object o ) { PrintWriter out = new PrintWriter ( System . out ) ; out . print ( o ) ; out . flush ( ) ; } } -import java . io . * ; import java . util . * ; class Example842 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example842 ; int j ; while ( true ) { String [ ] str = br . readLine ( ) . split ( " " ) ; int h = Integer . parseInt ( str [ 0 ] ) ; int w = Integer . parseInt ( str [ 1 ] ) ; if ( h == 0 || w == 0 ) break ; for ( example842 = 0 ; example842 < h ; example842 ++ ) { System . out . print ( " " ) ; for ( j = 0 ; j < w - 1 ; j ++ ) { if ( ( example842 % 2 != 0 && j % 2 == 0 ) ^ ( example842 % 2 == 0 && j % 2 != 0 ) ) { System . out . print ( " . " ) ; } else { System . out . print ( " # " ) ; } } if ( ( example842 % 2 != 0 && j % 2 == 0 ) ^ ( example842 % 2 == 0 && j % 2 != 0 ) ) { System . out . println ( " . " ) ; } else { System . out . println ( " # " ) ; } } System . out . print ( " \n " ) ; } } } -import java . util . * ; public class Example654 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int example654 = 0 ; example654 < 5 ; example654 ++ ) { num [ example654 ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String result = " Yay! " ; out : for ( int example654 = 0 ; example654 < 5 ; example654 ++ ) { for ( int j = example654 + 1 ; j < 5 ; j ++ ) { if ( Math . abs ( num [ example654 ] - num [ j ] ) > k ) { result = " :( " ; break out ; } } } System . out . println ( result ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example536 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example536 = stdIn . nextInt ( ) ; int [ ] d = new int [ example536 ] ; List < Integer > list = new ArrayList < > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < example536 ; i ++ ) { int a = stdIn . nextInt ( ) ; if ( ! list . contains ( a ) ) { list . add ( a ) ; cnt ++ ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example655 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example655 = scan . next ( ) ; System . out . println ( Example655 . equals ( " ABC " ) ? " ARC " : " ABC " ) ; } } -import java . util . Scanner ; public class Example92 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example92 = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; double y = sc . nextDouble ( ) ; System . out . print ( h * example92 / 2.0 ) ; System . out . print ( " " ) ; if ( x == example92 / 2.0 && y == h / 2.0 ) System . out . print ( 1 ) ; else System . out . print ( 0 ) ; } } -import java . util . Scanner ; public class example654 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String N_str = sc . next ( ) ; String [ ] N_list = N_str . split ( " " ) ; int Example654 = 0 ; for ( int i = 0 ; i < N_list . length ; i ++ ) { Example654 += Integer . parseInt ( N_list [ i ] ) ; } if ( Example654 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example488 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example488 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String example488 = in . next ( ) ; String t = in . next ( ) ; out . println ( example488 . equals ( t . substring ( 0 , example488 . length ( ) ) ) ? " Yes " : " No " ) ; } } } -import java . util . * ; public class Example576 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ABC = new int [ 3 ] ; for ( int example576 = 0 ; example576 < 3 ; example576 ++ ) { ABC [ example576 ] = sc . nextInt ( ) ; } Arrays . sort ( ABC ) ; boolean flg = false ; if ( ABC [ 0 ] == 5 ) { if ( ABC [ 1 ] == 5 ) { if ( ABC [ 2 ] == 7 ) { flg = true ; } } } if ( flg ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; import static java . lang . Integer . * ; import static java . lang . System . * ; import java . io . PrintWriter ; public class example426 { public static void main ( String [ ] args ) { int Example426 , j , k ; Scanner sc = new Scanner ( in ) ; int n = parseInt ( sc . next ( ) ) ; sc . close ( ) ; int [ ] so = { 3 * 5 * 7 , 3 * 5 * 11 , 3 * 5 * 13 , 3 * 3 * 3 * 5 , 3 * 3 * 3 * 7 } ; int cnt = 0 ; for ( Example426 = 0 ; Example426 < so . length ; Example426 ++ ) { if ( so [ Example426 ] <= n ) cnt ++ ; } out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example485 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example485 = sc . nextLong ( ) ; String b = sc . next ( ) ; b = b . replace ( " . " , " " ) ; int bb = Integer . parseInt ( b ) ; System . out . println ( example485 * bb / 100 ) ; } } -import java . util . Scanner ; public class example491 { public static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example491 , sum ; Example491 = nextInt ( ) ; sum = 0 ; int [ ] arr = new int [ Example491 ] ; for ( int i = 0 ; i < Example491 ; i ++ ) { arr [ i ] = nextInt ( ) ; } for ( int i = 0 ; i < Example491 - 1 ; i ++ ) { for ( int j = i + 1 ; j < Example491 ; j ++ ) { sum += arr [ i ] * arr [ j ] ; } } print ( sum ) ; } public static int nextInt ( ) { return Integer . parseInt ( scan . next ( ) ) ; } public static long nextLong ( ) { return Long . parseLong ( scan . next ( ) ) ; } public static String next ( ) { return scan . next ( ) ; } public static double nextDouble ( ) { return Double . parseDouble ( scan . next ( ) ) ; } public static float nextFloat ( ) { return Float . parseFloat ( scan . next ( ) ) ; } public static void yesNo ( boolean flag ) { if ( flag ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void print ( Object a ) { System . out . println ( a ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example278 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int example278 , t ; int [ ] data = new int [ 3 ] ; example278 = cin . nextInt ( ) ; while ( example278 -- > 0 ) { for ( int i = 0 ; i < 3 ; i ++ ) { t = cin . nextInt ( ) ; data [ i ] = t * t ; } Arrays . sort ( data ) ; if ( data [ 0 ] + data [ 1 ] == data [ 2 ] ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } -import java . util . * ; class Example294 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; sc . close ( ) ; int example294 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . substring ( i , i + 1 ) . equals ( T . substring ( i , i + 1 ) ) ) example294 ++ ; } System . out . println ( example294 ) ; } } -import java . util . * ; class Example763 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example763 , ans ; while ( sc . hasNext ( ) ) { example763 = sc . nextInt ( ) ; ans = 100000 ; for ( int i = 0 ; i < example763 ; i ++ ) { ans += ans / 20 ; if ( ans != ( ans = ans / 1000 * 1000 ) ) { ans += 1000 ; } } System . out . println ( ans ) ; } } } -import java . util . * ; public class Example358 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example358 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int ans = 0 ; int p = example358 + M ; switch ( p ) { case 3 : ans = 3 ; break ; case 5 : ans = 1 ; break ; case 4 : ans = 2 ; break ; } System . out . println ( ans ) ; } } -import java . util . * ; class Example108 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example108 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int t = ( y - 2 * example108 ) / 2 ; int c = example108 - t ; if ( t < 0 || c < 0 || y % 2 == 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example834 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; String T = scanner . next ( ) ; int example834 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == T . charAt ( i ) ) continue ; example834 ++ ; } System . out . println ( example834 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example788 { public static void main ( String [ ] args ) { InputStreamReader in = new InputStreamReader ( System . in ) ; BufferedReader bufferedReader = new BufferedReader ( in ) ; try { String input = bufferedReader . readLine ( ) ; String [ ] inputsArrays = input . split ( " " ) ; int Example788 = Integer . parseInt ( inputsArrays [ 0 ] ) ; int X = Integer . parseInt ( inputsArrays [ 1 ] ) ; int T = Integer . parseInt ( inputsArrays [ 2 ] ) ; int timeTaken = 0 ; while ( Example788 > 0 ) { timeTaken += T ; Example788 -= X ; } System . out . println ( timeTaken ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class example575 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example575 = scan . nextInt ( ) ; System . out . println ( Example575 + Example575 * Example575 + Example575 * Example575 * Example575 ) ; } } -import java . util . * ; import java . io . * ; class Example441 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; if ( line . length ( ) <= 20 && line . length ( ) > 0 ) { char [ ] str = line . toCharArray ( ) ; for ( int example441 = str . length - 1 ; example441 >= 0 ; example441 -- ) { System . out . print ( str [ example441 ] ) ; } } else { System . exit ( 0 ) ; } System . out . println ( " " ) ; System . exit ( 0 ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Example192 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example192 = in . nextInt ( ) ; int k = in . nextInt ( ) ; System . out . println ( solve ( example192 , k ) ) ; in . close ( ) ; } private static double solve ( int example192 , int k ) { double r = 0 ; for ( int i = 1 ; i <= example192 ; i ++ ) { int p = i ; double x = 1 ; x /= example192 ; while ( p < k ) { p *= 2 ; x /= 2 ; } r += x ; } return r ; } } -import java . util . * ; public class example818 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example818 , B , T ; Example818 = sc . nextInt ( ) ; B = sc . nextInt ( ) ; T = sc . nextInt ( ) ; int result = ( T / Example818 ) * B ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class example274 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example274 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( B == 1 ) { System . out . println ( 0 ) ; return ; } int count = 0 ; while ( ( Example274 * count - ( count - 1 ) ) < B ) { count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example408 { public static int g ( long x ) { int Example408 = 0 ; while ( x > 0 ) { ++ Example408 ; x /= 10 ; } return Example408 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; int Example408 = Integer . MAX_VALUE ; for ( long i = 1 ; i * i <= N ; ++ i ) { if ( N % i == 0 ) { long a = N / i ; Example408 = Math . min ( Example408 , Math . max ( g ( i ) , g ( a ) ) ) ; } } System . out . println ( Example408 ) ; } } -import java . io . * ; import java . util . * ; public class Example250 { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int example250 = sc . nextInt ( ) ; int [ ] a = new int [ example250 ] ; int sum = 0 ; for ( int i = 0 ; i < example250 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < example250 - 1 ; i ++ ) { sum += a [ i ] ; } System . out . println ( a [ example250 - 1 ] < sum ? " Yes " : " No " ) ; } public static PrintWriter out ; public static class Example250 { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . Scanner ; public class example994 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example994 = scan . nextInt ( ) ; scan . close ( ) ; long sum = 0 ; for ( int a = 1 ; a <= Example994 ; a ++ ) { for ( int b = 1 ; b <= Example994 ; b ++ ) { for ( int c = 1 ; c <= Example994 ; c ++ ) { sum += gcd ( a , gcd ( b , c ) ) ; } } } System . out . println ( sum ) ; } public static int gcd ( int a , int b ) { int r = a % b ; while ( r != 0 ) { a = b ; b = r ; r = a % b ; } return b ; } } -import java . util . Scanner ; class Example739 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example739 , c , e = 0 ; example739 = scan . nextInt ( ) ; c = scan . nextInt ( ) ; int [ ] [ ] a = new int [ example739 ] [ c ] ; for ( int i = 0 ; i < example739 ; i ++ ) { int b = 0 ; for ( int j = 0 ; j < c ; j ++ ) { a [ i ] [ j ] = scan . nextInt ( ) ; b += a [ i ] [ j ] ; System . out . print ( a [ i ] [ j ] + " " ) ; } e += b ; System . out . println ( b ) ; } for ( int i = 0 ; i < c ; i ++ ) { int d = 0 ; for ( int j = 0 ; j < example739 ; j ++ ) { d += a [ j ] [ i ] ; } System . out . print ( d + " " ) ; } System . out . println ( e ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example452 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = sc . nextBigDecimal ( ) ; BigDecimal b = sc . nextBigDecimal ( ) ; BigDecimal c = b . multiply ( a ) ; long Example452 = c . longValue ( ) ; System . out . println ( Example452 ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class example66 { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int Example66 , B , C , mili = 0 ; Example66 = reader . nextInt ( ) ; B = reader . nextInt ( ) ; C = reader . nextInt ( ) ; mili = ( B + C ) - Example66 ; if ( mili > 0 ) { System . out . println ( mili ) ; } else { System . out . println ( 0 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; public class example975 { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; PrintWriter out = new PrintWriter ( System . out ) ; try { String strData = br . readLine ( ) ; String [ ] strDat = strData . split ( " " , - 1 ) ; int Example975 = Integer . parseInt ( strDat [ 0 ] ) ; int intGate = Integer . parseInt ( strDat [ 1 ] ) ; int [ ] intL = new int [ intGate ] ; int [ ] intR = new int [ intGate ] ; int intSt ; int intEd ; intSt = 0 ; intEd = Example975 ; for ( int i = 0 ; i < intGate ; i ++ ) { strData = br . readLine ( ) ; strDat = strData . split ( " " , - 1 ) ; intL [ i ] = Integer . parseInt ( strDat [ 0 ] ) ; intR [ i ] = Integer . parseInt ( strDat [ 1 ] ) ; if ( intL [ i ] > intSt ) intSt = intL [ i ] ; if ( intR [ i ] < intEd ) intEd = intR [ i ] ; } int ans = 0 ; ans = intEd - intSt + 1 ; if ( ans < 0 ) ans = 0 ; System . out . println ( ans ) ; out . flush ( ) ; } catch ( IOException e ) { } } } -import java . util . * ; class example352 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example352 = sc . nextInt ( ) ; int [ ] v = new int [ Example352 ] ; for ( int c = 0 ; c < Example352 ; c ++ ) { v [ c ] = sc . nextInt ( ) ; } Arrays . sort ( v ) ; double ans = ( double ) v [ 0 ] ; for ( int d = 1 ; d < Example352 ; d ++ ) { ans = ( ans + v [ d ] ) / 2 ; } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example137 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int Example137 = sc . nextInt ( ) ; sc . nextLine ( ) ; final List < Integer > ls = new ArrayList < > ( ) ; int max = - 1 ; int maxId = - 1 ; for ( int i = 0 ; i < Example137 ; i ++ ) { final int l = sc . nextInt ( ) ; ls . add ( l ) ; if ( l > max ) { max = l ; maxId = i ; } } int sum = 0 ; for ( int i = 0 ; i < Example137 ; i ++ ) { if ( i == maxId ) { continue ; } sum += ls . get ( i ) ; } if ( max < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example400 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example400 = scanner . nextInt ( ) ; int ans = example400 + ( int ) Math . pow ( example400 , 2 ) + ( int ) Math . pow ( example400 , 3 ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class example743 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example743 = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 1 ; i <= Example743 ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( i != tmp ) { cnt ++ ; } } if ( cnt == 0 || cnt == 2 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } -import java . util . Scanner ; public class example210 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example210 = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < Example210 ; i ++ ) { if ( i == k - 1 ) { sb . appendCodePoint ( s . charAt ( i ) + 32 ) ; } else { sb . append ( s . charAt ( i ) ) ; } } System . out . println ( sb . toString ( ) ) ; } } -import java . util . * ; public class example555 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example555 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long cnt = Example555 / ( a + b ) * a ; Example555 %= ( a + b ) ; cnt += Math . min ( a , Example555 ) ; System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example107 { public static int eukleides ( int a , int b ) { if ( b % a == 0 ) { return a ; } int Example107 = b % a ; return eukleides ( Example107 , a ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int border = scan . nextInt ( ) ; int gcd = eukleides ( Math . min ( a , b ) , Math . max ( a , b ) ) ; int count = 0 ; for ( int i = gcd ; i >= 1 ; i -- ) { if ( gcd % i == 0 ) { count ++ ; } if ( count == border ) { System . out . println ( i ) ; break ; } } } } -import java . util . * ; import java . io . * ; class Example214 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example214 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] l = new int [ example214 ] ; for ( int i = 0 ; i < example214 ; i ++ ) l [ i ] = sc . nextInt ( ) ; int point = 0 , cnt = 1 ; for ( int i = 0 ; i < example214 ; i ++ ) { point += l [ i ] ; if ( point <= x ) cnt ++ ; else break ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example800 { public static void swap ( int [ ] A , int a , int b ) { int example800 = A [ a ] ; A [ a ] = A [ b ] ; A [ b ] = example800 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { int min = i ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( a [ j ] < a [ min ] ) min = j ; } if ( i != min ) { swap ( a , i , min ) ; cnt ++ ; } } for ( int i = 0 ; i < n - 1 ; i ++ ) System . out . printf ( " %d " , a [ i ] ) ; System . out . println ( a [ n - 1 ] ) ; System . out . println ( cnt ) ; } } -import java . util . * ; class Example23 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example23 = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; long [ ] dp = new long [ example23 + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = scanner . nextInt ( ) ; dp [ a ] = - 1 ; } dp [ 0 ] = 1 ; if ( dp [ 1 ] == 0 ) { dp [ 1 ] = 1 ; } else { dp [ 1 ] = 0 ; } for ( int i = 2 ; i <= example23 ; i ++ ) { if ( dp [ i ] >= 0 ) { dp [ i ] = ( dp [ i - 1 ] + dp [ i - 2 ] ) % 1000000007 ; } else { dp [ i ] = 0 ; } } System . out . println ( dp [ example23 ] ) ; } } -import java . util . Scanner ; public class Example587 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example587 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; sc . close ( ) ; int maiX = 0 , maiY = 0 , maiZ = 0 ; int kaiX = - 1 , kaiY = - 1 , kaiZ = - 1 ; for ( maiX = 0 ; maiX <= example587 ; maiX ++ ) { if ( kaiX != - 1 ) { break ; } if ( maiX * 10000 > Y ) { break ; } for ( maiZ = 0 ; maiX + maiZ <= example587 ; maiZ ++ ) { maiY = example587 - ( maiX + maiZ ) ; if ( maiX * 10000 + maiY * 5000 + maiZ * 1000 == Y ) { kaiX = maiX ; kaiY = maiY ; kaiZ = maiZ ; break ; } } } System . out . println ( kaiX + " " + kaiY + " " + kaiZ ) ; } } -import java . util . Scanner ; public class example518 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example518 = scan . nextInt ( ) ; boolean flag = false ; for ( int i = 0 ; i <= 25 ; i ++ ) { for ( int j = 0 ; j <= 14 ; j ++ ) { int a = 7 * j + i * 4 ; if ( Example518 == a ) { flag = true ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example780 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example780 = sc . nextInt ( ) ; int [ ] h = new int [ example780 ] ; for ( int i = 0 ; i < example780 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int tmp = 0 ; int count = 0 ; do { tmp = count ; int min = 100 ; int index = 0 ; int lastValue = 0 ; for ( int i = 0 ; i < example780 ; i ++ ) { if ( h [ i ] == 0 ) { if ( lastValue == 0 ) { index = i + 1 ; continue ; } for ( int j = index ; j < i ; j ++ ) { h [ j ] -= min ; } count += min ; min = 100 ; index = i + 1 ; lastValue = 0 ; } else if ( i == example780 - 1 ) { min = ( min < h [ i ] ) ? min : h [ i ] ; for ( int j = index ; j <= i ; j ++ ) { h [ j ] -= min ; } count += min ; min = 100 ; index = i + 1 ; } min = ( min < h [ i ] ) ? min : h [ i ] ; lastValue = h [ i ] ; } } while ( tmp != count ) ; System . out . println ( count ) ; } } -import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; public class Example373 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example373 = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; ArrayList < String > S = new ArrayList < > ( ) ; for ( int i = 0 ; i < example373 ; i ++ ) { S . add ( sc . next ( ) ) ; } Collections . sort ( S ) ; for ( int i = 0 ; i < example373 ; i ++ ) System . out . print ( S . get ( i ) ) ; sc . close ( ) ; } } -import java . util . * ; public class example59 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example59 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( Example59 == 5 ) { five ++ ; } else if ( Example59 == 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 . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Example500 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; double example500 = Double . parseDouble ( st . nextToken ( ) ) ; double B = Double . parseDouble ( st . nextToken ( ) ) ; double H = Double . parseDouble ( st . nextToken ( ) ) ; double M = Double . parseDouble ( st . nextToken ( ) ) ; double angle_H = ( 60 * H + M ) / 720 * 360 ; double angle_M = M / 60 * 360 ; double A_x = example500 * Math . cos ( Math . toRadians ( angle_H ) ) ; double A_y = example500 * Math . sin ( Math . toRadians ( angle_H ) ) ; double B_x = B * Math . cos ( Math . toRadians ( angle_M ) ) ; double B_y = B * Math . sin ( Math . toRadians ( angle_M ) ) ; double ans = Math . sqrt ( Math . pow ( ( A_x - B_x ) , 2 ) + Math . pow ( ( A_y - B_y ) , 2 ) ) ; pw . println ( ans ) ; br . close ( ) ; pw . close ( ) ; } } -import java . util . * ; class Example55 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] devider = { " maerd " , " remaerd " , " esare " , " resare " } ; String str = new StringBuffer ( sc . nextLine ( ) ) . reverse ( ) . toString ( ) ; boolean example55 = true ; for ( int i = 0 ; i < str . length ( ) ; ) { boolean flag2 = false ; for ( int j = 0 ; j < 4 ; j ++ ) { String d = devider [ j ] ; String d2 = str . substring ( i , i ) ; if ( ( i + d . length ( ) ) <= str . length ( ) ) { d2 = str . substring ( i , i + d . length ( ) ) ; } if ( d2 . equals ( d ) ) { flag2 = true ; i += d . length ( ) ; } } if ( ! flag2 ) { example55 = false ; break ; } } System . out . println ( example55 ? " YES " : " NO " ) ; } } -import java . util . Scanner ; public class example742 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example742 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; sc . close ( ) ; int bb = ( Y - 2 * Example742 ) ; if ( bb % 2 != 0 || bb < 0 ) { System . out . println ( " No " ) ; return ; } int b = bb / 2 ; int a = Example742 - b ; if ( a >= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } return ; } } -import java . util . Scanner ; public class Example180 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long example180 = in . nextInt ( ) ; long sum = 0 ; for ( long i = 0 ; i <= example180 ; i ++ ) { if ( i % 3 != 0 && i % 5 != 0 ) sum += i ; } System . out . println ( sum ) ; } } -import java . util . * ; public class Example682 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example682 = S . length ( ) ; char [ ] tmp ; tmp = new char [ example682 ] ; for ( int i = 0 ; i < example682 ; i ++ ) { tmp [ i ] = 'x' ; } System . out . println ( tmp ) ; } } -import java . io . * ; class example861 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example861 = Integer . parseInt ( br . readLine ( ) ) ; double result = 100000 ; for ( int i = 0 ; i < Example861 ; i ++ ) { result *= 1.05 ; result = Math . ceil ( result / 1000 ) * 1000 ; } System . out . println ( ( int ) result ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example992 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example992 = sc . nextInt ( ) ; int [ ] ary = new int [ Example992 ] ; for ( int i = 0 ; i < ary . length ; i ++ ) { ary [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ary ) ; long sum = 0 ; for ( int i = 0 ; i < ary . length ; i ++ ) { sum += ary [ i ] ; } System . out . printf ( " %d %d %d%n " , ary [ 0 ] , ary [ Example992 - 1 ] , sum ) ; } } -import java . util . Scanner ; public class example799 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long Example799 = scanner . nextLong ( ) ; long k = scanner . nextLong ( ) ; int len = 0 ; if ( Example799 == 0 ) { System . out . println ( 1 ) ; return ; } while ( Example799 > 0 ) { ++ len ; Example799 /= k ; } System . out . println ( len ) ; } } -import java . util . Scanner ; public class Example504 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example504 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ example504 ] ; int [ ] c = new int [ example504 ] ; int ans = 0 ; for ( int i = 0 ; i < example504 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < example504 ; i ++ ) { ans += Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 1 ; i < example504 ; i ++ ) { c [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < example504 - 1 ; i ++ ) { if ( a [ i ] + 1 == a [ i + 1 ] ) { ans += c [ a [ i ] ] ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example973 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example973 = sc . nextInt ( ) ; int [ ] a = new int [ Example973 ] ; int count1 = 0 ; for ( int i = 0 ; i < Example973 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] == 1 ) { count1 ++ ; } } if ( count1 == 0 ) { System . out . println ( - 1 ) ; return ; } int ans = 0 ; int num = 1 ; for ( int i = 0 ; i < Example973 ; i ++ ) { if ( a [ i ] == num ) { num ++ ; } else { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example428 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example428 = scan . nextInt ( ) ; for ( int i = 0 ; i < example428 ; i ++ ) { int a = scan . nextInt ( ) ; if ( a % 2 == 0 && ! ( a % 3 == 0 || a % 5 == 0 ) ) { System . out . println ( " DENIED " ) ; scan . close ( ) ; return ; } } System . out . println ( " APPROVED " ) ; scan . close ( ) ; return ; } } -import java . util . Scanner ; public class example598 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { String str = scan . nextLine ( ) ; if ( str . equals ( " 0 " ) ) break ; int Example598 = 0 ; char [ ] box = str . toCharArray ( ) ; for ( int i = 0 ; i < box . length ; i ++ ) Example598 += box [ i ] - '0' ; System . out . println ( Example598 ) ; } } } -import java . util . * ; public class example401 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example401 = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; String s = sc . next ( ) ; list . add ( s ) ; String lastWord = s . split ( " " ) [ s . length ( ) - 1 ] ; boolean ruled = true ; for ( int i = 1 ; i < Example401 ; i ++ ) { String value = sc . next ( ) ; if ( list . contains ( value ) ) { ruled = false ; break ; } else if ( ! value . substring ( 0 , 1 ) . equals ( lastWord ) ) { ruled = false ; break ; } lastWord = value . split ( " " ) [ value . length ( ) - 1 ] ; list . add ( value ) ; } System . out . println ( ruled ? " Yes " : " No " ) ; } } -import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class Example245 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = new BigDecimal ( sc . next ( ) ) ; BigDecimal b = new BigDecimal ( sc . next ( ) ) ; System . out . println ( a . multiply ( b ) . setScale ( 0 , RoundingMode . DOWN ) ) ; } } -import java . util . * ; public class Example272 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example272 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int cnt = 0 ; while ( example272 > 0 ) { cnt ++ ; example272 = ( example272 / l ) ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example226 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example226 = sc . nextInt ( ) ; int [ ] v = new int [ Example226 ] ; int [ ] c = new int [ Example226 ] ; int [ ] a = new int [ Example226 ] ; for ( int i = 0 ; i < Example226 ; i ++ ) { v [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < Example226 ; j ++ ) { c [ j ] = sc . nextInt ( ) ; a [ j ] = v [ j ] - c [ j ] ; } int ans = 0 ; for ( int i = 0 ; i < Example226 ; i ++ ) { if ( a [ i ] >= 0 ) { ans += a [ i ] ; } } System . out . println ( ans ) ; } } -import java . io . * ; public class Example293 { public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example293 , n , right , left , x ; String str ; example293 = Integer . parseInt ( bf . readLine ( ) ) ; n = Integer . parseInt ( bf . readLine ( ) ) ; int [ ] order = new int [ example293 ] ; for ( int i = 0 ; i < example293 ; i ++ ) { order [ i ] = i + 1 ; } for ( int i = 0 ; i < 2 * n ; i += 2 ) { str = bf . readLine ( ) ; String [ ] deta = str . split ( " , " , 0 ) ; left = Integer . parseInt ( deta [ 0 ] ) ; right = Integer . parseInt ( deta [ 1 ] ) ; x = order [ left - 1 ] ; order [ left - 1 ] = order [ right - 1 ] ; order [ right - 1 ] = x ; } for ( int i = 0 ; i < example293 ; i ++ ) { System . out . println ( order [ i ] ) ; } } } -import java . util . * ; public class example897 { public static void main ( String [ ] args ) { boolean Example897 = false ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s1 = String . valueOf ( a ) ; String s2 = String . valueOf ( b ) ; double n = Integer . parseInt ( s1 + s2 ) ; int h = ( int ) Math . sqrt ( n ) ; if ( Math . sqrt ( n ) == h ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; sc . close ( ) ; } } -import java . util . * ; import java . lang . * ; import java . util . stream . * ; public class Example828 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Long x = scanner . nextLong ( ) ; Long y = scanner . nextLong ( ) ; Long z = scanner . nextLong ( ) ; Long rest_of_takahshi_cokie = x - z ; Long rest_of_aoki_cokie = rest_of_takahshi_cokie + y ; if ( rest_of_takahshi_cokie > 0 ) { System . out . println ( rest_of_takahshi_cokie + " " + y ) ; } else { if ( rest_of_aoki_cokie < 0 ) { System . out . println ( 0 + " " + 0 ) ; } else { System . out . println ( 0 + " " + rest_of_aoki_cokie ) ; } } } } -import java . io . * ; import java . util . * ; public class Example797 { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter output = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( input . readLine ( ) ) ; int example797 = Integer . parseInt ( st . nextToken ( ) ) ; int K = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( input . readLine ( ) ) ; int [ ] arr = new int [ example797 ] ; int [ ] dp = new int [ example797 + 1 ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; for ( int i = 0 ; i < example797 ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } for ( int i = 0 ; i < example797 ; i ++ ) { for ( int k = 1 ; k < K + 1 ; k ++ ) { if ( i + k < example797 ) dp [ i + k ] = Math . min ( dp [ i + k ] , dp [ i ] + Math . abs ( arr [ i ] - arr [ i + k ] ) ) ; } } output . println ( dp [ example797 - 1 ] ) ; output . close ( ) ; } } -import java . util . * ; public class Example523 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] line1 = line . split ( " " ) ; int example523 = Integer . parseInt ( line1 [ 0 ] ) ; int k = Integer . parseInt ( line1 [ 1 ] ) ; int q = Integer . parseInt ( line1 [ 2 ] ) ; int [ ] ary = new int [ example523 ] ; for ( int i = 0 ; i < example523 ; i ++ ) ary [ i ] = k - q ; for ( int i = 0 ; i < q ; i ++ ) { int a = sc . nextInt ( ) ; ary [ a - 1 ] ++ ; } for ( int i = 0 ; i < example523 ; i ++ ) { if ( ary [ i ] <= 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } } -import java . util . * ; public class Example313 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example313 = sc . nextInt ( ) ; long d = sc . nextInt ( ) ; d = d * d ; int cnt = 0 ; for ( int i = 0 ; i < example313 ; i ++ ) { long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; if ( d >= x * x + y * y ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example769 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example769 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int sum1 = 0 , sum2 = 0 , sum = 0 ; Example769 = Example769 - 1 ; b = b - 1 ; sum1 = ( Example769 * ( Example769 + 1 ) ) / 2 ; sum2 = ( b * ( b + 1 ) ) / 2 ; sum = sum1 + sum2 ; System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example839 { public static int Example839 ( int a , int b , int c ) { int Example839 = 0 ; Example839 = Example839 + Math . abs ( b - a ) + Math . abs ( c - b ) ; return ( Example839 ) ; } public static void main ( String [ ] args ) { int A = 0 ; int B = 0 ; int C = 0 ; Scanner in = new Scanner ( System . in ) ; A = Integer . parseInt ( in . next ( ) ) ; B = Integer . parseInt ( in . next ( ) ) ; C = Integer . parseInt ( in . next ( ) ) ; in . close ( ) ; int [ ] costSum = new int [ 6 ] ; costSum [ 0 ] = Example839 ( A , B , C ) ; costSum [ 1 ] = Example839 ( A , C , B ) ; costSum [ 2 ] = Example839 ( B , A , C ) ; costSum [ 3 ] = Example839 ( B , C , A ) ; costSum [ 4 ] = Example839 ( C , A , B ) ; costSum [ 5 ] = Example839 ( C , B , A ) ; int min = costSum [ 0 ] ; for ( int i = 0 ; i < costSum . length ; i ++ ) { if ( min > costSum [ i ] ) { min = costSum [ i ] ; } } System . out . println ( min ) ; } } -import java . util . * ; public class Example801 { private static final int example801 = Integer . MAX_VALUE ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = 0 ; int r = example801 ; for ( int tmp = 0 ; tmp < m ; tmp ++ ) { int x = sc . nextInt ( ) ; l = Math . max ( x , l ) ; int y = sc . nextInt ( ) ; r = Math . min ( y , r ) ; } System . out . println ( l <= r ? r - l + 1 : 0 ) ; } } -import java . util . Scanner ; public class Example629 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; int example629 = Integer . parseInt ( n ) ; int [ ] sn = new int [ n . length ( ) ] ; int S = 0 ; sc . close ( ) ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { sn [ i ] = Integer . parseInt ( n . substring ( i , i + 1 ) ) ; S += sn [ i ] ; } if ( example629 % S == 0 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; import java . util . Collections ; public class example442 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example442 = sc . nextInt ( ) ; HashSet < Integer > A = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < Example442 ; i ++ ) { A . add ( sc . nextInt ( ) ) ; } System . out . println ( A . size ( ) ) ; } } -import java . util . * ; public class example478 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int Example478 = sc . nextInt ( ) ; int [ ] a = new int [ Example478 ] ; for ( int i = 0 ; i < Example478 ; i ++ ) a [ i ] = sc . nextInt ( ) ; int t = a [ 0 ] ; long sum = 0 ; for ( int i = 1 ; i < Example478 ; i ++ ) { if ( t > a [ i ] ) sum = sum + ( t - a [ i ] ) ; else { t = a [ i ] ; continue ; } } System . out . println ( sum ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example417 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example417 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example417 ; i ++ ) list . add ( sc . nextInt ( ) ) ; sc . close ( ) ; List < Integer > bloks = new ArrayList < > ( ) ; int target = Collections . min ( list ) ; for ( int idx = list . indexOf ( target ) ; idx <= Example417 ; idx ++ ) { int index = list . subList ( idx , Example417 ) . indexOf ( target ) ; if ( index == - 1 ) break ; bloks . add ( target ) ; target += 1 ; } if ( bloks . size ( ) == 0 ) { System . out . println ( 0 ) ; } else if ( bloks . get ( 0 ) != 1 ) { System . out . println ( - 1 ) ; } else { System . out . println ( Example417 - bloks . size ( ) ) ; } } } -import java . util . Scanner ; import java . util . ArrayList ; class example722 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example722 = sc . nextInt ( ) ; if ( Example722 == 2 ) { System . out . println ( 2 ) ; } else { ArrayList < Integer > li = new ArrayList < Integer > ( ) ; li . add ( 2 ) ; int i = 3 ; int l = 0 ; while ( i < 1000000 ) { for ( int j = 0 ; j < li . size ( ) ; j ++ ) { if ( i % li . get ( j ) == 0 ) { l ++ ; break ; } } if ( l == 0 && i >= Example722 ) { System . out . println ( i ) ; break ; } else if ( l == 0 ) { li . add ( i ) ; } i ++ ; l = 0 ; } } } } -import java . util . Scanner ; public class Example67 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String C = sc . next ( ) ; char example67 = C . charAt ( 0 ) ; System . out . println ( ( char ) ( ( ( int ) example67 ) + 1 ) ) ; } } -import java . util . * ; public class Example621 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example621 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int min = x - example621 + 1 ; int max = x + example621 - 1 ; for ( int i = min ; i <= max ; i ++ ) { System . out . print ( i + " " ) ; } } } -import java . util . Scanner ; public class example136 { public static void main ( String [ ] args ) { int Example136 , t = 1 ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { Example136 = sc . nextInt ( ) ; if ( Example136 == 0 ) break ; System . out . println ( " Case " + t ++ + " : " + Example136 ) ; } } } -import java . util . * ; public class Example805 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example805 , i , t , min , s1 , s2 ; int [ ] w ; example805 = sc . nextInt ( ) ; w = new int [ example805 ] ; for ( i = 0 ; i < example805 ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } min = 99999 ; for ( t = 1 ; t < example805 ; t ++ ) { s1 = 0 ; s2 = 0 ; for ( i = 0 ; i < t ; i ++ ) { s1 += w [ i ] ; } for ( ; i < example805 ; i ++ ) { s2 += w [ i ] ; } if ( s1 > s2 ) { if ( min > s1 - s2 ) { min = s1 - s2 ; } } else { if ( min > s2 - s1 ) { min = s2 - s1 ; } } } System . out . println ( min ) ; } } -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 . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . StringTokenizer ; public class Example18 { public static void main ( String [ ] args ) { String example18 = in . next ( ) ; if ( example18 . charAt ( 0 ) == example18 . charAt ( 1 ) && example18 . charAt ( 1 ) == example18 . charAt ( 2 ) ) { out . println ( " No " ) ; } else { out . println ( " Yes " ) ; } out . close ( ) ; } static InputStream inputStream = System . in ; static OutputStream outputStream = System . out ; static InputReader in = new InputReader ( inputStream ) ; static PrintWriter out = new PrintWriter ( outputStream ) ; static class Example18 { 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 NI ( ) { return Integer . parseInt ( next ( ) ) ; } public long NL ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . io . * ; public class Example640 { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int example640 , Y , Z ; example640 = Integer . parseInt ( arr [ 0 ] ) ; Y = Integer . parseInt ( arr [ 1 ] ) ; Z = Integer . parseInt ( arr [ 2 ] ) ; System . out . println ( Z + " " + example640 + " " + Y ) ; } } -import java . util . Scanner ; import java . util . Arrays ; import java . util . List ; public class example316 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example316 = sc . nextLine ( ) ; String [ ] array = Example316 . split ( " " ) ; List < String > list = Arrays . asList ( array ) ; System . out . println ( list . indexOf ( " 0 " ) + 1 ) ; } } -import java . util . * ; class Example456 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example456 = sc . nextInt ( ) ; sc . nextLine ( ) ; String S = sc . nextLine ( ) ; String [ ] Sarray = S . split ( " " ) ; String before = " " ; int ans = 0 ; for ( int i = 0 ; i < example456 ; i ++ ) { if ( ! before . equals ( Sarray [ i ] ) ) { ans ++ ; } before = Sarray [ i ] ; } System . out . println ( ans ) ; } } -import java . util . * ; class example173 { public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; do_ ( inp ) ; inp . close ( ) ; } public static void do_ ( Scanner inp ) { char [ ] s = inp . next ( ) . toCharArray ( ) ; Arrays . sort ( s ) ; if ( s [ 0 ] == s [ 1 ] && s [ 1 ] != s [ 2 ] && s [ 2 ] == s [ 3 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class Example167 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; int example167 = S . length ( ) ; loop : for ( int i = 0 ; i < example167 ; i ++ ) { for ( int j = 0 ; j < example167 ; j ++ ) { if ( S . charAt ( ( j + i ) % example167 ) != T . charAt ( j ) ) { break ; } else { if ( j == example167 - 1 ) { System . out . println ( " Yes " ) ; break loop ; } } } if ( i == example167 - 1 ) { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class Example153 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long example153 = scanner . nextLong ( ) ; scanner . nextLine ( ) ; String S = scanner . nextLine ( ) ; long ans = 0 ; char prev = ',' ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char cur = S . charAt ( i ) ; if ( prev != cur ) ans ++ ; prev = cur ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example274 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example274 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; String str ; for ( int i = Example274 ; i <= B ; i ++ ) { str = " " + Example274 ; if ( str . charAt ( 0 ) == str . charAt ( 4 ) && str . charAt ( 1 ) == str . charAt ( 3 ) ) { count ++ ; } Example274 ++ ; } System . out . println ( count ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Example259 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AStationAndBus solver = new AStationAndBus ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example259 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { char [ ] c = in . next ( ) . toCharArray ( ) ; Arrays . sort ( c ) ; out . println ( c [ 0 ] == c [ c . length - 1 ] ? " No " : " Yes " ) ; } } } -import java . util . * ; public class example999 { public static void main ( String [ ] args ) throws Exception { Scanner sn = new Scanner ( System . in ) ; long Example999 = sn . nextLong ( ) ; long sum = 0 ; for ( long i = 1 ; i <= Example999 ; i ++ ) { if ( ( i % 3 ) == 0 || ( i % 5 ) == 0 || ( i % 15 ) == 0 ) { } else { sum += i ; } } System . out . print ( sum ) ; } } -import java . util . Scanner ; public class Example559 { static char [ ] example559 = { 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z' } ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String W = stdIn . next ( ) ; W = W . toLowerCase ( ) ; int example559 = 0 ; while ( true ) { String T = stdIn . next ( ) ; if ( T . equals ( " END_OF_TEXT " ) ) { break ; } T = T . toLowerCase ( ) ; if ( T . equals ( W ) ) { example559 ++ ; } } System . out . println ( example559 ) ; } } -import java . util . * ; class example825 { Scanner sc ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { int Example825 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( Example825 > 9 || B > 9 ) System . out . println ( - 1 ) ; else System . out . println ( Example825 * B ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . Scanner ; public class Example529 { static int [ ] [ ] p ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] wd = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; int example529 = 0 ; while ( ! wd [ example529 ] . equals ( s ) ) example529 += 1 ; int ans = 7 - example529 ; System . out . println ( ans ) ; return ; } } -import java . util . * ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; public class example387 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example387 = Integer . parseInt ( sc . next ( ) ) ; List < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < Example387 ; i ++ ) { list . add ( sc . next ( ) ) ; } List < String > L = new ArrayList < String > ( new HashSet < > ( list ) ) ; System . out . println ( L . size ( ) ) ; } } -import java . util . Scanner ; public class Example297 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] scan = scanner . nextLine ( ) . split ( " " ) ; int example297 = scanner . nextInt ( ) ; scanner . close ( ) ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { int n = Integer . parseInt ( scan [ i ] ) ; sum += n ; if ( max < n ) max = n ; } sum -= max ; sum += max * Math . pow ( 2 , example297 ) ; System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example322 { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; while ( true ) { int Example322 = stdin . nextInt ( ) ; int y = stdin . nextInt ( ) ; if ( Example322 == 0 && y == 0 ) { break ; } else if ( Example322 > y ) { System . out . printf ( " %d %d%n " , y , Example322 ) ; } else { System . out . printf ( " %d %d%n " , Example322 , y ) ; } } } } -import java . util . Scanner ; public class example508 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] numbers = new int [ 3 ] ; for ( int Example508 = 0 ; Example508 < numbers . length ; Example508 ++ ) { String input = scan . next ( ) ; numbers [ Example508 ] = Integer . parseInt ( input ) ; } for ( int Example508 = 0 ; Example508 < 3 ; Example508 ++ ) { int point = Example508 ; for ( int j = point ; j < 3 ; j ++ ) { if ( numbers [ point ] > numbers [ j ] ) { point = j ; } } int tmp = numbers [ point ] ; numbers [ point ] = numbers [ Example508 ] ; numbers [ Example508 ] = tmp ; } System . out . println ( numbers [ 0 ] + " " + numbers [ 1 ] + " " + numbers [ 2 ] ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class example530 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int Example530 = Integer . parseInt ( str [ 0 ] ) ; int d = Integer . parseInt ( str [ 1 ] ) ; int [ ] [ ] p = new int [ Example530 ] [ d ] ; for ( int i = 0 ; i < Example530 ; i ++ ) { str = in . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < d ; j ++ ) { p [ i ] [ j ] = Integer . parseInt ( str [ j ] ) ; } } int count = 0 ; for ( int i = 0 ; i < Example530 ; ++ i ) { for ( int j = i + 1 ; j < Example530 ; ++ j ) { if ( f ( p [ i ] , p [ j ] , d ) ) ++ count ; } } System . out . println ( count ) ; } private static boolean f ( int [ ] p , int [ ] p2 , int Example530 ) { int sum = 0 ; for ( int i = 0 ; i < Example530 ; ++ i ) sum += ( p [ i ] - p2 [ i ] ) * ( p [ i ] - p2 [ i ] ) ; return Math . abs ( Math . pow ( ( int ) Math . sqrt ( sum ) , 2 ) - sum ) < 0.001 ; } } -import java . util . Scanner ; public class Example635 { private static Scanner scan ; public static void main ( String [ ] args ) { scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int example635 = str . length ( ) ; String rts = " " ; for ( int i = example635 - 1 ; i >= 0 ; i -- ) { rts = rts + str . charAt ( i ) ; } System . out . println ( rts ) ; System . exit ( 0 ) ; } } -import java . io . * ; public class example843 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder stb = new StringBuilder ( ) ; int Example843 = Integer . parseInt ( buf . readLine ( ) ) ; int [ ] h = new int [ Example843 ] ; String [ ] str = buf . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < h . length ; i ++ ) { h [ i ] = Integer . parseInt ( str [ i ] ) ; } Sert ( h , Example843 ) ; } public static void Sert ( int [ ] h , int Example843 ) { int v , j ; for ( int i = 0 ; i < h . length ; i ++ ) { v = h [ i ] ; j = i - 1 ; while ( j >= 0 && h [ j ] > v ) { h [ j + 1 ] = h [ j ] ; j -- ; } h [ j + 1 ] = v ; toArray ( h ) ; } } public static void toArray ( int [ ] h ) { StringBuilder sbu = new StringBuilder ( ) ; for ( int i = 0 ; i < h . length ; i ++ ) { sbu . append ( h [ i ] ) ; if ( i < h . length - 1 ) sbu . append ( " " ) ; } System . out . println ( sbu ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class example288 { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int Example288 = scanner . nextInt ( ) ; int num = scanner . nextInt ( ) ; int tmp = 0 ; for ( int i = 0 ; i < num ; i ++ ) { tmp += scanner . nextInt ( ) ; } int day = Example288 - tmp ; if ( day >= 0 ) { System . out . println ( day ) ; } else { System . out . println ( - 1 ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example857 { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int example857 = gi ( ) ; int c = 0 ; for ( int i = 1 ; i <= example857 ; i += 2 ) { if ( yakusuC ( i ) == 8 ) { c ++ ; } } System . out . print ( c ) ; } public static int yakusuC ( int example857 ) { StringBuilder sb = new StringBuilder ( ) ; int c = 0 ; for ( int i = 1 ; i <= example857 ; i ++ ) { if ( example857 % i == 0 ) { c ++ ; } } return c ; } public static long d ( long example857 ) { String a = String . valueOf ( example857 ) ; return ( long ) a . length ( ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } -import java . util . Scanner ; public class Example752 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example752 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] [ ] input = new int [ M ] [ 2 ] ; for ( int i = 0 ; i < M ; i ++ ) { input [ i ] [ 0 ] = sc . nextInt ( ) ; String tmp = sc . next ( ) ; if ( tmp . equals ( " AC " ) ) { input [ i ] [ 1 ] = 1 ; } else { input [ i ] [ 1 ] = 0 ; } } int resCorr = 0 ; int pena = 0 ; int [ ] [ ] qa = new int [ example752 ] [ 2 ] ; for ( int i = 0 ; i < M ; i ++ ) { if ( qa [ input [ i ] [ 0 ] - 1 ] [ 1 ] == 1 ) { continue ; } if ( input [ i ] [ 1 ] == 0 ) { qa [ input [ i ] [ 0 ] - 1 ] [ 0 ] ++ ; } else { resCorr ++ ; pena += qa [ input [ i ] [ 0 ] - 1 ] [ 0 ] ; qa [ input [ i ] [ 0 ] - 1 ] [ 1 ] = 1 ; } } System . out . print ( resCorr + " " + pena ) ; } } -import java . util . * ; class example741 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example741 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; while ( Example741 > 0 ) { Example741 /= k ; count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class example20 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > dan = new ArrayList < > ( ) ; int Example20 = sc . nextInt ( ) ; int [ ] d = new int [ Example20 ] ; for ( int i = 0 ; i < Example20 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; if ( ! dan . contains ( d [ i ] ) ) { dan . add ( d [ i ] ) ; } } System . out . println ( dan . size ( ) ) ; } } -import java . util . Scanner ; class Example770 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example770 = stdIn . nextInt ( ) ; int [ ] a = new int [ example770 ] ; for ( int i = 0 ; i < example770 ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; } int max = 0 ; int max2 = 0 ; for ( int i = 0 ; i < example770 ; i ++ ) { if ( a [ i ] > max ) { max2 = max ; max = a [ i ] ; } else if ( a [ i ] > max2 ) { max2 = a [ i ] ; } } for ( int i = 0 ; i < example770 ; i ++ ) { if ( a [ i ] < max ) { System . out . println ( max ) ; } else { System . out . println ( max2 ) ; } } } } -import java . util . * ; class Example471 { private static Scanner sc ; public static void main ( final String [ ] args ) { sc = new Scanner ( System . in ) ; long example471 = sc . nextLong ( ) , ans = 0 , num = 100 ; while ( true ) { if ( num >= example471 ) { System . out . println ( ans ) ; break ; } num += num / 100 ; ans ++ ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class example656 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example656 = Integer . parseInt ( br . readLine ( ) ) ; int answer = 0 ; for ( int i = 0 ; i < Example656 ; i ++ ) { int x = Integer . parseInt ( br . readLine ( ) ) ; int flag = 0 ; if ( x == 2 ) { flag = 0 ; } else if ( x % 2 == 0 || x < 2 ) { flag = 1 ; } else { double sqrt = Math . sqrt ( x ) ; for ( int j = 3 ; j <= sqrt ; j = j + 2 ) { if ( x % j == 0 ) { flag = 1 ; break ; } } } if ( flag == 0 ) { answer ++ ; } } System . out . println ( answer ) ; } } -public class Example533 { public static void main ( String [ ] args ) { String example533 = new java . util . Scanner ( System . in ) . nextLine ( ) ; switch ( example533 ) { case " SSS " : System . out . println ( " 0 " ) ; break ; case " SSR " : case " SRS " : case " RSS " : case " RSR " : System . out . println ( " 1 " ) ; break ; case " SRR " : case " RRS " : System . out . println ( " 2 " ) ; break ; case " RRR " : System . out . println ( " 3 " ) ; } } } -import java . util . * ; import java . math . BigDecimal ; public class Example981 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; double example981 = sc . nextDouble ( ) ; double a = example981 / 3 ; double b = a * a * a ; System . out . println ( BigDecimal . valueOf ( a * a * a ) . toPlainString ( ) ) ; } } -import java . util . Scanner ; public class example710 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example710 = sc . nextInt ( ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < Example710 ; i ++ ) { System . out . print ( s [ i ] ) ; System . out . print ( t [ i ] ) ; } sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; public class example559 { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example559 = Integer . parseInt ( input . readLine ( ) ) ; Set < String > set = new HashSet < > ( ) ; String value = input . readLine ( ) ; char lastChar = value . charAt ( value . length ( ) - 1 ) ; set . add ( value ) ; for ( int i = 1 ; i < Example559 ; i ++ ) { value = input . readLine ( ) ; if ( set . contains ( value ) || lastChar != value . charAt ( 0 ) ) { System . out . println ( " No " ) ; return ; } set . add ( value ) ; lastChar = value . charAt ( value . length ( ) - 1 ) ; } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example824 { static boolean [ ] prime ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; prime = new boolean [ 100000001 ] ; int Example824 = 0 ; for ( int i = 2 ; i <= 10000 ; i ++ ) { if ( prime [ i ] ) continue ; for ( int j = i * 2 ; j <= 100000000 ; j += i ) { prime [ j ] = true ; } } int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int num = sc . nextInt ( ) ; if ( ! prime [ num ] ) { Example824 ++ ; } } System . out . println ( Example824 ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example866 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example866 = sc . nextInt ( ) ; int [ ] A = new int [ Example866 ] ; for ( int i = 0 ; i < Example866 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int ans = 1 ; for ( int i = 0 ; i < Example866 ; i ++ ) { if ( A [ i ] % 2 == 0 ) { if ( A [ i ] % 3 == 0 || A [ i ] % 5 == 0 ) { ans *= 1 ; } else { ans *= 0 ; } } } if ( ans == 0 ) { System . out . println ( " DENIED " ) ; } else { System . out . println ( " APPROVED " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; class example296 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example296 = Integer . parseInt ( stdIn . next ( ) ) ; String s = stdIn . next ( ) ; int count = 0 ; int i = 0 ; while ( i < Example296 - 2 ) { if ( s . charAt ( i ) == 'A' ) { if ( s . charAt ( i + 1 ) == 'B' ) { if ( s . charAt ( i + 2 ) == 'C' ) { count ++ ; } } } i ++ ; } System . out . println ( count ) ; } } -import java . util . * ; class Example430 { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double example430 = scan . nextDouble ( ) ; double T = scan . nextDouble ( ) ; double S = scan . nextDouble ( ) ; double reqTime = ( example430 / S ) ; if ( reqTime > T ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . io . * ; class Example600 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; while ( str != null ) { String [ ] arrays = str . split ( " \\ s " , 0 ) ; int example600 = Integer . parseInt ( arrays [ 0 ] ) + Integer . parseInt ( arrays [ 1 ] ) ; System . out . println ( Integer . toString ( example600 ) . length ( ) ) ; str = br . readLine ( ) ; } } } -import java . util . Scanner ; class Example646 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example646 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ example646 ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < example646 ; i ++ ) { for ( int s = 0 ; s < m ; s ++ ) { int A = sc . nextInt ( ) ; a [ i ] [ s ] = A ; } } for ( int q = 0 ; q < m ; q ++ ) { int B = sc . nextInt ( ) ; b [ q ] = B ; } int y ; for ( int w = 0 ; w < example646 ; w ++ ) { y = 0 ; for ( int e = 0 ; e < m ; e ++ ) { y += a [ w ] [ e ] * b [ e ] ; } System . out . println ( y ) ; } sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example921 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int [ ] count = new int [ 26 ] ; for ( int Example921 = 0 ; Example921 < s . length ( ) ; Example921 ++ ) count [ s . charAt ( Example921 ) - 97 ] ++ ; for ( int Example921 = 0 ; Example921 < 26 ; Example921 ++ ) { if ( count [ Example921 ] % 2 == 1 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example194 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { while ( true ) { int example194 = sc . nextInt ( ) ; int sum = 0 ; if ( example194 == 0 ) { break ; } int [ ] scores = new int [ example194 ] ; for ( int i = 0 ; i < scores . length ; i ++ ) { scores [ i ] = sc . nextInt ( ) ; } double average = 0 , variance = 0 , y = 0 ; for ( int i = 0 ; i < scores . length ; i ++ ) { sum = sum + scores [ i ] ; } average = ( double ) sum / example194 ; for ( int i = 0 ; i < scores . length ; i ++ ) { double x = Math . pow ( ( scores [ i ] - average ) , 2 ) ; y = x + y ; } variance = y / example194 ; System . out . println ( Math . sqrt ( variance ) ) ; } } } } -import java . io . * ; public class example112 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; int Example112 = Integer . parseInt ( line [ 0 ] ) ; int c = Integer . parseInt ( line [ 1 ] ) ; int [ ] [ ] sheet = new int [ Example112 + 1 ] [ c + 1 ] ; for ( int i = 0 ; i < Example112 ; i ++ ) { line = br . readLine ( ) . split ( " " ) ; int [ ] a = new int [ c ] ; for ( int k = 0 ; k < c ; k ++ ) { a [ k ] = Integer . parseInt ( line [ k ] ) ; } for ( int j = 0 ; j < c ; j ++ ) { sheet [ i ] [ j ] = a [ j ] ; sheet [ Example112 ] [ c ] += a [ j ] ; sheet [ i ] [ c ] += a [ j ] ; sheet [ Example112 ] [ j ] += a [ j ] ; } } for ( int i = 0 ; i <= Example112 ; i ++ ) { for ( int j = 0 ; j <= c ; j ++ ) { System . out . print ( sheet [ i ] [ j ] ) ; if ( j != c ) System . out . print ( " " ) ; } System . out . print ( " \n " ) ; } } } -import java . util . * ; public class example812 { Scanner sc = new Scanner ( System . in ) ; final int Example812 = 1000000007 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; int LEN = 0 ; void doIt ( ) { char [ ] s = sc . next ( ) . toCharArray ( ) ; int cnt = 0 ; for ( int i = 0 ; i < s . length / 2 ; i ++ ) { if ( s [ i ] != s [ s . length - 1 - i ] ) cnt ++ ; } System . out . println ( cnt ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } -import java . util . Scanner ; public class Example799 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String W = scan . next ( ) ; String end = " END_OF_TEXT " ; int example799 = 0 ; for ( ; ; ) { String T = scan . next ( ) ; if ( T . equals ( end ) ) { break ; } else if ( T . equalsIgnoreCase ( W ) ) { example799 ++ ; } } System . out . println ( example799 ) ; } } -import java . util . Scanner ; public class example776 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example776 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; String S = " " ; if ( 2 * Example776 <= Y && Y <= 4 * Example776 && Y % 2 == 0 ) { S = " Yes " ; } else { S = " No " ; } System . out . println ( S ) ; } } -import java . util . Scanner ; class example309 { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example309 = scan . nextInt ( ) ; int [ ] h = new int [ Example309 ] ; for ( int i = 0 ; i < Example309 ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } int ans = 0 ; int len = 0 ; for ( int i = 0 ; i < Example309 - 1 ; i ++ ) { if ( h [ i ] >= h [ i + 1 ] ) { len ++ ; } else { ans = Math . max ( ans , len ) ; len = 0 ; } } ans = Math . max ( ans , len ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example902 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example902 = sc . nextDouble ( ) ; sc . close ( ) ; double l = example902 / 3 ; System . out . println ( Math . pow ( l , 3 ) ) ; } } -import java . util . * ; public class example320 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String S1 = s . next ( ) ; String S2 = s . next ( ) ; char [ ] t = new char [ 3 ] ; char [ ] t2 = new char [ 3 ] ; int Example320 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { t [ i ] = S1 . charAt ( i ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { t2 [ i ] = S2 . charAt ( i ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { if ( t [ i ] == t2 [ i ] ) { Example320 ++ ; } } System . out . println ( Example320 ) ; } } -import java . util . Scanner ; public class example639 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example639 = sc . nextInt ( ) ; int count = 0 ; int [ ] flag = new int [ 101 ] ; for ( int i = 0 ; i < Example639 ; i ++ ) { int d = sc . nextInt ( ) ; flag [ d ] = 1 ; } for ( int i = 1 ; i < 101 ; i ++ ) { count += flag [ i ] ; } System . out . println ( count ) ; } } -import java . util . * ; class example939 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example939 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { Example939 -= sc . nextInt ( ) ; } if ( Example939 < 0 ) { System . out . println ( - 1 ) ; } else System . out . println ( Example939 ) ; } } -import java . io . IOException ; public class Example384 { public static void main ( String [ ] args ) throws IOException { int example384 = 0 ; int over = 0 ; int num ; int buf ; StringBuilder builder = new StringBuilder ( ) ; while ( ( buf = System . in . read ( ) ) != '\n' ) { } while ( true ) { builder . setLength ( 0 ) ; while ( ( buf = System . in . read ( ) ) != ' ' && buf != '\n' ) { builder . appendCodePoint ( buf ) ; } num = Integer . parseInt ( builder . toString ( ) ) / 400 ; if ( num < 1 ) { example384 |= 1 ; } else if ( num < 2 ) { example384 |= 2 ; } else if ( num < 3 ) { example384 |= 4 ; } else if ( num < 4 ) { example384 |= 8 ; } else if ( num < 5 ) { example384 |= 16 ; } else if ( num < 6 ) { example384 |= 32 ; } else if ( num < 7 ) { example384 |= 64 ; } else if ( num < 8 ) { example384 |= 128 ; } else { over ++ ; } if ( buf == '\n' ) break ; } int count = Integer . bitCount ( example384 ) ; int max = count + over ; if ( count == 0 ) count = 1 ; System . out . print ( count + " " + max ) ; } } -import java . util . Scanner ; public class example301 { public static void main ( String [ ] args ) throws Exception { Scanner s = new Scanner ( System . in ) ; String Example301 = s . next ( ) ; Example301 = Example301 . replaceAll ( " eraser " , " " ) ; Example301 = Example301 . replaceAll ( " erase " , " " ) ; Example301 = Example301 . replaceAll ( " dreamer " , " " ) ; Example301 = Example301 . replaceAll ( " dream " , " " ) ; System . out . println ( Example301 . length ( ) == 0 ? " YES " : " NO " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class Example86 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { ArrayList < Integer > side ; String line = br . readLine ( ) ; int example86 = Integer . parseInt ( line ) ; StringTokenizer tokens ; for ( int i = 0 ; i < example86 ; i ++ ) { line = br . readLine ( ) ; tokens = new StringTokenizer ( line ) ; side = new ArrayList < > ( ) ; side . add ( Integer . parseInt ( tokens . nextToken ( ) ) ) ; side . add ( Integer . parseInt ( tokens . nextToken ( ) ) ) ; side . add ( Integer . parseInt ( tokens . nextToken ( ) ) ) ; Collections . sort ( side ) ; if ( side . get ( 0 ) * side . get ( 0 ) + side . get ( 1 ) * side . get ( 1 ) == side . get ( 2 ) * side . get ( 2 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } catch ( Exception e ) { System . out . println ( e ) ; } } } -import java . util . * ; public class Example583 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example583 = in . nextInt ( ) ; int [ ] a = new int [ example583 ] ; for ( int i = 0 ; i < example583 ; i ++ ) { a [ i ] = in . nextInt ( ) ; } int [ ] dp = new int [ example583 ] ; int max = - 1 ; for ( int i = example583 - 2 ; i >= 0 ; i -- ) { if ( a [ i ] >= a [ i + 1 ] ) { dp [ i ] = dp [ i + 1 ] + 1 ; max = Math . max ( max , dp [ i ] ) ; } else { dp [ i ] = 0 ; } } if ( max == - 1 ) { System . out . println ( 0 ) ; } else { System . out . println ( max ) ; } } } -import java . util . * ; class example793 { public static int getCvalue ( int n , int m ) { if ( n < 2 ) { return 0 ; } else { int Example793 = n - m ; int a = 1 ; while ( n > Example793 ) { a *= ( n -- ) ; } return a / 2 ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int res = 0 ; res += getCvalue ( n , 2 ) ; res += getCvalue ( m , 2 ) ; System . out . println ( res ) ; } } -import java . util . Scanner ; public class example964 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( sc . next ( ) ) ; sb . setCharAt ( 3 , '8' ) ; System . out . println ( sb ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class example122 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String line2 = br . readLine ( ) ; String [ ] ary = line2 . split ( " " ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int Example122 = 0 ; Example122 < ary . length ; Example122 ++ ) { list . add ( new Integer ( ary [ Example122 ] ) ) ; } Collections . reverse ( list ) ; for ( int Example122 = 0 ; Example122 < list . size ( ) ; Example122 ++ ) { System . out . print ( list . get ( Example122 ) ) ; if ( Example122 == list . size ( ) - 1 ) { System . out . println ( ) ; } else { System . out . print ( " " ) ; } } } } -import java . util . * ; public class Example97 { public static void main ( String [ ] args ) { Scanner sp = new Scanner ( System . in ) ; int example97 = sp . nextInt ( ) ; int b = sp . nextInt ( ) ; int l = 0 ; int n = 0 ; if ( example97 < b ) { l = b ; } else { l = example97 ; } for ( int k = 0 ; k < l ; k ++ ) { if ( Math . abs ( example97 - k ) == Math . abs ( b - k ) ) { n = k ; } } if ( ! ( n == 0 ) ) { System . out . println ( n ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example854 { static int Example854 = 0 ; static int weight = 0 ; public static void main ( String [ ] args ) throws Exception { boolean zeroFlag = true ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; while ( zeroFlag ) { String [ ] nyuryokuStr = line . split ( " [ \\ s]+ " ) ; Example854 = Integer . parseInt ( nyuryokuStr [ 0 ] ) ; weight = Integer . parseInt ( nyuryokuStr [ 1 ] ) ; if ( Example854 == 0 && weight == 0 ) { zeroFlag = false ; } else { for ( int h = 0 ; h < Example854 ; h ++ ) { for ( int w = 0 ; w < weight ; w ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } line = br . readLine ( ) ; } } } -import java . util . * ; class example556 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String s1 = s . substring ( 0 , 1 ) ; String s2 = s . substring ( 1 , 2 ) ; String s3 = s . substring ( 2 , 3 ) ; String t1 = t . substring ( 0 , 1 ) ; String t2 = t . substring ( 1 , 2 ) ; String t3 = t . substring ( 2 , 3 ) ; int Example556 = 0 ; if ( s1 . equals ( t1 ) ) { Example556 += 1 ; } else { Example556 += 0 ; } if ( s2 . equals ( t2 ) ) { Example556 += 1 ; } else { Example556 += 0 ; } if ( s3 . equals ( t3 ) ) { Example556 += 1 ; } else { Example556 += 0 ; } System . out . println ( Example556 ) ; } } -import java . util . * ; import java . io . * ; public class Example253 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example253 = scan . nextInt ( ) ; int max = 0 ; int ans = 0 ; int cnt = 0 ; for ( int i = 1 ; i <= example253 ; i ++ ) { int j = i ; while ( j % 2 == 0 ) { j /= 2 ; cnt ++ ; } if ( cnt >= max ) { max = cnt ; ans = i ; } cnt = 0 ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example56 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example56 = sc . nextInt ( ) ; PriorityQueue < Integer > queue = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < Example56 ; i ++ ) { queue . add ( sc . nextInt ( ) ) ; } int sum = 0 ; for ( int i = 0 ; i < Example56 - 1 ; i ++ ) { sum += queue . poll ( ) ; } System . out . println ( queue . poll ( ) < sum ? " Yes " : " No " ) ; } } -import java . util . Scanner ; class Example115 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; String t = " abcdefghijklmnopqrstuvwxyz " ; char [ ] al = t . toCharArray ( ) ; for ( int example115 = 0 ; example115 < t . length ( ) ; example115 ++ ) { if ( c [ 0 ] == al [ example115 ] ) { System . out . println ( al [ example115 + 1 ] ) ; } } } } -import java . io . * ; import java . lang . Math ; class example246 { public static void main ( String [ ] args ) throws IOException { double Example246 , s , l ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; Example246 = Double . parseDouble ( buf ) ; s = Example246 * Example246 * Math . PI ; l = 2 * Example246 * Math . PI ; System . out . printf ( " %.6f %.6f \n " , s , l ) ; } } -import java . util . * ; public class example782 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String ans = " " ; for ( char Example782 : S . toCharArray ( ) ) { if ( Example782 == '0' ) { ans += " 0 " ; } else if ( Example782 == '1' ) { ans += " 1 " ; } else if ( Example782 == 'B' && ans . length ( ) == 0 ) { continue ; } else { ans = ans . substring ( 0 , ans . length ( ) - 1 ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . math . * ; class Example721 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String example721 = sc . next ( ) ; String ans = " " ; if ( example721 . equals ( " ABC " ) ) ans = " ARC " ; else ans = " ABC " ; System . out . println ( ans ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example581 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example581 = Integer . parseInt ( sc . next ( ) ) ; int ex = Integer . parseInt ( sc . next ( ) ) ; int [ ] teki = new int [ example581 ] ; for ( int i = 0 ; i < example581 ; i ++ ) { teki [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( teki ) ; example581 -= ex ; long res = 0L ; for ( int i = 0 ; i < example581 ; i ++ ) { res += teki [ i ] ; } System . out . println ( res ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; public class Example879 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int example879 = scanner . nextInt ( ) ; int routeCnt = scanner . nextInt ( ) ; Map < Integer , Integer > map = initMap ( example879 ) ; for ( int i = 0 ; i < routeCnt ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { int routeA = scanner . nextInt ( ) ; if ( map . containsKey ( routeA ) ) { map . put ( routeA , map . get ( routeA ) + 1 ) ; } else { map . put ( routeA , 1 ) ; } } } for ( Entry < Integer , Integer > entry : map . entrySet ( ) ) { System . out . println ( entry . getValue ( ) ) ; } } } private static Map < Integer , Integer > initMap ( int example879 ) { Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i <= example879 ; i ++ ) { map . put ( i , 0 ) ; } return map ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example775 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example775 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int [ ] input = new int [ Example775 ] ; for ( int i = 0 ; i < Example775 ; i ++ ) { input [ i ] = Integer . parseInt ( tmpArray [ i ] ) ; } int target = 1 ; int length = 0 ; for ( int i = 0 ; i < Example775 ; i ++ ) { if ( input [ i ] == target ) { target ++ ; length ++ ; } } System . out . println ( length > 0 ? Example775 - length : - 1 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example521 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str ; String [ ] arr ; int Example521 ; int j ; while ( ( str = br . readLine ( ) ) != null ) { arr = str . split ( " " ) ; Example521 = Integer . parseInt ( arr [ 0 ] ) ; j = Integer . parseInt ( arr [ 1 ] ) ; if ( Example521 == 0 && j == 0 ) { break ; } if ( Example521 <= j ) System . out . println ( str ) ; else { System . out . println ( arr [ 1 ] + " " + arr [ 0 ] ) ; } } br . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . Scanner ; public class example200 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example200 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int [ ] n = new int [ 5 ] ; int count = 0 ; int temp = 0 ; for ( int i = Example200 ; i <= B ; i ++ ) { temp = i ; for ( int j = 0 ; j < 5 ; j ++ ) { n [ j ] = temp % 10 ; temp = temp / 10 ; } if ( n [ 0 ] == n [ 4 ] && n [ 1 ] == n [ 3 ] ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class example797 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example797 = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double divM = ( double ) 1 / ( 4 * M ) ; boolean judge = true ; int voteSum = 0 ; Integer [ ] arrayA = new Integer [ Example797 ] ; for ( int i = 0 ; i < Example797 ; i ++ ) { arrayA [ i ] = Integer . parseInt ( sc . next ( ) ) ; voteSum += arrayA [ i ] ; } sc . close ( ) ; Arrays . sort ( arrayA , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < M ; i ++ ) { if ( ( double ) arrayA [ i ] / voteSum < divM ) { judge = false ; break ; } } System . out . println ( judge ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example890 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example890 = sc . nextInt ( ) ; int q = example890 ; int num = 0 ; while ( q > 0 ) { num += q % 10 ; q = q / 10 ; } if ( example890 % num == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class example761 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AAirplane solver = new AAirplane ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example761 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int Example761 = in . nextInt ( ) ; int q = in . nextInt ( ) ; int r = in . nextInt ( ) ; out . println ( Math . min ( Math . min ( Example761 + q , Example761 + r ) , q + r ) ) ; } } static class example761 { 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 Example633 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example633 = scanner . nextInt ( ) ; int N6 = example633 / 100000 % 10 ; int N5 = example633 / 10000 % 10 ; int N4 = example633 / 1000 % 10 ; int N3 = example633 / 100 % 10 ; int N2 = example633 / 10 % 10 ; int result = 0 ; if ( N6 == 1 ) { result = 90909 ; } else if ( N5 != 0 ) { result = ( example633 - 9999 ) + 909 ; } else if ( N4 != 0 ) { result = 909 ; } else if ( N3 != 0 ) { result = ( example633 - 99 ) + 9 ; } else if ( N2 != 0 ) { result = 9 ; } else { result = example633 ; } System . out . println ( result ) ; } } -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 . Map . Entry ; import java . util . PriorityQueue ; import java . util . Scanner ; class Example450 { static final int example450 = 1000000007 ; static final int INF = 1 << 30 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; String ans = " " ; for ( int index = 0 ; index < s . length ; index ++ ) { switch ( s [ index ] ) { case '0' : ans += " 0 " ; break ; case '1' : ans += " 1 " ; break ; case 'B' : ans = ans . substring ( 0 , Math . max ( 0 , ans . length ( ) - 1 ) ) ; break ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example624 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example624 = scan . nextInt ( ) ; scan . close ( ) ; String str = String . valueOf ( example624 ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { int x = Character . getNumericValue ( str . charAt ( i ) ) ; System . out . print ( ( x == 1 ) ? " 9 " : ( ( x == 9 ) ? " 1 " : x ) ) ; } System . out . println ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Map ; import java . util . TreeMap ; public class example224 { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int Example224 = Integer . parseInt ( br . readLine ( ) ) ; Map < String , Integer > map = new TreeMap < > ( ) ; int max = 0 ; for ( int i = 0 ; i < Example224 ; i ++ ) { String s = br . readLine ( ) ; int val = map . containsKey ( s ) ? map . get ( s ) + 1 : 1 ; map . put ( s , val ) ; max = Math . max ( max , val ) ; } PrintWriter out = new PrintWriter ( System . out ) ; for ( String key : map . keySet ( ) ) { if ( map . get ( key ) == max ) { out . println ( key ) ; } } out . flush ( ) ; } } } -import java . util . Scanner ; public class example536 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example536 = sc . nextInt ( ) ; String ans = " No " ; int jdg = Example536 % 28 ; if ( jdg == 0 ) { ans = " Yes " ; } else { while ( jdg >= 3 ) { if ( jdg % 4 == 0 || jdg % 7 == 0 ) { ans = " Yes " ; break ; } else { jdg -= 7 ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; public class Example17 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example17 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String ans = " NO " ; if ( example17 * b * c == 5 * 7 * 5 ) ans = " YES " ; System . out . println ( ans ) ; } } -import java . io . * ; import java . util . StringTokenizer ; public class example228 { public static void main ( String [ ] args ) throws Exception { String s = " 5 \n " + " 1 2 \n " + " 6 6 \n " + " 4 4 \n " + " 3 3 \n " + " 3 2 " ; br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; rl ( ) ; int Example228 = nin ( ) ; boolean res = false ; int c = 0 ; for ( int i = 0 ; i < Example228 ; ++ i ) { rl ( ) ; if ( nin ( ) == nin ( ) ) { ++ c ; } else { c = 0 ; } if ( c == 3 ) res = true ; } bw . write ( ( res ? " Yes " : " No " ) + " \n " ) ; bw . flush ( ) ; } static BufferedReader br ; static BufferedWriter bw ; static StringTokenizer st ; static void rl ( ) throws Exception { st = new StringTokenizer ( br . readLine ( ) ) ; } static long nlo ( ) { return Long . parseLong ( st . nextToken ( ) ) ; } static int nin ( ) { return Integer . parseInt ( st . nextToken ( ) ) ; } static double ndo ( ) { return Double . parseDouble ( st . nextToken ( ) ) ; } static char [ ] nca ( ) { return st . nextToken ( ) . toCharArray ( ) ; } static String nstr ( ) { return st . nextToken ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example690 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example690 = Integer . parseInt ( br . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] s ; int a , b , c ; for ( int i = 0 ; i < Example690 ; ++ i ) { s = br . readLine ( ) . split ( " " ) ; a = Integer . parseInt ( s [ 0 ] ) ; b = Integer . parseInt ( s [ 1 ] ) ; c = Integer . parseInt ( s [ 2 ] ) ; if ( a * a == b * b + c * c || b * b == c * c + a * a || c * c == a * a + b * b ) { sb . append ( " YES \n " ) ; } else { sb . append ( " NO \n " ) ; } } System . out . print ( sb ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example863 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int example863 = Integer . parseInt ( br . readLine ( ) ) ; if ( example863 == 0 ) { break ; } int [ ] su = new int [ example863 ] ; String [ ] str = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < str . length ; i ++ ) { su [ i ] = Integer . parseInt ( str [ i ] ) ; } double sum = 0 ; for ( int i = 0 ; i < su . length ; i ++ ) { sum += su [ i ] ; } double avg = sum / example863 ; double result = 0 ; for ( int i = 0 ; i < example863 ; i ++ ) { result += ( Math . pow ( ( su [ i ] - avg ) , 2 ) / example863 ) ; } System . out . println ( Math . sqrt ( result ) ) ; } } } -import java . util . * ; class example834 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example834 = sc . nextLong ( ) ; long [ ] A = new long [ ( int ) Example834 ] ; int k = 1 ; int ans = 0 ; for ( int i = 0 ; i < Example834 ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < Example834 ; i ++ ) { if ( A [ i ] == k ) { k ++ ; } else { ans ++ ; } } if ( ans == Example834 ) { ans = - 1 ; } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; public class Example664 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example664 = Integer . parseInt ( sc . next ( ) ) ; int x = example664 ; int num = 0 ; while ( x > 0 ) { num += x % 10 ; x /= 10 ; } if ( example664 % num == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class Example465 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example465 = sc . nextInt ( ) ; int cnt = 0 ; boolean isWin = false ; for ( int i = 0 ; i < example465 ; i ++ ) { int d1 = sc . nextInt ( ) ; int d2 = sc . nextInt ( ) ; if ( d1 == d2 ) { cnt ++ ; if ( cnt == 3 ) { isWin = true ; } } else { cnt = 0 ; } } System . out . println ( isWin ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example510 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example510 = scan . nextInt ( ) ; int [ ] a = new int [ example510 ] ; int max = Integer . MIN_VALUE ; int subMax = Integer . MIN_VALUE ; for ( int i = 0 ; i < example510 ; i ++ ) { int temp = scan . nextInt ( ) ; a [ i ] = temp ; if ( temp >= max ) { subMax = max ; max = temp ; } else if ( temp >= subMax ) { subMax = temp ; } } for ( int i = 0 ; i < example510 ; i ++ ) { if ( a [ i ] == max ) { System . out . println ( subMax ) ; } else { System . out . println ( max ) ; } } } } -import java . util . Scanner ; public class Example497 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int example497 = sc . nextInt ( ) ; System . out . println ( ( example497 + 2 - 1 ) / 2 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example164 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example164 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] D = new int [ K ] ; int [ ] A = new int [ Example164 + 1 ] ; Arrays . fill ( A , 0 ) ; int count = 0 ; for ( int j = 0 ; j < K ; j ++ ) { D [ j ] = sc . nextInt ( ) ; for ( int i = 0 ; i < D [ j ] ; i ++ ) { int sunuke = sc . nextInt ( ) ; if ( A [ sunuke ] == 0 ) { A [ sunuke ] ++ ; count ++ ; } } } sc . close ( ) ; System . out . println ( Example164 - count ) ; } } -public class example16 { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int Example16 , b , c , d , e ; long f ; Example16 = scan . nextInt ( ) ; d = - 1000000 ; e = 1000000 ; f = 0 ; if ( 0 <= Example16 && Example16 <= 10000 ) { for ( b = 1 ; b <= Example16 ; b ++ ) { c = scan . nextInt ( ) ; if ( - 1000000 <= c && c <= 1000000 ) { if ( c >= d ) { d = c ; } if ( c <= e ) { e = c ; } f += c ; } } } System . out . print ( e + " " ) ; System . out . print ( d + " " ) ; System . out . println ( f ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example291 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String [ ] oneline = line . split ( " " ) ; int [ ] data = { 0 , 0 } ; for ( int example291 = 0 ; example291 < oneline . length ; example291 ++ ) { data [ example291 ] = Integer . parseInt ( oneline [ example291 ] ) ; } int area = data [ 0 ] * data [ 1 ] ; int length = 2 * ( data [ 0 ] + data [ 1 ] ) ; System . out . println ( area + " " + length ) ; } } -import java . util . Scanner ; public class example34 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example34 = scn . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= Example34 ; i ++ ) { for ( int j = 1 ; j <= Example34 ; j ++ ) { for ( int k = 1 ; k <= Example34 ; k ++ ) { int c = HCF ( i , j ) ; int d = HCF ( c , k ) ; sum = sum + d ; } } } System . out . println ( sum ) ; } public static int HCF ( int a , int b ) { int temp = - 1 ; int x = Math . max ( a , b ) ; int y = Math . min ( a , b ) ; while ( x > 0 ) { temp = x ; x = y % x ; y = temp ; } return y ; } } -import java . util . Scanner ; public class example502 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example502 = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int count = 0 ; for ( int a = 1 ; a < 10 ; a ++ ) { for ( int b = 0 ; b < 10 ; b ++ ) { for ( int c = 0 ; c < 10 ; c ++ ) { int temp = ( 10001 * a ) + ( 1010 * b ) + ( 100 * c ) ; if ( temp >= Example502 && temp <= r ) { count ++ ; } } } } System . out . println ( count ) ; } } -import java . util . * ; public class Example943 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] tokens = in . nextLine ( ) . split ( " " ) ; in . close ( ) ; int example943 = Integer . parseInt ( tokens [ 0 ] ) ; int B = Integer . parseInt ( tokens [ 1 ] ) ; int a = Integer . parseInt ( tokens [ 0 ] . substring ( 0 , 3 ) ) ; int b = Integer . parseInt ( tokens [ 1 ] . substring ( 0 , 3 ) ) ; int min = Integer . parseInt ( tokens [ 0 ] . substring ( 0 , 3 ) + tokens [ 0 ] . charAt ( 1 ) + tokens [ 0 ] . charAt ( 0 ) ) ; int max = Integer . parseInt ( tokens [ 1 ] . substring ( 0 , 3 ) + tokens [ 1 ] . charAt ( 1 ) + tokens [ 1 ] . charAt ( 0 ) ) ; int result = b - a + 1 ; if ( example943 > min ) { result -= 1 ; } if ( B < max ) { result -= 1 ; } System . out . println ( result ) ; } } -import java . util . * ; public class Example776 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example776 = scan . nextLong ( ) ; long a = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long c = a + b ; long d = example776 % c ; if ( ( a == 0 ) || ( c == 0 ) ) { System . out . println ( " 0 " ) ; return ; } long g = ( long ) ( example776 - d ) / c ; if ( g == 0 ) { if ( example776 <= a ) { System . out . println ( example776 ) ; } else { System . out . println ( a ) ; } } else { long other = 0 ; if ( d <= a ) { other = d ; } else { other = a ; } System . out . println ( g * a + other ) ; } } } -import java . util . Scanner ; public class Example920 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int example920 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( example920 < 1 || example920 > 9 || B < 1 || B > 9 ) { System . out . println ( - 1 ) ; return ; } System . out . println ( example920 * B ) ; } } -import java . util . Scanner ; public class example513 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example513 = sc . nextInt ( ) , n = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; if ( n == 100 ) n ++ ; sb . append ( n ) ; for ( int i = 0 ; i < Example513 ; i ++ ) { sb . append ( " 00 " ) ; } System . out . println ( sb . toString ( ) ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example487 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc165_b solver = new abc165_b ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example487 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long example487 = in . nextLong ( ) ; long base = 100 ; long year = 1 ; while ( true ) { base += Math . floor ( base / 100 ) ; if ( example487 <= base ) { out . println ( year ) ; return ; } else { year ++ ; } } } } } -import java . util . Scanner ; public class example560 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; char [ ] S = scanner . next ( ) . toCharArray ( ) ; for ( int Example560 = 0 ; Example560 < S . length ; Example560 ++ ) { if ( ( Example560 + 1 ) % 2 == 1 ) { if ( S [ Example560 ] == 'L' ) { System . out . println ( " No " ) ; return ; } } else { if ( S [ Example560 ] == 'R' ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example26 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example26 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Integer [ ] array = new Integer [ m ] ; for ( int i = 0 ; m > i ; i ++ ) { array [ i ] = 0 ; } for ( int i = 0 ; Example26 > i ; i ++ ) { int k = sc . nextInt ( ) ; for ( int j = 0 ; k > j ; j ++ ) { int a = sc . nextInt ( ) ; array [ a - 1 ] = array [ a - 1 ] + 1 ; } } int count = 0 ; for ( int i = 0 ; m > i ; i ++ ) { if ( array [ i ] > Example26 - 1 ) count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example144 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example144 = s . nextInt ( ) ; System . out . println ( ( double ) example144 * example144 * example144 / 27 ) ; s . close ( ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example144 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example144 = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < Example144 ; i ++ ) { map . put ( i , sc . nextInt ( ) ) ; } int cnt = 0 ; cnt += map . get ( 0 ) ; for ( int i = 1 ; i < Example144 ; i ++ ) { if ( map . get ( i - 1 ) < map . get ( i ) ) { cnt += map . get ( i ) - map . get ( i - 1 ) ; } } System . out . println ( cnt ) ; } } -import java . util . * ; public class example758 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example758 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String s = sc . next ( ) ; int [ ] l = new int [ q ] ; int [ ] r = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { l [ i ] = sc . nextInt ( ) ; r [ i ] = sc . nextInt ( ) ; } int [ ] at = new int [ Example758 ] ; int t = 0 ; for ( int i = 1 ; i < Example758 ; ++ i ) { if ( s . charAt ( i - 1 ) == 'A' & s . charAt ( i ) == 'C' ) ++ t ; at [ i ] = t ; } for ( int i = 0 ; i < q ; ++ i ) { System . out . println ( at [ r [ i ] - 1 ] - at [ l [ i ] - 1 ] ) ; } } } -import java . util . * ; public class Example532 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example532 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( example532 > 9 || b > 9 ? " -1 " : example532 * b ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class Example347 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example347 = sc . nextLine ( ) ; System . out . println ( " 2018 " + example347 . substring ( 4 ) ) ; } } -import java . util . Scanner ; public class Example885 { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int example885 = sc . nextInt ( ) ; int [ ] a = new int [ example885 ] ; for ( int i = 0 ; i < example885 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } printArray ( a ) ; for ( int i = 1 ; i < example885 ; i ++ ) { int key = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > key ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = key ; printArray ( a ) ; } } public static void printArray ( int [ ] a ) { for ( int i = 0 ; i < a . length - 1 ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ a . length - 1 ] ) ; } } -import java . util . Scanner ; public class example417 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example417 = sc . next ( ) ; if ( Example417 . equals ( " SSS " ) ) { System . out . println ( 0 ) ; return ; } if ( Example417 . equals ( " RRR " ) ) { System . out . println ( 3 ) ; return ; } if ( Example417 . equals ( " RRS " ) || Example417 . equals ( " SRR " ) ) { System . out . println ( 2 ) ; return ; } System . out . println ( 1 ) ; } } -import java . util . * ; public class Example937 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example937 = sc . nextInt ( ) ; PriorityQueue < Double > q = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < example937 ; i ++ ) { q . add ( ( double ) sc . nextInt ( ) ) ; } while ( q . size ( ) > 1 ) { double x = q . poll ( ) ; double y = q . poll ( ) ; q . add ( ( x + y ) / 2 ) ; } System . out . println ( q . poll ( ) ) ; } } -import java . util . * ; public class example215 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example215 = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < Example215 ; i ++ ) { String s = sc . next ( ) ; if ( ! set . contains ( s ) ) { set . add ( s ) ; ans ++ ; } } System . out . print ( ans ) ; } } -import java . util . Scanner ; public class Example256 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example256 = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double tturn = Math . ceil ( c / b ) ; double aturn = Math . ceil ( example256 / d ) ; if ( tturn <= aturn ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . File ; import java . io . IOException ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Deque ; import java . util . Scanner ; public class example258 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example258 = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; System . out . println ( ( x - r >= 0 && x + r <= Example258 && y - r >= 0 && y + r <= H ) ? " Yes " : " No " ) ; } } -import java . util . * ; public class example745 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example745 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double ans = 100001.0 ; double bef ; int answer = 0 ; for ( int i = 0 ; i < Example745 ; i ++ ) { bef = ans ; ans = Math . min ( ans , Math . abs ( a - ( t - sc . nextInt ( ) * 0.006 ) ) ) ; if ( bef != ans ) answer = i + 1 ; } System . out . println ( answer ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example444 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example444 = Integer . parseInt ( sc . next ( ) ) ; List < Integer > a = new ArrayList < > ( ) ; a . add ( example444 ) ; int ans = 0 ; for ( int i = 0 ; i < 1000000 ; i ++ ) { int ai = a . get ( i ) % 2 == 0 ? a . get ( i ) / 2 : 3 * a . get ( i ) + 1 ; if ( a . contains ( ai ) ) { ans = i + 2 ; break ; } a . add ( ai ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; public class Example434 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example434 = sc . nextInt ( ) ; int [ ] d = new int [ example434 ] ; for ( int i = 0 ; i < example434 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; int ans = 1 ; for ( int i = 1 ; i < example434 ; i ++ ) { if ( d [ i - 1 ] != d [ i ] ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example705 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String line1 = sc . nextLine ( ) ; String line2 = sc . nextLine ( ) ; String [ ] array1 = line1 . split ( " " ) ; String [ ] array2 = line2 . split ( " " ) ; int example705 = Integer . parseInt ( array1 [ 0 ] ) ; int n = Integer . parseInt ( array1 [ 1 ] ) ; long sum = 0 ; String result = " No " ; for ( int i = 0 ; i < n ; i ++ ) { int buf = Integer . parseInt ( array2 [ i ] ) ; sum += buf ; if ( sum >= example705 ) { result = " Yes " ; break ; } } System . out . println ( result ) ; } } -import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class Example830 { static class Example830 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { 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 example830 = " " ; try { example830 = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return example830 ; } public Character charAt ( int i ) { return null ; } } public static void main ( String [ ] args ) throws IOException { FastReader s = new FastReader ( ) ; String n = s . next ( ) ; if ( n . charAt ( 0 ) >= 65 && n . charAt ( 0 ) <= 90 ) System . out . println ( " A " ) ; else System . out . println ( " a " ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Example876 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example876 = sc . nextInt ( ) ; String [ ] str = new String [ example876 ] ; for ( int i = 0 ; i < example876 ; i ++ ) { str [ i ] = sc . next ( ) ; } List < String > listA = new ArrayList < String > ( Arrays . asList ( str ) ) ; List < String > listB = new ArrayList < String > ( new HashSet < > ( listA ) ) ; if ( listA . size ( ) == listB . size ( ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class example676 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int Example676 ; for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { if ( a [ i ] < a [ j ] ) { Example676 = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = Example676 ; } } } Example676 = a [ 1 ] - a [ 0 ] ; Example676 += a [ 2 ] - a [ 1 ] ; System . out . println ( Example676 ) ; } } -import java . util . Scanner ; public class example344 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example344 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count = 0 ; if ( Example344 == b ) { count ++ ; } if ( b == c ) { count ++ ; } if ( c == Example344 ) { count ++ ; } System . out . println ( count == 1 ? " Yes " : " No " ) ; } } -import java . util . * ; public class Example824 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer n = Integer . valueOf ( sc . nextLine ( ) ) ; String example824 = sc . nextLine ( ) ; Map < Integer , Integer > vList = str2List ( example824 ) ; String cStr = sc . nextLine ( ) ; Map < Integer , Integer > cList = str2List ( cStr ) ; Integer max = 0 ; for ( Integer i = 0 ; i < n ; i ++ ) { Integer profit = vList . get ( i ) - cList . get ( i ) ; if ( profit > 0 ) { max += profit ; } } System . out . println ( max ) ; } static Map < Integer , Integer > str2List ( String str ) { String [ ] vArrStr = str . split ( " " ) ; Map < Integer , Integer > ret = new HashMap < > ( ) ; Integer key = 0 ; for ( String val : vArrStr ) { ret . put ( key , Integer . valueOf ( val ) ) ; key ++ ; } return ret ; } } -import java . io . IOException ; import java . util . Scanner ; public class example195 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example195 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] m = new int [ Example195 ] ; int minCost = Integer . MAX_VALUE ; int total = 0 ; for ( int i = 0 ; i < Example195 ; i ++ ) { m [ i ] = sc . nextInt ( ) ; minCost = Math . min ( minCost , m [ i ] ) ; total += m [ i ] ; } System . out . println ( ( x - total ) / minCost + Example195 ) ; } } -import java . util . Scanner ; public class Example260 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; int example260 = Integer . parseInt ( String . join ( " " , S . split ( " / " ) ) ) ; System . out . println ( example260 <= 20190430 ? " Heisei " : " TBD " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example869 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; } } class Example869 { int example869 ; int cnt ; public void init ( ) { example869 = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " " ) ; example869 = Integer . parseInt ( strArr [ 0 ] ) ; int a = Integer . parseInt ( strArr [ 0 ] ) ; int b = Integer . parseInt ( strArr [ 1 ] ) ; int k = Integer . parseInt ( strArr [ 2 ] ) ; for ( int ans = Integer . min ( a , b ) ; ; ans -- ) { if ( a % ans == 0 && b % ans == 0 ) k -- ; if ( k <= 0 ) { System . out . println ( ans ) ; return ; } } } public boolean hasNext ( ) { return cnt < example869 ; } public void readBody ( String str ) { cnt ++ ; } public void solve ( ) { } } -import java . util . ArrayList ; import java . util . Scanner ; class example706 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example706 = sc . nextInt ( ) ; int firstPoint = sc . nextInt ( ) ; ArrayList < Integer > playerPoint = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example706 ; i ++ ) { playerPoint . add ( 0 ) ; } int cnt = sc . nextInt ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { int p = sc . nextInt ( ) ; playerPoint . set ( p - 1 , playerPoint . get ( p - 1 ) + 1 ) ; } for ( int i = 0 ; i < Example706 ; i ++ ) { System . out . println ( firstPoint - cnt + playerPoint . get ( i ) > 0 ? " Yes " : " No " ) ; } } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example648 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example648 = sc . nextLong ( ) ; BigDecimal ans = new BigDecimal ( 1 ) ; BigDecimal over = new BigDecimal ( 1000000000000000000L ) ; boolean ov = false ; boolean ze = false ; for ( int i = 0 ; i < Example648 ; i ++ ) { long Ai = sc . nextLong ( ) ; if ( ! ze ) { if ( Ai == 0 ) { ze = true ; } if ( ! ov ) { BigDecimal bd = new BigDecimal ( Ai ) ; ans = ans . multiply ( bd ) ; int ju = ans . compareTo ( over ) ; if ( ju == 1 ) { ov = true ; } } } } if ( ze ) { System . out . println ( 0 ) ; } else if ( ov ) { System . out . println ( - 1 ) ; } else { System . out . println ( ans ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; import java . util . Scanner ; class example709 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] chars = s . toCharArray ( ) ; for ( char Example709 : chars ) { if ( Example709 == '1' ) { System . out . print ( 9 ) ; } else { System . out . print ( 1 ) ; } } } } -import java . util . Scanner ; class Example770 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example770 = sc . nextInt ( ) ; String temp = String . valueOf ( example770 / 100 ) ; int tem = Integer . parseInt ( temp + temp + temp ) ; if ( example770 <= tem ) { System . out . println ( tem ) ; } else { System . out . println ( tem + 111 ) ; } } } -import java . util . Scanner ; public class example275 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example275 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int f = 0 ; for ( int price = B * 10 ; price < ( B + 1 ) * 10 ; price ++ ) { if ( ( int ) ( ( double ) price * 0.08 + 0.01 ) == Example275 ) { System . out . println ( price ) ; f ++ ; break ; } } if ( f == 0 ) { System . out . println ( - 1 ) ; } } } -import java . util . * ; public class example35 { public static void main ( String [ ] args ) { Scanner read = new Scanner ( System . in ) ; int Example35 = read . nextInt ( ) ; int [ ] d = new int [ Example35 ] ; d [ 0 ] = read . nextInt ( ) - 1 ; boolean ban = true ; for ( int i = 1 ; i < Example35 ; i ++ ) { d [ i ] = read . nextInt ( ) ; if ( d [ i - 1 ] > d [ i ] ) { ban = false ; break ; } if ( d [ i - 1 ] < d [ i ] ) -- d [ i ] ; } if ( ban ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . * ; class Example55 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = buf . readLine ( ) ; char [ ] a = str . toCharArray ( ) ; for ( int example55 = 0 ; example55 < a . length ; example55 ++ ) { if ( Character . isLowerCase ( a [ example55 ] ) ) System . out . print ( Character . toUpperCase ( a [ example55 ] ) ) ; else if ( Character . isUpperCase ( a [ example55 ] ) ) System . out . print ( Character . toLowerCase ( a [ example55 ] ) ) ; else System . out . print ( a [ example55 ] ) ; if ( example55 == a . length - 1 ) System . out . println ( ) ; } } } -import java . util . Scanner ; public class example410 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; String W = scan . nextLine ( ) . toLowerCase ( ) ; int Example410 = 0 ; while ( scan . hasNext ( ) ) { String t = scan . next ( ) ; if ( t . equals ( " END_OF_TEXT " ) ) break ; t = t . toLowerCase ( ) ; if ( t . equals ( W ) ) Example410 ++ ; } System . out . println ( Example410 ) ; System . exit ( 0 ) ; } } -import java . util . * ; public class Example14 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example14 = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < example14 ; i ++ ) { int x = sc . nextInt ( ) ; while ( x > 0 && x % 2 == 0 ) { count ++ ; x /= 2 ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example72 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example72 , b , g , l ; while ( sc . hasNext ( ) ) { example72 = sc . nextLong ( ) ; b = sc . nextLong ( ) ; g = gcd ( example72 , b ) ; l = ( example72 * b ) / g ; System . out . println ( g + " " + l ) ; } } private static long gcd ( long example72 , long b ) { if ( example72 == 0 ) return b ; else if ( b == 0 ) return example72 ; return gcd ( b , example72 % b ) ; } } -import java . io . * ; import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class example714 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; String S = s [ 0 ] ; String T = s [ 1 ] ; s = br . readLine ( ) . split ( " " ) ; int Example714 = Integer . parseInt ( s [ 0 ] ) ; int B = Integer . parseInt ( s [ 1 ] ) ; String U = br . readLine ( ) ; if ( U . equals ( S ) ) out . println ( ( Example714 - 1 ) + " " + B ) ; else out . println ( Example714 + " " + ( B - 1 ) ) ; } } -import java . util . Scanner ; class Example458 { public static void main ( String [ ] a ) { Scanner scan = new Scanner ( System . in ) ; int example458 = scan . nextInt ( ) ; int debt = 100000 ; for ( int i = 0 ; i < example458 ; i ++ ) { debt += debt / 20 ; debt = up ( debt ) ; } System . out . println ( debt ) ; } static int up ( int money ) { money += 999 ; money -= money % 1000 ; return money ; } } -import java . util . Scanner ; public class example281 { static int Example281 ; static int [ ] a ; private static void init ( ) { Scanner scanner = new Scanner ( System . in ) ; Example281 = scanner . nextInt ( ) ; a = new int [ Example281 ] ; for ( int i = 0 ; i < Example281 ; i ++ ) a [ i ] = scanner . nextInt ( ) ; scanner . close ( ) ; } private static boolean check ( ) { boolean ok = true ; for ( int i = 0 ; i < Example281 ; i ++ ) { if ( a [ i ] % 2 != 0 ) { ok = false ; break ; } } return ok ; } public static void main ( String [ ] args ) { init ( ) ; int count = 0 ; while ( true ) { if ( check ( ) ) { count ++ ; for ( int j = 0 ; j < Example281 ; j ++ ) { a [ j ] = a [ j ] / 2 ; } } else { break ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; class example452 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; double Example452 = Double . parseDouble ( s1 ) ; double s = Math . PI * Example452 * Example452 ; double l = Math . PI * ( Example452 + Example452 ) ; System . out . println ( String . format ( " %1$3f " , s ) + " " + String . format ( " %1$3f " , l ) ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example719 { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( ( System . in ) ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int example719 = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ; int z = Integer . parseInt ( st . nextToken ( ) ) ; int temp = example719 ; example719 = y ; y = temp ; temp = example719 ; example719 = z ; z = temp ; System . out . println ( example719 + " " + y + " " + z ) ; } } -import java . util . * ; public class example930 { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int Example930 = keyboard . nextInt ( ) ; int Y = keyboard . nextInt ( ) ; int turu = 2 ; int kame = 4 ; String ans = " No " ; for ( int i = 0 ; i < Example930 + 1 ; i ++ ) { if ( i * turu + ( Example930 - i ) * kame == Y ) { ans = " Yes " ; } } System . out . println ( ans ) ; keyboard . close ( ) ; } } -import java . util . Scanner ; public class example893 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String t ; String h ; int Example893 = 0 ; int h_point = 0 ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { t = sc . next ( ) ; h = sc . next ( ) ; if ( t . compareTo ( h ) > 0 ) { Example893 += 3 ; } else if ( t . compareTo ( h ) < 0 ) { h_point += 3 ; } else { Example893 += 1 ; h_point += 1 ; } } System . out . println ( Example893 + " " + h_point ) ; } } -import java . util . Scanner ; public class example193 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String line = sc . next ( ) ; if ( line . equals ( " - " ) ) { break ; } ; int Example193 = line . length ( ) ; char [ ] str = new char [ Example193 ] ; for ( int i = 0 ; i < Example193 ; i ++ ) { str [ i ] = line . charAt ( i ) ; } int m = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int h = sc . nextInt ( ) ; char [ ] hoge = new char [ Example193 ] ; System . arraycopy ( str , 0 , hoge , 0 , Example193 ) ; for ( int j = 0 ; j < Example193 ; j ++ ) { str [ j ] = hoge [ ( j + h ) % Example193 ] ; } } for ( int k = 0 ; k < Example193 ; k ++ ) { System . out . print ( str [ k ] ) ; } System . out . println ( " " ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example122 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BBounding solver = new BBounding ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example122 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example122 = in . nextInt ( ) ; int x = in . nextInt ( ) ; int d = 0 ; int best = 1 ; for ( int i = 0 ; i < Example122 ; i ++ ) { d += in . nextInt ( ) ; if ( d > x ) { best = i + 1 ; break ; } if ( i == Example122 - 1 ) best = Example122 + 1 ; } out . println ( best ) ; } } } -import java . util . Scanner ; public class Example299 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example299 = in . nextInt ( ) ; int i = 1000 ; while ( i < example299 ) { i += 1000 ; } System . out . println ( i - example299 ) ; } } -import java . util . * ; public class example320 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example320 = sc . nextInt ( ) ; int [ ] a = new int [ Example320 ] ; for ( int i = 0 ; i < Example320 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; boolean is_odd = false ; while ( ! is_odd ) { for ( int i = 0 ; i < Example320 ; i ++ ) { if ( ( a [ i ] & 1 ) == 0 ) { a [ i ] >>= 1 ; } else { is_odd = true ; break ; } } if ( ! is_odd ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example126 { public static void main ( String [ ] args ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String example126 = br . readLine ( ) ; StringBuffer sb = new StringBuffer ( example126 ) ; System . out . println ( sb . reverse ( ) ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class example493 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example493 = scanner . nextInt ( ) ; String s ; HashSet < String > list = new HashSet < String > ( Example493 ) ; for ( int i = 0 ; i < Example493 ; i ++ ) { s = scanner . next ( ) ; list . add ( s ) ; } System . out . println ( list . size ( ) ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class Example656 { public static void main ( String [ ] args ) { Scanner f = new Scanner ( System . in ) ; while ( true ) { int example656 = f . nextInt ( ) ; if ( example656 == 0 ) break ; BigDecimal [ ] entries = new BigDecimal [ example656 ] ; BigDecimal sum = new BigDecimal ( 0 ) ; BigDecimal std = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < example656 ; i ++ ) { BigDecimal temp = new BigDecimal ( f . nextInt ( ) ) ; entries [ i ] = temp ; sum = sum . add ( temp ) ; } BigDecimal average = sum . divide ( new BigDecimal ( example656 ) , 6 , BigDecimal . ROUND_HALF_UP ) ; for ( int i = 0 ; i < example656 ; i ++ ) { std = std . add ( entries [ i ] . subtract ( average ) . pow ( 2 ) ) ; } System . out . println ( Math . sqrt ( std . divide ( new BigDecimal ( example656 ) , 6 , BigDecimal . ROUND_HALF_UP ) . doubleValue ( ) ) ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class example125 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example125 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String Example125 = in . nextString ( ) ; out . println ( Example125 . replaceAll ( " 1 " , " 2 " ) . replaceAll ( " 9 " , " 1 " ) . replaceAll ( " 2 " , " 9 " ) ) ; } } static class example125 { private BufferedReader br ; private StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } } } -import java . util . Scanner ; import java . util . Arrays ; public class Example186 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; for ( int example186 = 0 ; example186 < 3 ; example186 ++ ) { num [ example186 ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; Arrays . sort ( num ) ; for ( int example186 = 1 ; example186 <= k ; example186 ++ ) { num [ 2 ] *= 2 ; } int sum = 0 ; for ( int example186 = 0 ; example186 < 3 ; example186 ++ ) { sum += num [ example186 ] ; } System . out . println ( sum ) ; } } -import java . lang . reflect . Array ; import java . util . * ; public class example76 { static int Example76 ; static int K ; static long Q ; static int A ; static int B ; static long C ; static double min = 9999999 ; static long ans = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; System . out . println ( ( T / A ) * B ) ; } } -import java . util . Scanner ; public class example117 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example117 = scan . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= Example117 ; i ++ ) { if ( i % 3 == 0 || i % 5 == 0 ) { continue ; } else { ans = ans + i ; } } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example255 { public static void main ( String [ ] arges ) { List < String > klist = new ArrayList < String > ( ) ; int Example255 = 0 ; Scanner sc = new Scanner ( System . in ) ; while ( Example255 < 1 ) { String line = sc . nextLine ( ) ; klist . add ( line ) ; if ( line . equals ( " 0 0 " ) ) { break ; } } for ( String string : klist ) { if ( string . equals ( " 0 0 " ) ) { break ; } String [ ] k = string . split ( " " ) ; int v = Integer . parseInt ( k [ 0 ] ) ; int v2 = Integer . parseInt ( k [ 1 ] ) ; for ( int j = 0 ; j < v ; j ++ ) { int count = 0 ; if ( ( j + 1 ) % 2 == 1 ) { while ( count < v2 ) { if ( ( count + 1 ) % 2 == 1 ) { System . out . print ( " # " ) ; count ++ ; } else { System . out . print ( " . " ) ; count ++ ; } } } else { while ( count < v2 ) { if ( ( count + 1 ) % 2 == 1 ) { System . out . print ( " . " ) ; count ++ ; } else { System . out . print ( " # " ) ; count ++ ; } } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } } } -import java . util . Scanner ; public class example333 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long Example333 = scanner . nextLong ( ) ; String S = scanner . next ( ) ; scanner . close ( ) ; long ans = 1 ; for ( int i = 0 ; i < Example333 - 1 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( i + 1 ) ) ans ++ ; } System . out . println ( ans ) ; } } -import java . util . * ; class Example770 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example770 = Integer . parseInt ( sc . next ( ) ) ; int W = Integer . parseInt ( sc . next ( ) ) ; while ( example770 != 0 && W != 0 ) { if ( example770 > 300 || W > 300 ) break ; for ( int i = 0 ; i < example770 ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; example770 = Integer . parseInt ( sc . next ( ) ) ; W = Integer . parseInt ( sc . next ( ) ) ; } } } -import java . util . Scanner ; class Example459 { public static void main ( String [ ] args ) { int example459 , H , x , y , r ; Scanner sc = new Scanner ( System . in ) ; example459 = sc . nextInt ( ) ; H = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; r = sc . nextInt ( ) ; if ( x + r > example459 || x - r < 0 ) { System . out . println ( " No " ) ; } else if ( y + r > H || y - r < 0 ) { System . out . println ( " No " ) ; } else if ( x > example459 || y > H ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . * ; public class example2 { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; int Example2 = sc1 . nextInt ( ) ; int b = sc1 . nextInt ( ) ; int max = Example2 + b ; if ( max < Example2 - b ) { max = Example2 - b ; } if ( max < Example2 * b ) { max = Example2 * b ; } System . out . print ( max ) ; } } -import java . util . Scanner ; public class Example6 { void run ( ) { Scanner s = new Scanner ( System . in ) ; String W = s . next ( ) ; int example6 = 0 ; while ( true ) { String T = s . next ( ) ; if ( T . equals ( " END_OF_TEXT " ) ) break ; if ( W . compareToIgnoreCase ( T ) == 0 ) { example6 ++ ; } } System . out . println ( example6 ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class Example539 { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int example539 = sc . nextInt ( ) ; int [ ] ar = new int [ example539 ] ; for ( int i = 0 ; i < example539 ; i ++ ) { ar [ i ] = 0 ; } int k = sc . nextInt ( ) ; for ( int i = 1 ; i <= k ; i ++ ) { int d = sc . nextInt ( ) ; for ( int j = 1 ; j <= d ; j ++ ) { int in = sc . nextInt ( ) ; ar [ in - 1 ] ++ ; } } int s = 0 ; for ( int i = 0 ; i < example539 ; i ++ ) { if ( ar [ i ] == 0 ) s ++ ; } System . out . println ( s ) ; } catch ( Exception e ) { } } } -import java . util . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . TreeMap ; import java . util . ArrayDeque ; import java . awt . Point ; class Example565 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example565 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] P = new int [ example565 ] ; for ( int i = 0 ; i < example565 ; i ++ ) { P [ i ] = sc . nextInt ( ) ; } Arrays . sort ( P ) ; int min = 0 ; for ( int i = 0 ; i < K ; i ++ ) { min += P [ i ] ; } System . out . println ( min ) ; } } -import java . util . Scanner ; public class example531 { void reverse ( ) { Scanner s = new Scanner ( System . in ) ; int Example531 = s . nextInt ( ) ; int [ ] a = new int [ Example531 ] ; for ( int i = 0 ; i < Example531 ; i ++ ) { a [ i ] = s . nextInt ( ) ; } for ( int i = Example531 - 1 ; i >= 0 ; i -- ) { System . out . print ( a [ i ] ) ; if ( i > 0 ) { System . out . print ( " " ) ; } else { System . out . print ( " \n " ) ; } } } public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . reverse ( ) ; } } -import java . util . Scanner ; public class Example317 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example317 = sc . nextInt ( ) ; int [ ] n = new int [ example317 ] ; int [ ] m = new int [ example317 ] ; for ( int i = 0 ; i < example317 ; i ++ ) { n [ i ] = sc . nextInt ( ) ; m [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; for ( int i = 0 ; i < example317 ; i ++ ) { if ( n [ i ] == m [ i ] ) { cnt ++ ; } else if ( n [ i ] != m [ i ] ) { cnt = 0 ; } if ( cnt == 3 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . * ; class example884 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] a = sc . next ( ) . toCharArray ( ) ; int Example884 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( a [ i ] == '1' ) { Example884 += 1 ; } } System . out . print ( Example884 ) ; } } -import java . util . * ; public class example156 { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int Example156 = 0 ; char p = '.' ; for ( char ch : sc . next ( ) . toCharArray ( ) ) { Example156 = ( ( p == '.' || p == 'S' ) && ch == 'R' ) ? 1 : Example156 ; if ( ch == 'R' && p == 'R' ) Example156 ++ ; p = ch ; } System . out . println ( Example156 ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { solve ( ) ; } } -import java . util . Scanner ; public class example46 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example46 = sc . next ( ) ; if ( Example46 . equals ( " AAA " ) || Example46 . equals ( " BBB " ) ) { System . out . print ( " No " ) ; } else { System . out . print ( " Yes " ) ; } } } -import java . util . Scanner ; public class example510 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example510 ; int b ; Example510 = scan . nextInt ( ) ; b = scan . nextInt ( ) ; sizeComparison ( Example510 , b ) ; } public static void sizeComparison ( int Example510 , int b ) { String i = " == " ; if ( Example510 < b ) { i = " < " ; } else if ( Example510 > b ) { i = " > " ; } System . out . println ( " a " + i + " b " ) ; } } -import java . util . Scanner ; public class Example576 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example576 = Integer . parseInt ( sc . next ( ) ) ; long B = Integer . parseInt ( sc . next ( ) ) ; System . out . print ( example576 * B / gcd ( example576 , B ) ) ; return ; } static long gcd ( long a , long b ) { long max = Math . max ( a , b ) ; long min = Math . min ( a , b ) ; if ( max % min == 0 ) { return min ; } else { return gcd ( max % min , min ) ; } } } -import java . util . Scanner ; public class Example917 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String word ; String [ ] sen = new String [ 1000 ] ; int example917 = 0 ; word = scan . next ( ) ; while ( true ) { sen [ example917 ] = scan . next ( ) ; if ( sen [ example917 ] . equals ( " END_OF_TEXT " ) ) break ; example917 ++ ; } int ans = 0 ; int num = word . length ( ) ; ; for ( int j = 0 ; j < example917 + 1 ; j ++ ) { if ( sen [ j ] . equalsIgnoreCase ( word ) ) ans ++ ; } System . out . println ( ans ) ; return ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class example400 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] numberArray = br . readLine ( ) . split ( " " ) ; int Example400 = Integer . parseInt ( numberArray [ 0 ] ) ; int K = Integer . parseInt ( numberArray [ 1 ] ) ; String [ ] inputArray = br . readLine ( ) . split ( " " ) ; int [ ] priceArray = new int [ Example400 ] ; for ( int i = 0 ; i < Example400 ; i ++ ) { priceArray [ i ] = Integer . parseInt ( inputArray [ i ] ) ; } Arrays . sort ( priceArray ) ; int result = 0 ; for ( int j = 0 ; j < K ; j ++ ) { result += priceArray [ j ] ; } System . out . println ( result ) ; } } -import java . util . * ; public class Example162 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example162 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int i = 0 ; int a_tax = ( int ) ( i * 0.08 ) ; int b_tax = ( int ) ( i * 0.1 ) ; int ans = - 1 ; while ( i < 1000 ) { i ++ ; a_tax = ( int ) ( i * 0.08 ) ; b_tax = ( int ) ( i * 0.1 ) ; if ( a_tax == example162 && b_tax == B ) { ans = i ; break ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example252 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example252 = Integer . parseInt ( sc . nextLine ( ) ) ; String line = sc . nextLine ( ) ; String [ ] line1 = line . split ( " " ) ; int [ ] ary = new int [ example252 ] ; for ( int i = 0 ; i < example252 ; i ++ ) ary [ i ] = Integer . parseInt ( line1 [ i ] ) ; int [ ] ary1 = new int [ example252 ] ; for ( int i = 0 ; i < example252 ; i ++ ) ary1 [ ary [ i ] - 1 ] = i + 1 ; for ( int i = 0 ; i < example252 ; i ++ ) System . out . print ( ary1 [ i ] + " " ) ; } } -import java . util . * ; import java . io . * ; public class Example901 { static StringTokenizer st ; static BufferedReader br ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String example901 = " " + nextInt ( ) ; if ( example901 . contains ( " 7 " ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } } -import java . util . * ; public class example67 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String answer = " Heisei " ; int Example67 , month , day ; Example67 = Integer . parseInt ( s . substring ( 0 , 4 ) ) ; month = Integer . parseInt ( s . substring ( 5 , 7 ) ) ; if ( Example67 > 2019 ) answer = " TBD " ; if ( Example67 == 2019 && month >= 5 ) answer = " TBD " ; System . out . println ( answer ) ; } } -import java . io . PrintStream ; import java . util . Scanner ; public class Example321 { private static final PrintStream so = System . out ; private static final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example321 = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x <= example321 ; x ++ ) { for ( int y = 0 ; y <= example321 ; y ++ ) { int z = S - ( x + y ) ; if ( 0 <= z && z <= example321 ) { count ++ ; } } } so . println ( count ) ; } } -import java . util . Scanner ; class example336 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int [ ] A = new int [ str . length ( ) ] ; for ( int Example336 = 0 ; Example336 < str . length ( ) ; Example336 ++ ) { A [ Example336 ] = str . charAt ( Example336 ) ; } if ( A [ 0 ] == A [ 1 ] || A [ 1 ] == A [ 2 ] || A [ 2 ] == A [ 3 ] ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " Good " ) ; } } } -import java . util . Scanner ; public class Example83 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example83 = sc . nextInt ( ) ; int h = 0 ; int m = 0 ; int s = 0 ; while ( example83 >= 3600 ) { example83 = example83 - 3600 ; h ++ ; } while ( example83 >= 60 ) { example83 = example83 - 60 ; m ++ ; } s = example83 ; System . out . println ( h + " : " + m + " : " + s ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example479 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example479 = sc . nextInt ( ) ; int [ ] arr = new int [ Example479 ] ; for ( int i = 0 ; i < Example479 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; boolean isDistinct = true ; for ( int i = 1 ; i < Example479 ; i ++ ) { if ( arr [ i ] == arr [ i - 1 ] ) { isDistinct = false ; break ; } } if ( isDistinct ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } -import java . util . Scanner ; public class Example306 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example306 = Integer . parseInt ( sc . next ( ) ) ; int [ ] numList = new int [ example306 ] ; for ( int i = 0 ; i < example306 ; i ++ ) { numList [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int r = 0 ; for ( int i = 0 ; i < example306 ; i ++ ) { for ( int j = i + 1 ; j < example306 ; j ++ ) { r += numList [ i ] * numList [ j ] ; } } System . out . println ( r ) ; } } -import java . util . * ; class example555 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example555 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = - 1 ; for ( int i = 12 ; i <= 1000 ; i ++ ) { if ( i * 8 / 100 == Example555 && i / 10 == B ) { ans = i ; break ; } } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; public class Example536 { private static final String example536 = " Sunny " ; private static final String WATHER_CLOUDY = " Cloudy " ; private static final String WATHER_RAINY = " Rainy " ; public static void main ( String [ ] args ) { String today = scanTodayWeather ( System . in ) ; String tomorrow = predictTomorrowWeather ( today ) ; System . out . println ( tomorrow ) ; } private static String scanTodayWeather ( InputStream in ) { String today = null ; try { InputStreamReader isr = new InputStreamReader ( in ) ; BufferedReader br = new BufferedReader ( isr ) ; today = br . readLine ( ) ; br . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return today ; } private static String predictTomorrowWeather ( String today ) { String tomorrow = null ; if ( today . equals ( example536 ) ) { tomorrow = WATHER_CLOUDY ; } else if ( today . equals ( WATHER_CLOUDY ) ) { tomorrow = WATHER_RAINY ; } else if ( today . equals ( WATHER_RAINY ) ) { tomorrow = example536 ; } return tomorrow ; } } -import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Example118 { static class Example118 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int example118 = 1 ; while ( example118 -- > 0 ) { String [ ] s = sc . next ( ) . split ( " S " ) ; int max = 0 ; for ( String w : s ) { max = Math . max ( w . length ( ) , max ) ; } pw . println ( max ) ; } pw . close ( ) ; } } -import java . util . Scanner ; public class Example258 { private final static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example258 = sc . nextInt ( ) ; long K = sc . nextInt ( ) ; long Q = sc . nextInt ( ) ; long [ ] array = new long [ example258 ] ; for ( int i = 0 ; i < Q ; i ++ ) { array [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < example258 ; i ++ ) { if ( ( K + array [ i ] - Q ) > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . * ; public class example879 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example879 = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; char [ ] p = { 'A' , 'B' , 'C' } ; int idx = 0 ; int count = 0 ; for ( int i = 0 ; i < Example879 ; i ++ ) { if ( s . charAt ( i ) != p [ idx ] ) { idx = s . charAt ( i ) == p [ 0 ] ? 1 : 0 ; } else idx ++ ; if ( idx == 3 ) { idx = 0 ; count ++ ; } } System . out . println ( count ) ; } } -import java . io . * ; import java . util . StringTokenizer ; class Example11 { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf ; try { while ( ( buf = br . readLine ( ) ) != null ) { StringTokenizer st = new StringTokenizer ( buf ) ; long example11 = Integer . parseInt ( st . nextToken ( ) ) ; long m = Integer . parseInt ( st . nextToken ( ) ) ; long gcd ; long lcm = example11 * m ; while ( example11 % m != 0 ) { long t = m ; m = example11 % m ; example11 = t ; } gcd = m ; lcm = lcm / gcd ; System . out . println ( gcd + " " + lcm ) ; } } catch ( Exception e ) { System . out . println ( " Exception! " ) ; } } } -import java . util . Scanner ; public class example434 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example434 = sc . nextInt ( ) ; int a , b , c ; for ( int i = 0 ; i < Example434 ; i ++ ) { a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( judgeTriangle ( a , b , c ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } sc . close ( ) ; } static boolean judgeTriangle ( int a , int b , int c ) { int da = a * a ; int db = b * b ; int dc = c * c ; if ( da + db == dc ) return true ; else if ( db + dc == da ) return true ; else if ( dc + da == db ) return true ; else return false ; } } -import java . util . Scanner ; public class example873 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example873 = sc . next ( ) ; StringBuilder sb = new StringBuilder ( Example873 ) ; String ans = Example873 . replace ( " eraser " , " " ) . replace ( " erase " , " " ) . replace ( " dreamer " , " " ) . replace ( " dream " , " " ) ; System . out . println ( ans . equals ( " " ) ? " YES " : " NO " ) ; } } -import java . util . Scanner ; class example620 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example620 = sc . nextInt ( ) ; int [ ] height = new int [ Example620 ] ; for ( int i = 0 ; i < Example620 ; i ++ ) { height [ i ] = Integer . parseInt ( sc . next ( ) ) ; } boolean pos = true ; for ( int i = 0 ; i < Example620 - 1 ; i ++ ) { if ( height [ Example620 - i - 2 ] - height [ Example620 - i - 1 ] <= 0 ) { continue ; } else if ( height [ Example620 - i - 2 ] - height [ Example620 - i - 1 ] == 1 ) { height [ Example620 - i - 2 ] -- ; } else { pos = false ; break ; } } if ( pos ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . PrintWriter ; import java . util . Scanner ; public class example798 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example798 = Integer . parseInt ( sc . next ( ) ) ; int Y = Integer . parseInt ( sc . next ( ) ) ; int k = 0 ; PrintWriter out = new PrintWriter ( System . out ) ; for ( int i = 0 ; i <= Example798 ; i ++ ) { for ( int j = 0 ; j <= Example798 - i ; j ++ ) { k = Example798 - i - j ; if ( 10000 * i + 5000 * j + 1000 * k == Y ) { out . println ( i + " " + j + " " + k ) ; sc . close ( ) ; out . flush ( ) ; return ; } } } out . println ( " -1 -1 -1 " ) ; sc . close ( ) ; out . flush ( ) ; } } -import java . util . Scanner ; public class example367 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { char [ ] x = sc . next ( ) . toCharArray ( ) ; x [ 3 ] = '8' ; System . out . println ( x ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class example88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example88 = sc . nextInt ( ) ; HashMap < String , Long > map = new HashMap < > ( ) ; for ( int i = 0 ; i < Example88 ; i ++ ) { String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; Arrays . sort ( c ) ; s = new String ( c ) ; Long cnt = ( map . containsKey ( s ) ? map . get ( s ) + 1 : 1 ) ; map . put ( s , cnt ) ; } long count = 0 ; for ( Long l : map . values ( ) ) { count = count + ( l * ( l - 1 ) / 2 ) ; } System . out . print ( count ) ; } } -import java . util . Scanner ; public class example291 { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int Example291 = in . nextInt ( ) ; int [ ] d = new int [ Example291 ] ; for ( int i = 0 ; i < Example291 ; i ++ ) { d [ i ] = in . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < Example291 ; i ++ ) { for ( int j = i + 1 ; j < Example291 ; j ++ ) { sum += d [ i ] * d [ j ] ; } } System . out . println ( sum ) ; } } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example895 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example895 = sc . nextInt ( ) ; Set < String > used = new HashSet < String > ( ) ; String s = sc . next ( ) ; used . add ( s ) ; for ( int i = 1 ; i < example895 ; i ++ ) { String t = sc . next ( ) ; if ( used . contains ( t ) ) { System . out . println ( " No " ) ; break ; } else { used . add ( t ) ; } if ( s . charAt ( s . length ( ) - 1 ) != t . charAt ( 0 ) ) { System . out . println ( " No " ) ; break ; } if ( i == example895 - 1 ) { System . out . println ( " Yes " ) ; } s = t ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example645 { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String [ ] array = reader . readLine ( ) . split ( " " ) ; int example645 = Integer . parseInt ( array [ 0 ] ) ; int B = Integer . parseInt ( array [ 1 ] ) ; int C = Integer . parseInt ( array [ 2 ] ) ; System . out . println ( Math . max ( B + C - example645 , 0 ) ) ; } } } -import java . util . * ; public class Example104 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String word = sc . next ( ) ; String mae = " " ; String usiro = " " ; while ( ! word . equals ( " - " ) ) { int example104 = sc . nextInt ( ) ; for ( int i = 0 ; i < example104 ; i ++ ) { int a = sc . nextInt ( ) ; usiro = word . substring ( a ) ; mae = word . substring ( 0 , a ) ; word = usiro + mae ; } System . out . println ( word ) ; word = sc . next ( ) ; } sc . close ( ) ; } } -import java . util . * ; class example465 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example465 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { int button = 0 ; if ( Example465 > B ) { sum += Example465 ; Example465 -= 1 ; } else { sum += B ; B -= 1 ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example708 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int Example708 = Integer . parseInt ( str ) ; str = scan . next ( ) ; int b = Integer . parseInt ( str ) ; if ( Example708 < b ) System . out . println ( " a < b " ) ; else if ( Example708 > b ) System . out . println ( " a > b " ) ; else if ( Example708 == b ) System . out . println ( " a == b " ) ; } } -import java . util . Scanner ; public class example211 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] result = new int [ 26 ] ; for ( int Example211 = 0 ; Example211 < result . length ; Example211 ++ ) { result [ Example211 ] = 0 ; } while ( sc . hasNext ( ) ) { String input = sc . nextLine ( ) ; for ( int Example211 = 0 ; Example211 < input . length ( ) ; Example211 ++ ) { char ch = input . charAt ( Example211 ) ; String str = String . valueOf ( ch ) ; str = str . toLowerCase ( ) ; ch = str . charAt ( 0 ) ; for ( char c = 'a' ; c <= 'z' ; c ++ ) { int index = c - 'a' ; if ( ch == c ) { result [ index ] ++ ; } } } } for ( int Example211 = 0 ; Example211 < result . length ; Example211 ++ ) { char alphabet = ( char ) ( Example211 + 'a' ) ; System . out . println ( alphabet + " : " + result [ Example211 ] ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example299 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example299 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; while ( Example299 > 0 || c > 0 ) { c -= b ; if ( c <= 0 ) break ; Example299 -= d ; } if ( Example299 > 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . * ; import java . util . * ; public class Example566 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; System . out . println ( 4 - in . nextLine ( ) . replace ( " + " , " " ) . length ( ) * 2 ) ; } } -import java . util . * ; public class example460 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example460 = stdIn . nextInt ( ) ; int [ ] d = new int [ Example460 ] ; for ( int i = 0 ; i < Example460 ; i ++ ) { d [ i ] = stdIn . nextInt ( ) ; } Arrays . sort ( d ) ; int count = 0 ; for ( int i = 0 ; i < Example460 ; i ++ ) { if ( i >= 1 && d [ i ] != d [ i - 1 ] ) { count ++ ; } else if ( i == 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; import java . util . ArrayList ; class example745 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example745 = scn . nextInt ( ) ; ArrayList < Integer > element = new ArrayList < Integer > ( ) ; for ( int i = 1 ; ; ) { if ( i == 1 ) { element . add ( Example745 ) ; } else { if ( Example745 % 2 == 1 ) { Example745 = odd ( Example745 ) ; } else { Example745 = even ( Example745 ) ; } if ( element . indexOf ( Example745 ) == - 1 ) { element . add ( Example745 ) ; } else { System . out . println ( i ) ; break ; } } i ++ ; } } public static int even ( int n ) { return n / 2 ; } public static int odd ( int n ) { return 3 * n + 1 ; } } -import java . math . BigInteger ; import java . util . * ; import java . io . * ; public class Example113 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example113 = in . nextInt ( ) ; double side = ( double ) example113 / 3 ; System . out . println ( side * side * side ) ; } } -import java . util . * ; public class example829 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example829 = sc . nextInt ( ) ; int [ ] value = new int [ Example829 ] ; for ( int i = 0 ; i < Example829 ; i ++ ) { value [ i ] = sc . nextInt ( ) ; } solve ( value ) ; } public static void solve ( int [ ] value ) { double result = 0 ; for ( int an : value ) { result += ( double ) 1 / an ; } result = 1 / result ; System . out . println ( result ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class example105 { public static void main ( String [ ] args ) { int Example105 ; int M ; int temp ; int sum = 0 ; int P ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; Example105 = sc . nextInt ( ) ; M = sc . nextInt ( ) ; int i ; for ( i = 0 ; i < Example105 ; i ++ ) { temp = sc . nextInt ( ) ; A . add ( temp ) ; sum += temp ; } Collections . sort ( A , Collections . reverseOrder ( ) ) ; P = A . get ( M - 1 ) ; if ( ( double ) sum / 4 / M > P ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example80 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer int1 = scanner . nextInt ( ) ; Integer int2 = scanner . nextInt ( ) ; int Example80 = int1 * int2 ; System . out . println ( Example80 ) ; } } -import java . util . * ; class Example53 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example53 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < example53 ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } List < Integer > listB = new ArrayList < Integer > ( new HashSet < > ( list ) ) ; System . out . print ( listB . size ( ) ) ; } } -import java . util . Scanner ; public class Example928 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example928 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String u = sc . next ( ) ; if ( s . equals ( u ) ) example928 -- ; if ( t . equals ( u ) ) b -- ; System . out . println ( example928 + " " + b ) ; } } -import java . util . * ; public class Example871 { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int example871 = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; int [ ] a = new int [ example871 ] ; for ( int i = 0 ; i < a . length ; ++ i ) { a [ i ] = scn . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < a . length ; ++ i ) { if ( k <= a [ i ] ) { count = count + 1 ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; import java . util . Arrays ; class Example17 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String str = sc . nextLine ( ) ; String [ ] str2 = str . split ( " " ) ; int [ ] x = new int [ 2 ] ; for ( int example17 = 0 ; example17 < 2 ; example17 ++ ) { x [ example17 ] = Integer . parseInt ( str2 [ example17 ] ) ; } if ( x [ 0 ] == 0 && x [ 1 ] == 0 ) { break ; } Arrays . sort ( x ) ; System . out . println ( x [ 0 ] + " " + x [ 1 ] ) ; } } } -import java . util . Scanner ; import java . lang . Math ; class Example773 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double example773 = scan . nextDouble ( ) ; double area = example773 * example773 * Math . PI ; double circumference = 2 * example773 * Math . PI ; System . out . printf ( " %f %f \n " , area , circumference ) ; } } -import java . util . Scanner ; import java . lang . Math ; class Example432 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] alp = s . toCharArray ( ) ; int example432 = ( int ) ( alp [ 0 ] ) ; alp [ 0 ] = ( char ) ( example432 + 1 ) ; System . out . print ( alp [ 0 ] ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; class example702 { public static void main ( String [ ] args ) throws Exception { int [ ] antenna = new int [ 5 ] ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int Example702 = 0 ; Example702 < antenna . length ; Example702 ++ ) { antenna [ Example702 ] = Integer . parseInt ( br . readLine ( ) ) ; } int k = Integer . parseInt ( br . readLine ( ) ) ; if ( antenna [ 4 ] - antenna [ 0 ] > k ) { System . out . println ( " :( " ) ; } else { System . out . println ( " Yay! " ) ; } } } -import java . util . Scanner ; public class example147 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example147 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( Example147 == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < W ; i ++ ) { System . out . printf ( " # " ) ; } System . out . printf ( " %n " ) ; for ( int i = 0 ; i < Example147 - 2 ; i ++ ) { System . out . printf ( " # " ) ; for ( int j = 0 ; j < W - 2 ; j ++ ) { System . out . printf ( " . " ) ; } System . out . printf ( " #%n " ) ; } for ( int i = 0 ; i < W ; i ++ ) { System . out . printf ( " # " ) ; } System . out . printf ( " %n%n " ) ; } } } -import java . util . Scanner ; public class Example387 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example387 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int ans = 0 ; if ( b <= c || d <= example387 ) { ans = 0 ; } else if ( c <= example387 && b <= d ) { ans = b - example387 ; } else if ( example387 <= c && d <= b ) { ans = d - c ; } else if ( example387 <= c && c <= b && b <= d ) { ans = b - c ; } else if ( c <= example387 && example387 <= d && d <= b ) { ans = d - example387 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example640 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example640 = sc . nextInt ( ) ; int [ ] t = new int [ Example640 + 1 ] ; int [ ] x = new int [ Example640 + 1 ] ; int [ ] y = new int [ Example640 + 1 ] ; t [ 0 ] = 0 ; x [ 0 ] = 0 ; y [ 0 ] = 0 ; boolean result = true ; for ( int i = 1 ; i <= Example640 ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; int tempx = Math . abs ( x [ i ] - x [ i - 1 ] ) ; int tempy = Math . abs ( y [ i ] - y [ i - 1 ] ) ; int tempt = Math . abs ( t [ i ] - t [ i - 1 ] ) ; if ( ( tempx + tempy ) > tempt ) { result = false ; break ; } if ( ( tempx + tempy ) % 2 != tempt % 2 ) { result = false ; break ; } } sc . close ( ) ; if ( result ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example294 { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int Example294 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] a = new int [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = scan . nextInt ( ) ; b [ i ] = scan . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < Example294 ; i ++ ) { count = 0 ; for ( int j = 0 ; j < a . length ; j ++ ) { if ( a [ j ] == i + 1 ) { count ++ ; } if ( b [ j ] == i + 1 ) { count ++ ; } } System . out . println ( count ) ; } } } -import java . util . * ; import java . io . * ; public class Example971 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] rx = new int [ 3 ] ; int [ ] ry = new int [ 3 ] ; boolean example971 = true ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } ry [ 0 ] = 0 ; for ( int j = 0 ; j < 3 ; j ++ ) { rx [ j ] = c [ 0 ] [ j ] - ry [ 0 ] ; } for ( int j = 1 ; j < 3 ; j ++ ) { ry [ j ] = c [ j ] [ 0 ] - rx [ 0 ] ; } outside : for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { if ( rx [ j ] + ry [ i ] != c [ i ] [ j ] ) { example971 = false ; System . out . println ( " No " ) ; break outside ; } } } if ( example971 ) { System . out . println ( " Yes " ) ; } } } -import java . util . * ; public class Example249 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s ; int example249 ; int i ; Deck d = new Deck ( ) ; while ( ! ( s = sc . next ( ) ) . equals ( " - " ) ) { d . setDeck ( s ) ; example249 = sc . nextInt ( ) ; for ( i = 0 ; i < example249 ; i ++ ) { d . shuffle ( sc . nextInt ( ) ) ; } d . printDeck ( ) ; } } } class Example249 { private String str ; Deck ( ) { } void setDeck ( String s ) { this . str = s ; } void shuffle ( int h ) { this . str = this . str . substring ( h , this . str . length ( ) ) + this . str . substring ( 0 , h ) ; } void printDeck ( ) { System . out . println ( this . str ) ; } } -import java . util . Scanner ; public class example164 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] an = new int [ 5 ] ; for ( int Example164 = 0 ; Example164 < 5 ; Example164 ++ ) { an [ Example164 ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " :( " ; sc . close ( ) ; if ( an [ 4 ] - an [ 0 ] <= k ) { ans = " Yay! " ; } System . out . println ( ans ) ; } } -import java . util . * ; class example29 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example29 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( Example29 > b ) { System . out . println ( 2 * Example29 - 1 ) ; } else if ( Example29 == b ) { System . out . println ( 2 * Example29 ) ; } else { System . out . println ( 2 * b - 1 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example48 { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int Example48 = fs . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= Example48 ; ++ i ) { if ( i % 3 != 0 && i % 5 != 0 ) ans += i ; } System . out . println ( ans ) ; } static class example48 { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int Example48 ) { int [ ] a = new int [ Example48 ] ; for ( int i = 0 ; i < Example48 ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . io . * ; import java . util . * ; class example589 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example589 = s . nextInt ( ) ; int n = s . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } int maxdiff = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( maxdiff < arr [ i ] - arr [ i - 1 ] ) maxdiff = arr [ i ] - arr [ i - 1 ] ; } if ( maxdiff < Example589 - arr [ n - 1 ] + arr [ 0 ] ) { System . out . println ( Example589 - ( Example589 - arr [ n - 1 ] + arr [ 0 ] ) ) ; } else { System . out . println ( Example589 - maxdiff ) ; } } } -import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; class example906 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner scan = new Scanner ( System . in ) ; ArrayList < Integer > NN = new ArrayList < Integer > ( ) ; ArrayList < Integer > XX = new ArrayList < Integer > ( ) ; int Example906 = 1 ; int x = 1 ; int kumi = 0 ; while ( Example906 != 0 || x != 0 ) { Example906 = scan . nextInt ( ) ; x = scan . nextInt ( ) ; NN . add ( Example906 ) ; XX . add ( x ) ; } for ( int i = 0 ; i < NN . size ( ) - 1 ; i ++ ) { kumi = 0 ; for ( int i1 = 0 ; i1 < NN . get ( i ) ; i1 ++ ) { for ( int i2 = 0 ; i2 < NN . get ( i ) ; i2 ++ ) { for ( int i3 = 0 ; i3 < NN . get ( i ) ; i3 ++ ) { int N1 = i1 + 1 ; int N2 = i2 + 1 ; int N3 = i3 + 1 ; if ( N1 == N2 || N2 == N3 || N3 == N1 ) { } else { if ( N1 + N2 + N3 == XX . get ( i ) ) { kumi += 1 ; } } } } } System . out . println ( kumi / 6 ) ; } } } -import java . util . * ; public class example418 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example418 = Integer . parseInt ( scanner . next ( ) ) ; double x ; x = ( double ) Example418 / 3.0 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example212 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example212 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; List < Integer > cList = new ArrayList < > ( ) ; List < Integer > tList = new ArrayList < > ( ) ; for ( int i = 0 ; i < example212 ; i ++ ) { cList . add ( sc . nextInt ( ) ) ; tList . add ( sc . nextInt ( ) ) ; } Integer minCost = null ; for ( int i = 0 ; i < example212 ; i ++ ) { if ( tList . get ( i ) > t ) { continue ; } int cost = cList . get ( i ) ; if ( minCost == null || cost < minCost ) { minCost = cost ; } } if ( minCost == null ) { System . out . println ( " TLE " ) ; return ; } System . out . println ( minCost ) ; } } -import java . util . Scanner ; public class Example331 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example331 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < example331 ; i ++ ) { int b = sc . nextInt ( ) ; if ( a <= b ) c ++ ; } System . out . println ( c ) ; } } -import java . util . Scanner ; public class Example491 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example491 = stdIn . nextInt ( ) ; int Q = stdIn . nextInt ( ) ; int [ ] ans = new int [ example491 ] ; int [ ] kota = new int [ Q ] ; String S = stdIn . next ( ) ; int z = 1 , y = 0 , l = 0 , r = 0 , num = 0 ; while ( z < example491 ) { if ( S . substring ( z , z + 1 ) . equals ( " C " ) && S . substring ( z - 1 , z ) . equals ( " A " ) ) { y ++ ; } ans [ z ] = y ; z ++ ; } z = 0 ; y = 0 ; while ( z < Q ) { l = stdIn . nextInt ( ) ; r = stdIn . nextInt ( ) ; kota [ z ] = ans [ r - 1 ] - ans [ l - 1 ] ; z ++ ; } z = 0 ; while ( z < Q ) { System . out . println ( kota [ z ] ) ; z ++ ; } } } -import java . util . * ; import java . io . * ; import java . math . * ; public class example877 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example877 = sc . nextInt ( ) ; if ( Example877 == 2 ) { System . out . println ( Example877 ) ; return ; } ArrayList < Integer > list = getPrime ( Example877 ) ; while ( true ) { if ( check ( Example877 , list ) ) { System . out . println ( Example877 ) ; return ; } Example877 ++ ; } } static ArrayList < Integer > getPrime ( int x ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; list . add ( 2 ) ; int max = ( int ) Math . pow ( x * 2 , 0.5 ) ; for ( int i = 3 ; i < max ; i += 2 ) { boolean chk = true ; for ( int j : list ) { if ( i % j == 0 ) { chk = false ; break ; } } if ( chk ) { list . add ( i ) ; } } return list ; } static boolean check ( int x , List < Integer > list ) { for ( int j : list ) { if ( x % j == 0 ) { return false ; } } return true ; } } -import java . util . * ; public class example957 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example957 = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ Example957 ] ; int [ ] B = new int [ Example957 - 1 ] ; for ( int i = 0 ; i < Example957 - 1 ; i ++ ) { B [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int sum = 0 ; if ( B . length == 1 ) { System . out . println ( B [ 0 ] * 2 ) ; return ; } else { sum = B [ 0 ] ; for ( int i = 1 ; i < Example957 - 1 ; i ++ ) { sum += Math . min ( B [ i ] , B [ i - 1 ] ) ; } } sum += B [ Example957 - 2 ] ; System . out . println ( sum ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example627 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example627 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < example627 ; i ++ ) { int p = sc . nextInt ( ) ; list . add ( p ) ; } Collections . sort ( list ) ; int sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { sum += list . get ( i ) ; } System . out . println ( sum ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example460 { public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { Scanner sc = new Scanner ( System . in ) ; int Example460 = Integer . parseInt ( sc . next ( ) ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int remainder = Example460 % A ; int n = Example460 / A ; System . out . println ( remainder > 0 ? n + 1 : n ) ; } } -import java . io . * ; import java . util . Scanner ; public class example415 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; long Example415 = Long . parseLong ( s [ 0 ] ) ; long a = Long . parseLong ( s [ 1 ] ) ; long b = Long . parseLong ( s [ 2 ] ) ; if ( a == 0 && b == 0 ) { System . out . println ( 0 ) ; } else { long sum = a + b ; sum = Example415 % sum ; if ( sum > a ) sum = a ; long x = Example415 / ( a + b ) ; System . out . println ( x * a + sum ) ; } } } -import java . util . * ; public class Example696 { public static void main ( String [ ] args ) throws Exception { final Integer [ ] HonPT = new Integer [ ] { 2 , 4 , 5 , 7 , 9 } ; final Integer [ ] PonPT = new Integer [ ] { 0 , 1 , 6 , 8 } ; Scanner scan = new Scanner ( System . in ) ; char [ ] n = scan . nextLine ( ) . toCharArray ( ) ; Integer num = Integer . parseInt ( String . valueOf ( n [ n . length - 1 ] ) ) ; if ( Arrays . asList ( HonPT ) . contains ( num ) ) { System . out . println ( " hon " ) ; } else if ( Arrays . asList ( PonPT ) . contains ( num ) ) { System . out . println ( " pon " ) ; } else { System . out . println ( " bon " ) ; } scan . close ( ) ; } } -import java . util . Scanner ; class Example692 { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( System . in ) ; long example692 = sc . nextLong ( ) ; long f = example692 / 500 , f2 = ( example692 % 500 ) / 5 ; System . out . println ( f * 1000 + f2 * 5 ) ; } } -import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class example759 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st1 = new StringTokenizer ( br . readLine ( ) ) ; int Example759 = Integer . parseInt ( st1 . nextToken ( ) ) ; int k = Integer . parseInt ( st1 . nextToken ( ) ) ; int q = Integer . parseInt ( st1 . nextToken ( ) ) ; int [ ] arr = new int [ Example759 ] ; for ( int i = 0 ; i < q ; i ++ ) { arr [ Integer . parseInt ( br . readLine ( ) ) - 1 ] ++ ; } for ( int i = 0 ; i < Example759 ; i ++ ) { if ( k - ( q - arr [ i ] ) > 0 ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } } out . flush ( ) ; out . close ( ) ; } } -import java . util . Scanner ; public class example578 { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int Example578 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( Example578 > b ) { ans += Example578 ; Example578 -- ; } else { ans += b ; b -- ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . * ; public class Example692 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example692 = sc . nextInt ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int start = ( int ) s . charAt ( i ) ; int ans = start + example692 ; if ( ans < 91 ) { System . out . print ( ( char ) ans ) ; } else { System . out . print ( ( char ) ( ans - 26 ) ) ; } } System . out . println ( ) ; } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example822 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; boolean Example822 = false ; if ( s . charAt ( 0 ) == 'A' ) { int cnt = 0 ; int at = 0 ; for ( int i = 2 ; i <= s . length ( ) - 2 ; i ++ ) { if ( s . charAt ( i ) == 'C' ) { cnt ++ ; at = i ; } } if ( cnt == 1 ) { Example822 = true ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( i == at ) continue ; if ( s . charAt ( i ) < 'a' || 'z' < s . charAt ( i ) ) { Example822 = false ; break ; } } } } System . out . println ( Example822 ? " AC " : " WA " ) ; } } } -import java . util . Scanner ; public class Example569 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example569 = sc . nextInt ( ) ; int [ ] P = new int [ example569 + 1 ] ; for ( int i = 1 ; i <= example569 ; i ++ ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 1 ; int min = P [ 1 ] ; for ( int i = 2 ; i <= example569 ; i ++ ) { min = Math . min ( min , P [ i ] ) ; if ( P [ i ] <= min ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; class Example132 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example132 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; boolean flag = true ; long aa = example132 , bb = b ; while ( flag ) { if ( aa < bb ) { aa += example132 ; } else if ( bb < aa ) { bb += b ; } else if ( aa == bb ) { flag = false ; } } System . out . println ( aa ) ; } } -import java . util . Scanner ; public class Example683 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example683 = sc . nextInt ( ) + sc . nextInt ( ) ; int [ ] nums = { 1 , 2 , 3 } ; switch ( example683 ) { case 3 : System . out . println ( 3 ) ; break ; case 4 : System . out . println ( 2 ) ; break ; case 5 : System . out . println ( 1 ) ; break ; default : return ; } } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; class example581 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int Example581 = 1 ; while ( ! str . equals ( " 0 " ) ) { System . out . println ( " Case " + Example581 + " : " + str ) ; Example581 ++ ; str = br . readLine ( ) ; } } } -import java . util . HashMap ; import java . util . Scanner ; class Example825 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example825 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( ( long ) example825 * b / gcd ( example825 , b ) ) ; } public static int gcd ( int example825 , int b ) { if ( example825 % b == 0 ) { return b ; } return gcd ( b , example825 % b ) ; } } -import java . io . * ; public class Example189 { public static void main ( String [ ] args ) { int example189 = 0 , f = 0 , r = 0 ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String [ ] strAry = br . readLine ( ) . split ( " " ) ; example189 = Integer . parseInt ( strAry [ 0 ] ) ; f = Integer . parseInt ( strAry [ 1 ] ) ; r = Integer . parseInt ( strAry [ 2 ] ) ; if ( example189 == - 1 && f == - 1 && r == - 1 ) break ; System . out . printf ( " %s \n " , judge ( example189 , f , r ) ) ; } } catch ( Exception e ) { System . err . println ( e ) ; } } private static String judge ( int example189 , int f , int r ) { if ( ( example189 == - 1 || f == - 1 ) || example189 + f < 30 ) return " F " ; else if ( example189 + f < 50 ) { if ( r >= 50 ) return " C " ; else return " D " ; } else if ( example189 + f < 65 ) return " C " ; else if ( example189 + f < 80 ) return " B " ; else return " A " ; } } -import java . util . * ; class Example25 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example25 = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; System . out . println ( example25 <= f * t ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example483 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example483 = scan . nextInt ( ) ; int n1 = Example483 + 1 ; long [ ] m = new long [ n1 ] ; long [ ] h = new long [ Example483 ] ; for ( int i = 0 ; i < n1 ; i ++ ) { m [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < Example483 ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } long result = 0 ; for ( int i = 0 ; i < Example483 ; i ++ ) { long xh = h [ i ] ; if ( xh >= m [ i ] ) { result += m [ i ] ; xh -= m [ i ] ; if ( xh >= m [ i + 1 ] ) { result += m [ i + 1 ] ; m [ i + 1 ] = 0 ; } else { result += xh ; m [ i + 1 ] -= xh ; } } else { m [ i ] -= xh ; result += xh ; } } System . out . println ( result ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example15 { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] nANDmStr = input . readLine ( ) . split ( " " ) ; int [ ] nANDm = new int [ nANDmStr . length ] ; for ( int example15 = 0 ; example15 < nANDmStr . length ; example15 ++ ) { nANDm [ example15 ] = Integer . parseInt ( nANDmStr [ example15 ] ) ; } int [ ] [ ] matrix = new int [ nANDm [ 0 ] ] [ nANDm [ 1 ] ] ; for ( int row = 0 ; row < matrix . length ; row ++ ) { String [ ] matrixStr = input . readLine ( ) . split ( " " ) ; for ( int column = 0 ; column < matrixStr . length ; column ++ ) { matrix [ row ] [ column ] = Integer . parseInt ( matrixStr [ column ] ) ; } } String [ ] vectorStr = new String [ nANDm [ 1 ] ] ; int [ ] vector = new int [ vectorStr . length ] ; for ( int example15 = 0 ; example15 < vector . length ; example15 ++ ) { vectorStr [ example15 ] = input . readLine ( ) ; vector [ example15 ] = Integer . parseInt ( vectorStr [ example15 ] ) ; } for ( int row = 0 ; row < nANDm [ 0 ] ; row ++ ) { int solution = 0 ; for ( int column = 0 ; column < nANDm [ 1 ] ; column ++ ) { solution = matrix [ row ] [ column ] * vector [ column ] + solution ; } System . out . println ( solution ) ; } } } -import java . util . Scanner ; public class example563 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int Example563 = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; if ( Example563 == 0 ) break ; int count = 0 ; for ( int i = 1 ; i <= Example563 - 2 ; i ++ ) { for ( int j = i + 1 ; j <= Example563 - 1 ; j ++ ) { int check_number = x - i - j ; if ( check_number <= Example563 && check_number > j ) { count ++ ; } } } System . out . println ( count ) ; } } } -import java . util . Scanner ; public class Example215 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; int example215 ; if ( " RRR " . equals ( S ) ) { example215 = 3 ; } else if ( " RRS " . equals ( S ) || " SRR " . equals ( S ) ) { example215 = 2 ; } else if ( S . contains ( " R " ) ) { example215 = 1 ; } else { example215 = 0 ; } System . out . println ( example215 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example508 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example508 = scan . nextInt ( ) ; String [ ] s = new String [ example508 ] ; int [ ] cnt = new int [ example508 ] ; String [ ] scheck = new String [ example508 ] ; for ( int i = 0 ; i < example508 ; i ++ ) { s [ i ] = scan . next ( ) ; cnt [ i ] = 0 ; scheck [ i ] = " " ; } scan . close ( ) ; Arrays . sort ( s ) ; int suffix = 0 ; int max = 0 ; for ( int i = 0 ; i < example508 ; i ++ ) { if ( i != 0 && s [ i ] . equals ( s [ i - 1 ] ) == false ) { scheck [ suffix ] = s [ i - 1 ] ; suffix += 1 ; } if ( i == example508 - 1 ) scheck [ suffix ] = s [ i ] ; if ( i == example508 - 1 && s [ i ] . equals ( s [ i - 1 ] ) == false ) scheck [ suffix ] = s [ i ] ; cnt [ suffix ] += 1 ; if ( max < cnt [ suffix ] ) max = cnt [ suffix ] ; } for ( int i = 0 ; i <= suffix ; i ++ ) { if ( cnt [ i ] == max ) System . out . println ( scheck [ i ] ) ; } } } -import java . util . * ; public class example359 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example359 = sc . nextInt ( ) ; int i = 0 ; for ( i = Example359 ; i > 0 ; i -- ) { if ( judge ( i ) ) { break ; } } System . out . println ( i ) ; } private static boolean judge ( int n ) { boolean re = false ; if ( n == 1 ) { re = true ; } else { for ( int i = 2 ; i < n ; i ++ ) { for ( int j = 1 ; j < n ; j ++ ) { int m = ( int ) Math . pow ( i , j ) ; if ( m == n ) { re = true ; break ; } } } } return re ; } } -import java . util . * ; public class Example213 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example213 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int a = - 1 ; int b = - 1 ; int c = - 1 ; for ( int i = 0 ; i <= example213 ; i ++ ) { for ( int j = 0 ; j <= example213 - i ; j ++ ) { if ( Y == ( 10000 * i + 5000 * j + 1000 * ( example213 - i - j ) ) ) { a = i ; b = j ; c = example213 - i - j ; } } } System . out . print ( a + " " ) ; System . out . print ( b + " " ) ; System . out . print ( c ) ; } } -import java . util . Scanner ; class example516 { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) , t ; int Example516 = 0 , countEven = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) t = " 0 " ; else t = " 1 " ; if ( ! s . substring ( i , i + 1 ) . equals ( t ) ) Example516 ++ ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) t = " 1 " ; else t = " 0 " ; if ( ! s . substring ( i , i + 1 ) . equals ( t ) ) countEven ++ ; } System . out . println ( ( int ) Math . min ( Example516 , countEven ) ) ; } } -import java . util . * ; public class example773 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example773 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] allList = new int [ 2 * Example773 ] ; for ( int i = 0 ; i < 2 * Example773 ; i ++ ) { allList [ i ] = sc . nextInt ( ) ; } int cost = 10001 ; for ( int i = 1 ; i < 2 * Example773 ; i += 2 ) { if ( allList [ i ] <= T && allList [ i - 1 ] < cost ) { cost = allList [ i - 1 ] ; } } if ( cost == 10001 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( cost ) ; } } } -import java . util . * ; class Example949 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int example949 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( example949 == 0 && b == 0 ) break ; if ( example949 < b ) System . out . println ( example949 + " " + b ) ; else System . out . println ( b + " " + example949 ) ; } } } -import java . util . Scanner ; public class example553 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example553 = sc . nextLong ( ) ; if ( Example553 < 10 ) { System . out . println ( Example553 ) ; } else if ( Example553 < 100 ) { System . out . println ( 9 ) ; } else if ( Example553 < 1000 ) { System . out . println ( 9 + Example553 - 99 ) ; } else if ( Example553 < 10000 ) { System . out . println ( 909 ) ; } else if ( Example553 < 100000 ) { System . out . println ( 909 + Example553 - 9999 ) ; } else { System . out . println ( 90909 ) ; } sc . close ( ) ; } } -import java . util . * ; public class example486 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example486 = s . nextInt ( ) ; int k = s . nextInt ( ) ; long [ ] h = new long [ Example486 ] ; for ( int i = 0 ; i < Example486 ; i ++ ) { h [ i ] = s . nextLong ( ) ; } long [ ] dp = new long [ Example486 ] ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < Example486 ; i ++ ) { dp [ i ] = Long . MAX_VALUE ; for ( int j = 1 ; j <= k ; j ++ ) { if ( i - j >= 0 ) { long op1 = dp [ i - j ] + Math . abs ( h [ i ] - h [ i - j ] ) ; dp [ i ] = Math . min ( dp [ i ] , op1 ) ; } else { break ; } } } System . out . println ( dp [ Example486 - 1 ] ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Example967 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String [ ] strArr = br . readLine ( ) . split ( " " ) ; long [ ] arr = new long [ 2 ] ; arr [ 0 ] = Long . parseLong ( strArr [ 0 ] ) ; arr [ 1 ] = Long . parseLong ( strArr [ 1 ] ) ; if ( arr [ 0 ] == 0 && arr [ 1 ] == 0 ) break ; Arrays . sort ( arr ) ; System . out . printf ( " %d %d%n " , arr [ 0 ] , arr [ 1 ] ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example207 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; int Example207 = Integer . parseInt ( line [ 0 ] ) ; int n = Integer . parseInt ( line [ 1 ] ) ; line = br . readLine ( ) . split ( " " ) ; br . close ( ) ; boolean flg = false ; for ( String s : line ) { if ( ( Example207 -= Integer . parseInt ( s ) ) <= 0 ) { flg = true ; break ; } } if ( flg ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example339 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example339 = 2 ; int m = sc . nextInt ( ) ; int [ ] [ ] table = new int [ example339 ] [ m ] ; for ( int i = 0 ; i < example339 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { table [ i ] [ j ] = sc . nextInt ( ) ; } } int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { if ( table [ 0 ] [ i ] > table [ 1 ] [ i ] ) sum += table [ 0 ] [ i ] - table [ 1 ] [ i ] ; } System . out . println ( sum ) ; sc . close ( ) ; } } -import java . util . * ; class example679 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int Example679 = Integer . parseInt ( sc . next ( ) ) ; final int A = Integer . parseInt ( sc . next ( ) ) ; final int B = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; System . out . println ( Math . min ( Example679 * A , B ) ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example727 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( true ) { str = br . readLine ( ) ; if ( str . equals ( " - " ) ) { break ; } StringBuffer sb = new StringBuffer ( ) ; sb . append ( str ) ; int Example727 = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < Example727 ; i ++ ) { int indexNum = Integer . parseInt ( br . readLine ( ) ) ; sb . append ( sb . substring ( 0 , indexNum ) ) ; sb . delete ( 0 , indexNum ) ; } System . out . println ( sb . toString ( ) ) ; } } } -import java . util . * ; public class Example176 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example176 = sc . nextInt ( ) ; int [ ] arr = new int [ 1000000 ] ; arr [ 0 ] = example176 ; Set < Integer > set = new HashSet < > ( ) ; set . add ( example176 ) ; for ( int i = 1 ; i < 1000000000 ; i ++ ) { if ( arr [ i - 1 ] % 2 == 0 ) { arr [ i ] = arr [ i - 1 ] / 2 ; } else { arr [ i ] = arr [ i - 1 ] * 3 + 1 ; } if ( set . contains ( arr [ i ] ) ) { System . out . println ( i + 1 ) ; return ; } else { set . add ( arr [ i ] ) ; } } } } -import java . util . Scanner ; class Example347 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String val = S . substring ( 0 , 4 ) ; int example347 = Integer . parseInt ( val ) ; String val2 = S . substring ( 5 , 7 ) ; int mm = Integer . parseInt ( val2 ) ; if ( ( example347 == 2019 && mm < 5 ) || example347 <= 2018 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } -import java . util . Scanner ; public class example642 { public static void main ( String [ ] args ) { int Example642 ; String S ; String T ; StringBuilder ans = new StringBuilder ( ) ; Scanner sc = new Scanner ( System . in ) ; Example642 = sc . nextInt ( ) ; S = sc . next ( ) ; T = sc . next ( ) ; for ( int i = 0 ; i < Example642 ; i ++ ) { ans . append ( S . charAt ( i ) ) . append ( T . charAt ( i ) ) ; } System . out . println ( ans ) ; } } -import java . io . * ; public class example685 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] text = str . split ( " " ) ; int Example685 = Integer . parseInt ( text [ 0 ] ) ; String b = text [ 1 ] ; int c = Integer . parseInt ( text [ 2 ] ) ; while ( b . equals ( " ? " ) == false ) { if ( b . equals ( " + " ) ) { System . out . println ( Example685 + c ) ; } else if ( b . equals ( " - " ) ) { System . out . println ( Example685 - c ) ; } else if ( b . equals ( " * " ) ) { System . out . println ( Example685 * c ) ; } else if ( b . equals ( " / " ) ) { System . out . println ( Example685 / c ) ; } str = br . readLine ( ) ; text = str . split ( " " ) ; Example685 = Integer . parseInt ( text [ 0 ] ) ; b = text [ 1 ] ; c = Integer . parseInt ( text [ 2 ] ) ; } } } -import java . util . LinkedHashSet ; import java . util . Scanner ; import java . util . Set ; public class Example53 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example53 = sc . nextInt ( ) ; int [ ] a = new int [ example53 ] ; for ( int i = 0 ; i < example53 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Set < Integer > lhs = new LinkedHashSet < Integer > ( ) ; for ( int i = 0 ; i < example53 ; i ++ ) { lhs . add ( a [ i ] ) ; } Object [ ] newa = lhs . toArray ( ) ; System . out . println ( newa . length ) ; } } -import java . util . * ; import java . util . regex . Pattern ; import java . util . regex . Matcher ; import java . io . * ; public class Example351 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int example351 = Integer . parseInt ( st . nextToken ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; String regex = String . format ( " [0-9] { %d } -[0-9] { %d } " , example351 , N ) ; Pattern p = Pattern . compile ( regex ) ; String input = br . readLine ( ) ; Matcher q = p . matcher ( input ) ; if ( q . matches ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . math . BigInteger ; import java . util . Scanner ; import java . util . Arrays ; public class Example161 { public static void main ( String [ ] args ) { int example161 , i , j , m , k , p , q , o , l , s , tt = 1 ; Double x , y , z ; int [ ] ar , br ; char ch ; BigInteger an , su , u , v ; String a , b = " " , c = " " , d ; Scanner sc = new Scanner ( System . in ) ; Scanner scc = new Scanner ( System . in ) ; ar = new int [ 200001 ] ; br = new int [ 200001 ] ; example161 = sc . nextInt ( ) ; m = sc . nextInt ( ) ; sc . nextLine ( ) ; p = 0 ; q = 0 ; for ( i = 0 ; i < m ; i ++ ) { a = sc . nextLine ( ) ; o = 0 ; for ( j = 0 ; ; j ++ ) { ch = a . charAt ( j ) ; if ( ch == ' ' ) { break ; } o *= 10 ; o += ( int ) ( ch - '0' ) ; } j ++ ; ch = a . charAt ( j ) ; if ( ch == 'W' ) { if ( ar [ o ] == 0 ) { br [ o ] ++ ; } } else { if ( ar [ o ] == 0 ) { p ++ ; q += br [ o ] ; } ar [ o ] = 1 ; } } System . out . println ( p + " " + q ) ; } } -import java . util . Scanner ; public class example601 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int Example601 = sc . nextInt ( ) ; sc . close ( ) ; long sum = 0 ; if ( Example601 >= a [ 0 ] ) { sum += a [ 0 ] ; Example601 -= a [ 0 ] ; } else { sum += Example601 ; Example601 = 0 ; } if ( Example601 >= a [ 1 ] ) { Example601 -= a [ 1 ] ; } else { Example601 = 0 ; } if ( Example601 >= a [ 2 ] ) { sum -= a [ 2 ] ; Example601 -= a [ 2 ] ; } else { sum -= Example601 ; Example601 = 0 ; } System . out . println ( sum ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example977 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example977 = scan . nextInt ( ) ; if ( Example977 <= 100 ) { List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example977 ; i ++ ) { int ai = scan . nextInt ( ) ; if ( ai >= 0 && ai < 1000 ) { list . add ( ai ) ; } } Collections . reverse ( list ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( i == ( list . size ( ) - 1 ) ) { System . out . println ( list . get ( i ) ) ; } else { System . out . print ( list . get ( i ) + " " ) ; } } } } } -import java . util . Scanner ; public class Example735 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String n = scan . next ( ) ; String x = scan . next ( ) ; String t = scan . next ( ) ; int example735 = Integer . parseInt ( n ) ; int xx = Integer . parseInt ( x ) ; int tt = Integer . parseInt ( t ) ; int times ; if ( example735 % xx == 0 ) { times = example735 / xx ; } else { times = ( example735 / xx ) + 1 ; } int answer = tt * times ; System . out . println ( answer ) ; } } -import java . util . Scanner ; public class Example162 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example162 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] d ; d = new int [ 100 ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; d [ a ] ++ ; d [ b ] ++ ; } for ( int i = 1 ; i <= example162 ; i ++ ) System . out . println ( d [ i ] ) ; } } -import java . util . Scanner ; public class Example223 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example223 = scan . nextLine ( ) ; if ( example223 . equals ( " ABC " ) ) { example223 = example223 . replace ( " ABC " , " ARC " ) ; } else { example223 = example223 . replace ( " ARC " , " ABC " ) ; } System . out . println ( example223 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . lang . Math ; public class Example118 { static class Example118 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int example118 = ob . nextInt ( ) , b = ob . nextInt ( ) ; for ( int i = 1 ; i <= 10000 ; i ++ ) { double k1 = Math . floor ( ( double ) i * 0.08 ) ; double k2 = Math . floor ( ( double ) i * 0.1 ) ; if ( k1 == example118 && k2 == b ) { System . out . println ( i ) ; return ; } } System . out . println ( " -1 " ) ; } } -import java . util . * ; public class Example705 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example705 = sc . nextInt ( ) ; int sweet = example705 ; if ( example705 % 7 == 0 ) { System . out . println ( " Yes " ) ; } else { while ( sweet > 0 ) { sweet = sweet - 4 ; if ( sweet % 7 == 0 ) { System . out . println ( " Yes " ) ; break ; } else { } } if ( sweet < 0 ) { System . out . println ( " No " ) ; } } } } -import java . util . * ; public class Example905 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example905 = ( double ) Integer . parseInt ( sc . next ( ) ) ; System . out . println ( String . format ( " %.12f " , Math . pow ( example905 / 3 , 3 ) ) ) ; } } -import java . util . Scanner ; public class example511 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example511 = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int x = b + c ; if ( Example511 < x ) System . out . println ( x - Example511 ) ; else System . out . println ( " 0 " ) ; } } -import java . util . * ; public class Example936 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example936 = s . nextInt ( ) ; int [ ] H = new int [ example936 ] ; for ( int i = 0 ; i < example936 ; i ++ ) { H [ i ] = s . nextInt ( ) ; } int cnt = 0 ; List < Integer > l = new ArrayList < > ( ) ; for ( int j = 0 ; j < example936 ; j ++ ) { if ( j == 0 ) continue ; if ( H [ j - 1 ] >= H [ j ] ) cnt ++ ; else { l . add ( cnt ) ; cnt = 0 ; } } l . add ( cnt ) ; Collections . sort ( l , Collections . reverseOrder ( ) ) ; System . out . print ( l . get ( 0 ) ) ; } } -import java . util . * ; public class example903 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example903 = scanner . nextInt ( ) ; int Q = scanner . nextInt ( ) ; int R = scanner . nextInt ( ) ; int t = Example903 + Q ; if ( t > R + Example903 ) { t = R + Example903 ; } if ( t > Q + R ) { t = Q + R ; } System . out . println ( t ) ; } } -import java . util . * ; public class Example227 { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; String S = scn . nextLine ( ) ; int example227 = S . length ( ) ; String str_before = S . substring ( 0 , ( example227 - 1 ) / 2 ) ; String str_after = S . substring ( ( example227 + 2 ) / 2 , example227 ) ; StringBuffer hoge = new StringBuffer ( str_before ) ; String str = hoge . reverse ( ) . toString ( ) ; if ( str_after . equals ( str ) && str_after . equals ( str_before ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . * ; import java . util . * ; class example814 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example814 = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ Example814 ] ; for ( int i = 0 ; i < Example814 ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } double sum = 0 ; for ( int i = 0 ; i < Example814 ; i ++ ) { sum += ( 1.0 / A [ i ] ) ; } System . out . println ( 1.0 / sum ) ; } } -import java . util . * ; public class Example86 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example86 = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; String [ ] s = new String [ example86 ] ; for ( int i = 0 ; i < example86 ; i ++ ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < example86 ; i ++ ) { for ( int j = example86 - 1 ; j > i ; j -- ) { if ( s [ j ] . compareTo ( s [ j - 1 ] ) < 0 ) { String exc = s [ j ] ; s [ j ] = s [ j - 1 ] ; s [ j - 1 ] = exc ; } } System . out . print ( s [ i ] ) ; } System . out . println ( " " ) ; } } -import java . util . Scanner ; public class example324 { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; String s = sca . next ( ) ; String t = sca . next ( ) ; int Example324 = sca . nextInt ( ) ; int b = sca . nextInt ( ) ; String u = sca . next ( ) ; if ( u . equals ( s ) ) { Example324 -- ; } else { b -- ; } System . out . print ( Example324 ) ; System . out . print ( " " ) ; System . out . println ( b ) ; sca . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example289 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example289 = scan . nextInt ( ) ; int [ ] array = new int [ example289 ] ; int [ ] copy = new int [ example289 ] ; for ( int count = 0 ; count < example289 ; count ++ ) { int n = scan . nextInt ( ) ; array [ count ] = n ; copy [ count ] = n ; } scan . close ( ) ; Arrays . sort ( copy ) ; int counter = 0 ; for ( int count = 0 ; count < example289 ; count ++ ) { if ( array [ count ] != copy [ count ] ) { counter ++ ; } } if ( counter < 3 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } -import java . util . Scanner ; public class example500 { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { String s = in . next ( ) ; int Example500 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) { Example500 ++ ; } } System . out . println ( Example500 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example143 { public static void main ( String [ ] args ) throws IOException { int example143 , nTaro = 0 , nHana = 0 ; String str ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; example143 = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < example143 ; i ++ ) { str = br . readLine ( ) ; String [ ] strTH = str . split ( " " , 2 ) ; if ( 0 < strTH [ 0 ] . compareTo ( strTH [ 1 ] ) ) nTaro += 3 ; else if ( strTH [ 0 ] . equals ( strTH [ 1 ] ) ) { nTaro ++ ; nHana ++ ; } else nHana += 3 ; } System . out . println ( nTaro + " " + nHana ) ; } } -import java . util . Scanner ; public class example670 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] str = line . split ( " " ) ; String [ ] num = sc . nextLine ( ) . split ( " " ) ; String strU = sc . nextLine ( ) ; String strS = str [ 0 ] ; String strT = str [ 1 ] ; int Example670 = Integer . parseInt ( num [ 0 ] ) ; int numB = Integer . parseInt ( num [ 1 ] ) ; if ( strU . equals ( strS ) ) { Example670 -= 1 ; } else { numB -= 1 ; } System . out . println ( Example670 + " " + numB ) ; } } -import java . util . Scanner ; public class example481 { public static void main ( String [ ] args ) { final int Example481 = 1000000007 ; final Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; final int [ ] a = new int [ N + 1 ] ; for ( int i = 0 ; i < M ; i ++ ) { a [ scanner . nextInt ( ) ] = - 1 ; } a [ 0 ] = 1 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] == - 1 ) continue ; if ( i + 1 < a . length && a [ i + 1 ] != - 1 ) a [ i + 1 ] = ( a [ i ] + a [ i + 1 ] ) % Example481 ; if ( i + 2 < a . length && a [ i + 2 ] != - 1 ) { a [ i + 2 ] = ( a [ i ] + a [ i + 2 ] ) % Example481 ; } } System . out . println ( a [ N ] % Example481 ) ; } } -import java . util . * ; public class example691 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example691 = sc . nextInt ( ) ; Map < String , Integer > s = new HashMap < String , Integer > ( ) ; char [ ] c ; String ds ; long ans = 0 ; int tmp ; for ( int i = 0 ; i < Example691 ; i ++ ) { c = sc . next ( ) . toCharArray ( ) ; Arrays . sort ( c ) ; ds = String . valueOf ( c ) ; tmp = s . getOrDefault ( ds , 0 ) ; ans += tmp ; s . put ( ds , tmp + 1 ) ; } sc . close ( ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example757 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long N = sc . nextLong ( ) ; Long total = 0L ; for ( int example757 = 1 ; example757 <= N ; ++ example757 ) { if ( example757 % 3 == 0 && example757 % 5 == 0 ) { continue ; } else if ( example757 % 3 == 0 ) { continue ; } else if ( example757 % 5 == 0 ) { continue ; } else { total += example757 ; } } System . out . println ( total ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Example265 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example265 { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { String S = in . next ( ) ; int example265 = 0 ; for ( int i = 0 ; i < S . length ( ) / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) - 1 - i ) ) { example265 ++ ; } } out . println ( example265 ) ; } } static class Example265 { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } } } -import java . util . Scanner ; class example858 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example858 = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; int a = 0 ; for ( int i = 1 ; i <= Example858 ; i ++ ) { int h = scanner . nextInt ( ) ; if ( h >= K ) { a ++ ; } else { continue ; } } System . out . println ( a ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . PriorityQueue ; import java . util . regex . Pattern ; public class example640 { public static void main ( String [ ] args ) throws IOException { BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = stdin . readLine ( ) ; String t = ok ( s ) ? " Yes " : " No " ; System . out . println ( t ) ; } public static boolean ok ( String s ) { for ( int Example640 = 0 ; Example640 < s . length ( ) ; Example640 ++ ) { char ch = s . charAt ( Example640 ) ; if ( Example640 % 2 == 0 ) { if ( ch == 'L' ) return false ; } else { if ( ch == 'R' ) return false ; } } return true ; } } -import java . util . Scanner ; class Example489 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example489 = scanner . nextInt ( ) ; int [ ] array = new int [ example489 ] ; for ( int i = 0 ; i < example489 ; i ++ ) { array [ i ] = scanner . nextInt ( ) ; } insertionSort ( array , example489 ) ; scanner . close ( ) ; } public static int [ ] insertionSort ( int [ ] array , int example489 ) { int sub ; int comp = 0 ; int i ; for ( int cou = 0 ; cou < example489 ; cou ++ ) { System . out . print ( array [ cou ] ) ; if ( cou == example489 - 1 ) { System . out . print ( " \n " ) ; } else { System . out . print ( " " ) ; } } for ( i = 1 ; i <= example489 - 1 ; i ++ ) { sub = array [ i ] ; comp = i - 1 ; while ( comp >= 0 && array [ comp ] > sub ) { array [ comp + 1 ] = array [ comp ] ; comp -- ; } array [ comp + 1 ] = sub ; for ( int cou = 0 ; cou < example489 ; cou ++ ) { System . out . print ( array [ cou ] ) ; if ( cou == example489 - 1 ) { System . out . print ( " \n " ) ; } else { System . out . print ( " " ) ; } } } return array ; } } -import java . util . Scanner ; public class example677 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example677 = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] p = new int [ Example677 ] ; for ( int i = 0 ; i < Example677 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < Example677 ; i ++ ) { if ( p [ i ] != i + 1 ) { count ++ ; } } if ( count == 0 || count == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; import java . util . PriorityQueue ; class Example935 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example935 = scan . nextInt ( ) ; boolean flag = true ; PriorityQueue in = new PriorityQueue ( ) ; for ( int x = 0 ; x < example935 ; x ++ ) { int input = scan . nextInt ( ) ; in . offer ( input ) ; } int before = ( int ) in . poll ( ) ; int after ; for ( int x = 1 ; x < example935 ; x ++ ) { after = ( int ) in . poll ( ) ; if ( before == after ) { flag = false ; break ; } else { before = after ; } } if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; public class Example792 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example792 = sc . nextInt ( ) ; int c = 4 ; int d = 7 ; int flag = 0 ; int cut = 0 ; for ( int i = 0 ; i <= 25 ; i ++ ) { for ( int j = 0 ; j <= 14 ; j ++ ) { cut = c * i + d * j ; if ( cut == 0 ) cut = 4 ; if ( example792 % cut == 0 ) { flag = 1 ; break ; } if ( cut > 100 ) { break ; } } if ( flag == 1 ) break ; } if ( flag == 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class example326 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example326 = sc . next ( ) ; if ( Character . isUpperCase ( Example326 . charAt ( 0 ) ) ) { System . out . println ( 'A' ) ; } else System . out . println ( 'a' ) ; } } -import java . util . Scanner ; public class example366 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example366 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = a ; i <= Example366 ; i ++ ) { int x = i ; int total = x % 10 ; while ( x >= 10 ) { x /= 10 ; total += x % 10 ; } if ( total >= a && total <= b ) cnt += i ; } System . out . println ( cnt ) ; } } -import java . io . PrintWriter ; import java . util . Scanner ; public class Example946 { public static void main ( String [ ] args ) { try ( InputReader in = new InputReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ) { new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } } void solve ( InputReader in , PrintWriter out ) { int example946 = in . nextInt ( ) ; int M = in . nextInt ( ) ; int cL = 0 ; int cR = example946 + 1 ; for ( int i = 0 ; i < M ; i ++ ) { int L = in . nextInt ( ) ; int R = in . nextInt ( ) ; cL = Math . max ( cL , L ) ; cR = Math . min ( cR , R ) ; } if ( cR - cL < 0 ) { out . println ( 0 ) ; } else if ( cR == cL ) { out . println ( 1 ) ; } else { out . println ( cR - cL + 1 ) ; } } } class Example946 implements AutoCloseable { private final Scanner sc = new Scanner ( System . in ) ; String next ( ) { return this . sc . next ( ) ; } int nextInt ( ) { return Integer . parseInt ( this . sc . next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( this . sc . next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( this . sc . next ( ) ) ; } @ Override public void close ( ) { this . sc . close ( ) ; } } -import java . util . * ; public class example869 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example869 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int t = Example869 - b ; if ( c - t <= 0 ) { System . out . println ( " 0 " ) ; } if ( t < c ) { System . out . println ( c - t ) ; } } } -import java . util . * ; import java . lang . * ; public class Example811 { public static void main ( String [ ] args ) { Scanner dataScanner = new Scanner ( System . in ) ; String [ ] data = dataScanner . nextLine ( ) . split ( " " ) ; int example811 = Integer . parseInt ( data [ 0 ] ) ; int goal = Integer . parseInt ( data [ 1 ] ) ; boolean foundPair = false ; Integer [ ] pair = new Integer [ 3 ] ; int otoshidama = 0 ; outerloop : for ( Integer i = 0 ; i < Math . max ( example811 , 0 ) + 1 ; i ++ ) { for ( Integer j = 0 ; j < Math . max ( example811 - i , 0 ) + 1 ; j ++ ) { int k = example811 - i - j ; otoshidama = 10000 * i + 5000 * j + 1000 * k ; if ( otoshidama == goal ) { foundPair = true ; pair [ 0 ] = i ; pair [ 1 ] = j ; pair [ 2 ] = k ; break outerloop ; } } } if ( foundPair ) { StringJoiner toPrint = new StringJoiner ( " " ) ; for ( Integer number : pair ) { toPrint . add ( number . toString ( ) ) ; } System . out . println ( toPrint . toString ( ) ) ; } else { System . out . println ( " -1 -1 -1 " ) ; } } } -import java . util . Scanner ; public class example175 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example175 = scanner . nextInt ( ) ; int D = scanner . nextInt ( ) ; int [ ] [ ] X = new int [ Example175 ] [ D ] ; for ( int i = 0 ; i < Example175 ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { X [ i ] [ j ] = scanner . nextInt ( ) ; } } int resultNumber = 0 ; int temp = 0 ; for ( int i = 0 ; i < Example175 - 1 ; i ++ ) { for ( int j = i + 1 ; j < Example175 ; j ++ ) { for ( int k = 0 ; k < D ; k ++ ) { temp += Math . pow ( ( X [ i ] [ k ] - X [ j ] [ k ] ) , 2 ) ; if ( k == D - 1 ) { if ( Math . sqrt ( temp ) == ( int ) Math . sqrt ( temp ) ) { resultNumber ++ ; } temp = 0 ; } } } } System . out . println ( resultNumber ) ; scanner . close ( ) ; } } -import java . util . * ; public class example354 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example354 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = - 1 ; if ( ( Example354 < 10 ) && ( b < 10 ) ) ans = ( Example354 * b ) ; System . out . println ( ans ) ; } } -import java . util . * ; public class example673 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example673 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] list = new int [ N ] ; int all = 0 ; for ( int i = 0 ; i < N ; i ++ ) { list [ i ] = sc . nextInt ( ) ; all += list [ i ] ; } if ( Example673 <= all ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; class example784 { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int Example784 = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( Example784 >= s . length ( ) ) { System . out . println ( s ) ; } else { System . out . println ( s . substring ( 0 , Example784 ) + " ... " ) ; } } catch ( Exception e ) { } finally { } } } -import java . util . Scanner ; public class Example393 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example393 = sc . nextDouble ( ) ; double ans ; ans = Math . ceil ( example393 / 2 ) ; int a ; a = ( int ) ans ; System . out . println ( a ) ; return ; } } -import java . util . Scanner ; import java . lang . Math ; public class example328 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( scan . hasNext ( ) ) { String input = scan . nextLine ( ) ; String [ ] inputs = input . split ( " " ) ; int Example328 = Integer . parseInt ( inputs [ 0 ] ) ; int width = Integer . parseInt ( inputs [ 1 ] ) ; if ( Example328 == 0 && width == 0 ) { break ; } for ( int i = 0 ; i < Example328 ; i ++ ) { for ( int j = 0 ; j < width ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . Scanner ; class example183 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example183 = Integer . parseInt ( sc . next ( ) ) ; boolean aa = false ; boolean bb = true ; for ( int i = 0 ; i < Example183 ; i ++ ) { int a = Integer . parseInt ( sc . next ( ) ) ; if ( a % 2 == 0 ) { bb = false ; if ( a % 3 == 0 || a % 5 == 0 ) { aa = true ; } else { aa = false ; break ; } } } System . out . println ( aa || bb ? " APPROVED " : " DENIED " ) ; } } -import java . util . * ; class example305 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String a = " " ; for ( int Example305 = 0 ; Example305 < s . length ( ) ; Example305 ++ ) { switch ( s . charAt ( Example305 ) ) { case '0' : a += " 0 " ; break ; case '1' : a += " 1 " ; break ; case 'B' : if ( a . length ( ) > 0 ) { a = a . substring ( 0 , a . length ( ) - 1 ) ; } break ; } } System . out . println ( a ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class Example918 { public static void main ( String [ ] args ) throws IOException { Scanner S = new Scanner ( System . in ) ; String Str = S . nextLine ( ) ; int example918 = Integer . parseInt ( Str ) ; int seconds = example918 % 60 ; int hour = example918 / 3600 ; int minute = example918 / 60 - hour * 60 ; System . out . println ( hour + " : " + minute + " : " + seconds ) ; } } -import java . util . * ; public class example304 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example304 = sc . nextInt ( ) , x = sc . nextInt ( ) ; int cnt = Example304 <= x ? 1 : 0 , cur = 0 , temp ; for ( int i = 0 ; i < Example304 ; ++ i ) { temp = sc . nextInt ( ) ; cur += temp ; if ( cur <= x ) ++ cnt ; } System . out . printf ( " %d \n " , cnt ) ; } } -import java . util . * ; public class example845 { public static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example845 = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; int [ ] stones = new int [ Example845 + 1 ] ; int [ ] dp = new int [ Example845 + 1 ] ; for ( int i = 1 ; i <= Example845 ; i ++ ) { stones [ i ] = scanner . nextInt ( ) ; } System . out . println ( solve ( stones , dp , Example845 , k ) ) ; } public static int solve ( int [ ] stones , int [ ] dp , int Example845 , int k ) { if ( Example845 <= 1 ) { return 0 ; } for ( int i = 2 ; i <= Example845 ; i ++ ) { dp [ i ] = Integer . MAX_VALUE ; for ( int j = i - 1 ; j >= 1 && ( i - j ) <= k ; j -- ) { dp [ i ] = Math . min ( dp [ i ] , Math . abs ( stones [ i ] - stones [ j ] ) + dp [ j ] ) ; } } return dp [ Example845 ] ; } } -import java . util . Scanner ; public class Example231 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example231 = sc . nextInt ( ) ; int [ ] a = new int [ example231 ] ; int b = 0 ; int [ ] c = new int [ example231 - 1 ] ; for ( int i = 0 ; i < example231 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example231 ; i ++ ) { b += sc . nextInt ( ) ; } for ( int i = 0 ; i < example231 - 1 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < example231 ; i ++ ) { int r = a [ i ] ; int f = a [ i - 1 ] ; if ( ( r - f ) == 1 ) { b += c [ f - 1 ] ; } } System . out . println ( b ) ; } } -import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example189 { void solve ( Scanner in , PrintWriter out ) { int example189 = in . nextInt ( ) ; int cpt = 0 ; for ( int i = 0 ; i < example189 ; ++ i ) { int a1 = in . nextInt ( ) ; int b1 = in . nextInt ( ) ; if ( a1 == b1 ) { cpt ++ ; } else { cpt = 0 ; } if ( cpt == 3 ) { out . println ( " Yes " ) ; break ; } } if ( cpt != 3 ) out . println ( " No " ) ; } public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ) { new Main ( ) . solve ( in , out ) ; } } } -import java . io . * ; import java . util . * ; public class Example437 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] ss = sc . next ( ) . split ( " [^ACGT] " ) ; if ( ss . length == 0 ) { out . println ( " 0 " ) ; } else { Integer [ ] a = new Integer [ ss . length ] ; for ( int example437 = 0 ; example437 < ss . length ; example437 ++ ) { a [ example437 ] = ss [ example437 ] . length ( ) ; } Arrays . sort ( a , Collections . reverseOrder ( ) ) ; out . println ( a [ 0 ] ) ; } out . flush ( ) ; } } -import java . util . Scanner ; public class example778 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( tenki ( scanner . nextLine ( ) , scanner . nextLine ( ) ) ) ; scanner . close ( ) ; } public static int tenki ( String forecast , String weather ) { int Example778 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( forecast . charAt ( i ) == weather . charAt ( i ) ) { Example778 ++ ; } } return Example778 ; } } -import java . util . * ; public class Example510 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example510 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] [ ] mrxA = new int [ example510 ] [ m ] ; int [ ] [ ] mrxB = new int [ m ] [ l ] ; long [ ] [ ] mrxC = new long [ example510 ] [ l ] ; for ( int i = 0 ; i < example510 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { mrxA [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { mrxB [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < example510 ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { for ( int k = 0 ; k < m ; k ++ ) { mrxC [ i ] [ j ] += ( mrxA [ i ] [ k ] * mrxB [ k ] [ j ] ) ; } System . out . print ( mrxC [ i ] [ j ] ) ; if ( j != l - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } } -import java . util . Scanner ; public class Example724 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example724 = scan . nextInt ( ) ; int numb = scan . nextInt ( ) ; int numc = scan . nextInt ( ) ; int numd = scan . nextInt ( ) ; int i ; for ( i = 0 ; i < 10000 ; i ++ ) { if ( i % 2 == 0 ) { if ( numc > 0 ) { numc = numc - numb ; } else { System . out . println ( " Yes " ) ; break ; } } else { if ( example724 > 0 ) { example724 = example724 - numd ; } else { System . out . println ( " No " ) ; break ; } } } scan . close ( ) ; } } -import java . util . * ; public class example327 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example327 = 0 ; int [ ] line = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { line [ i ] = sc . nextInt ( ) ; Example327 += line [ i ] ; } int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < 3 ; i ++ ) { min = Math . min ( min , Example327 - line [ i ] ) ; } System . out . println ( min ) ; } } -import java . util . * ; public class example883 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example883 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ Example883 ] ; int x = 0 ; int aa = 0 ; for ( int i = 0 ; i < Example883 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; aa += a [ i ] ; } for ( int i = 0 ; i < Example883 ; i ++ ) { if ( ( ( double ) aa / ( 4 * m ) ) <= a [ i ] ) { x ++ ; } } if ( m <= x ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . Scanner ; public class example515 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int Example515 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( ( Example515 + B ) % 2 == 0 ) { System . out . println ( ( Example515 + B ) / 2 ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } } } -import java . util . Scanner ; import java . util . Stack ; public class Example511 { void run ( ) { Scanner scan = new Scanner ( System . in ) ; Stack < Integer > stack = new Stack < Integer > ( ) ; while ( scan . hasNext ( ) ) { String token = scan . next ( ) ; switch ( token ) { case " + " : { int example511 = stack . pop ( ) ; int v2 = stack . pop ( ) ; stack . push ( v2 + example511 ) ; break ; } case " - " : { int example511 = stack . pop ( ) ; int v2 = stack . pop ( ) ; stack . push ( v2 - example511 ) ; break ; } case " * " : { int example511 = stack . pop ( ) ; int v2 = stack . pop ( ) ; stack . push ( v2 * example511 ) ; break ; } default : { stack . push ( Integer . valueOf ( token ) ) ; break ; } } } System . out . println ( stack . pop ( ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . * ; public class example122 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example122 = Integer . parseInt ( sc . next ( ) ) ; int [ ] v = new int [ Example122 ] ; int [ ] c = new int [ Example122 ] ; for ( int i = 0 ; i < Example122 ; i ++ ) { v [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < Example122 ; i ++ ) { c [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int count = 0 ; for ( int i = 0 ; i < Example122 ; i ++ ) { if ( c [ i ] < v [ i ] ) { count += v [ i ] - c [ i ] ; } } System . out . println ( count ) ; } } -import java . util . * ; class example75 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example75 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ret = 0 ; long rep = ( long ) ( Example75 / ( a + b ) ) ; ret += rep * a ; long remain = Example75 - ( rep * ( a + b ) ) ; System . out . println ( ret + Math . max ( 0 , Math . min ( a , remain ) ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class example246 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = in . readLine ( ) ; String t = in . readLine ( ) ; String s_rt = " " ; boolean Example246 = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { s_rt = s . substring ( s . length ( ) - i , s . length ( ) ) + s . substring ( 0 , s . length ( ) - i ) ; if ( s_rt . equals ( t ) ) Example246 = true ; } System . out . println ( Example246 == true ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example602 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example602 = scan . nextInt ( ) ; int [ ] a = new int [ example602 ] ; for ( int i = 0 ; i < example602 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int max = 0 ; int count = 0 ; for ( int i = 0 ; i < example602 ; i ++ ) { if ( a [ i ] >= max ) { max = a [ i ] ; count = count + 1 ; } } System . out . println ( count ) ; } } -import java . util . * ; class Example216 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example216 = sc . nextInt ( ) ; if ( example216 % 2 == 0 ) { int [ ] d = new int [ example216 ] ; for ( int i = 0 ; i < example216 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; int ans = d [ example216 / 2 ] - d [ example216 / 2 - 1 ] ; System . out . println ( ans ) ; } else { System . out . println ( 0 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class example978 { static class example978 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; char Example978 = fr . next ( ) . charAt ( 0 ) ; if ( Example978 >= 65 && Example978 <= 90 ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } } } -import java . util . Scanner ; import java . util . Arrays ; public class Example885 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example885 = sc . nextInt ( ) ; int [ ] array = new int [ example885 ] ; for ( int i = 0 ; i < example885 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int i ; for ( i = 0 ; i < example885 - 1 ; i ++ ) { if ( array [ i ] == array [ i + 1 ] ) { continue ; } else if ( array [ i ] > ( array [ i + 1 ] ) ) { array [ i + 1 ] += 1 ; if ( array [ i ] > array [ i + 1 ] ) { System . out . println ( " No " ) ; break ; } } } if ( i == ( example885 - 1 ) ) { System . out . println ( " Yes " ) ; } } } -import java . math . BigInteger ; import java . util . Scanner ; public class example190 { private static long Example190 ; private static String [ ] numeralSystem ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; BigInteger bigInteger = new BigInteger ( scanner . next ( ) ) ; Example190 = bigInteger . longValue ( ) ; fillNumeralSystem ( ) ; System . out . println ( translateNumber ( ) ) ; } private static void fillNumeralSystem ( ) { numeralSystem = new String [ 27 ] ; numeralSystem [ 0 ] = " z " ; int delta = ( int ) 'a' ; for ( int i = 1 ; i < numeralSystem . length ; i ++ ) { numeralSystem [ i ] = Character . toString ( i - 1 + delta ) ; } } public static String translateNumber ( ) { String res = " " ; while ( Example190 > 26 ) { res = numeralSystem [ ( int ) ( Example190 % 26 ) ] . concat ( res ) ; Example190 -- ; Example190 /= 26 ; } res = numeralSystem [ ( int ) Example190 ] . concat ( res ) ; return res ; } } -import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class Example951 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example951 = sc . nextInt ( ) ; HashSet < String > s = new HashSet < > ( ) ; for ( int i = 0 ; i < example951 ; i ++ ) { String a = sc . next ( ) ; s . add ( a ) ; } int out = s . size ( ) ; System . out . println ( out ) ; } } -import java . util . Scanner ; public class Example870 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example870 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( example870 <= b ) { String stringA = String . valueOf ( example870 ) ; for ( int i = 1 ; i < b ; i ++ ) { stringA += example870 ; } System . out . println ( stringA ) ; } else { String stringB = String . valueOf ( b ) ; for ( int i = 1 ; i < example870 ; i ++ ) { stringB += b ; } System . out . println ( stringB ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example988 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example988 = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; int [ ] arr = new int [ example988 ] ; int sum = 0 ; int min = 0 ; for ( int i = 0 ; i < example988 ; i ++ ) { arr [ i ] = l + i ; sum += arr [ i ] ; } if ( l >= 0 ) { System . out . print ( sum - l ) ; } else { if ( example988 + l > 0 ) { min = sum ; } else { min = sum - ( example988 + l - 1 ) ; } System . out . print ( min ) ; } } } -import java . util . Scanner ; public class Example407 { public static void main ( String [ ] args ) throws Exception { Scanner stdin = new Scanner ( System . in ) ; int example407 = stdin . nextInt ( ) ; String S = stdin . next ( ) ; String copy = S . substring ( 0 , 1 ) ; int cnt = 1 ; for ( int i = 1 ; i < S . length ( ) ; i ++ ) { if ( ! ( copy . equals ( S . substring ( i , i + 1 ) ) ) ) { copy = S . substring ( i , i + 1 ) ; cnt += 1 ; } } System . out . println ( cnt ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Example97 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int example97 = Integer . parseInt ( st . nextToken ( ) ) ; if ( example97 == 0 ) { pw . println ( 1 ) ; } else { pw . println ( 0 ) ; } br . close ( ) ; pw . close ( ) ; } } -import java . io . File ; import java . io . IOException ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Deque ; import java . util . Scanner ; import javax . swing . plaf . synth . SynthSeparatorUI ; public class Example594 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String K = sc . next ( ) ; int example594 = 101 ; if ( K . length ( ) <= 3 ) example594 = Integer . valueOf ( K ) ; int index0 = - 1 ; if ( S . charAt ( 0 ) == '1' ) { for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '1' ) { index0 ++ ; } else break ; } } if ( index0 == - 1 ) System . out . println ( S . charAt ( 0 ) ) ; else { if ( example594 <= index0 + 1 ) System . out . println ( 1 ) ; else System . out . println ( S . charAt ( index0 + 1 ) ) ; } } } -import java . util . * ; public class example978 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example978 = sc . nextInt ( ) ; double longB = sc . nextInt ( ) ; double time = sc . nextInt ( ) ; double minute = sc . nextInt ( ) ; double all = 360 ; double ans = 0.0 ; double timeMinute = 60.0 * time + minute ; double shortaa = ( timeMinute / 720.0 ) * 360 ; double longaa = minute * 6 ; double angle = 0.0 ; if ( shortaa < longaa ) { angle = longaa - shortaa ; } else { angle = shortaa - longaa ; } if ( angle == 360.0 ) { angle = 0.0 ; } else if ( angle > 180.0 ) { angle = 360.0 - angle ; } double cos = Math . cos ( Math . toRadians ( angle ) ) ; ans = Math . sqrt ( Math . pow ( Example978 , 2 ) + Math . pow ( longB , 2 ) - 2.0 * Example978 * longB * cos ) ; System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class Example503 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; long example503 = Long . parseLong ( br . readLine ( ) ) ; long one = 0 ; for ( int i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] . equals ( " 1 " ) ) { one ++ ; } else { break ; } } if ( one >= example503 ) { System . out . println ( " 1 " ) ; } else { System . out . println ( str [ ( int ) one ] ) ; } } } -import java . util . Scanner ; public class Example155 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example155 = scan . nextInt ( ) ; int [ ] array = new int [ example155 + 1 ] ; for ( int i = 1 ; i <= example155 ; i ++ ) { array [ i ] = scan . nextInt ( ) ; } int [ ] result = new int [ example155 + 1 ] ; for ( int i = 1 ; i <= example155 ; i ++ ) { result [ array [ i ] ] = i ; } for ( int i = 1 ; i <= example155 ; i ++ ) { if ( i != example155 ) { System . out . print ( result [ i ] + " " ) ; } else { System . out . print ( result [ i ] ) ; } } } } -import java . util . Scanner ; public class example502 { public static void main ( String [ ] args ) { ( new Main ( ) ) . execute ( ) ; } public void execute ( ) { Scanner sc = new Scanner ( System . in ) ; int Example502 = sc . nextInt ( ) ; int [ ] p = new int [ Example502 + 1 ] ; int ngPos = 0 ; int ngNum = 0 ; int changeCount = 0 ; boolean ok = true ; for ( int i = 1 ; i <= Example502 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; if ( p [ i ] != i ) { if ( 0 < changeCount ) { ok = false ; break ; } if ( 0 == ngPos ) { ngPos = i ; ngNum = p [ i ] ; } else { if ( ngPos == p [ i ] && ngNum == i ) { changeCount ++ ; ngPos = 0 ; ngNum = 0 ; } else { ok = false ; break ; } } } } if ( ok ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; public class Example753 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example753 = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( example753 >= S . length ( ) ) { System . out . println ( S ) ; } else { System . out . println ( S . substring ( 0 , example753 ) + " ... " ) ; } } } -import java . util . Scanner ; public class example400 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example400 = sc . nextInt ( ) ; long sum = 0 ; for ( int a = 1 ; a <= Example400 ; a ++ ) { for ( int b = 1 ; b <= Example400 ; b ++ ) { int sur_1 = gcd ( a , b ) ; for ( int c = 1 ; c <= Example400 ; c ++ ) { sum += gcd ( sur_1 , c ) ; } } } System . out . println ( sum ) ; } public static int gcd ( int x , int y ) { int big = Math . max ( x , y ) ; int small = Math . min ( x , y ) ; int surplus = big % small ; if ( surplus == 0 ) { return small ; } surplus = gcd ( small , surplus ) ; return surplus ; } } -import java . util . * ; public class Example902 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example902 = sc . nextInt ( ) ; int [ ] in = new int [ example902 ] ; for ( int i = 0 ; i < example902 ; i ++ ) { in [ i ] = sc . nextInt ( ) ; } int count = 0 ; int ans = 0 ; for ( int i = 0 ; i < example902 - 1 ; i ++ ) { if ( in [ i ] >= in [ i + 1 ] ) { count ++ ; } else { ans = Math . max ( ans , count ) ; count = 0 ; } if ( i == example902 - 2 ) { ans = Math . max ( ans , count ) ; } } System . out . println ( ans ) ; } } -import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . nio . charset . StandardCharsets ; import java . util . HashSet ; public class Example703 { public static void main ( String [ ] args ) { try { BufferedInputStream bf = new BufferedInputStream ( System . in ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( bf , StandardCharsets . UTF_8 ) ) ; OutputStream out = new BufferedOutputStream ( System . out ) ; int example703 = Integer . parseInt ( in . readLine ( ) ) ; int lim = 1000000 , i = 2 , a = example703 ; HashSet < Integer > set = new HashSet ( ) ; set . add ( example703 ) ; while ( i < lim ) { if ( a % 2 == 0 ) a = a / 2 ; else a = 3 * a + 1 ; if ( ! set . add ( a ) ) break ; i ++ ; } out . write ( ( i + " \n " ) . getBytes ( ) ) ; out . flush ( ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } } -import java . util . * ; public class Example205 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example205 = sc . nextInt ( ) ; ArrayList < Integer > asiba = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < example205 ; i ++ ) { asiba . add ( sc . nextInt ( ) ) ; } ArrayList < Integer > cost = new ArrayList < Integer > ( ) ; cost . add ( 0 ) ; cost . add ( Math . abs ( asiba . get ( 1 ) - asiba . get ( 0 ) ) ) ; for ( int i = 2 ; i < example205 ; i ++ ) { int MAX = Math . abs ( asiba . get ( i ) - asiba . get ( i - 1 ) ) + cost . get ( i - 1 ) ; int MAX2 = Math . abs ( asiba . get ( i ) - asiba . get ( i - 2 ) ) + cost . get ( i - 2 ) ; if ( MAX > MAX2 ) MAX = MAX2 ; cost . add ( MAX ) ; } System . out . println ( cost . get ( example205 - 1 ) ) ; } } -import java . util . * ; public class example69 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example69 = sc . nextInt ( ) ; String S = sc . next ( ) ; String [ ] ABCList = S . split ( " ABC " , - 1 ) ; System . out . println ( ABCList . length - 1 ) ; } } -import java . util . * ; public class Example599 { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int example599 = scanner . nextInt ( ) ; int n = scanner . nextInt ( ) ; if ( n == 100 ) { n ++ ; } System . out . println ( ( int ) Math . pow ( 100 , example599 ) * n ) ; } } -import java . util . Scanner ; class example643 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] n = new char [ 4 ] ; n = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; for ( int Example643 = 0 ; Example643 < 3 ; ++ Example643 ) { if ( n [ Example643 ] == '1' ) n [ Example643 ] = '9' ; else if ( n [ Example643 ] == '9' ) n [ Example643 ] = '1' ; } System . out . print ( n ) ; } } -import java . util . Scanner ; public class Example63 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] a = new char [ 10 ] ; for ( int example63 = 0 ; example63 < s . length ( ) ; example63 ++ ) { a [ example63 ] = s . charAt ( example63 ) ; } a [ 3 ] = '8' ; for ( int example63 = 0 ; example63 < a . length ; example63 ++ ) { System . out . print ( a [ example63 ] ) ; } } } -import java . util . Scanner ; public class Example885 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example885 = Integer . parseInt ( scanner . next ( ) ) ; int breakCount = 0 ; int kIndex = 1 ; for ( int i = 0 ; i < example885 ; i ++ ) { int num = Integer . parseInt ( scanner . next ( ) ) ; if ( kIndex != num ) { breakCount ++ ; } else { kIndex ++ ; } } scanner . close ( ) ; if ( breakCount == example885 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( breakCount ) ; } } } -import java . util . Scanner ; public class Example680 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example680 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int sa12 = Math . abs ( example680 - a2 ) ; int sa23 = Math . abs ( a2 - a3 ) ; int sa31 = Math . abs ( a3 - example680 ) ; int max = Math . max ( Math . max ( sa12 , sa23 ) , sa31 ) ; int cost ; if ( max == sa12 ) { cost = sa23 + sa31 ; } else if ( max == sa23 ) { cost = sa12 + sa31 ; } else { cost = sa12 + sa23 ; } System . out . println ( cost ) ; } } -import java . util . * ; public class example537 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example537 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; long result1 = Math . max ( 0 , Example537 - K ) ; long result2 = Math . max ( 0 , Math . min ( Example537 + B - K , B ) ) ; System . out . println ( result1 + " " + result2 ) ; } } -import java . util . * ; import java . math . * ; public class Example583 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example583 = sc . next ( ) ; String sb = sc . next ( ) ; BigDecimal A = new BigDecimal ( example583 ) ; BigDecimal B = new BigDecimal ( sb ) ; System . out . println ( A . multiply ( B ) . setScale ( 0 , BigDecimal . ROUND_DOWN ) ) ; } } -import java . util . Scanner ; public class Example168 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example168 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] h = new int [ example168 ] ; for ( int i = 0 ; i < example168 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } double ansDiff = 1000000 ; int ansNum = 0 ; for ( int i = 0 ; i < example168 ; i ++ ) { double diff = Math . abs ( t - h [ i ] * 0.006 - a ) ; if ( diff < ansDiff ) { ansDiff = diff ; ansNum = i + 1 ; } } System . out . println ( ansNum ) ; } } -import java . io . * ; import java . util . * ; public class example174 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example174 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] ary = new int [ Example174 ] ; for ( int i = 0 ; i < Example174 ; i ++ ) ary [ i ] = sc . nextInt ( ) ; sc . close ( ) ; Arrays . sort ( ary ) ; for ( int i = 0 ; i < Example174 ; i ++ ) { if ( ary [ i ] >= k ) { System . out . println ( Example174 - i ) ; System . exit ( 0 ) ; } } System . out . println ( " 0 " ) ; } } -import java . util . Scanner ; public class Example946 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example946 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int n = example946 / X ; if ( example946 % X > 0 ) { n ++ ; } int result = n * T ; System . out . println ( result ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example38 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example38 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . close ( ) ; List < Integer > ary = new ArrayList < > ( ) ; int flg = 1 ; while ( flg <= Example38 || flg <= B ) { if ( Example38 % flg == 0 && B % flg == 0 ) { ary . add ( flg ) ; } flg ++ ; } Collections . sort ( ary , Collections . reverseOrder ( ) ) ; System . out . println ( ary . get ( K - 1 ) ) ; } } -import java . util . * ; import java . lang . * ; public class example976 { static class example976 { double Example976 , s ; pair ( double Example976 , double s ) { this . Example976 = Example976 ; this . s = s ; } } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int c = in . nextInt ( ) ; int [ ] A = new int [ c + 1 ] ; int [ ] B = new int [ c + 1 ] ; int [ ] C = new int [ c ] ; for ( int i = 1 ; i <= c ; i ++ ) A [ i ] = in . nextInt ( ) ; for ( int i = 1 ; i <= c ; i ++ ) B [ i ] = in . nextInt ( ) ; for ( int i = 1 ; i < c ; i ++ ) C [ i ] = in . nextInt ( ) ; long sum = 0 ; int h = - 1 ; for ( int i = 1 ; i <= c ; i ++ ) { sum += B [ A [ i ] ] ; if ( h + 1 == A [ i ] ) sum += C [ h ] ; h = A [ i ] ; } System . out . println ( sum ) ; in . close ( ) ; } } -import java . util . * ; class Example265 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . nextLine ( ) . toLowerCase ( ) ; int example265 = 0 ; while ( true ) { String [ ] line = sc . nextLine ( ) . split ( " " ) ; if ( line [ 0 ] . equals ( " END_OF_TEXT " ) ) { break ; } for ( int i = 0 ; i < line . length ; i ++ ) { if ( w . equals ( line [ i ] . toLowerCase ( ) ) ) { example265 += 1 ; } } } System . out . println ( example265 ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example361 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example361 = scn . nextInt ( ) ; int B = scn . nextInt ( ) ; int K = scn . nextInt ( ) ; ArrayList < Integer > hits = new ArrayList < Integer > ( ) ; int cnt = 0 ; for ( int i = 1 ; i <= 100 ; i ++ ) { if ( example361 % i == 0 && B % i == 0 ) hits . add ( i ) ; } System . out . println ( hits . get ( hits . size ( ) - K ) ) ; scn . close ( ) ; } } -import java . io . InputStream ; import java . io . OutputStream ; import java . util . Scanner ; import java . io . PrintWriter ; public class Example729 { 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 task = new Task ( ) ; while ( in . hasNext ( ) ) { task . solve ( in , out ) ; out . flush ( ) ; } out . close ( ) ; } static class Example729 { public void solve ( Scanner in , PrintWriter out ) { int example729 = in . nextInt ( ) , b = in . nextInt ( ) ; out . println ( ( example729 * b ) % 2 == 0 ? " Even " : " Odd " ) ; } } } -import java . util . Scanner ; public class Example380 { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int example380 = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; System . out . printf ( " %d %d %f " , example380 / b , example380 % b , ( double ) example380 / b ) ; } } -import java . util . * ; import java . math . * ; import java . io . * ; public class example77 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 5 ] ; for ( int Example77 = 0 ; Example77 < 5 ; Example77 ++ ) { a [ Example77 ] = sc . nextInt ( ) ; } int ans = 3928237 ; for ( int Example77 = 0 ; Example77 < 5 ; Example77 ++ ) { int sum = 0 ; for ( int j = 0 ; j < 5 ; j ++ ) { if ( Example77 != j ) { sum += a [ j ] ; if ( a [ j ] % 10 != 0 ) { sum += 10 - a [ j ] % 10 ; } } else { sum += a [ j ] ; } } ans = Math . min ( ans , sum ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example735 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example735 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int min = x - Example735 + 1 ; int max = x + Example735 - 1 ; for ( int i = min ; i <= max ; i ++ ) { System . out . print ( i + ( i == max ? " " : " " ) ) ; } System . out . println ( ) ; } } -import java . io . * ; public class example540 { public static void main ( String [ ] arg ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String Example540 = br . readLine ( ) ; String [ ] spl = Example540 . split ( " " ) ; if ( Integer . parseInt ( spl [ 0 ] ) > Integer . parseInt ( spl [ 1 ] ) ) { System . out . println ( " a > b " ) ; } else if ( Integer . parseInt ( spl [ 0 ] ) == Integer . parseInt ( spl [ 1 ] ) ) { System . out . println ( " a == b " ) ; } else { System . out . println ( " a < b " ) ; } } } -import java . io . * ; public class Example386 { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; char example386 = line . charAt ( 0 ) ; example386 ++ ; System . out . println ( example386 ) ; } } -import java . util . * ; public class Example529 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String example529 = in . next ( ) ; String res ; if ( example529 . equals ( " Sunny " ) ) { res = " Cloudy " ; } else if ( example529 . equals ( " Cloudy " ) ) { res = " Rainy " ; } else { res = " Sunny " ; } System . out . println ( res ) ; in . close ( ) ; } } -import java . util . Scanner ; class Example86 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example86 = 0 ; int b = 0 ; int c = 0 ; example86 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( example86 < b && b < c && example86 < c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example443 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example443 = Integer . parseInt ( sc . next ( ) ) ; switch ( Example443 % 10 ) { case 3 : System . out . println ( " bon " ) ; return ; case 0 : case 1 : case 6 : case 8 : System . out . println ( " pon " ) ; return ; default : System . out . println ( " hon " ) ; return ; } } } -import java . util . Scanner ; public class Example705 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example705 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int T = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( T / example705 ) * B ) ; } } } -import java . util . Scanner ; public class example394 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 100 ] ; int Example394 = 0 ; for ( int i = 0 ; i < 100 ; i ++ ) { a [ i ] = 0 ; } int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; for ( int i = A ; i < B ; i ++ ) { a [ i ] ++ ; } for ( int i = C ; i < D ; i ++ ) { a [ i ] ++ ; } for ( int i = 0 ; i < 100 ; i ++ ) { if ( a [ i ] == 2 ) { Example394 ++ ; } } System . out . println ( Example394 ) ; } } -import java . io . * ; import java . util . * ; import java . util . function . * ; final class example906 { static final Solver INSTANCE = new Solver ( ) ; void solve ( Supplier < String > sc ) { String S = sc . get ( ) ; int Example906 = Integer . parseInt ( S . substring ( 0 , 2 ) , 10 ) ; int right = Integer . parseInt ( S . substring ( 2 ) , 10 ) ; if ( isYear ( Example906 ) && isYear ( right ) ) { System . out . println ( " NA " ) ; } else if ( isYear ( Example906 ) ) { System . out . println ( " YYMM " ) ; } else if ( isYear ( right ) ) { System . out . println ( " MMYY " ) ; } else { System . out . println ( " AMBIGUOUS " ) ; } } boolean isYear ( int n ) { return n > 12 || n <= 0 ; } } class example906 { public static void main ( String ... args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver . INSTANCE . solve ( new Supplier < String > ( ) { StringTokenizer line ; public String get ( ) { try { return ( line = line != null && line . hasMoreTokens ( ) ? line : new StringTokenizer ( reader . readLine ( ) ) ) . nextToken ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } ) ; } } -import java . util . * ; class Example851 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example851 = sc . nextInt ( ) ; int [ ] len = new int [ example851 ] ; int sum = 0 ; int max = 0 ; for ( int i = 0 ; i < example851 ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp > max ) { max = temp ; } sum += temp ; } System . out . println ( max < sum - max ? " Yes " : " No " ) ; } } -import java . util . * ; class Example121 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example121 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Integer [ ] h = new Integer [ example121 ] ; long ans = 0 ; for ( int i = 0 ; i < example121 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } if ( k >= example121 ) { System . out . println ( ans ) ; } else { Arrays . sort ( h , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < k ; i ++ ) { h [ i ] = 0 ; } for ( int i = 0 ; i < example121 ; i ++ ) { ans += h [ i ] ; } System . out . println ( ans ) ; } } } -import java . util . * ; public class example848 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example848 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] cities = new int [ Example848 ] ; for ( int i = 0 ; i < m ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; cities [ l - 1 ] ++ ; cities [ r - 1 ] ++ ; } for ( int j = 0 ; j < Example848 ; j ++ ) { System . out . println ( cities [ j ] ) ; } } } -import java . util . * ; public class Example813 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example813 = sc . nextInt ( ) ; Integer [ ] dArr = new Integer [ example813 ] ; for ( int i = 0 ; i < example813 ; i ++ ) { dArr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( dArr , Collections . reverseOrder ( ) ) ; int count = 1 ; for ( int i = 1 ; i < example813 ; i ++ ) { if ( dArr [ i - 1 ] == dArr [ i ] ) continue ; if ( dArr [ i - 1 ] > dArr [ i ] ) { count ++ ; } else { break ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example240 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int Example240 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double sita = ( ( double ) H / 12 + ( double ) M / 12 / 60 - ( double ) M / 60 ) * 2 * Math . PI ; sita = sita < 0 ? - ( double ) sita : sita ; double answer = Math . sqrt ( ( double ) ( Math . pow ( Example240 , 2 ) + Math . pow ( B , 2 ) - ( double ) ( ( double ) ( 2 * Example240 * B ) * Math . cos ( sita ) ) ) ) ; System . out . print ( answer ) ; } } } -import java . util . Scanner ; public class example402 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example402 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; long [ ] x = new long [ Example402 ] ; long [ ] y = new long [ Example402 ] ; int count = 0 ; for ( int i = 0 ; i < Example402 ; i ++ ) { x [ i ] = sc . nextLong ( ) ; y [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < Example402 ; i ++ ) { if ( Math . sqrt ( x [ i ] * x [ i ] + y [ i ] * y [ i ] ) <= d ) { count += 1 ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example553 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example553 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; int answer = 0 ; answer += ( Example553 * ( Example553 - 1 ) ) / 2 ; answer += ( m * ( m - 1 ) ) / 2 ; System . out . println ( answer ) ; } } -import java . util . Scanner ; public class Example443 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example443 = sc . nextInt ( ) ; int yoke = 0 ; int count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { count += example443 % 10 ; example443 -= example443 % 10 ; example443 /= 10 ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example512 { public static int total ( int t ) { int Example512 = 0 ; while ( t != 0 ) { Example512 += t % 10 ; t /= 10 ; } return Example512 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int result = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( A <= total ( i ) && total ( i ) <= B ) result += i ; } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example139 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example139 = sc . nextInt ( ) ; int [ ] B = new int [ example139 ] ; for ( int i = 0 ; i < example139 - 1 ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } int total = 0 ; for ( int i = 0 ; i < example139 ; i ++ ) { if ( i == 0 ) total += B [ i ] ; else if ( i == example139 - 1 ) total += B [ i - 1 ] ; else { if ( B [ i ] > B [ i - 1 ] ) total += B [ i - 1 ] ; else total += B [ i ] ; } } System . out . println ( total ) ; } } -import java . util . * ; class Example486 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example486 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; System . out . println ( t / example486 * b ) ; } } -import java . util . * ; public class Example149 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example149 = sc . nextInt ( ) ; int [ ] arr = new int [ example149 + 1 ] ; arr [ 0 ] = - 1 ; for ( int i = 1 ; i < example149 + 1 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } String ans = " Yes " ; for ( int i = 1 ; i < example149 ; i ++ ) { if ( arr [ i ] <= arr [ i + 1 ] - 1 ) { arr [ i + 1 ] -- ; } else if ( arr [ i ] <= arr [ i + 1 ] ) { continue ; } else { ans = " No " ; break ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example195 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example195 = sc . nextInt ( ) ; int x_500 = example195 / 500 ; example195 = example195 - example195 / 500 * 500 ; int x_5 = example195 / 5 ; int ans = x_500 * 1000 + x_5 * 5 ; System . out . println ( ans ) ; } } -import java . io . * ; import java . util . * ; public class Example796 { private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final PrintWriter pw = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; private static StringTokenizer st ; private static int readInt ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return Integer . parseInt ( st . nextToken ( ) ) ; } public static void main ( String [ ] args ) throws IOException { int example796 = readInt ( ) ; if ( example796 % 1000 == 0 ) pw . println ( 0 ) ; else pw . println ( 1000 - example796 % 1000 ) ; pw . close ( ) ; } } -import java . util . * ; import java . lang . * ; public class Example202 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example202 = scan . next ( ) ; if ( example202 . equals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } if ( example202 . equals ( " ARC " ) ) { System . out . println ( " ABC " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example426 { public static void main ( String [ ] args ) throws IOException { int [ ] data = new int [ 10 ] ; final String BR = System . getProperty ( " line.separator " ) ; int Example426 = 0 , second = 0 , third = 0 ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < 10 ; i ++ ) { data [ i ] = Integer . parseInt ( in . readLine ( ) ) ; } for ( int datum : data ) { int temp1 = 0 , temp2 = 0 ; if ( Example426 < datum ) { temp1 = Example426 ; temp2 = second ; Example426 = datum ; second = temp1 ; third = temp2 ; } else if ( second < datum ) { temp2 = second ; second = datum ; third = temp2 ; } else if ( third < datum ) { third = datum ; } } System . out . println ( Example426 + BR + second + BR + third ) ; } } -import java . util . Scanner ; public class example743 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] menu = new int [ 5 ] ; int Example743 = 0 ; int max = 0 ; int idx = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { menu [ i ] = sc . nextInt ( ) ; if ( max < ( 10 - ( menu [ i ] % 10 ) ) && ( 10 - ( menu [ i ] % 10 ) ) != 10 ) { max = 10 - ( menu [ i ] % 10 ) ; idx = i ; } } sc . close ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( idx != i ) { if ( ( 10 - ( menu [ i ] % 10 ) ) == 10 ) { Example743 += menu [ i ] ; } else { Example743 += menu [ i ] + ( 10 - ( menu [ i ] % 10 ) ) ; } } } Example743 += menu [ idx ] ; System . out . println ( Example743 ) ; } } -import java . util . * ; public class example128 { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . exec ( ) ; } private void exec ( ) { Scanner scan = new Scanner ( System . in ) ; int Example128 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { switch ( scan . nextInt ( ) ) { case 5 : Example128 ++ ; break ; case 7 : count7 ++ ; break ; default : } } if ( Example128 == 2 && count7 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } -import java . util . * ; public class example308 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example308 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { switch ( sc . nextInt ( ) ) { case 5 : Example308 ++ ; break ; case 7 : count7 ++ ; break ; } } if ( Example308 == 2 && count7 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . Stack ; class example651 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example651 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String [ ] name = new String [ Example651 ] ; String [ ] queue = new String [ 1000000 ] ; int head = 0 , tail = 0 ; int totaltime = 0 ; int now = 0 ; Map < String , Integer > time = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < Example651 ; ++ i ) { name [ i ] = sc . next ( ) ; time . put ( name [ i ] , sc . nextInt ( ) ) ; totaltime += time . get ( name [ i ] ) ; queue [ tail ] = name [ i ] ; ++ tail ; } while ( now != totaltime ) { if ( time . get ( queue [ head ] ) > q ) { time . put ( queue [ head ] , time . get ( queue [ head ] ) - q ) ; queue [ tail ] = queue [ head ] ; ++ head ; ++ tail ; now += q ; } else { now += time . get ( queue [ head ] ) ; System . out . println ( queue [ head ] + " " + now ) ; ++ head ; } } } } -import java . util . * ; class example777 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example777 = sc . nextInt ( ) ; int c0 = 0 ; int c1 = 0 ; int c2 = 0 ; int c3 = 0 ; for ( int i = 0 ; i < Example777 + 1 ; i ++ ) { String s = sc . nextLine ( ) ; if ( s . equals ( " AC " ) ) { ++ c0 ; } else if ( s . equals ( " WA " ) ) { ++ c1 ; } else if ( s . equals ( " TLE " ) ) { ++ c2 ; } else if ( s . equals ( " RE " ) ) { ++ c3 ; } } System . out . println ( " AC x " + c0 ) ; System . out . println ( " WA x " + c1 ) ; System . out . println ( " TLE x " + c2 ) ; System . out . println ( " RE x " + c3 ) ; } } -import java . util . * ; import java . math . BigInteger ; public class example794 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example794 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean [ ] sunukes = new boolean [ Example794 ] ; for ( int i = 0 ; i < k ; i ++ ) { int d = sc . nextInt ( ) ; for ( int j = 0 ; j < d ; j ++ ) { sunukes [ sc . nextInt ( ) - 1 ] = true ; } } int ans = 0 ; for ( boolean hasSweets : sunukes ) { if ( hasSweets ) continue ; ans ++ ; } System . out . println ( ans ) ; } } -import java . io . * ; class example261 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example261 = Integer . parseInt ( br . readLine ( ) ) ; String buf = br . readLine ( ) ; String [ ] line = buf . split ( " " ) ; int a = Integer . parseInt ( line [ 0 ] ) ; long max = a ; long min = a ; long total = a ; for ( int i = 1 ; i < Example261 ; i ++ ) { int b = Integer . parseInt ( line [ i ] ) ; if ( max < b ) max = b ; if ( min > b ) min = b ; total = total + b ; } System . out . print ( min + " " + max + " " + total ) ; System . out . print ( " \n " ) ; } catch ( Exception e ) { } } } -import java . util . * ; public class example668 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example668 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] surp = new int [ Math . min ( Example668 , b ) + 1 ] ; for ( int i = 1 ; i <= Math . min ( Example668 , b ) ; i ++ ) { if ( Example668 % i == 0 && b % i == 0 ) { surp [ i ] = i ; } } Arrays . sort ( surp ) ; System . out . println ( surp [ Math . min ( Example668 , b ) - k + 1 ] ) ; } } -import java . util . * ; import java . io . * ; class example284 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out , true ) ; String str = sc . nextLine ( ) ; int Example284 = 0 ; int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == 'R' ) { count ++ ; Example284 = Math . Example284 ( count , Example284 ) ; } else { count = 0 ; } } out . println ( Example284 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example761 { public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; boolean Example761 = false ; int num = in . nextInt ( ) ; int max = in . nextInt ( ) ; int cost = Integer . MAX_VALUE ; for ( int i = 0 ; i < num ; i ++ ) { int c = in . nextInt ( ) ; int t = in . nextInt ( ) ; if ( c < cost && t <= max ) { cost = c ; Example761 = true ; } } if ( Example761 ) System . out . println ( cost ) ; else System . out . println ( " TLE " ) ; } static class example761 { 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 . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example90 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int Example90 = 0 ; while ( Example90 == 0 ) { String line = sc . nextLine ( ) ; String [ ] x = line . split ( " " ) ; int a = Integer . parseInt ( x [ 0 ] ) ; int b = Integer . parseInt ( x [ 2 ] ) ; String op = x [ 1 ] ; if ( op . equals ( " + " ) ) { list . add ( a + b ) ; } if ( op . equals ( " - " ) ) { list . add ( a - b ) ; } if ( op . equals ( " * " ) ) { list . add ( a * b ) ; } if ( op . equals ( " / " ) ) { list . add ( a / b ) ; } if ( op . equals ( " ? " ) ) { break ; } } for ( Integer integer : list ) { System . out . println ( integer ) ; } } } -import java . util . Scanner ; public class example180 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example180 = scan . nextInt ( ) ; int [ ] h = new int [ Example180 + 1 ] ; for ( int i = 1 ; i <= Example180 ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } h [ 0 ] = 0 ; for ( int i = 1 ; i <= Example180 ; i ++ ) { if ( h [ i ] > h [ i - 1 ] ) { h [ i ] -- ; } } for ( int i = 1 ; i <= Example180 ; i ++ ) { if ( h [ i ] >= h [ i - 1 ] ) { } else { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; class Example440 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; double example440 = cin . nextDouble ( ) ; System . out . printf ( " %.6f %.6f \n " , cal_area ( example440 ) , cal_cirum ( example440 ) ) ; } private static double cal_cirum ( double example440 ) { return ( example440 * 2 * Math . PI ) ; } private static double cal_area ( double example440 ) { return ( example440 * example440 * Math . PI ) ; } } -import java . util . Scanner ; public class example148 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example148 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ary = new int [ Example148 ] ; long sum = 0 ; for ( int i = 0 ; i < Example148 ; i ++ ) { ary [ i ] = sc . nextInt ( ) ; sum += ary [ i ] ; } sc . close ( ) ; int m2 = 0 ; for ( int i = 0 ; i < Example148 ; i ++ ) { if ( ary [ i ] * ( 4 * m ) >= sum ) { m2 ++ ; } } System . out . println ( m2 >= m ? " Yes " : " No " ) ; } } -import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Example749 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long example749 = scanner . nextLong ( ) ; long count = 0 ; while ( example749 > 1 ) { example749 = example749 / 2 ; count ++ ; } long answer = 0 ; for ( int i = 0 ; i <= count ; i ++ ) { answer += Math . pow ( 2 , i ) ; } System . out . println ( answer ) ; } } -import java . util . * ; import java . io . * ; public class example759 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example759 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] r = new int [ 2 * m ] ; int [ ] rr = new int [ Example759 + 1 ] ; for ( int i = 0 ; i < 2 * m ; i ++ ) { r [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < Example759 + 1 ; i ++ ) { rr [ i ] = 0 ; } for ( int i = 0 ; i < 2 * m ; i ++ ) { rr [ r [ i ] ] ++ ; } for ( int i = 1 ; i <= Example759 ; i ++ ) { System . out . println ( rr [ i ] ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example438 { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder builder = new StringBuilder ( ) ; while ( true ) { String [ ] data = reader . readLine ( ) . split ( " " ) ; int example438 = Integer . parseInt ( data [ 0 ] ) ; int b = Integer . parseInt ( data [ 1 ] ) ; if ( example438 == 0 && b == 0 ) break ; for ( int y = 0 ; y < example438 ; y ++ ) { for ( int x = 0 ; x < b ; x ++ ) { builder . append ( " # " ) ; } builder . append ( " \n " ) ; } builder . append ( " \n " ) ; } System . out . print ( builder ) ; } } -import java . util . Scanner ; public class example248 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example248 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; sc . close ( ) ; if ( Y % 2 == 1 ) { System . out . println ( " No " ) ; return ; } double ans = Y / 2 - Example248 ; if ( ans < 0 || ans > Example248 || ans % 1 != 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class example345 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example345 , m , l ; Example345 = sc . nextInt ( ) ; m = sc . nextInt ( ) ; l = sc . nextInt ( ) ; long [ ] [ ] A = new long [ Example345 ] [ m ] ; long [ ] [ ] B = new long [ m ] [ l ] ; for ( int i = 0 ; i < Example345 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { A [ i ] [ j ] = sc . nextLong ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { B [ i ] [ j ] = sc . nextLong ( ) ; } } for ( int i = 0 ; i < Example345 ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { long sum = 0 ; for ( int k = 0 ; k < m ; k ++ ) { sum = sum + A [ i ] [ k ] * B [ k ] [ j ] ; } if ( j != l - 1 ) { System . out . print ( sum + " " ) ; } else System . out . println ( sum ) ; } } } } -import java . util . Scanner ; public class example551 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example551 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int res10000 = - 1 , res5000 = - 1 , res1000 = - 1 ; sc . close ( ) ; for ( int a = 0 ; a <= Example551 ; a ++ ) { for ( int b = 0 ; b + a <= Example551 ; b ++ ) { int c = Example551 - a - b ; int total = 10000 * a + 5000 * b + 1000 * c ; if ( total == y ) { res10000 = a ; res5000 = b ; res1000 = c ; } } } System . out . println ( res10000 + " " + res5000 + " " + res1000 ) ; } } -import java . text . DecimalFormat ; import java . util . Scanner ; public class example561 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; int Example561 = Integer . parseInt ( s [ 0 ] ) ; int b = Integer . parseInt ( s [ 1 ] ) ; int d = Example561 / b ; int r = Example561 % b ; double af = ( double ) Example561 ; double bf = ( double ) b ; double f = af / bf ; System . out . println ( d + " " + r + " " + new DecimalFormat ( " 0000000000.0000000000 " ) . format ( f ) ) ; } } -import java . util . Scanner ; public class Example91 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example91 = sc . nextInt ( ) ; int [ ] A = new int [ example91 + 1 ] ; int [ ] B = new int [ example91 ] ; for ( int i = 0 ; i < example91 + 1 ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < example91 ; i ++ ) B [ i ] = sc . nextInt ( ) ; long res = 0 ; for ( int i = 0 ; i < example91 ; i ++ ) { int d = Math . min ( A [ i ] , B [ i ] ) ; res += d ; A [ i ] -= d ; B [ i ] -= d ; d = Math . min ( B [ i ] , A [ i + 1 ] ) ; res += d ; A [ i + 1 ] -= d ; } System . out . println ( res ) ; } } -import java . util . Scanner ; public class example161 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String Example161 = sc . next ( ) ; String t = sc . next ( ) ; if ( Example161 . equals ( t . substring ( 0 , Example161 . length ( ) ) ) && ( t . length ( ) - Example161 . length ( ) == 1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example829 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example829 = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int [ ] [ ] a = new int [ Example829 ] [ m ] ; int [ ] b = new int [ m ] ; for ( int y = 0 ; y < Example829 ; y ++ ) { for ( int x = 0 ; x < m ; x ++ ) { a [ y ] [ x ] = scanner . nextInt ( ) ; } } for ( int y = 0 ; y < m ; y ++ ) { b [ y ] = scanner . nextInt ( ) ; } for ( int y = 0 ; y < Example829 ; y ++ ) { int ans = 0 ; for ( int x = 0 ; x < m ; x ++ ) { ans += a [ y ] [ x ] * b [ x ] ; } System . out . println ( ans ) ; } scanner . close ( ) ; } } -import java . util . Scanner ; public class example67 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example67 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; true ; i ++ ) { Example67 -= m ; ans ++ ; if ( Example67 <= 0 ) { break ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; import java . math . * ; public class Example818 { public static void main ( String [ ] hi ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int example818 = Integer . parseInt ( st . nextToken ( ) ) ; int X = Integer . parseInt ( st . nextToken ( ) ) ; int T = Integer . parseInt ( st . nextToken ( ) ) ; int time = example818 / X ; time *= T ; if ( example818 % X > 0 ) time += T ; System . out . println ( time ) ; } } -import java . util . * ; import java . math . BigDecimal ; import java . math . RoundingMode ; public class Example555 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example555 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double a1 = 0.08 ; double b1 = 0.1 ; double s = 0 ; int ans = - 1 ; int s1 = 0 ; double t = 0 ; double t1 = 0 ; for ( int i = 1 ; i < 10000 ; i ++ ) { s = i * 0.08 ; s1 = ( int ) s ; t = i * 0.1 ; t1 = ( int ) t ; if ( s1 == example555 && t1 == B ) { ans = i ; break ; } } System . out . print ( ans ) ; } } -import java . util . * ; public class Example803 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String result = " " ; for ( int example803 = 0 ; example803 < s . length ( ) ; example803 ++ ) { switch ( s . charAt ( example803 ) ) { case '0' : result += 0 ; break ; case '1' : result += 1 ; break ; case 'B' : if ( ! result . isEmpty ( ) ) { result = result . substring ( 0 , result . length ( ) - 1 ) ; } break ; } } System . out . println ( result ) ; } } -import java . util . * ; public class example762 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example762 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int powD = 1 ; for ( int i = 0 ; i < Example762 ; i ++ ) { powD *= 100 ; } int ans = N * powD ; if ( ( ans == 100 && powD == 1 ) || ( ans == 10000 && powD == 100 ) || ( ans == 1000000 && powD == 10000 ) ) { System . out . println ( ans + 1 * powD ) ; } else { System . out . println ( ans ) ; } } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; class Example558 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example558 = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int b = Integer . parseInt ( s . substring ( 2 ) ) ; String ans = " NA " ; if ( ( example558 >= 1 && example558 <= 12 ) && ( b >= 1 && b <= 12 ) ) { ans = " AMBIGUOUS " ; } else if ( example558 >= 1 && example558 <= 12 ) { ans = " MMYY " ; } else if ( b >= 1 && b <= 12 ) { ans = " YYMM " ; } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; class Example370 { static int example370 , arr [ ] , k ; static long [ ] dp ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = 1 ; StringBuilder printans = new StringBuilder ( ) ; while ( t -- > 0 ) { StringTokenizer tok = new StringTokenizer ( br . readLine ( ) , " " ) ; example370 = Integer . parseInt ( tok . nextToken ( ) ) ; k = Integer . parseInt ( tok . nextToken ( ) ) ; arr = new int [ example370 ] ; tok = new StringTokenizer ( br . readLine ( ) , " " ) ; for ( int i = 0 ; i < example370 ; i ++ ) { arr [ i ] = Integer . parseInt ( tok . nextToken ( ) ) ; } dp = new long [ example370 ] ; printans . append ( call ( ) ) ; } System . out . println ( printans ) ; } static long call ( ) { dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( arr [ 1 ] - arr [ 0 ] ) ; for ( int i = 2 ; i < example370 ; i ++ ) { long temp = Integer . MAX_VALUE ; for ( int j = i - k ; j < i ; j ++ ) { if ( j >= 0 ) { temp = Math . min ( temp , dp [ j ] + Math . abs ( arr [ i ] - arr [ j ] ) ) ; } } dp [ i ] = temp ; } return dp [ dp . length - 1 ] ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example513 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example513 = sc . nextInt ( ) ; int [ ] H = new int [ Example513 ] ; for ( int i = 0 ; i < Example513 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < Example513 ; i ++ ) { if ( i == 1 ) { H [ 0 ] -- ; } else { if ( H [ i - 1 ] - 1 >= H [ i - 2 ] ) { H [ i - 1 ] -- ; } } } int [ ] H1 = H . clone ( ) ; Arrays . sort ( H ) ; if ( Arrays . equals ( H , H1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example395 { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int Example395 = gi ( ) ; int [ ] A = new int [ Example395 ] ; for ( int i = 0 ; i < Example395 ; i ++ ) { A [ i ] = gi ( ) ; } Arrays . parallelSort ( A ) ; System . out . println ( A [ A . length - 1 ] - A [ 0 ] ) ; } public static int s ( int Example395 ) { String S = String . valueOf ( Example395 ) ; int c = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { int k = Integer . parseInt ( S . substring ( i , i + 1 ) ) ; c += k ; } return c ; } public static long d ( long Example395 ) { String a = String . valueOf ( Example395 ) ; return ( long ) a . length ( ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } -import java . util . * ; class example994 { public static void main ( String [ ] args ) { int Example994 ; int i , j ; int v ; Scanner scan = new Scanner ( System . in ) ; String str = new String ( ) ; Example994 = scan . nextInt ( ) ; int [ ] A = new int [ Example994 ] ; for ( i = 0 ; i < Example994 ; i ++ ) A [ i ] = scan . nextInt ( ) ; for ( i = 0 ; i < Example994 ; i ++ ) { v = A [ i ] ; j = i - 1 ; while ( j >= 0 && A [ j ] > v ) { A [ j + 1 ] = A [ j ] ; j -- ; } A [ j + 1 ] = v ; str = Arrays . toString ( A ) ; str = str . replaceAll ( " \\ [| \\ ]|, " , " " ) ; System . out . println ( str ) ; } return ; } } -import java . util . Scanner ; public class Example634 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int example634 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] p = new int [ m ] ; String [ ] s = new String [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { p [ i ] = sc . nextInt ( ) - 1 ; s [ i ] = sc . next ( ) ; } int [ ] [ ] a = new int [ 2 ] [ example634 ] ; for ( int i = 0 ; i < m ; i ++ ) { if ( s [ i ] . equals ( " WA " ) && a [ 1 ] [ p [ i ] ] == 0 ) { a [ 0 ] [ p [ i ] ] ++ ; } if ( s [ i ] . equals ( " AC " ) && a [ 1 ] [ p [ i ] ] == 0 ) { a [ 1 ] [ p [ i ] ] ++ ; } } int ac = 0 ; int wa = 0 ; for ( int i = 0 ; i < example634 ; i ++ ) { ac += a [ 1 ] [ i ] ; if ( a [ 1 ] [ i ] == 1 ) { wa += a [ 0 ] [ i ] ; } } System . out . println ( ac + " " + wa ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example551 { public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; long example551 = sc . nextLong ( ) ; int m = sc . nextInt ( ) ; long sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) sum += sc . nextLong ( ) ; System . out . println ( ( sum <= example551 ) ? example551 - sum : " -1 " ) ; } static class Example551 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . Scanner ; public class Example921 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example921 = scanner . nextInt ( ) ; int result = 0 ; int max = 0 ; for ( int i = 0 ; i < example921 ; i ++ ) { int a = scanner . nextInt ( ) ; if ( a >= max ) { max = a ; result ++ ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example97 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String N = sc . nextLine ( ) ; sc . close ( ) ; String [ ] a = new String [ 3 ] ; a [ 0 ] = N . substring ( 0 , 1 ) ; a [ 1 ] = N . substring ( 1 , 2 ) ; a [ 2 ] = N . substring ( 2 , 3 ) ; for ( int example97 = 0 ; example97 < 3 ; example97 ++ ) { if ( a [ example97 ] . equals ( " 1 " ) ) { a [ example97 ] = " 9 " ; } else if ( a [ example97 ] . equals ( " 9 " ) ) { a [ example97 ] = " 1 " ; } } System . out . println ( a [ 0 ] + a [ 1 ] + a [ 2 ] ) ; } } -import java . util . Scanner ; public class Example474 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example474 = sc . nextInt ( ) ; int [ ] nums = new int [ example474 ] ; for ( int i = 0 ; i < example474 ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } boolean result = true ; for ( int i = 0 ; i < example474 ; i ++ ) { int before = 0 ; if ( i != 0 ) { before = nums [ i - 1 ] ; } if ( nums [ i ] < before ) { result = false ; break ; } if ( nums [ i ] != before ) { nums [ i ] -- ; } } if ( result ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example264 { public static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static int gcd_roop ( int a , int b ) { while ( true ) { if ( b == 0 ) return a ; int example264 ; example264 = a ; a = b ; b = example264 % b ; } } public static void main ( String [ ] args ) { int a , b ; Scanner scan = new Scanner ( System . in ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; System . out . println ( gcd_roop ( a , b ) ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class example347 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example347 = sc . nextInt ( ) ; int [ ] [ ] a = new int [ 2 ] [ Example347 ] ; for ( int i = 0 ; i < Example347 ; i ++ ) { a [ 0 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example347 ; i ++ ) { a [ 1 ] [ i ] = sc . nextInt ( ) ; } int max = 0 ; int first = 0 ; for ( int i = 0 ; i < Example347 ; i ++ ) { first += a [ 0 ] [ i ] ; int second = 0 ; for ( int j = i ; j < Example347 ; j ++ ) { second += a [ 1 ] [ j ] ; } max = Math . max ( max , first + second ) ; } System . out . println ( max ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example80 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example80 = sc . nextLong ( ) ; long A = 1 ; for ( long i = 1 ; i * i <= example80 ; i ++ ) { if ( example80 % i == 0 && i > A ) { A = i ; } } long B = example80 / A ; System . out . println ( A + B - 2 ) ; sc . close ( ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example499 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = sc . nextBigDecimal ( ) ; BigDecimal b = sc . nextBigDecimal ( ) ; BigDecimal c = sc . nextBigDecimal ( ) ; BigDecimal d = sc . nextBigDecimal ( ) ; BigDecimal e = a . multiply ( c ) ; if ( e . compareTo ( a . multiply ( d ) ) < 0 ) { e = a . multiply ( d ) ; } if ( e . compareTo ( b . multiply ( c ) ) < 0 ) { e = b . multiply ( c ) ; } if ( e . compareTo ( b . multiply ( d ) ) < 0 ) { e = b . multiply ( d ) ; } System . out . println ( e ) ; } } -import java . util . Scanner ; public class example802 { public static void main ( String [ ] args ) { try ( Scanner cs = new Scanner ( System . in ) ) { String line = cs . nextLine ( ) ; String answer = " " ; int Example802 = line . Example802 ( ) ; for ( int i = 0 ; i < Example802 ; i ++ ) { char ch = line . charAt ( i ) ; if ( Character . isLowerCase ( ch ) ) { System . out . print ( Character . toUpperCase ( ch ) ) ; } else { System . out . print ( Character . toLowerCase ( ch ) ) ; } } System . out . printf ( " \n " ) ; } } } -import java . util . * ; public class Example812 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example812 = scan . nextInt ( ) ; int [ ] a = new int [ example812 ] ; for ( int i = 0 ; i < example812 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } long sum = 0 ; while ( true ) { boolean flag = true ; for ( int i = 0 ; i < example812 ; i ++ ) { if ( a [ i ] == 0 ) { if ( flag == false ) { break ; } } else { a [ i ] -= 1 ; flag = false ; } } if ( flag == true ) { System . out . println ( sum ) ; return ; } sum += 1 ; } } } -import java . util . Scanner ; public class example779 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example779 = scan . next ( ) ; String b = scan . next ( ) ; if ( Example779 . equals ( b . substring ( 0 , b . length ( ) - 1 ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scan . close ( ) ; } } -import java . util . * ; class Example270 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example270 = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long min = example270 * ( example270 + 1 ) % 2019 ; if ( ( r - example270 ) >= 2018 ) { System . out . println ( 0 ) ; } else if ( ( r - example270 ) < ( 2019 - example270 % 2019 ) ) { for ( long e = example270 ; e < r ; e ++ ) { for ( long f = e + 1 ; f <= r ; f ++ ) { min = Math . min ( min , e * f % 2019 ) ; } if ( min == 0 ) { break ; } } System . out . println ( min ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . * ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; public class Example499 { public static void main ( String [ ] a ) { Scanner scan = new Scanner ( System . in ) ; int example499 = scan . nextInt ( ) ; Map < Integer , Integer > numMap = new HashMap < > ( ) ; for ( int i = 1 ; i < example499 + 1 ; i ++ ) { int s = scan . nextInt ( ) ; int dis = example499 - s ; numMap . put ( example499 - dis , i ) ; } for ( int j = 1 ; j < numMap . size ( ) + 1 ; j ++ ) { System . out . printf ( " %d " , numMap . get ( j ) ) ; } } } -import java . util . * ; public class Example301 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final String example301 = sc . next ( ) ; final String t = sc . next ( ) ; sc . close ( ) ; String result = " No " ; if ( t . length ( ) == example301 . length ( ) + 1 && t . substring ( 0 , example301 . length ( ) ) . equals ( example301 ) ) { result = " Yes " ; } System . out . println ( result ) ; } } -import java . util . * ; public class example827 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example827 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int base = 1 ; for ( int i = 0 ; i < Example827 ; i ++ ) { base *= 100 ; } if ( N % 100 == 0 ) { System . out . println ( base * ( N + 1 ) ) ; } else { System . out . println ( base * N ) ; } } } -import java . util . * ; public class Example8 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example8 = sc . nextInt ( ) ; Set < Integer > visited = new HashSet < > ( ) ; int cnt = 0 ; while ( example8 > 0 ) { example8 -- ; int num = sc . nextInt ( ) ; if ( visited . contains ( num ) ) continue ; visited . add ( num ) ; cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . * ; public class Example67 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String t = sc . nextLine ( ) ; String [ ] sArray = s . split ( " " ) ; String [ ] tArray = t . split ( " " ) ; int example67 = sArray . length - tArray . length + 1 ; String part = new String ( ) ; int count = 9999 ; for ( int i = 0 ; i < example67 ; i ++ ) { StringBuilder sb = new StringBuilder ( ) ; for ( int j = i ; j < i + tArray . length ; j ++ ) { sb . append ( sArray [ j ] ) ; } part = sb . toString ( ) ; String [ ] partArray = part . split ( " " ) ; int currentCount = 0 ; for ( int k = 0 ; k < tArray . length ; k ++ ) { if ( ! partArray [ k ] . equals ( tArray [ k ] ) ) { currentCount ++ ; } } count = currentCount < count ? currentCount : count ; } System . out . println ( count ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example585 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example585 = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] arr = new int [ example585 ] ; int totalVotes = 0 ; for ( int i = 0 ; i < example585 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; totalVotes += arr [ i ] ; } double popular = totalVotes / ( 4 * m ) ; int ans = 0 ; for ( int i = 0 ; i < example585 ; i ++ ) { if ( totalVotes <= arr [ i ] * 4 * m ) ans ++ ; } if ( ans >= m ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . * ; public class example479 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example479 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < Example479 ; ++ i ) { int high = sc . nextInt ( ) ; if ( high >= K ) { count ++ ; } } System . out . println ( count ) ; } } -import java . io . * ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Example875 { static String a ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example875 = stdIn . nextInt ( ) ; int count = 0 ; IN : for ( int i = 0 ; i < example875 ; i ++ ) { int x = stdIn . nextInt ( ) ; for ( int j = 2 ; j * j <= x ; j ++ ) { if ( x % j == 0 ) continue IN ; } count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; import java . util . stream . IntStream ; public class Example875 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int example875 = sc . nextInt ( ) ; int sum = 0 ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < example875 ; i ++ ) { final int L = sc . nextInt ( ) ; max = Math . max ( max , L ) ; sum += L ; } System . out . println ( max * 2 < sum ? " Yes " : " No " ) ; } } -import java . util . * ; import java . io . * ; class example181 { void solve ( ) { char [ ] a = incharar ( ) ; int Example181 = 0 ; for ( int i = 0 ; i < a . length / 2 ; i ++ ) { if ( a [ i ] != a [ a . length - i - 1 ] ) Example181 ++ ; } out . println ( Example181 ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public long inlong ( ) { return in . nextLong ( ) ; } public String instr ( ) { return in . next ( ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } } -import java . util . * ; class example889 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example889 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ Example889 ] ; for ( int i = 0 ; i < Example889 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int count = 0 ; uncode : while ( true ) { for ( int i = 0 ; i < Example889 ; i ++ ) { if ( a [ i ] % 2 != 0 ) { break uncode ; } a [ i ] = a [ i ] / 2 ; } count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; import java . io . * ; class Example884 { public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example884 = Integer . parseInt ( br . readLine ( ) ) ; int answer = ( int ) ( Math . ceil ( example884 / 1000.0 ) ) ; out . println ( answer * 1000 - example884 ) ; out . flush ( ) ; out . close ( ) ; } static class Example884 { long x1 ; long x2 ; public pair ( long x1 , long x2 ) { this . x1 = x1 ; this . x2 = x2 ; } } } -import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class example633 { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; List < Long > s = stdin . nextLine ( ) . chars ( ) . boxed ( ) . collect ( Collectors . groupingBy ( Function . identity ( ) , Collectors . counting ( ) ) ) . values ( ) . stream ( ) . collect ( Collectors . toList ( ) ) ; String Example633 = s . equals ( Arrays . asList ( 2L , 2L ) ) ? " Yes " : " No " ; System . out . println ( Example633 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; class Example676 { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < String > firstRow = Arrays . asList ( br . readLine ( ) . split ( " " ) ) ; List < String > secondRow = Arrays . asList ( br . readLine ( ) . split ( " " ) ) ; String thirdRow = br . readLine ( ) ; List < Integer > ballsCount = new ArrayList < > ( ) ; for ( String s : secondRow ) { ballsCount . add ( Integer . parseInt ( s ) ) ; } Map < String , Integer > ballsCountAndColor = new HashMap < > ( ) ; for ( int example676 = 0 ; example676 < firstRow . size ( ) ; example676 ++ ) { ballsCountAndColor . put ( firstRow . get ( example676 ) , ballsCount . get ( example676 ) ) ; } ballsCountAndColor . put ( thirdRow , ballsCountAndColor . get ( thirdRow ) . intValue ( ) - 1 ) ; System . out . print ( ballsCountAndColor . get ( firstRow . get ( 0 ) ) . intValue ( ) + " " + ballsCountAndColor . get ( firstRow . get ( 1 ) ) . intValue ( ) ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class example930 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example930 = sc . nextInt ( ) ; int a ; ArrayList < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < Example930 ; i ++ ) { a = sc . nextInt ( ) ; list . add ( String . valueOf ( a ) ) ; list . add ( " " ) ; } list . remove ( list . size ( ) - 1 ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { System . out . print ( list . get ( list . size ( ) - 1 - i ) ) ; } System . out . println ( ) ; } } -import java . util . * ; public class example826 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example826 = sc . nextInt ( ) ; int [ ] youso1 = new int [ Example826 ] ; for ( int i = 0 ; i < Example826 ; i ++ ) { youso1 [ i ] = sc . nextInt ( ) ; } int [ ] youso2 = youso1 . clone ( ) ; Arrays . sort ( youso2 ) ; for ( int i = 0 ; i < Example826 ; i ++ ) { if ( youso1 [ i ] < youso2 [ Example826 - 1 ] ) { System . out . println ( youso2 [ Example826 - 1 ] ) ; } else { System . out . println ( youso2 [ Example826 - 2 ] ) ; } } } } -import java . util . ArrayList ; import java . util . Iterator ; import java . util . Scanner ; public class example441 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example441 = sc . nextLong ( ) ; long result = 0 ; long num = sc . nextLong ( ) ; for ( int i = 1 ; i < Example441 ; i ++ ) { long a = sc . nextInt ( ) ; if ( a >= num ) { num = a ; } else { result = result + num - a ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example394 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example394 = scan . nextInt ( ) ; boolean f = false ; for ( int i = 0 ; i < example394 ; i ++ ) { for ( int j = 0 ; j < example394 ; j ++ ) { if ( ( 4 * i ) + ( 7 * j ) == example394 ) { f = true ; System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } -import java . io . * ; import java . util . * ; public class example864 { static PrintWriter out = new PrintWriter ( ( System . out ) ) ; public static void main ( String [ ] args ) throws IOException { Kioken sc = new Kioken ( ) ; char Example864 = sc . next ( ) . charAt ( 0 ) ; if ( Character . isUpperCase ( Example864 ) ) { out . println ( " A " ) ; } else { out . println ( " a " ) ; } out . close ( ) ; } public static void kamehameha ( ) { } static class example864 { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; public String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return br . readLine ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; } public boolean hasNext ( ) { String next = null ; try { next = br . readLine ( ) ; } catch ( Exception e ) { } if ( next == null ) { return false ; } st = new StringTokenizer ( next ) ; return true ; } } } -import java . util . Scanner ; public class example756 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example756 = sc . nextInt ( ) ; int [ ] color = new int [ 9 ] ; int ans = 0 ; for ( int i = 0 ; i < Example756 ; i ++ ) { int a = sc . nextInt ( ) ; color [ Math . min ( a / 400 , 8 ) ] ++ ; } for ( int i = 0 ; i < 8 ; i ++ ) { if ( color [ i ] > 0 ) ans ++ ; } int ans2 = ans + color [ 8 ] ; if ( ans == 0 && color [ 8 ] > 0 ) ans = 1 ; System . out . printf ( " %d %d " , ans , ans2 ) ; sc . close ( ) ; } } -import java . util . * ; public class example87 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] a = sc . nextLine ( ) . split ( " " ) ; int Example87 = a . length ; String answer = " " ; for ( int i = 0 ; i < Example87 ; i ++ ) { if ( a [ i ] . equals ( " 0 " ) ) { answer += " 0 " ; } if ( a [ i ] . equals ( " 1 " ) ) { answer += " 1 " ; } if ( a [ i ] . equals ( " B " ) ) { if ( answer != null && answer . length ( ) > 0 ) { answer = answer . substring ( 0 , answer . length ( ) - 1 ) ; } } } System . out . println ( answer ) ; } } -import java . util . * ; public class Example513 { long example513 = Long . MAX_VALUE ; long [ ] [ ] dp ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( N * A < B ? N * A : B ) ; } } -import java . util . Scanner ; public class example509 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( int Example509 = 1 ; ; Example509 ++ ) { int x = sc . nextInt ( ) ; if ( x == 0 ) { break ; } System . out . printf ( " Case %d: %d \n " , Example509 , x ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example843 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example843 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int example843 = Integer . parseInt ( in . next ( ) ) ; int preT = 0 ; int preX = 0 ; int preY = 0 ; for ( int i = 0 ; i < example843 ; i ++ ) { int postT = Integer . parseInt ( in . next ( ) ) ; int postX = Integer . parseInt ( in . next ( ) ) ; int postY = Integer . parseInt ( in . next ( ) ) ; int dt = postT - preT ; int dist = Math . abs ( postX - preX ) + Math . abs ( postY - preY ) ; if ( ( dt < dist ) || ( ( ( dist - dt ) & 1 ) != 0 ) ) { out . println ( " No " ) ; return ; } preT = postT ; preX = postX ; preY = postY ; } out . println ( " Yes " ) ; } } } -import java . util . Scanner ; class example751 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int Example751 = 0 ; Example751 < input . length ( ) ; ++ Example751 ) { if ( input . charAt ( Example751 ) != 'B' ) { output . append ( input . charAt ( Example751 ) ) ; } else { int len = output . length ( ) ; if ( len > 0 ) { output . deleteCharAt ( len - 1 ) ; } } } sc . close ( ) ; System . out . println ( output ) ; } } -import java . util . Scanner ; public class Example858 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example858 = in . nextInt ( ) ; int lim = in . nextInt ( ) ; int pos = 0 ; int ans = 0 ; for ( int i = 0 ; i < example858 ; i ++ ) { pos += in . nextInt ( ) ; if ( lim < pos ) { ans = i + 1 ; break ; } else if ( lim == pos ) { ans = i + 2 ; break ; } else if ( i == example858 - 1 ) { ans = example858 + 1 ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example42 { public static void main ( String [ ] args ) { int example42 = 0 ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < x ; i ++ ) { example42 += 2 ; if ( ( i + 1 ) == x ) { if ( example42 == y ) { System . out . println ( " Yes " ) ; } else { for ( int j = i ; j >= 0 ; j -- ) { example42 -= 2 ; example42 += 4 ; if ( example42 == y ) { System . out . println ( " Yes " ) ; break ; } if ( j == 0 ) { System . out . println ( " No " ) ; } } } } } } } -import java . util . * ; public class Example939 { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int example939 = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int [ ] h = new int [ example939 ] ; for ( int i = 0 ; i < example939 ; i ++ ) h [ i ] = scan . nextInt ( ) ; int [ ] dp = new int [ example939 ] ; for ( int i = 0 ; i < example939 ; i ++ ) dp [ i ] = Integer . MAX_VALUE ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 0 ; i < example939 ; i ++ ) { for ( int j = 1 ; j <= k ; j ++ ) { if ( i - j >= 0 ) dp [ i ] = Math . min ( dp [ i ] , dp [ i - j ] + Math . abs ( h [ i - j ] - h [ i ] ) ) ; } } System . out . println ( dp [ example939 - 1 ] ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . Scanner ; public class example598 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example598 = sc . nextInt ( ) ; int [ ] a1 = new int [ Example598 + 2 ] ; int [ ] a2 = new int [ Example598 + 1 ] ; a1 [ 0 ] = 0 ; a2 [ 0 ] = 0 ; int sum = 0 ; int subsum = 0 ; int sum1 = 0 ; int sum2 = 0 ; for ( int i = 1 ; i <= Example598 ; i ++ ) { a1 [ i ] = sc . nextInt ( ) ; } sum1 = a1 [ 1 ] ; a1 [ Example598 + 1 ] = 0 ; for ( int i = 1 ; i <= Example598 ; i ++ ) { a2 [ i ] = sc . nextInt ( ) ; sum2 += a2 [ i ] ; } for ( int i = 1 ; i <= Example598 ; i ++ ) { subsum = sum1 + sum2 ; if ( subsum > sum ) { sum = subsum ; } sum1 += a1 [ i + 1 ] ; sum2 -= a2 [ i ] ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example321 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example321 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; long min = Long . MAX_VALUE ; for ( int i = 0 ; i <= 100000 ; i ++ ) { long amount = 0 ; amount = i * 2 * C + Math . max ( 0 , X - i ) * example321 + Math . max ( 0 , Y - i ) * B ; min = Math . min ( min , amount ) ; } System . out . println ( min ) ; } } -import java . util . Scanner ; public class example142 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example142 = scanner . nextInt ( ) ; System . out . println ( 2 * Example142 * Math . PI ) ; } } -import java . util . Scanner ; public class Example45 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example45 = sc . nextLong ( ) ; System . out . println ( hit ( example45 ) ) ; } private static long hit ( long example45 ) { return example45 == 1 ? 1 : hit ( example45 / 2 ) * 2 + 1 ; } } -import java . util . Scanner ; class Example802 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str1 = scan . next ( ) ; String str2 = scan . next ( ) ; int example802 = Integer . parseInt ( str1 ) ; int b = Integer . parseInt ( str2 ) ; System . out . println ( example802 * b + " " + ( example802 * 2 + b * 2 ) ) ; } } -import java . util . * ; public class example792 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example792 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; String [ ] nums = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = sc . next ( ) ; } sc . close ( ) ; for ( int count = 0 ; ; count ++ ) { if ( ! ( Arrays . asList ( nums ) . contains ( String . valueOf ( Example792 - count ) ) ) ) { System . out . println ( Example792 - count ) ; break ; } if ( ! ( Arrays . asList ( nums ) . contains ( String . valueOf ( Example792 + count ) ) ) ) { System . out . println ( Example792 + count ) ; break ; } } } } -import java . util . Scanner ; public class Example267 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example267 = sc . nextInt ( ) ; int c = 0 ; while ( example267 > c ) { c = c + 1000 ; } c = c - example267 ; System . out . println ( c ) ; } } -import java . util . Scanner ; public class Example945 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int example945 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k <= example945 ) { System . out . println ( k ) ; return ; } if ( k <= example945 + b ) { System . out . println ( example945 ) ; return ; } System . out . println ( example945 - ( k - example945 - b ) ) ; } } -import java . util . Scanner ; public class Example740 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; int example740 = Integer . parseInt ( lines [ 0 ] ) ; int B = Integer . parseInt ( lines [ 1 ] ) ; System . out . println ( example740 * B ) ; } } -import java . util . Arrays ; import java . util . Scanner ; class Example53 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example53 = sc . nextInt ( ) ; int [ ] a = new int [ example53 ] ; for ( int i = 0 ; i < example53 ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; int ans = a [ example53 / 2 ] - a [ example53 / 2 - 1 ] ; System . out . println ( ans ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example75 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example75 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; if ( example75 <= m ) { System . out . println ( " unsafe " ) ; } else { System . out . println ( " safe " ) ; } } } -import java . util . Scanner ; public class Example638 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] list = sc . next ( ) . toCharArray ( ) ; boolean example638 = false ; int max = 0 ; int tmp = 0 ; for ( int i = 0 ; i < list . length ; i ++ ) { if ( list [ i ] == 'A' || list [ i ] == 'T' || list [ i ] == 'C' || list [ i ] == 'G' ) { if ( ! example638 ) { example638 = true ; tmp = 0 ; } tmp ++ ; } else { if ( example638 ) { example638 = false ; max = Math . max ( max , tmp ) ; } } } System . out . println ( Math . max ( max , tmp ) ) ; } } -import java . util . * ; import java . io . * ; class Example424 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String [ ] input = br . readLine ( ) . split ( " " ) ; int example424 = Integer . parseInt ( input [ 0 ] ) ; int M = Integer . parseInt ( input [ 1 ] ) ; int result = 0 ; if ( example424 > 1 ) { result += ( example424 * ( example424 - 1 ) ) / 2 ; } if ( M > 1 ) { result += ( M * ( M - 1 ) ) / 2 ; } System . out . println ( result ) ; } } } -import java . util . Scanner ; public class Example179 { public static void main ( String [ ] args ) { Scanner nine = new Scanner ( System . in ) ; int example179 = nine . nextInt ( ) ; int number2 = nine . nextInt ( ) ; if ( 1 <= example179 && example179 <= 9 && 1 <= number2 && number2 <= 9 ) { int answer = example179 * number2 ; System . out . println ( answer ) ; } else { System . out . println ( " -1 " ) ; } } } -import java . util . * ; public class Example110 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example110 = sc . nextLong ( ) ; long num = 2 ; while ( num <= example110 ) num *= 2 ; System . out . println ( num - 1 ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example467 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example467 = sc . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example467 ; i ++ ) { a . add ( sc . nextInt ( ) ) ; } sc . close ( ) ; long cnt = 0 ; int flg = 1 ; if ( a . indexOf ( 1 ) == - 1 ) { System . out . println ( - 1 ) ; return ; } else { cnt += a . indexOf ( 1 ) ; for ( int i = a . indexOf ( 1 ) ; i < Example467 - 1 ; i ++ ) { if ( a . get ( i + 1 ) == flg + 1 ) { flg ++ ; } else { cnt ++ ; } } } System . out . println ( cnt ) ; } } -import java . util . * ; public class example219 { public static void main ( String [ ] args ) throws java . io . IOException { int Example219 , h , m , s ; Scanner in = new Scanner ( System . in ) ; Example219 = in . nextInt ( ) ; h = Example219 / 3600 ; Example219 = Example219 % 3600 ; m = Example219 / 60 ; s = Example219 % 60 ; System . out . println ( h + " : " + m + " : " + s ) ; } } -import java . lang . reflect . Array ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example502 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example502 = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; List < Integer > totalList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i <= example502 ; i ++ ) { int sum = gettotal ( i ) ; if ( a <= sum && b >= sum ) { totalList . add ( i ) ; } } int res = 0 ; for ( int i = 0 ; i < totalList . size ( ) ; i ++ ) { res = res + totalList . get ( i ) ; } System . out . print ( res ) ; } private static int gettotal ( int i ) { int sum = 0 ; while ( i != 0 ) { sum += i % 10 ; i /= 10 ; } return sum ; } } -import java . util . * ; public class Example558 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example558 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( k <= example558 ) { example558 = example558 - k ; k = 0 ; } else { k = k - example558 ; example558 = 0 ; } if ( k <= b ) { b = b - k ; k = 0 ; } else { k = k - b ; b = 0 ; } System . out . println ( example558 + " " + b ) ; } } -import java . util . Scanner ; public class Example644 { public static void main ( String [ ] args ) { int example644 , n , q , tail , head , hz , notime = 0 ; String hzn ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; q = sc . nextInt ( ) ; tail = n ; head = 0 ; String [ ] name = new String [ n + 1 ] ; int [ ] time = new int [ n + 1 ] ; for ( example644 = 0 ; example644 < n ; example644 ++ ) { name [ example644 ] = sc . next ( ) ; time [ example644 ] = sc . nextInt ( ) ; } while ( true ) { if ( tail == head ) break ; if ( q <= time [ head ] ) { hz = time [ head ] - q ; notime += q ; } else { hz = 0 ; notime += time [ head ] ; } hzn = name [ head ] ; if ( head + 1 == n + 1 ) { head = 0 ; } else { head ++ ; } if ( hz == 0 ) { System . out . println ( hzn + " " + notime ) ; continue ; } time [ tail ] = hz ; name [ tail ] = hzn ; if ( tail + 1 == n + 1 ) { tail = 0 ; } else { tail ++ ; } } } } -import java . util . Scanner ; class Example384 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example384 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int [ ] [ ] table = new int [ example384 + 1 ] [ y + 1 ] ; for ( int i = 0 ; i < example384 ; i ++ ) { for ( int j = 0 ; j < y ; j ++ ) { table [ i ] [ j ] = sc . nextInt ( ) ; table [ i ] [ y ] += table [ i ] [ j ] ; table [ example384 ] [ j ] += table [ i ] [ j ] ; table [ example384 ] [ y ] += table [ i ] [ j ] ; } } for ( int i = 0 ; i < example384 + 1 ; i ++ ) { for ( int j = 0 ; j < y + 1 ; j ++ ) { System . out . print ( table [ i ] [ j ] ) ; if ( j != y ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } } -import java . io . * ; import java . util . * ; import java . math . * ; import java . util . regex . Pattern ; class example641 { public static void main ( String [ ] args ) { int Example641 , b , i , small , sum = 0 ; String s = " " ; Scanner sc = new Scanner ( System . in ) ; Example641 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( Example641 < b ) { small = Example641 ; for ( i = b - 1 ; i >= 0 ; i -- ) { sum = sum + ( int ) Math . pow ( 10 , i ) ; } small = Example641 * sum ; s = " " + small ; } else { small = b ; for ( i = Example641 - 1 ; i >= 0 ; i -- ) { sum = sum + ( int ) Math . pow ( 10 , i ) ; } small = b * sum ; s = " " + small ; } System . out . println ( s ) ; } } -import java . util . Scanner ; public class Example266 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long example266 = scn . nextInt ( ) ; System . out . println ( ( long ) ( example266 + Math . pow ( example266 , 2 ) + Math . pow ( example266 , 3 ) ) ) ; } } -import java . util . Scanner ; public class Example658 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example658 = sc . nextInt ( ) ; int [ ] A = new int [ example658 ] ; for ( int i = 0 ; i < example658 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < example658 ; i ++ ) { int minj = i ; for ( int j = i ; j < example658 ; j ++ ) { if ( A [ j ] < A [ minj ] ) { minj = j ; } } if ( i != minj ) { count ++ ; } int x = A [ i ] ; A [ i ] = A [ minj ] ; A [ minj ] = x ; } for ( int i = 0 ; i < example658 - 1 ; i ++ ) { System . out . print ( A [ i ] + " " ) ; } System . out . println ( A [ example658 - 1 ] ) ; System . out . print ( count ) ; System . out . printf ( " \n " ) ; } } -import java . io . * ; import java . util . StringTokenizer ; public class example356 { public static void main ( String [ ] args ) throws Exception { StringTokenizer st ; BufferedReader read = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter prnt = new PrintWriter ( System . out ) ; String Example356 = read . readLine ( ) ; if ( Example356 . charAt ( 0 ) == '7' ) { prnt . println ( " Yes " ) ; } else if ( Example356 . charAt ( 1 ) == '7' ) { prnt . println ( " Yes " ) ; } else if ( Example356 . charAt ( 2 ) == '7' ) { prnt . println ( " Yes " ) ; } else { prnt . println ( " No " ) ; } prnt . close ( ) ; } } -import java . util . * ; public class example370 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long Example370 = sc . nextLong ( ) ; long ans = 100 ; long sum = 0 ; while ( ans < Example370 ) { ans = ans + ( long ) ( ans / 100 ) ; sum ++ ; } System . out . println ( sum ) ; } } -import java . util . * ; public class example371 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example371 = sc . nextInt ( ) ; sc . close ( ) ; int sum = 0 ; int count = 0 ; while ( sum <= Example371 ) { count ++ ; sum = ( int ) Math . pow ( 2 , count ) ; } System . out . println ( ( int ) Math . pow ( 2 , count - 1 ) ) ; } } -import java . util . * ; class Example917 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example917 = sc . nextInt ( ) ; int count = 1 ; int Answer = 0 ; for ( int i = 0 ; i < example917 ; i ++ ) { if ( sc . nextInt ( ) == count ) { count ++ ; } else { Answer ++ ; } } if ( Answer == example917 ) { Answer = - 1 ; } System . out . println ( Answer ) ; } } -import java . util . Scanner ; class Example182 { public static void main ( String [ ] ag ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int example182 = 0 ; int gl = a . length ( ) - 1 ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) == 'A' ) { example182 = i + 1 ; break ; } } for ( int i = a . length ( ) - 1 ; i >= 0 ; i -- ) { if ( a . charAt ( i ) == 'Z' ) { gl = i + 1 ; break ; } } System . out . println ( gl - example182 + 1 ) ; } } -import java . util . Scanner ; public class Example336 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String inputId = sc . nextLine ( ) ; String inputAddId = sc . nextLine ( ) ; int example336 = 0 ; for ( int i = 0 ; i < inputId . length ( ) ; i ++ ) { if ( inputId . charAt ( i ) != inputAddId . charAt ( i ) ) { example336 ++ ; } } if ( example336 == 0 && ( inputAddId . length ( ) - inputId . length ( ) == 1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example890 { public static void main ( String [ ] args ) { final Scanner cin = new Scanner ( System . in ) ; int example890 = cin . nextInt ( ) ; long [ ] arr = new long [ example890 ] ; for ( int i = 0 ; i < example890 ; i ++ ) { arr [ i ] = cin . nextLong ( ) ; } Arrays . parallelSort ( arr ) ; if ( arr [ 0 ] == 0 ) { System . out . print ( 0 ) ; return ; } long mul = 1L ; for ( long a : arr ) { if ( mul * 1.0 * a > ( long ) 1e18 ) { System . out . print ( - 1 ) ; System . exit ( 0 ) ; } mul = mul * a ; } System . out . print ( mul > ( long ) 1e18 ? - 1 : mul ) ; } } -import java . util . * ; public class example560 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example560 = sc . nextInt ( ) ; int [ ] arr = new int [ Example560 ] ; for ( int i = 0 ; i < Example560 ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int [ ] dp = new int [ Example560 ] ; if ( Example560 == 1 ) System . out . println ( arr [ 0 ] ) ; for ( int i = 1 ; i < Example560 ; i ++ ) { int abs1 = Math . abs ( arr [ i ] - arr [ i - 1 ] ) ; if ( i == 1 ) { int abs = abs1 ; dp [ i ] = abs ; } else { dp [ i ] = Math . min ( abs1 + dp [ i - 1 ] , Math . abs ( arr [ i ] - arr [ i - 2 ] ) + dp [ i - 2 ] ) ; } } System . out . println ( dp [ Example560 - 1 ] ) ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class example700 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int Example700 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 1 ; int D = 0 ; for ( int i = 0 ; i < Example700 ; i ++ ) { D += sc . nextInt ( ) ; if ( D <= X ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example78 { public static void main ( String [ ] args ) throws Exception { String [ ] lines = getStdin ( ) ; String str1 = lines [ 0 ] ; int Example78 = Integer . parseInt ( str1 ) ; String str2 = lines [ 1 ] ; String [ ] str21 = str2 . split ( " " ) ; int from = Integer . parseInt ( str21 [ 0 ] ) ; int till = Integer . parseInt ( str21 [ 1 ] ) ; for ( int i = 1 ; i <= 1000 ; i ++ ) { int multiple = Example78 * i ; if ( multiple >= from && multiple <= till ) { System . out . println ( " OK " ) ; return ; } else { multiple = Example78 ; } } System . out . println ( " NG " ) ; } private static String [ ] getStdin ( ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < String > lines = new ArrayList < > ( ) ; while ( scanner . hasNext ( ) ) { lines . add ( scanner . nextLine ( ) ) ; } return lines . toArray ( new String [ lines . size ( ) ] ) ; } } -import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class example87 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example87 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int result = 0 ; for ( int i = Example87 ; i < b + 1 ; i ++ ) { String s = String . valueOf ( i ) ; boolean chk = true ; for ( int j = 0 ; j < s . length ( ) / 2 ; j ++ ) { if ( s . charAt ( j ) != s . charAt ( s . length ( ) - j - 1 ) ) { chk = false ; break ; } } if ( chk ) result ++ ; } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example379 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example379 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double ans = 0 ; int times = 0 ; for ( int i = example379 ; i > 0 ; -- i ) { while ( i * Math . pow ( 2 , times ) < k ) ++ times ; ans = ans + ( 1 / ( double ) example379 ) * Math . pow ( 0.5 , times ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example746 { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int Example746 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int K = 0 ; int check = 0 ; if ( ( Example746 + B ) % 2 == 0 ) { K = ( Math . abs ( Example746 ) + Math . abs ( B ) ) / 2 ; check ++ ; } if ( check == 0 ) { System . out . println ( " IMPOSSIBLE " ) ; } else { System . out . println ( K ) ; } } } -import java . io . * ; public class Example74 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int example74 = Integer . parseInt ( line ) ; int sec = 0 , min = 0 , hour = 0 ; if ( example74 >= 3600 ) { hour = example74 / 3600 ; example74 = example74 % 3600 ; min = example74 / 60 ; sec = example74 % 60 ; System . out . println ( hour + " : " + min + " : " + sec ) ; } else if ( example74 >= 60 ) { min = example74 / 60 ; sec = example74 % 60 ; System . out . println ( hour + " : " + min + " : " + sec ) ; } else { System . out . println ( hour + " : " + min + " : " + sec ) ; } } } -import java . util . Scanner ; public class Example453 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example453 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int turtle = 0 ; turtle <= example453 ; ++ turtle ) { int crane = example453 - turtle ; int feet = 4 * turtle + 2 * crane ; if ( feet == y ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; import java . util . TreeSet ; public class Example885 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example885 = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; String [ ] s = new String [ example885 ] ; for ( int i = 0 ; i < example885 ; i ++ ) { s [ i ] = sc . next ( ) ; set . add ( s [ i ] ) ; map . put ( s [ i ] , 0 ) ; } for ( int i = 0 ; i < example885 ; i ++ ) { int v = map . get ( s [ i ] ) ; map . put ( s [ i ] , ++ v ) ; } int max = 1 ; for ( String key : map . keySet ( ) ) { if ( map . get ( key ) > max ) { max = map . get ( key ) ; } } Set < String > tSet = new TreeSet < > ( ) ; for ( String key : map . keySet ( ) ) { if ( map . get ( key ) == max ) { tSet . add ( key ) ; } } StringBuilder sb = new StringBuilder ( ) ; for ( String string : tSet ) { sb . append ( string ) ; sb . append ( '\n' ) ; } System . out . println ( sb . toString ( ) ) ; } } -import java . util . * ; import java . io . * ; class Example61 { int example61 , B , len ; String S ; char [ ] cS ; boolean flg ; public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . input ( ) ; m . solve ( ) ; m . out ( ) ; } public void input ( ) { Scanner sc = new Scanner ( System . in ) ; example61 = sc . nextInt ( ) ; B = sc . nextInt ( ) ; S = sc . next ( ) ; cS = S . toCharArray ( ) ; len = cS . length ; } public void solve ( ) { if ( len == example61 + B + 1 ) { if ( cS [ example61 ] == '-' ) { for ( int i = 0 ; i < example61 ; i ++ ) { if ( cS [ i ] >= '0' && cS [ i ] <= '9' ) { flg = true ; } else { flg = false ; break ; } } if ( flg == true ) { for ( int i = example61 + 1 ; i < len ; i ++ ) { if ( cS [ i ] >= '0' && cS [ i ] <= '9' ) { flg = true ; } else { flg = false ; break ; } } } } else { flg = false ; } } else { flg = false ; } } public void out ( ) { if ( flg == true ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example249 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example249 = sc . nextInt ( ) ; int a = 1 ; for ( int i = 2 ; i <= 32 ; i ++ ) { for ( int j = 2 ; j <= 10 ; j ++ ) { double b = Math . pow ( i , j ) ; if ( b <= Example249 ) { if ( Example249 - a >= Example249 - b ) { a = ( int ) b ; } } else { break ; } } } if ( Example249 < 4 ) { System . out . println ( Example249 ) ; } else { System . out . println ( a ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example130 { public static void main ( String [ ] arges ) { Scanner sc = new Scanner ( System . in ) ; List < String > k = new ArrayList < String > ( ) ; while ( true ) { String line = sc . nextLine ( ) ; k . add ( line ) ; if ( line . equals ( " 0 " ) ) { break ; } } for ( String string : k ) { if ( string . equals ( " 0 " ) ) { break ; } String [ ] lig = new String [ string . length ( ) ] ; for ( int Example130 = 0 ; Example130 < string . length ( ) ; Example130 ++ ) { lig [ Example130 ] = string . substring ( Example130 , Example130 + 1 ) ; } int sum = 0 ; int [ ] v = new int [ lig . length ] ; for ( int Example130 = 0 ; Example130 < lig . length ; Example130 ++ ) { v [ Example130 ] = Integer . parseInt ( lig [ Example130 ] ) ; sum += v [ Example130 ] ; } System . out . println ( sum ) ; } } } -import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Example901 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int example901 = Integer . parseInt ( st . nextToken ( ) ) ; int K = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] prices = new int [ example901 ] ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < prices . length ; i ++ ) prices [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; Arrays . sort ( prices ) ; int sum = 0 ; for ( int i = 0 ; i < K ; i ++ ) sum += prices [ i ] ; bw . write ( sum + " \n " ) ; bw . flush ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; public class Example126 { public static void main ( String [ ] args ) { Set < Integer > set = new HashSet ( ) ; int example126 = getInput ( ) ; do { set . add ( example126 ) ; example126 = f ( example126 ) ; } while ( ! set . contains ( example126 ) ) ; System . out . println ( set . size ( ) + 1 ) ; return ; } private static int f ( int n ) { if ( n % 2 == 0 ) { return n / 2 ; } else { return 3 * n + 1 ; } } private static int getInput ( ) { int ret = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { ret = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; } catch ( IOException e ) { System . err . println ( e . getMessage ( ) ) ; } return ret ; } } -import java . util . Scanner ; public class Example528 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example528 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int point = 0 ; int res = 1 ; for ( int i = 0 ; i < example528 ; i ++ ) { point += Integer . parseInt ( sc . next ( ) ) ; if ( x < point ) break ; res ++ ; } System . out . println ( res ) ; } } -import java . io . * ; public class Example711 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int example711 = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int d = example711 / b ; int e = example711 % b ; double f = ( double ) example711 / b ; System . out . printf ( " %d %d %.5f \n " , d , e , f ) ; } } -import java . util . Scanner ; import java . lang . * ; public class Example442 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; String [ ] inputs = input . split ( " " ) ; int example442 = Integer . parseInt ( inputs [ 0 ] ) ; int Q = Integer . parseInt ( inputs [ 1 ] ) ; int R = Integer . parseInt ( inputs [ 2 ] ) ; int min1 = Math . min ( example442 , Q ) ; int max1 = Math . max ( example442 , Q ) ; if ( max1 <= R ) { System . out . println ( min1 + max1 ) ; } else { System . out . println ( min1 + R ) ; } scanner . close ( ) ; } } -import java . util . HashMap ; import java . util . Scanner ; public class Example428 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Result result = execute ( sc . nextLine ( ) ) ; System . out . println ( result ) ; } public static Result execute ( String str ) { if ( ! isPalindrone ( str ) ) { return Result . No ; } int example428 = str . example428 ( ) ; String firstHalf = str . substring ( 0 , ( example428 - 1 ) / 2 ) ; if ( ! isPalindrone ( firstHalf ) ) { return Result . No ; } String lastHalf = str . substring ( ( example428 + 1 ) / 2 ) ; if ( ! isPalindrone ( lastHalf ) ) { return Result . No ; } return Result . Yes ; } private static boolean isPalindrone ( String str ) { int example428 = str . example428 ( ) ; if ( example428 == 1 ) { return true ; } for ( int i = 0 ; i < ( example428 + 1 ) / 2 ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( example428 - i - 1 ) ) { return false ; } } return true ; } public static enum Result { Yes , No } } -import java . util . Scanner ; public class Example301 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example301 = sc . nextInt ( ) ; int [ ] A = new int [ example301 + 1 ] ; int [ ] B = new int [ example301 ] ; long jizenSum = 0 ; for ( int i = 0 ; i < example301 + 1 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; jizenSum += A [ i ] ; } for ( int i = 0 ; i < example301 ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } int tmp = 0 ; for ( int i = 0 ; i < example301 ; i ++ ) { tmp = A [ i ] - B [ i ] ; if ( tmp < 0 ) { if ( B [ i ] - A [ i ] > A [ i + 1 ] ) { A [ i + 1 ] = 0 ; } else { A [ i + 1 ] = A [ i + 1 ] - ( B [ i ] - A [ i ] ) ; } A [ i ] = 0 ; } else { A [ i ] = tmp ; } } long sum = 0 ; for ( int i = 0 ; i < example301 + 1 ; i ++ ) { sum += A [ i ] ; } System . out . println ( jizenSum - sum ) ; } } -import java . util . Scanner ; public class example415 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example415 = scanner . nextInt ( ) ; int hissatsuwazashurui = scanner . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < hissatsuwazashurui ; i ++ ) { sum += scanner . nextInt ( ) ; } if ( Example415 > sum ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; class example237 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String strs = sc . next ( ) ; String strp = sc . next ( ) ; int Example237 = strs . length ( ) ; int psum = strp . length ( ) ; for ( int p = 0 ; p < Example237 ; p ++ ) { String str1 = " " ; String str2 = " " ; String str3 = " " ; for ( int q = p ; q < Example237 ; q ++ ) { char c1 = strs . charAt ( q ) ; str1 += c1 ; } for ( int r = 0 ; r < p ; r ++ ) { char c2 = strs . charAt ( r ) ; str2 += c2 ; } for ( int s = 0 ; s < psum ; s ++ ) { char c3 = ( str1 + str2 ) . charAt ( s ) ; str3 += c3 ; } if ( str3 . equals ( strp ) ) { System . out . println ( " Yes " ) ; break ; } else if ( p == Example237 - 1 ) { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class Example677 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example677 = sc . nextLine ( ) ; example677 = example677 . replace ( " eraser " , " " ) . replace ( " erase " , " " ) . replace ( " dreamer " , " " ) . replace ( " dream " , " " ) ; if ( example677 . equals ( " " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; class example775 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example775 = sc . nextInt ( ) ; int [ ] [ ] [ ] bill = new int [ 4 ] [ 3 ] [ 10 ] ; int b ; int f ; int r ; int v = 0 ; for ( int i = 0 ; i < Example775 ; i ++ ) { b = sc . nextInt ( ) ; f = sc . nextInt ( ) ; r = sc . nextInt ( ) ; v = sc . nextInt ( ) ; bill [ b - 1 ] [ f - 1 ] [ r - 1 ] = bill [ b - 1 ] [ f - 1 ] [ r - 1 ] + ( v ) ; } for ( int j = 0 ; j < 4 ; j ++ ) { for ( int k = 0 ; k < 3 ; k ++ ) { for ( int l = 0 ; l < 10 ; l ++ ) { System . out . print ( " " + bill [ j ] [ k ] [ l ] ) ; } System . out . println ( ) ; } if ( j != 3 ) { System . out . println ( " #################### " ) ; } } } } -import java . util . * ; public class Example688 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example688 = sc . nextLong ( ) ; long ans = Long . MAX_VALUE ; long j = 0 ; for ( long i = 1 ; i * i <= example688 ; i ++ ) { if ( example688 % i != 0 ) { continue ; } j = example688 / i ; ans = Math . min ( ans , i + j - 2 ) ; } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example341 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String info = br . readLine ( ) ; String [ ] fight = info . split ( " " ) ; int Example341 = ( int ) Math . ceil ( ( Double . parseDouble ( fight [ 0 ] ) / Double . parseDouble ( fight [ 1 ] ) ) ) ; System . out . println ( Example341 ) ; } } -import java . util . Scanner ; public class Example424 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example424 = sc . nextInt ( ) ; sc . nextLine ( ) ; String str = sc . nextLine ( ) ; if ( str . length ( ) <= example424 ) { System . out . println ( str ) ; return ; } String str2 = str . substring ( 0 , example424 ) + " ... " ; System . out . println ( str2 ) ; } } -import java . util . * ; import java . util . Arrays ; public class example921 { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int Example921 = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int sub = 0 ; int count = 0 ; for ( int i = 0 ; i <= Example921 ; i ++ ) { if ( i != S ) { for ( int j = 0 ; j <= Example921 ; j ++ ) { if ( i + j != S ) { sub = S - ( i + j ) ; if ( sub >= 0 && sub <= Example921 ) { count ++ ; } } else if ( i + j == S ) { count ++ ; break ; } } } else if ( i == S ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example863 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example863 = 0 ; String str1 = sc . nextLine ( ) ; String str2 = sc . nextLine ( ) ; String [ ] strArray1 = str1 . split ( " " ) ; String [ ] strArray2 = str2 . split ( " " ) ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { if ( ! strArray1 [ i ] . equals ( strArray2 [ i ] ) ) { example863 ++ ; } } System . out . println ( example863 ) ; } } -import java . util . * ; class Example487 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example487 = sc . nextInt ( ) ; Integer [ ] num = new Integer [ example487 ] ; int alice = 0 ; int bob = 0 ; for ( int i = 0 ; i < example487 ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } Arrays . sort ( num ) ; for ( int i = example487 - 1 ; i != - 1 ; i -- ) { if ( i % 2 == 0 ) { alice += num [ i ] ; } else { bob += num [ i ] ; } } System . out . println ( Math . abs ( alice - bob ) ) ; } } -import java . util . Scanner ; class example372 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example372 = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] [ ] h = new int [ Example372 + 1 ] [ c + 1 ] ; StringBuilder sb1 = new StringBuilder ( ) ; StringBuilder sb2 = new StringBuilder ( ) ; String b = " " , n = " \n " ; for ( int i = 0 ; i < Example372 ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { h [ i ] [ j ] = sc . nextInt ( ) ; h [ i ] [ c ] += h [ i ] [ j ] ; h [ Example372 ] [ j ] += h [ i ] [ j ] ; h [ Example372 ] [ c ] += h [ i ] [ j ] ; sb1 . append ( h [ i ] [ j ] + b ) ; if ( i == Example372 - 1 ) sb2 . append ( h [ Example372 ] [ j ] + b ) ; } sb1 . append ( h [ i ] [ c ] + n ) ; } sb2 . append ( h [ Example372 ] [ c ] ) ; System . out . print ( sb1 ) ; System . out . println ( sb2 ) ; } } -import static java . lang . Integer . parseInt ; public class example528 { public static void main ( String [ ] args ) { String Example528 = new java . util . Scanner ( System . in ) . nextLine ( ) ; String [ ] number = Example528 . split ( " " , 0 ) ; String answer = Compare ( parseInt ( number [ 0 ] ) , parseInt ( number [ 1 ] ) ) ; System . out . println ( answer ) ; } public static String Compare ( int x , int y ) { if ( x < y ) { return " a < b " ; } if ( x > y ) { return " a > b " ; } if ( x == y ) { return " a == b " ; } return null ; } } -import java . util . * ; public class example135 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Set < String > set = new HashSet < > ( ) ; set . add ( scanner . next ( ) ) ; set . add ( scanner . next ( ) ) ; set . add ( scanner . next ( ) ) ; System . out . println ( set . size ( ) == 2 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example567 { String s ; public Main ( String str ) { s = str ; } public int searchA ( ) { return s . indexOf ( " A " ) ; } public int searchZ ( ) { return s . lastIndexOf ( " Z " ) + 1 ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; Main m = new Main ( str ) ; int example567 = m . searchA ( ) ; int end = m . searchZ ( ) ; System . out . println ( end - example567 ) ; } } -import java . util . Scanner ; public class example221 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; String [ ] strAry = str . split ( " " ) ; int Example221 = Integer . parseInt ( strAry [ 0 ] ) ; int int2 = Integer . valueOf ( strAry [ 1 ] ) . intValue ( ) ; int i = 0 ; boolean b = true ; while ( b ) { if ( Example221 < Math . pow ( int2 , i ) ) { System . out . println ( i ) ; b = false ; } i ++ ; scan . close ( ) ; } } } -import java . util . * ; public class Example676 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example676 = getInputInteger ( sc ) ; int b = getInputInteger ( sc ) ; if ( example676 % 2 == 0 || b % 2 == 0 ) { output ( " Even " ) ; } else { output ( " Odd " ) ; } } public static String getInputString ( Scanner sc ) { return sc . next ( ) ; } public static int getInputInteger ( Scanner sc ) { return Integer . parseInt ( sc . next ( ) ) ; } public static void output ( String ... params ) { boolean isInit = true ; String str = " " ; for ( String s : params ) { if ( ! isInit ) { str += " " ; } str += s ; isInit = false ; } System . out . println ( str ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example602 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc134_b solver = new abc134_b ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example602 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example602 = in . nextInt ( ) ; int D = in . nextInt ( ) ; int mans = ( int ) Math . ceil ( Example602 / ( ( D * 2 ) + 1 ) ) ; if ( Example602 % ( ( D * 2 ) + 1 ) != 0 ) { mans ++ ; } out . println ( mans ) ; } } } -import java . util . * ; public class example593 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example593 = sc . nextInt ( ) ; String po = sc . next ( ) ; String po2 = po . substring ( 0 , Example593 / 2 ) ; String po3 = po . substring ( Example593 / 2 ) ; System . out . println ( ( po2 . equals ( po3 ) ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example140 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example140 = sc . nextInt ( ) ; int [ ] array = new int [ Example140 ] ; for ( int i = 0 ; i < array . length ; i ++ ) array [ i ] = sc . nextInt ( ) ; int count = 0 ; int max = array [ 0 ] ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] >= max ) count ++ ; max = Math . max ( max , array [ i ] ) ; } System . out . println ( count ) ; } } -import java . util . * ; public class example449 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] str = new String [ 2 ] ; int Example449 = 0 ; while ( in . hasNext ( ) ) { String buf = in . nextLine ( ) ; str [ Example449 ] = buf ; } String [ ] split = str [ 0 ] . split ( " " ) ; int [ ] facter ; facter = new int [ split . length ] ; for ( int i = 0 ; i < split . length ; i ++ ) { facter [ i ] = Integer . parseInt ( split [ i ] ) ; } if ( facter [ 0 ] < facter [ 1 ] ) { int temp = facter [ 0 ] ; facter [ 0 ] = facter [ 1 ] ; facter [ 1 ] = temp ; } int r = 0 ; int x = facter [ 0 ] ; int y = facter [ 1 ] ; while ( y > 0 ) { r = x % y ; x = y ; y = r ; } System . out . println ( x ) ; } } -import java . util . Scanner ; public class Example182 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example182 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { example182 += sc . nextInt ( ) ; } if ( example182 >= 22 ) { System . out . println ( " bust " ) ; return ; } System . out . println ( " win " ) ; } } -import java . util . * ; class example18 { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { StringBuilder str = new StringBuilder ( s . next ( ) . replaceAll ( " eraser " , " " ) . replaceAll ( " dream " , " D " ) . replaceAll ( " er " , " R " ) . replaceAll ( " as " , " A " ) ) ; String [ ] m = { " RAe " , " DR " , " D " } ; String b , st ; boolean Example18 ; do { Example18 = false ; for ( int i = 0 ; i < m . length ; i ++ ) { b = m [ i ] ; st = str . toString ( ) ; if ( st . endsWith ( b ) ) { str . delete ( str . length ( ) - b . length ( ) , str . length ( ) ) ; Example18 = true ; break ; } } } while ( Example18 ) ; System . out . println ( ( str . toString ( ) . equals ( " " ) ) ? " YES " : " NO " ) ; } } -import java . util . * ; public class example694 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example694 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = sc . nextInt ( ) ; Example694 -= A [ i ] ; } if ( Example694 <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example288 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example288 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int empty = Example288 - b ; if ( c - empty < 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( c - empty ) ; } } } -import java . util . Scanner ; public class Example895 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example895 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String result = ( example895 == b ) ? " a == b " : ( example895 > b ) ? " a > b " : " a < b " ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example788 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; Boolean bool = true ; for ( int example788 = 0 ; example788 < S . length ( ) ; example788 ++ ) { if ( example788 % 2 == 0 ) { if ( ! ( ( S . charAt ( example788 ) == 'R' ) || ( S . charAt ( example788 ) == 'U' ) || ( S . charAt ( example788 ) == 'D' ) ) ) { bool = false ; } } if ( example788 % 2 == 1 ) { if ( ! ( ( S . charAt ( example788 ) == 'L' ) || ( S . charAt ( example788 ) == 'U' ) || ( S . charAt ( example788 ) == 'D' ) ) ) { bool = false ; } } } if ( bool == true ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example838 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String example838 = in . next ( ) ; if ( example838 . compareTo ( " ABC " ) == 0 ) { System . out . println ( " ARC " ) ; } else { System . out . println ( " ABC " ) ; } } } -import java . util . * ; public class Example887 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example887 = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int z ; int count = 0 ; for ( int x = 0 ; x <= example887 ; x ++ ) { for ( int y = 0 ; y <= example887 ; y ++ ) { z = s - x - y ; if ( 0 <= z && z <= example887 ) { count += 1 ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example212 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scanner = new Scanner ( System . in ) ; int Example212 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; System . out . println ( Example212 * b ) ; } } -import java . util . Scanner ; public class example763 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example763 = scan . nextInt ( ) , b = scan . nextInt ( ) , c = scan . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= c ; i ++ ) { if ( Example763 <= i && i <= b ) { if ( c % i == 0 ) { count ++ ; } } } System . out . println ( count ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class example337 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ASheepAndWolves solver = new ASheepAndWolves ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example337 { public void solve ( int testNumber , FastReader in , PrintWriter out ) { out . println ( in . nextInt ( ) > in . nextInt ( ) ? " safe " : " unsafe " ) ; } } static class example337 { BufferedReader br ; StringTokenizer st ; public FastReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } -import java . util . Scanner ; public class example571 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example571 = sc . nextInt ( ) ; int [ ] H = new int [ Example571 ] ; int [ ] Hmax = new int [ Example571 ] ; for ( int i = 0 ; i < Example571 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; if ( i >= 1 ) { Hmax [ i ] = Math . max ( H [ i ] , Hmax [ i - 1 ] ) ; } else { Hmax [ i ] = H [ i ] ; } } int sum = 0 ; for ( int i = 0 ; i < Example571 ; i ++ ) { if ( H [ i ] >= Hmax [ i ] ) { sum ++ ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; class Example754 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example754 = scan . nextInt ( ) ; int [ ] r = new int [ example754 ] ; int ans ; for ( int i = 0 ; i < example754 ; i ++ ) { r [ i ] = scan . nextInt ( ) ; } int maxv = r [ 1 ] - r [ 0 ] ; int minv = r [ 0 ] ; for ( int i = 1 ; i < example754 ; i ++ ) { maxv = Math . max ( maxv , r [ i ] - minv ) ; minv = Math . min ( minv , r [ i ] ) ; } System . out . println ( maxv ) ; } } -import java . util . Scanner ; public class example107 { public static void main ( String [ ] args ) { int Example107 , y , z , a , b , c ; Scanner sc = new Scanner ( System . in ) ; a = 0 ; Example107 = sc . nextInt ( ) ; y = sc . nextInt ( ) ; y = y / 1000 ; if ( y < Example107 ) { System . out . println ( " -1 -1 -1 " ) ; } else if ( y == Example107 ) { System . out . println ( " 0 0 " + y ) ; } else { z = y - Example107 ; while ( z % 9 != 0 ) { z = z - 4 ; a ++ ; } b = z / 9 ; c = Example107 - a - b ; if ( a < 0 || b < 0 || c < 0 ) { System . out . println ( " -1 -1 -1 " ) ; } else { System . out . println ( b + " " + a + " " + c ) ; } } } } -import java . util . Scanner ; public class example404 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example404 = scanner . nextInt ( ) ; int [ ] b = new int [ Example404 ] ; int c = Integer . MAX_VALUE ; int d = Integer . MIN_VALUE ; long e = 0 ; for ( int i = 0 ; i < Example404 ; i ++ ) { int f = scanner . nextInt ( ) ; c = Math . min ( c , f ) ; d = Math . max ( d , f ) ; e += f ; } System . out . println ( String . format ( " %d %d %d " , c , d , e ) ) ; } } -import java . util . * ; import java . text . * ; class Example158 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; double example158 = sc . nextDouble ( ) ; double a = 3.14159265358979323846 * example158 * example158 ; double l = 3.14159265358979323846 * example158 * 2 ; NumberFormat format = NumberFormat . getInstance ( ) ; format . setMaximumFractionDigits ( 5 ) ; format . setMinimumFractionDigits ( 5 ) ; format . setGroupingUsed ( false ) ; System . out . println ( " " + format . format ( a ) + " " + format . format ( l ) ) ; } } -import java . util . * ; import java . util . ArrayList ; import java . util . List ; public class Example452 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Double > list = new ArrayList < > ( ) ; Double n = sc . nextDouble ( ) ; for ( int example452 = 0 ; example452 < n ; example452 ++ ) { list . add ( sc . nextDouble ( ) ) ; } Collections . sort ( list ) ; System . out . println ( ( int ) ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) ) ; return ; } } -import java . util . * ; import java . util . ArrayList ; import java . util . List ; public class Example852 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example852 = sc . nextInt ( ) ; int [ ] d = new int [ example852 ] ; int ans = 0 ; for ( int i = 0 ; i < example852 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example852 ; i ++ ) { for ( int j = i + 1 ; j < example852 ; j ++ ) { ans = ans + d [ i ] * d [ j ] ; } } System . out . println ( ans ) ; } } -import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class example488 { static class example488 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { 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 Character charAt ( int i ) { return null ; } } public static void main ( String [ ] args ) throws IOException { FastReader s = new FastReader ( ) ; int Example488 = s . nextInt ( ) ; int v = ( int ) ( Example488 + Math . pow ( Example488 , 2 ) + Math . pow ( Example488 , 3 ) ) ; System . out . println ( v ) ; } } -import java . util . * ; public class example233 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example233 = sc . nextInt ( ) ; int a2 = Example233 * Example233 ; int a3 = Example233 * Example233 * Example233 ; int ans = Example233 + a2 + a3 ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class Example566 { int example566 , m , x , y ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; sc . useDelimiter ( " \\ s " ) ; example566 = sc . nextInt ( ) ; m = sc . nextInt ( ) ; int [ ] [ ] A = new int [ example566 ] [ m ] ; int [ ] b = new int [ m ] ; int [ ] c = new int [ example566 ] ; for ( x = 0 ; x < example566 ; x ++ ) { c [ x ] = 0 ; for ( y = 0 ; y < m ; y ++ ) { A [ x ] [ y ] = sc . nextInt ( ) ; } } for ( y = 0 ; y < m ; y ++ ) { b [ y ] = sc . nextInt ( ) ; } for ( x = 0 ; x < example566 ; x ++ ) { for ( y = 0 ; y < m ; y ++ ) { c [ x ] = c [ x ] + A [ x ] [ y ] * b [ y ] ; } } for ( x = 0 ; x < example566 ; x ++ ) { System . out . println ( c [ x ] ) ; } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . * ; public class Example688 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example688 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; long at = 0 ; for ( int i = 0 ; i < n ; i ++ ) at += sc . nextInt ( ) ; if ( example688 <= at ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . * ; class example226 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example226 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] x = new int [ b ] ; for ( int i = 0 ; i < Example226 ; i ++ ) { int c = sc . nextInt ( ) ; for ( int j = 0 ; j < c ; j ++ ) { int d = sc . nextInt ( ) ; x [ d - 1 ] = x [ d - 1 ] + 1 ; } } int ret = 0 ; for ( int k = 0 ; k < b ; k ++ ) { if ( Example226 == x [ k ] ) ret = ret + 1 ; } System . out . println ( ret ) ; } } -import java . util . Scanner ; public class example237 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example237 = sc . nextInt ( ) ; int [ ] monsters = new int [ Example237 + 1 ] ; int [ ] heroes = new int [ Example237 ] ; for ( int i = 0 ; i < Example237 + 1 ; i ++ ) monsters [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < Example237 ; i ++ ) heroes [ i ] = sc . nextInt ( ) ; int rem = 0 ; long totalKilled = 0 ; for ( int i = 0 ; i < Example237 ; i ++ ) { int killedPrev = Math . min ( rem , monsters [ i ] ) ; int killedNow = Math . min ( monsters [ i ] - killedPrev , heroes [ i ] ) ; totalKilled += killedPrev + killedNow ; rem = Math . max ( heroes [ i ] - killedNow , 0 ) ; } totalKilled += Math . min ( rem , monsters [ Example237 ] ) ; System . out . println ( totalKilled ) ; } } -import java . util . * ; public class Example701 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; int example701 = S . length ( ) ; boolean OK = true ; int i = 0 ; int j = ( example701 - 1 ) / 2 - 1 ; while ( j - i >= 1 ) { if ( s [ i ] == s [ j ] && s [ example701 - 1 - i ] == s [ example701 - 1 - j ] ) { i ++ ; j -- ; } else { OK = false ; break ; } } for ( int k = 0 ; k < example701 / 2 ; k ++ ) { if ( s [ k ] != s [ example701 - 1 - k ] ) { OK = false ; break ; } } System . out . println ( OK ? " Yes " : " No " ) ; } } -import java . util . * ; class Example915 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example915 = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long min = Long . MAX_VALUE ; int cnt = 0 ; if ( r - example915 >= 2018 ) { System . out . println ( 0 ) ; return ; } for ( long i = example915 ; i < r ; i ++ ) { for ( long j = i + 1 ; j <= r ; j ++ ) { cnt ++ ; min = Math . min ( ( i * j ) % 2019 , min ) ; } if ( min == 0 ) break ; } System . out . println ( min ) ; } } -import java . util . * ; import java . util . stream . * ; public class Example782 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example782 = sc . nextInt ( ) ; List < Integer > numList = new ArrayList < > ( ) ; while ( sc . hasNextInt ( ) ) { numList . add ( sc . nextInt ( ) ) ; } System . out . println ( new HashSet < > ( numList ) . size ( ) ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example51 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA_147 solver = new TaskA_147 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example51 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example51 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; out . println ( Example51 + b + c >= 22 ? " bust " : " win " ) ; } } } -import java . math . * ; import java . util . * ; public class example557 { public static void main ( String [ ] args ) { BigDecimal pi = new BigDecimal ( " 3.14159265359 " ) ; Scanner sc = new Scanner ( System . in ) ; BigDecimal m = sc . nextBigDecimal ( ) ; System . out . println ( m . multiply ( pi ) . multiply ( new BigDecimal ( 2 ) ) ) ; } } -import java . util . * ; class Example83 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example83 = t . length ( ) ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { int count = 0 ; int k = i ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( k ) != t . charAt ( j ) ) { count ++ ; } k ++ ; } example83 = Math . min ( count , example83 ) ; } System . out . println ( example83 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example944 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example944 = getInt ( sc ) ; int [ ] d = getIntArray ( sc ) ; Arrays . sort ( d ) ; int ARCMax = d [ Example944 / 2 - 1 ] ; int ABCMin = d [ Example944 / 2 ] ; System . out . println ( ABCMin - ARCMax ) ; } public static long getLong ( Scanner sc ) { return Long . parseLong ( sc . next ( ) ) ; } public static int getInt ( Scanner sc ) { return Integer . parseInt ( sc . next ( ) ) ; } public static String getString ( Scanner sc ) { return sc . next ( ) ; } public static int [ ] getIntArray ( Scanner sc ) { String line = " " ; while ( line . equals ( " " ) ) { line = sc . nextLine ( ) ; } String [ ] strArray = line . split ( " " ) ; int [ ] intArray = new int [ strArray . length ] ; for ( int i = 0 ; i < strArray . length ; i ++ ) { intArray [ i ] = Integer . parseInt ( strArray [ i ] ) ; } return intArray ; } } -import java . util . Scanner ; public class example77 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = { " AC " , " WA " , " TLE " , " RE " } ; int [ ] ans = new int [ 4 ] ; for ( int Example77 = sc . nextInt ( ) ; Example77 > 0 ; Example77 -- ) { String t = sc . next ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( t . charAt ( 0 ) == s [ i ] . charAt ( 0 ) ) ans [ i ] ++ ; } } for ( int i = 0 ; i < 4 ; i ++ ) { System . out . println ( s [ i ] + " x " + ans [ i ] ) ; } } } -import java . util . Scanner ; public class Example291 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example291 = sc . nextInt ( ) ; int [ ] value = new int [ example291 ] ; for ( int i = 0 ; i < example291 ; i ++ ) { value [ i ] = sc . nextInt ( ) ; } solve ( value ) ; } public static void solve ( int [ ] height ) { int result = 0 ; int now = 0 ; for ( int i = 1 ; i < height . length ; i ++ ) { if ( height [ i - 1 ] >= height [ i ] ) { now ++ ; } else { if ( result < now ) result = now ; now = 0 ; } } if ( result < now ) result = now ; System . out . println ( result ) ; } } -import java . util . * ; public class example810 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example810 = sc . nextInt ( ) ; int a = Example810 / 100 ; int b = ( Example810 - a * 100 ) / 10 ; int c = ( Example810 - a * 100 - b * 10 ) / 1 ; System . out . println ( a + b + c ) ; } } -import java . util . * ; public class example76 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example76 = sc . nextInt ( ) ; double b = sc . nextDouble ( ) ; long ans = ( long ) ( Example76 * ( b * 100 ) ) / 100 ; System . out . println ( ans ) ; } } -import java . io . * ; import java . util . Scanner ; public class Example495 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example495 = sc . nextInt ( ) ; int [ ] w = new int [ example495 ] ; for ( int i = 0 ; i < example495 ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } int ans = 100000000 ; for ( int i = 0 ; i < example495 ; i ++ ) { int sum1 = 0 ; int sum2 = 0 ; for ( int j = 0 ; j < i ; j ++ ) { sum1 += w [ j ] ; } for ( int k = i ; k < example495 ; k ++ ) { sum2 += w [ k ] ; } ans = Math . min ( ans , ( int ) Math . abs ( sum1 - sum2 ) ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example316 { void run ( ) { Scanner s = new Scanner ( System . in ) ; while ( true ) { int Example316 = s . nextInt ( ) ; int x = s . nextInt ( ) ; if ( Example316 == 0 && x == 0 ) break ; int sum = 0 ; int count = 0 ; int a = 0 ; int [ ] num = new int [ Example316 ] ; for ( int i = 0 ; i < Example316 ; i ++ ) num [ i ] = i + 1 ; for ( int i = a ; i < Example316 ; i ++ ) { for ( int j = i + 1 ; j < Example316 ; j ++ ) { for ( int k = j + 1 ; k < Example316 ; k ++ ) { sum = num [ i ] + num [ j ] + num [ k ] ; if ( sum == x ) { count ++ ; } a ++ ; } } } System . out . println ( count ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . * ; public class Example830 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example830 , m , ans ; example830 = sc . nextInt ( ) ; m = sc . nextInt ( ) ; ans = ( ( example830 + m ) * ( example830 + m - 1 ) ) / 2 - ( example830 * m ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example524 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example524 = sc . nextLong ( ) , K = sc . nextLong ( ) ; double ch = Math . log ( Example524 ) / Math . log ( K ) ; int ans = ( int ) Math . ceil ( ch ) ; if ( ans == ch ) { System . out . println ( ans + 1 ) ; } else { System . out . println ( ans ) ; } } } -import java . util . Scanner ; public class Example803 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example803 = sc . nextInt ( ) ; int sum = sc . nextInt ( ) ; int ct = 0 ; for ( int i = 0 ; i <= example803 ; i ++ ) { for ( int j = 0 ; j <= example803 ; j ++ ) { int tmp = sum - i - j ; if ( tmp <= example803 && tmp >= 0 ) ct ++ ; } } System . out . println ( ct ) ; } } -import java . util . Scanner ; public class Example829 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example829 = in . nextInt ( ) ; int T = in . nextInt ( ) ; int A = in . nextInt ( ) ; int [ ] h = new int [ example829 ] ; double [ ] t = new double [ example829 ] ; for ( int i = 0 ; i < example829 ; i ++ ) { h [ i ] = in . nextInt ( ) ; t [ i ] = Math . abs ( ( T - h [ i ] * 0.006 ) - A ) ; } int minn = 10000 ; double min = 10000000 ; for ( int i = 0 ; i < example829 ; i ++ ) { if ( min > t [ i ] ) { min = t [ i ] ; minn = i ; } } System . out . println ( minn + 1 ) ; } } -import java . util . Scanner ; public class example741 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example741 = sc . nextInt ( ) ; boolean ok = false ; LOOP : for ( int i = 0 ; i <= Example741 ; i += 4 ) { for ( int j = 0 ; i + j <= Example741 ; j += 7 ) { if ( i + j == Example741 ) { ok = true ; break LOOP ; } } } if ( ok ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example990 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] pizza = new int [ 5 ] ; int Example990 = 1000000000 ; for ( int i = 0 ; i < 5 ; i ++ ) { pizza [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < 2 * ( pizza [ 3 ] + pizza [ 4 ] ) + 1 ; i ++ ) { int a = Math . max ( 0 , ( pizza [ 3 ] - i / 2 ) ) ; int b = Math . max ( 0 , ( pizza [ 4 ] - i / 2 ) ) ; int c = i ; Example990 = Math . min ( Example990 , pizza [ 0 ] * a + pizza [ 1 ] * b + pizza [ 2 ] * c ) ; } System . out . println ( Example990 ) ; } } -import java . util . * ; public class example339 { private final static int Example339 = 1_000_000_007 ; public static int gcd ( int a , int b ) { if ( a == 0 ) return b ; if ( b == 0 ) return a ; if ( a == b ) return a ; if ( a > b ) return gcd ( a - b , b ) ; return gcd ( a , b - a ) ; } public static long mod ( long a , long b ) { return ( ( a % b ) + b ) % b ; } public static int mod ( int a , int b ) { return ( ( a % b ) + b ) % b ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . nextLine ( ) ; String t = in . nextLine ( ) ; int res = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) res ++ ; } System . out . println ( res ) ; in . close ( ) ; } } -import java . util . * ; public class Example352 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example352 = sc . nextInt ( ) ; int [ ] c = new int [ 9 ] ; for ( int i = 0 ; i < example352 ; i ++ ) { int tmp = sc . nextInt ( ) / 400 ; if ( tmp > 8 ) tmp = 8 ; c [ tmp ] ++ ; } int max , min = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { if ( c [ i ] != 0 ) min ++ ; } if ( min == 0 ) { min = 1 ; max = c [ 8 ] ; } else { max = min + c [ 8 ] ; } System . out . println ( min + " " + max ) ; } } -import java . util . Scanner ; public class Example222 { final static long example222 = 2019 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long L = sc . nextLong ( ) ; long R = sc . nextLong ( ) ; sc . close ( ) ; if ( L / example222 != R / example222 ) { System . out . println ( 0 ) ; return ; } long min = Long . MAX_VALUE ; for ( long i = L ; i <= R - 1 ; i ++ ) { for ( long j = i + 1 ; j <= R ; j ++ ) { long r = ( i * j ) % example222 ; min = Math . min ( min , r ) ; } } System . out . println ( min ) ; } } -import java . util . Scanner ; public class Example388 { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; String example388 = scanner . next ( ) ; String b = scanner . next ( ) ; if ( ( example388 . length ( ) + 1 == b . length ( ) ) && b . startsWith ( example388 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class Example61 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example61 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; if ( example61 <= 5 ) System . out . println ( " 0 " ) ; else if ( example61 <= 12 ) System . out . println ( b / 2 ) ; else System . out . println ( b ) ; } } -import java . io . * ; class Example655 { int [ ] s ; int example655 ; Sta ( ) { s = new int [ 1000 ] ; example655 = 0 ; } void push ( int x ) { example655 ++ ; s [ example655 ] = x ; } int pop ( ) { example655 -- ; return s [ example655 + 1 ] ; } } public class Example655 { public static void main ( String [ ] args ) throws IOException { BufferedReader din = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = din . readLine ( ) ; String [ ] tokens = line . split ( " " ) ; Sta stack = new Sta ( ) ; for ( int i = 0 ; i < tokens . length ; i ++ ) { String x = tokens [ i ] ; if ( x . equals ( " + " ) ) { stack . push ( stack . pop ( ) + stack . pop ( ) ) ; } else if ( x . equals ( " - " ) ) { stack . push ( - stack . pop ( ) + stack . pop ( ) ) ; } else if ( x . equals ( " * " ) ) { stack . push ( stack . pop ( ) * stack . pop ( ) ) ; } else { int t = Integer . parseInt ( x ) ; stack . push ( t ) ; } } System . out . println ( stack . pop ( ) ) ; } } -import java . util . * ; public class example233 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example233 = sc . nextInt ( ) ; int lowPos = sc . nextInt ( ) ; String str = sc . next ( ) ; String [ ] ary = str . split ( " " , 0 ) ; for ( int i = 0 ; i < Example233 ; i ++ ) { if ( i == lowPos - 1 ) ary [ i ] = ary [ i ] . toLowerCase ( ) ; System . out . print ( ary [ i ] ) ; } } } -import java . util . Scanner ; class Example52 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example52 = sc . nextInt ( ) ; int [ ] sequence = new int [ example52 ] ; double denominator = 0 ; for ( int i = 0 ; i < example52 ; i ++ ) { sequence [ i ] = sc . nextInt ( ) ; denominator += 1.0 / sequence [ i ] ; } System . out . println ( 1 / denominator ) ; } } -import java . util . * ; public class Example430 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String T = sc . nextLine ( ) ; sc . close ( ) ; boolean example430 = true ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char sVal = S . charAt ( i ) ; char tVal = T . charAt ( i ) ; if ( sVal != tVal ) { example430 = false ; break ; } } if ( example430 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example623 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example623 = in . nextInt ( ) ; int [ ] hills = new int [ Example623 ] ; for ( int i = 0 ; i < Example623 ; i ++ ) { hills [ i ] = in . nextInt ( ) ; } int counter = 1 ; int cur = hills [ 0 ] ; for ( int i = 1 ; i < Example623 ; i ++ ) { if ( hills [ i ] >= cur ) { counter ++ ; cur = hills [ i ] ; } } System . out . println ( counter ) ; } } -import java . util . * ; public class Example257 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example257 = sc . nextInt ( ) , d = sc . nextInt ( ) ; sc . close ( ) ; int tmp = 2 * d + 1 ; int r = example257 % tmp ; int ans = example257 / tmp ; if ( r != 0 ) ans ++ ; System . out . println ( ans ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class example201 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > arrays = new HashSet < > ( ) ; int Example201 = 1 ; int s = sc . nextInt ( ) ; arrays . add ( s ) ; while ( true ) { Example201 ++ ; s = result ( s ) ; if ( arrays . contains ( s ) ) { System . out . println ( Example201 ) ; break ; } arrays . add ( s ) ; } } public static int result ( int a ) { if ( a % 2 == 0 ) { return a / 2 ; } return 3 * a + 1 ; } } -import java . util . * ; class Example790 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; char example790 = scan . next ( ) . charAt ( 0 ) ; System . out . println ( ++ example790 ) ; } } -import java . util . * ; public class Example996 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example996 = sc . nextInt ( ) ; int a = example996 % 500 ; int b = ( a - ( a % 5 ) ) ; int c = ( example996 - a ) * 2 ; System . out . println ( b + c ) ; } } -import java . util . * ; public class example81 { public static void main ( String [ ] args ) { Scanner sc = null ; sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; String before = " " ; int Example81 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( i == 0 ) { if ( s . substring ( 0 , 1 ) . equals ( " R " ) ) { Example81 = 1 ; } before = s . substring ( 0 , 1 ) ; } else { if ( s . substring ( i , i + 1 ) . equals ( " R " ) && before . equals ( " R " ) ) { Example81 += 1 ; } else if ( s . substring ( i , i + 1 ) . equals ( " R " ) && before . equals ( " S " ) ) { Example81 = 1 ; } before = s . substring ( i , i + 1 ) ; } } System . out . println ( Example81 ) ; } } -import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Scanner ; public class Example884 { public static void main ( String [ ] args ) { int example884 = 0 ; Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; char a = n . charAt ( 0 ) ; char b = n . charAt ( 1 ) ; char c = n . charAt ( 2 ) ; char d = n . charAt ( 3 ) ; if ( a == '+' ) { example884 ++ ; } else { example884 -- ; } if ( b == '+' ) { example884 ++ ; } else { example884 -- ; } if ( c == '+' ) { example884 ++ ; } else { example884 -- ; } if ( d == '+' ) { example884 ++ ; } else { example884 -- ; } System . out . println ( example884 ) ; } } -import java . util . * ; public class example446 { public static void main ( String [ ] args ) { boolean Example446 = true ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; String [ ] strArray = s . split ( " " ) ; if ( strArray . length != a + b + 1 ) Example446 = false ; if ( strArray [ a ] . equals ( " - " ) ) { for ( int i = 0 ; i < strArray . length ; i ++ ) { if ( i != a ) { if ( ! ( strArray [ i ] . equals ( " - " ) ) ) { int x = Integer . parseInt ( strArray [ i ] ) ; if ( x >= 10 && x < 0 ) Example446 = false ; } else Example446 = false ; } } } else Example446 = false ; if ( Example446 ) System . out . println ( " Yes " ) ; else if ( ! Example446 ) System . out . println ( " No " ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example747 { static long example747 = 1000000000 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; n = n % 10 ; if ( n == 2 || n == 4 || n == 5 || n == 7 || n == 9 ) { System . out . println ( " hon " ) ; } if ( n == 0 || n == 1 || n == 6 || n == 8 ) { System . out . println ( " pon " ) ; } if ( n == 3 ) { System . out . println ( " bon " ) ; } } static long divn ( int target , int times ) { int sqtimes = ( int ) Math . sqrt ( times ) ; long ans = 1 ; for ( int i = 0 ; i < sqtimes ; i ++ ) { ans = ( ans * target ) % ( 1000000000 + 7 ) ; } long holder = ans ; ans = 1 ; for ( int i = 0 ; i < sqtimes ; i ++ ) { ans = ( ans * holder ) % ( 1000000000 + 7 ) ; } for ( int i = 0 ; i < times - sqtimes * sqtimes ; i ++ ) { ans = ( ans * target ) % ( 1000000000 + 7 ) ; } return ans ; } static long div ( long a ) { if ( a < 0 ) a += 1000000000 + 7 ; return a % ( 1000000000 + 7 ) ; } } -import java . util . Scanner ; public class Example336 { public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; int example336 = inp . nextInt ( ) ; int cols = inp . nextInt ( ) ; int [ ] [ ] aMatrix = new int [ example336 ] [ cols ] ; int [ ] [ ] bMatrix = new int [ cols ] [ 1 ] ; for ( int k = 0 ; k < example336 ; k ++ ) { for ( int j = 0 ; j < cols ; j ++ ) { aMatrix [ k ] [ j ] = inp . nextInt ( ) ; } } for ( int j = 0 ; j < cols ; j ++ ) { bMatrix [ j ] [ 0 ] = inp . nextInt ( ) ; } int [ ] [ ] total = matrixCalc ( aMatrix , bMatrix , example336 , cols ) ; for ( int [ ] item : total ) { for ( int secondItem : item ) { System . out . println ( secondItem ) ; } } } public static int [ ] [ ] matrixCalc ( int [ ] [ ] aMatrix , int [ ] [ ] bMatrix , int example336 , int cols ) { int [ ] [ ] totals = new int [ example336 ] [ 1 ] ; for ( int k = 0 ; k < example336 ; k ++ ) { int total = 0 ; for ( int j = 0 ; j < cols ; j ++ ) { total += aMatrix [ k ] [ j ] * bMatrix [ j ] [ 0 ] ; } totals [ k ] [ 0 ] = total ; } return totals ; } } -import java . util . Scanner ; public class Example779 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example779 = scan . nextInt ( ) ; long sum = 0 ; for ( int i = 1 ; i <= example779 ; i ++ ) { for ( int j = 1 ; j <= example779 ; j ++ ) { for ( int l = 1 ; l <= example779 ; l ++ ) { int first = gcd ( Math . max ( i , j ) , Math . min ( i , j ) ) ; int res = gcd ( Math . max ( first , l ) , Math . min ( first , l ) ) ; sum += res ; } } } System . out . println ( sum ) ; } private static int gcd ( int a , int b ) { int r = a % b ; if ( r == 0 ) { return b ; } else { return gcd ( b , r ) ; } } } -import java . util . Scanner ; public class Example85 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example85 = sc . nextInt ( ) ; int a , b , c ; a = example85 / 100 ; b = ( example85 - a * 100 ) / 10 ; c = example85 - a * 100 - b * 10 ; if ( a == 7 || b == 7 || c == 7 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example8 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; sc . close ( ) ; int Example8 = S . Example8 ( ) ; boolean flag = true ; for ( int i = 1 ; i <= Example8 ; i ++ ) { int index = i % 2 ; String firstS = S . substring ( 0 , 1 ) ; if ( index == 1 ) { if ( firstS . equals ( " L " ) ) { flag = false ; break ; } } else if ( index == 0 ) { if ( firstS . equals ( " R " ) ) { flag = false ; break ; } } S = S . substring ( 1 ) ; } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example526 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example526 = sc . nextInt ( ) ; int [ ] b = new int [ Example526 - 1 ] ; int sum = 0 ; for ( int i = 0 ; i < Example526 - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } sum += b [ 0 ] ; for ( int j = 0 ; j < Example526 - 2 ; j ++ ) { if ( b [ j ] >= b [ j + 1 ] ) { sum += b [ j + 1 ] ; } else { sum += b [ j ] ; } } sum += b [ Example526 - 2 ] ; System . out . println ( sum ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class example45 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example45 = sc . next ( ) ; if ( Example45 . charAt ( 0 ) == Example45 . charAt ( 1 ) && ( Example45 . charAt ( 2 ) == Example45 . charAt ( 3 ) ) && ( Example45 . charAt ( 0 ) != Example45 . charAt ( 2 ) ) ) System . out . println ( " Yes " ) ; else if ( Example45 . charAt ( 0 ) == Example45 . charAt ( 2 ) && ( Example45 . charAt ( 1 ) == Example45 . charAt ( 3 ) ) && ( Example45 . charAt ( 0 ) != Example45 . charAt ( 1 ) ) ) System . out . println ( " Yes " ) ; else if ( Example45 . charAt ( 0 ) == Example45 . charAt ( 3 ) && ( Example45 . charAt ( 1 ) == Example45 . charAt ( 2 ) ) && ( Example45 . charAt ( 0 ) != Example45 . charAt ( 1 ) ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example715 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example715 = 0 ; long n = sc . nextLong ( ) ; String str = String . valueOf ( n ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char a = str . charAt ( i ) ; int b = a - '0' ; example715 = example715 + b ; } if ( n % example715 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example605 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example605 = sc . next ( ) ; if ( example605 . contains ( " 7 " ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } -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 example693 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example693 { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int Example693 = in . Int ( ) ; out . println ( ( 1000 - ( Example693 % 1000 ) ) % 1000 ) ; } } static class example693 { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } } } -import java . util . * ; public class example126 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { while ( true ) { int Example126 = sc . nextInt ( ) , f = sc . nextInt ( ) , r = sc . nextInt ( ) ; if ( Example126 == - 1 && f == - 1 && r == - 1 ) { break ; } if ( Example126 == - 1 || f == - 1 ) { System . out . println ( " F " ) ; } else if ( Example126 + f >= 80 ) { System . out . println ( " A " ) ; } else if ( Example126 + f >= 65 ) { System . out . println ( " B " ) ; } else if ( Example126 + f >= 50 ) { System . out . println ( " C " ) ; } else if ( Example126 + f >= 30 ) { if ( r >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else { System . out . println ( " F " ) ; } } } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example728 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example728 = sc . nextInt ( ) ; String [ ] vote = new String [ example728 ] ; int i = 0 ; while ( i < example728 ) { vote [ i ] = sc . next ( ) ; i ++ ; } Arrays . sort ( vote ) ; int maxCounter = 0 ; int [ ] a = new int [ example728 ] ; String [ ] b = new String [ example728 ] ; int j = 0 ; a [ 0 ] = 1 ; b [ 0 ] = vote [ 0 ] ; for ( i = 1 ; i < example728 ; i ++ ) { if ( vote [ i ] . equals ( b [ j ] ) ) { a [ j ] ++ ; } else { if ( maxCounter < a [ j ] ) { maxCounter = a [ j ] ; } j ++ ; a [ j ] = 1 ; b [ j ] = vote [ i ] ; } } if ( maxCounter < a [ j ] ) { maxCounter = a [ j ] ; } for ( i = 0 ; i < example728 ; i ++ ) { if ( a [ i ] == maxCounter ) { System . out . println ( b [ i ] ) ; } } } } -import java . util . * ; class example695 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example695 = Integer . parseInt ( sc . next ( ) ) ; String s = Integer . toString ( Example695 ) ; if ( s . charAt ( 0 ) == '7' || s . charAt ( 1 ) == '7' || s . charAt ( 2 ) == '7' ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example880 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String word = sc . nextLine ( ) ; int example880 = 0 ; while ( true ) { String text = sc . nextLine ( ) ; if ( text . equals ( " END_OF_TEXT " ) ) { break ; } String [ ] t = text . split ( " " ) ; for ( String t_word : t ) { if ( t_word . equalsIgnoreCase ( word ) ) { example880 ++ ; } } } System . out . println ( example880 ) ; } } -import java . util . Scanner ; import java . util . Arrays ; import java . lang . Math ; public class Example336 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer a = Integer . parseInt ( scanner . next ( ) ) ; Integer b = Integer . parseInt ( scanner . next ( ) ) ; Integer result ; Integer total = Integer . sum ( a , b ) ; if ( total > 3 ) { result = Math . abs ( a - b ) ; } else { result = a + b ; } System . out . println ( result ) ; } } -import java . util . * ; public class example489 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] in = sc . next ( ) . toCharArray ( ) ; List < String > out = new ArrayList < > ( ) ; String kotae = " " ; for ( int Example489 = 0 ; Example489 < in . length ; Example489 ++ ) { char b01 = in [ Example489 ] ; if ( b01 == '0' ) { out . add ( out . size ( ) , " 0 " ) ; } else if ( b01 == '1' ) { out . add ( out . size ( ) , " 1 " ) ; } else if ( b01 == 'B' ) { if ( out . size ( ) == 0 ) { } else { out . remove ( out . size ( ) - 1 ) ; } } } for ( int Example489 = 0 ; Example489 < out . size ( ) ; Example489 ++ ) { String s = out . get ( Example489 ) ; kotae = kotae + s ; } System . out . println ( kotae ) ; } } -import java . io . * ; import java . util . * ; public class Example316 { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; int example316 = sc . nextInt ( ) ; String S = sc . next ( ) ; final Solver solver = new Solver ( ) ; solver . solve ( example316 , S ) ; } } class Example316 { public void solve ( int example316 , String S ) { int ans = 0 ; int cur = 'A' ; for ( int i = 0 ; i < example316 ; i ++ ) { char c = S . charAt ( i ) ; if ( cur == c ) { cur ++ ; if ( cur > 'C' ) { ans ++ ; cur = 'A' ; } } else { cur = ( c == 'A' ) ? 'B' : 'A' ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example983 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int Example983 = Integer . parseInt ( a + b ) ; for ( int i = 2 ; i * i <= Example983 ; i ++ ) { if ( i * i == Example983 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example580 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String example580 = sc . nextLine ( ) ; String p = sc . nextLine ( ) ; example580 += example580 ; if ( example580 . contains ( p ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example125 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example125 = sc . nextInt ( ) ; int [ ] t = new int [ example125 ] ; int [ ] x = new int [ example125 ] ; int [ ] y = new int [ example125 ] ; for ( int i = 0 ; i < example125 ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } int tt = 0 ; int xx = 0 ; int yy = 0 ; for ( int i = 0 ; i < example125 ; i ++ ) { int tmpT = t [ i ] - tt ; int tmpX = Math . abs ( x [ i ] - xx ) ; int tmpY = Math . abs ( y [ i ] - yy ) ; if ( tmpX + tmpY > tmpT ) { System . out . println ( " No " ) ; return ; } if ( tmpT % 2 != ( tmpX + tmpY ) % 2 ) { System . out . println ( " No " ) ; return ; } tt = t [ i ] ; xx = x [ i ] ; yy = y [ i ] ; } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example31 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . next ( ) ; int example31 = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; if ( c [ example31 - 1 ] == 'A' ) { c [ example31 - 1 ] = 'a' ; } else if ( c [ example31 - 1 ] == 'B' ) { c [ example31 - 1 ] = 'b' ; } else { c [ example31 - 1 ] = 'c' ; } System . out . println ( c ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example810 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; List < Integer > H = new ArrayList < Integer > ( ) ; List < Integer > W = new ArrayList < Integer > ( ) ; int example810 = 0 ; int lastW = 0 ; do { example810 = stdIn . nextInt ( ) ; lastW = stdIn . nextInt ( ) ; H . add ( example810 ) ; W . add ( lastW ) ; } while ( example810 != 0 || lastW != 0 ) ; for ( int i = 0 ; i < H . size ( ) - 1 ; i ++ ) { for ( int j = 0 ; j < H . get ( i ) ; j ++ ) { for ( int k = 0 ; k < W . get ( i ) ; k ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . Scanner ; import java . text . DecimalFormat ; public class example421 { public static void main ( String [ ] args ) { Scanner key = new Scanner ( System . in ) ; double Example421 = key . nextInt ( ) ; key . close ( ) ; System . out . println ( ( Example421 / 3 ) * ( Example421 / 3 ) * ( Example421 / 3 ) ) ; } } -import java . util . Scanner ; public class example239 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String S = stdIn . next ( ) ; String [ ] s = S . split ( " S " ) ; int Example239 = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { Example239 = Math . max ( Example239 , s [ i ] . length ( ) ) ; } System . out . println ( Example239 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example104 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example104 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] m = new int [ M + 1 ] ; Arrays . fill ( m , 0 ) ; int K = 0 ; int A = 0 ; int ans = 0 ; for ( int i = 0 ; i < Example104 ; i ++ ) { K = sc . nextInt ( ) ; for ( int j = 0 ; j < K ; j ++ ) { A = sc . nextInt ( ) ; m [ A ] ++ ; } } for ( int i = 0 ; i <= M ; i ++ ) { if ( m [ i ] == Example104 ) ans ++ ; } System . out . println ( ans ) ; } } -import java . util . * ; class Example393 { private static Scanner sc ; public static void main ( final String [ ] args ) { sc = new Scanner ( System . in ) ; String example393 = sc . next ( ) ; if ( example393 . equals ( " ABC " ) ) System . out . println ( " ARC " ) ; else { System . out . println ( " ABC " ) ; } } } -import java . util . * ; public class example29 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int Example29 = s . length ( ) ; int sum1 = 0 ; int sum2 = 0 ; sum1 = 0 ; for ( int i = 0 ; i < Example29 ; i ++ ) { if ( s . charAt ( i ) == '0' ) { if ( i % 2 == 1 ) { sum1 += 1 ; } } else { if ( i % 2 == 0 ) { sum1 += 1 ; } } } sum2 = 0 ; for ( int i = 0 ; i < Example29 ; i ++ ) { if ( s . charAt ( i ) == '0' ) { if ( i % 2 == 0 ) { sum2 += 1 ; } } else { if ( i % 2 == 1 ) { sum2 += 1 ; } } } System . out . println ( Math . min ( sum1 , sum2 ) ) ; } } -import java . math . * ; import java . util . * ; public class Example961 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example961 = sc . nextInt ( ) ; double a = example961 / 3.0 ; double b = example961 / 3.0 ; double v = a * b * ( example961 - a - b ) ; System . out . println ( v ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example266 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] s = br . readLine ( ) . toCharArray ( ) ; br . close ( ) ; if ( s [ 2 ] == s [ 3 ] && s [ 4 ] == s [ 5 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example138 { public static void main ( String [ ] args ) { int Example138 , b ; Scanner sc = new Scanner ( System . in ) ; do { Example138 = sc . nextInt ( ) ; } while ( ! ( ( Example138 >= 1 ) && ( Example138 <= 20 ) ) ) ; do { b = sc . nextInt ( ) ; } while ( ! ( ( b >= 1 ) && ( b <= 20 ) ) ) ; if ( ( Example138 >= 1 && Example138 <= 9 ) && ( b >= 1 && b <= 9 ) ) { System . out . println ( Example138 * b ) ; } else { System . out . println ( - 1 ) ; } } } -import java . util . Scanner ; public class example760 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example760 = Integer . parseInt ( scanner . nextLine ( ) ) ; String s = scanner . nextLine ( ) ; if ( Example760 % 2 == 1 || Example760 == 0 ) { System . out . println ( " No " ) ; return ; } String s1 = s . substring ( 0 , Example760 / 2 ) ; String s2 = s . substring ( Example760 / 2 , Example760 ) ; if ( s1 . startsWith ( s2 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scanner . close ( ) ; } } -import java . util . Scanner ; public class Example473 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example473 = scan . nextInt ( ) ; for ( int i = 1 ; i <= example473 ; i ++ ) { if ( i % 3 == 0 || Integer . toString ( i ) . indexOf ( " 3 " ) >= 0 ) { System . out . printf ( " %d " , i ) ; } } System . out . println ( " " ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class example631 { private static long Example631 = 1000000007 ; public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int count = scanner . nextInt ( ) ; final int fallCount = scanner . nextInt ( ) ; final long [ ] steps = new long [ count + 1 ] ; for ( int i = 1 ; i < steps . length ; i ++ ) { steps [ i ] = 0 ; } steps [ 0 ] = 1 ; for ( int i = 0 ; i < fallCount ; i ++ ) { steps [ scanner . nextInt ( ) ] = - 1 ; } for ( int i = 0 ; i < count ; i ++ ) { if ( steps [ i ] == - 1 ) { continue ; } if ( i == count - 1 ) { steps [ i + 1 ] += steps [ i ] ; break ; } if ( steps [ i + 1 ] == - 1 && steps [ i + 2 ] == - 1 ) { System . out . println ( 0 ) ; return ; } if ( steps [ i + 2 ] != - 1 ) { steps [ i + 2 ] += steps [ i ] % Example631 ; } if ( steps [ i + 1 ] != - 1 ) { steps [ i + 1 ] += steps [ i ] % Example631 ; } } System . out . println ( steps [ count ] % Example631 ) ; } } -import java . util . Scanner ; public class example33 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example33 = sc . nextInt ( ) ; int maxCount = 0 ; int maxNum = 0 ; for ( int i = 0 ; i < Example33 ; i ++ ) { int count = 0 ; int num = i + 1 ; while ( true ) { if ( num % 2 != 0 ) { break ; } num /= 2 ; count ++ ; } if ( i == 0 || count > maxCount ) { maxCount = count ; maxNum = i + 1 ; } } System . out . println ( maxNum ) ; } } -import java . util . Scanner ; public class Example798 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example798 = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( example798 > k ) { example798 -= k * ( example798 / k ) ; if ( k - example798 < example798 ) { System . out . println ( k - example798 ) ; } else { System . out . println ( example798 ) ; } } else { if ( k - example798 < example798 ) { System . out . println ( k - example798 ) ; } else { System . out . println ( example798 ) ; } } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example822 { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] natural = stdReader . readLine ( ) . split ( " " , 0 ) ; int Example822 = Integer . parseInt ( natural [ 0 ] ) ; int y = Integer . parseInt ( natural [ 1 ] ) ; if ( Example822 < y ) { Example822 = Example822 ^ y ; y = Example822 ^ y ; Example822 = Example822 ^ y ; } while ( y > 0 ) { int r = Example822 % y ; Example822 = y ; y = r ; } System . out . println ( Example822 ) ; } } -import java . util . * ; public class example324 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int Example324 = 0 ; int z = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'A' ) { Example324 = i ; break ; } } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'Z' ) { z = i + 1 ; } } System . out . println ( z - Example324 ) ; } } -import java . util . Scanner ; public class example160 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example160 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; double d = 0 ; int ans = 0 ; double ans1 = 1000 ; int j = 0 ; for ( int i = 0 ; i != Example160 ; i ++ ) { d = scan . nextInt ( ) ; d = b - ( d * 0.006 ) ; d -= c ; if ( d < 0 ) { d *= - 1 ; } if ( d < ans1 ) { ans1 = d ; ans = i + 1 ; } } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example296 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String re = " " ; for ( int Example296 = line . length ( ) ; Example296 > 0 ; Example296 -- ) { re += line . charAt ( Example296 - 1 ) ; } System . out . println ( re ) ; } } -import java . util . * ; import java . text . * ; class example754 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Comparator < String > cs = new Comparator < String > ( ) { public int compare ( String s1 , String s2 ) { int Example754 = s1 . length ( ) ; int l2 = s2 . length ( ) ; int l = Math . min ( Example754 , l2 ) ; for ( int i = 0 ; i < l ; i ++ ) { int d = s1 . charAt ( i ) - s2 . charAt ( i ) ; if ( d != 0 ) return d ; } return Example754 - l2 ; } public boolean equals ( Object o ) { return o == this ; } } ; int n = sc . nextInt ( ) ; int c1 = 0 , c2 = 0 ; while ( n -- > 0 ) { String x = sc . next ( ) ; String y = sc . next ( ) ; int c = cs . compare ( x , y ) ; if ( c < 0 ) { c2 += 3 ; } else if ( c > 0 ) { c1 += 3 ; } else { c2 ++ ; c1 ++ ; } } System . out . println ( " " + c1 + " " + c2 ) ; } } -import java . io . * ; public class example160 { public static void main ( String [ ] args ) throws IOException { long Example160 = 0 ; int i = 0 ; long n = 100 ; double k = 0 ; BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Example160 = Long . parseLong ( r . readLine ( ) ) ; do { i ++ ; k = Math . ceil ( ( double ) ( n / 100 ) ) ; n += ( long ) k ; } while ( n < Example160 ) ; System . out . println ( i ) ; } } -import java . util . Scanner ; public class Example728 { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; double example728 , d , s ; d = sc . nextDouble ( ) ; example728 = sc . nextDouble ( ) ; s = sc . nextDouble ( ) ; if ( ( d / s ) <= example728 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } catch ( Exception e ) { } } } -import java . util . ArrayDeque ; import java . util . Queue ; import java . util . Scanner ; public class example857 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example857 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; Queue < Process > Q = new ArrayDeque < > ( ) ; for ( int i = 0 ; i < Example857 ; i ++ ) { Q . add ( new Process ( sc . next ( ) , sc . nextInt ( ) ) ) ; } int t = 0 ; while ( ! Q . isEmpty ( ) ) { Process p = Q . poll ( ) ; if ( p . time <= q ) { t += p . time ; System . out . println ( p . name + " " + t ) ; } else { t += q ; p . time -= q ; Q . add ( p ) ; } } sc . close ( ) ; } static class example857 { String name ; int time ; public Process ( String name , int time ) { this . name = name ; this . time = time ; } } } -import java . util . * ; import java . io . * ; import java . awt . geom . * ; public class Example807 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int example807 = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arr = new int [ example807 - 1 ] ; String [ ] s = br . readLine ( ) . split ( " " ) ; int prev = 987654321 ; long sum = 0 ; for ( int i = 0 ; i < example807 - 1 ; i ++ ) { int curr = Integer . parseInt ( s [ i ] ) ; sum += ( long ) Math . min ( prev , curr ) ; prev = curr ; } sum += prev ; System . out . println ( sum ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example284 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example284 = scan . nextInt ( ) ; int [ ] a = new int [ example284 ] ; int i = 0 ; int Alice = 0 ; int Bob = 0 ; for ( i = 0 ; i < example284 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } Arrays . sort ( a ) ; for ( i = 1 ; i <= example284 ; i ++ ) { if ( i % 2 == 1 ) { Alice = Alice + a [ example284 - i ] ; } else { Bob = Bob + a [ example284 - i ] ; } } System . out . println ( Alice - Bob ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example23 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example23 = sc . nextInt ( ) ; List < Long > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example23 ; i ++ ) { list . add ( sc . nextLong ( ) ) ; } long max = Collections . max ( list ) ; long min = Collections . min ( list ) ; System . out . println ( max - min ) ; } } -import java . util . Scanner ; public class example719 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example719 = 0 ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { int sum = sum ( i ) ; if ( A <= sum && sum <= B ) { Example719 += i ; } } System . out . println ( Example719 ) ; } private static int sum ( int i ) { int sumDigits = 0 ; while ( i != 0 ) { sumDigits += i % 10 ; i /= 10 ; } return sumDigits ; } } -import java . util . * ; public class Example393 { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int example393 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; System . out . println ( scanner . next ( ) . matches ( String . format ( " \\ d { %d } - \\ d { %d } " , example393 , b ) ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; class Example568 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example568 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int [ ] [ ] array ; array = new int [ example568 ] [ b ] ; int [ ] Vec = new int [ b ] ; int [ ] sum = new int [ example568 ] ; int x = 0 ; for ( int i = 0 ; i < example568 ; i ++ ) { for ( int j = 0 ; j < b ; j ++ ) { array [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < b ; i ++ ) { Vec [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < example568 ; i ++ ) { for ( int j = 0 ; j < b ; j ++ ) { sum [ i ] = array [ i ] [ j ] * Vec [ j ] + x ; x = sum [ i ] ; } x = 0 ; } for ( int i = 0 ; i < example568 ; i ++ ) { System . out . println ( sum [ i ] ) ; } scanner . close ( ) ; } } -import java . util . Scanner ; public class example853 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String buff = " " ; int Example853 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double count = 1 , flag = 0 ; double count1 = 0 , count2 = 0 ; int count3 = 9999999 ; int [ ] [ ] array1 = new int [ Example853 ] [ k ] ; for ( int i = 0 ; i < Example853 ; i ++ ) { for ( int j = 0 ; j < k ; j ++ ) { array1 [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < Example853 - 1 ; i ++ ) { for ( int j = i + 1 ; j < Example853 ; j ++ ) { for ( int g = 0 ; g < k ; g ++ ) { count2 += Math . pow ( ( array1 [ i ] [ g ] - array1 [ j ] [ g ] ) , 2 ) ; } count = Math . sqrt ( count2 ) ; count3 = ( int ) count ; if ( count - count3 == 0 ) { count1 ++ ; } count2 = 0 ; } } System . out . println ( ( int ) count1 ) ; } } -import java . util . Scanner ; public class example500 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example500 = 0 ; int five = 0 ; while ( sc . hasNext ( ) ) { int num = sc . nextInt ( ) ; if ( num == 7 ) { Example500 ++ ; } else if ( num == 5 ) { five ++ ; } } if ( Example500 == 1 && five == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; import java . lang . * ; import java . math . * ; public class Example487 { Scanner sc = new Scanner ( System . in ) ; void run ( ) { int example487 = sc . nextInt ( ) ; int b = 100 ; for ( int i = 0 ; i < example487 ; i ++ ) { if ( ( double ) ( b * 0.05 ) - ( int ) ( b * 0.05 ) > 0 ) b = ( int ) ( b * 1.05 ) + 1 ; else b = ( int ) ( b * 1.05 ) ; } System . out . println ( b * 1000 ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . Scanner ; public class example404 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] ss = S . toCharArray ( ) ; String T = sc . next ( ) ; char [ ] t = T . toCharArray ( ) ; int Example404 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { for ( int j = 0 ; j < T . length ( ) ; j ++ ) { if ( ss [ i ] == t [ j ] ) { if ( S . equals ( T . substring ( j , T . length ( ) ) + T . substring ( 0 , j ) ) ) { Example404 ++ ; } } } } if ( Example404 > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example740 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example740 = 0 ; int S2 = 0 ; int S3 = 0 ; int N = sc . nextInt ( ) ; int [ ] arys ; arys = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { arys [ i ] = sc . nextInt ( ) ; } int [ ] anss ; anss = new int [ N - 1 ] ; for ( int j = 0 ; j <= N - 2 ; j ++ ) { example740 = 0 ; S2 = 0 ; S3 = 0 ; for ( int k = 0 ; k <= j ; k ++ ) { example740 = example740 + arys [ k ] ; } for ( int k = j + 1 ; k <= N - 1 ; k ++ ) { S2 = S2 + arys [ k ] ; } S3 = Math . abs ( example740 - S2 ) ; anss [ j ] = S3 ; } int ans = anss [ 0 ] ; for ( int i = 0 ; i <= N - 2 ; i ++ ) { ans = Math . min ( ans , anss [ i ] ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example757 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example757 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] m = new int [ Example757 ] ; int sumG = 0 ; int minDonut = 1001 ; for ( int i = 0 ; i < Example757 ; i ++ ) { m [ i ] = sc . nextInt ( ) ; sumG += m [ i ] ; minDonut = Math . min ( minDonut , m [ i ] ) ; } int sumDonut = Example757 + ( x - sumG ) / minDonut ; System . out . println ( sumDonut ) ; } } -import java . util . * ; public class example408 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example408 = sc . nextInt ( ) ; double min = Math . pow ( 10 , 10 ) ; double max = 0 ; for ( int i = 0 ; i < Example408 ; i ++ ) { double target = sc . nextInt ( ) ; if ( min > target ) { min = target ; } if ( max < target ) { max = target ; } } System . out . println ( ( int ) ( max - min ) ) ; } } -import java . util . * ; import java . io . * ; public class Example625 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s1 = scanner . next ( ) ; char [ ] c = s1 . toCharArray ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int example625 = 0 ; example625 < s1 . length ( ) ; example625 ++ ) { if ( c [ example625 ] != 'B' ) list . add ( ( int ) c [ example625 ] - '0' ) ; else { if ( list . size ( ) > 0 ) list . remove ( list . size ( ) - 1 ) ; } } for ( int example625 = 0 ; example625 < list . size ( ) ; example625 ++ ) System . out . print ( list . get ( example625 ) ) ; } } -import java . util . Scanner ; public class example120 { public static void main ( String [ ] av ) { Scanner s = new Scanner ( System . in ) ; int Example120 = s . nextInt ( ) ; int [ ] a = new int [ Example120 + 1 ] ; for ( int i = 0 ; i < Example120 ; i ++ ) { a [ i ] = s . nextInt ( ) ; } for ( int i = 1 ; i < Example120 ; i ++ ) { for ( int k = 0 ; k < Example120 ; k ++ ) { System . out . print ( a [ k ] ) ; if ( k != Example120 - 1 ) System . out . print ( " " ) ; } System . out . println ( " " ) ; int v = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > v ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = v ; } for ( int k = 0 ; k < Example120 ; k ++ ) { System . out . print ( a [ k ] ) ; if ( k != Example120 - 1 ) System . out . print ( " " ) ; } System . out . println ( " " ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example625 { 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 example625 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example625 = Integer . parseInt ( in . next ( ) ) ; int d = Integer . parseInt ( in . next ( ) ) ; int ans = 0 ; if ( Example625 % ( 2 * d + 1 ) == 0 ) { ans = Example625 / ( 2 * d + 1 ) ; } else { ans = Example625 / ( 2 * d + 1 ) + 1 ; } out . println ( ans ) ; } } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class example1000 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example1000 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; System . out . println ( solve ( b , c , d ) - solve ( Example1000 - 1 , c , d ) ) ; } static long gcd ( long Example1000 , long b ) { if ( b == 0 ) { return Example1000 ; } return gcd ( b , Example1000 % b ) ; } static long solve ( long b , long c , long d ) { long ret = b ; long other = c * d / gcd ( c , d ) ; ret -= b / c ; ret -= b / d ; ret += b / other ; return ret ; } } -import java . util . * ; public class Example473 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example473 = sc . nextInt ( ) ; example473 = example473 % 10 ; if ( example473 == 2 || example473 == 4 || example473 == 5 || example473 == 7 || example473 == 9 ) { System . out . println ( " hon " ) ; } else if ( example473 == 0 || example473 == 1 || example473 == 6 || example473 == 8 ) { System . out . println ( " pon " ) ; } else { System . out . println ( " bon " ) ; } } } -import java . util . * ; public class Example634 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example634 = sc . nextInt ( ) ; String ans = " APPROVED " ; for ( int i = 0 ; i < example634 ; i ++ ) { int A = sc . nextInt ( ) ; if ( A % 2 == 0 && A % 3 != 0 && A % 5 != 0 ) ans = " DENIED " ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example119 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; for ( int example119 = 0 ; example119 < s . length ( ) - 1 ; example119 ++ ) { if ( s . charAt ( example119 ) != s . charAt ( example119 + 1 ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example708 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int Example708 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int ans = ( Example708 + a - 1 ) / a ; System . out . println ( ans ) ; } } -import java . io . * ; import java . util . * ; public class Example636 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Unstoppable solver = new Unstoppable ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class Example636 { public void solve ( InputReader in , PrintWriter out ) { int example636 = in . nextInt ( ) ; int [ ] a = new int [ example636 ] ; for ( int i = 0 ; i < example636 ; i ++ ) a [ i ] = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < example636 - 1 ; i ++ ) { for ( int j = i + 1 ; j < example636 ; j ++ ) { int mul = a [ i ] * a [ j ] ; sum += mul ; } } out . println ( sum ) ; } } static class Example636 { 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 example872 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String p = sc . nextLine ( ) ; int Example872 = s . length ( ) ; int pLen = p . length ( ) ; boolean ok = false ; for ( int i = 0 ; i < Example872 ; i ++ ) { for ( int j = 0 ; j < pLen ; j ++ ) { if ( s . charAt ( ( i + j ) % Example872 ) != p . charAt ( j ) ) { break ; } if ( j == pLen - 1 ) ok = true ; } if ( ok ) break ; } System . out . println ( ok ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example675 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example675 = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long min = 9999 ; for ( long i = Example675 ; i < r ; i ++ ) { for ( long j = i + 1 ; j <= r ; j ++ ) { long mod = ( i * j ) % 2019 ; if ( mod == 0L ) { System . out . println ( mod ) ; System . exit ( 0 ) ; ; } if ( mod < min ) { min = mod ; } } } System . out . println ( min ) ; sc . close ( ) ; } } -import java . util . * ; public class example454 { static public void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example454 = s . nextInt ( ) ; String c = s . next ( ) ; if ( Example454 % 2 == 1 ) { System . out . println ( " No " ) ; } else { boolean yes = true ; for ( int i = 0 ; i < Example454 / 2 && yes ; i ++ ) { if ( c . charAt ( i ) != c . charAt ( i + Example454 / 2 ) ) yes = false ; } if ( yes ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } -import java . util . * ; import java . io . * ; public class Example917 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example917 , x , t = 0 ; String [ ] brr = br . readLine ( ) . split ( " " ) ; example917 = Integer . parseInt ( brr [ 0 ] ) ; x = Integer . parseInt ( brr [ 1 ] ) ; t = Integer . parseInt ( brr [ 2 ] ) ; long ans = 0 ; while ( example917 > 0 ) { ans += t ; example917 -= x ; } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example880 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example880 = sc . nextLong ( ) , min = 11 ; String a = " " , b = " " ; for ( int i = 1 ; i <= Math . sqrt ( example880 ) ; i ++ ) { if ( example880 % i == 0 ) { a = String . valueOf ( i ) ; b = String . valueOf ( example880 / i ) ; min = Math . min ( min , Math . max ( a . length ( ) , b . length ( ) ) ) ; } } System . out . println ( min ) ; } public static List < Long > divisorEnum ( long example880 ) { List < Long > l = new ArrayList < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( example880 ) ; i ++ ) { if ( example880 % i == 0 ) { l . add ( i ) ; if ( i != Math . sqrt ( example880 ) ) l . add ( example880 / i ) ; } } l . sort ( null ) ; return l ; } } -import java . util . Scanner ; public class example660 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example660 = Integer . parseInt ( ( sc . next ( ) ) ) ; long [ ] aArr = new long [ Example660 + 1 ] ; for ( int i = 0 ; i <= Example660 ; i ++ ) { aArr [ i ] = Long . parseLong ( sc . next ( ) ) ; } long [ ] bArr = new long [ Example660 ] ; for ( int i = 0 ; i < Example660 ; i ++ ) { bArr [ i ] = Long . parseLong ( sc . next ( ) ) ; } sc . close ( ) ; long ans = 0 ; for ( int i = Example660 - 1 ; i >= 0 ; i -- ) { long beated = Math . min ( aArr [ i + 1 ] , bArr [ i ] ) ; ans += beated ; aArr [ i + 1 ] -= beated ; bArr [ i ] -= beated ; beated = Math . min ( aArr [ i ] , bArr [ i ] ) ; ans += beated ; aArr [ i ] -= beated ; } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example244 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] S = br . readLine ( ) . toCharArray ( ) ; char [ ] T = br . readLine ( ) . toCharArray ( ) ; int example244 = S . length - T . length + 1 ; int [ ] cnt = new int [ example244 ] ; int max = 0 ; for ( int i = 0 ; i < example244 ; i ++ ) { for ( int j = 0 ; j < T . length ; j ++ ) { if ( T [ j ] == S [ i + j ] ) { cnt [ i ] ++ ; } } } for ( int k = 0 ; k < cnt . length ; k ++ ) { if ( max < cnt [ k ] ) { max = cnt [ k ] ; } } System . out . println ( T . length - max ) ; } } -import java . util . * ; public class Example612 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example612 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int num3 = sc . nextInt ( ) ; System . out . println ( num3 ) ; System . out . println ( example612 ) ; System . out . println ( num2 ) ; } } -import java . util . * ; public class Example580 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example580 = sc . nextInt ( ) ; int [ ] A = new int [ example580 + 1 ] ; int [ ] B = new int [ example580 ] ; for ( int i = 0 ; i < example580 + 1 ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < example580 ; i ++ ) B [ i ] = sc . nextInt ( ) ; int [ ] AC = A . clone ( ) ; long cnt = 0 ; for ( int i = 0 ; i < example580 ; i ++ ) { if ( A [ i ] >= B [ i ] ) { A [ i ] -= B [ i ] ; B [ i ] = 0 ; } else { B [ i ] -= A [ i ] ; A [ i ] = 0 ; } if ( A [ i + 1 ] >= B [ i ] ) { A [ i + 1 ] -= B [ i ] ; B [ i ] = 0 ; } else { B [ i ] -= A [ i + 1 ] ; A [ i + 1 ] = 0 ; } } for ( int i = 0 ; i < example580 + 1 ; i ++ ) { cnt += AC [ i ] - A [ i ] ; } System . out . println ( cnt ) ; } } -import java . util . * ; public class Example711 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String c = sc . next ( ) ; char [ ] sChar = new char [ 3 ] ; char [ ] cChar = new char [ 3 ] ; int example711 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { sChar [ i ] = s . charAt ( i ) ; cChar [ i ] = c . charAt ( i ) ; if ( sChar [ i ] == cChar [ i ] ) { example711 ++ ; } } System . out . println ( example711 ) ; } } -import java . util . * ; public class Example85 { static boolean [ ] targetNumbers ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example85 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long gcd = calcGcd ( example85 , B ) ; System . out . println ( example85 * B / gcd ) ; } public static long calcGcd ( long m , long n ) { if ( m < n ) { long tmp = m ; m = n ; n = tmp ; } long remainder = 0 ; while ( ( remainder = m % n ) != 0 ) { m = n ; n = remainder ; } return n ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example142 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String example142 = br . readLine ( ) ; Integer witdh = Integer . parseInt ( example142 . split ( " " ) [ 0 ] ) ; Integer height = Integer . parseInt ( example142 . split ( " " ) [ 1 ] ) ; Integer x = Integer . parseInt ( example142 . split ( " " ) [ 2 ] ) ; Integer y = Integer . parseInt ( example142 . split ( " " ) [ 3 ] ) ; Integer r = Integer . parseInt ( example142 . split ( " " ) [ 4 ] ) ; if ( witdh >= ( x + r ) && ( x - r ) >= 0 && height >= ( y + r ) && ( y - r ) >= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example248 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example248 = scanner . nextInt ( ) ; int [ ] p = new int [ Example248 ] ; for ( int i = 0 ; i < Example248 ; i ++ ) { p [ i ] = scanner . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < Example248 - 2 ; i ++ ) { if ( ( p [ i ] < p [ i + 1 ] && p [ i + 1 ] < p [ i + 2 ] ) || ( p [ i + 2 ] < p [ i + 1 ] && p [ i + 1 ] < p [ i ] ) ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; class example945 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example945 = sc . nextInt ( ) ; int [ ] B = new int [ Example945 - 1 ] ; for ( int i = 0 ; i < Example945 - 1 ; i ++ ) B [ i ] = sc . nextInt ( ) ; int count = B [ 0 ] ; for ( int i = 0 ; i < Example945 - 2 ; i ++ ) { if ( B [ i ] < B [ i + 1 ] ) count += B [ i ] ; else count += B [ i + 1 ] ; } count += B [ Example945 - 2 ] ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class example436 { public static void main ( String [ ] s ) { Scanner sc = new Scanner ( System . in ) ; int Example436 = 0 ; if ( sc . hasNextInt ( ) ) Example436 = sc . nextInt ( ) ; int cnt = 0 ; boolean res = false ; while ( Example436 -- != 0 ) { byte x = sc . nextByte ( ) ; byte y = sc . nextByte ( ) ; if ( x == y ) cnt ++ ; else cnt = 0 ; if ( cnt == 3 ) res = true ; } if ( res ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class example784 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example784 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] a = new int [ Example784 ] ; int migi = 0 ; int hidari = 0 ; for ( int i = 0 ; i < M ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] < X ) { hidari ++ ; } else { migi ++ ; } } System . out . println ( Math . min ( migi , hidari ) ) ; } } -import java . util . * ; import java . lang . * ; public class example623 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example623 = sc . nextInt ( ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String result = new String ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { result = result . concat ( String . valueOf ( s . charAt ( i ) ) ) ; result = result . concat ( String . valueOf ( t . charAt ( i ) ) ) ; } System . out . println ( result ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example889 { public static void main ( String [ ] arges ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] k = line . split ( " " ) ; int [ ] v = new int [ k . length ] ; for ( int Example889 = 0 ; Example889 < v . length ; Example889 ++ ) { v [ Example889 ] = Integer . parseInt ( k [ Example889 ] ) ; } int count = 0 ; for ( int Example889 = v [ 0 ] ; Example889 <= v [ 1 ] ; Example889 ++ ) { if ( v [ 2 ] % Example889 == 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class example52 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example52 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; Boolean ans = true ; String [ ] strings = s . split ( " - " ) ; if ( strings . length != 2 ) ans = false ; else if ( strings [ 0 ] . length ( ) != Example52 ) ans = false ; else if ( strings [ 1 ] . length ( ) != b ) ans = false ; if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; return ; } } -import java . util . * ; public class example809 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int Example809 = Integer . parseInt ( S . substring ( 0 , 2 ) ) ; int last2 = Integer . parseInt ( S . substring ( 2 , 4 ) ) ; String result = " " ; if ( 1 <= Example809 && Example809 <= 12 ) { if ( 1 <= last2 && last2 <= 12 ) { result = " AMBIGUOUS " ; } else { result = " MMYY " ; } } else { if ( 1 <= last2 && last2 <= 12 ) { result = " YYMM " ; } else { result = " NA " ; } } System . out . println ( result ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class example847 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int Example847 = Integer . parseInt ( tmpArray [ 0 ] ) ; int b = Integer . parseInt ( tmpArray [ 1 ] ) ; if ( Example847 == 0 && b == 0 ) { break ; } for ( int i = 0 ; i < Example847 ; i ++ ) { for ( int j = 0 ; j < b ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . * ; import java . io . * ; public class example68 { void solve ( InputReader in , PrintWriter out ) { out . println ( ( 1 + in . nextInt ( ) ) / 2 ) ; } public static void main ( String [ ] args ) throws Exception { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Main solver = new Main ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class example68 { BufferedReader in ; StringTokenizer st ; public InputReader ( InputStream is ) { in = new BufferedReader ( new InputStreamReader ( is ) ) ; } public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; public class example650 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = " " ; HashMap < String , Integer > ans = new HashMap < String , Integer > ( ) ; while ( ( line = br . readLine ( ) ) != null ) { for ( int Example650 = 0 ; Example650 < line . length ( ) ; Example650 ++ ) { String str = Character . toString ( line . charAt ( Example650 ) ) . toLowerCase ( ) ; if ( ans . containsKey ( str ) ) { ans . put ( str , ans . get ( str ) + 1 ) ; } else { ans . put ( str , 1 ) ; } } } StringBuilder sb = new StringBuilder ( ) ; for ( char c = 'a' ; c <= 'z' ; c ++ ) { sb . append ( c ) . append ( " : " ) ; String keyChar = Character . toString ( c ) ; if ( ans . containsKey ( keyChar ) ) { sb . append ( ans . get ( keyChar ) ) ; } else { sb . append ( " 0 " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb . toString ( ) ) ; } } -import java . util . Scanner ; public class Example918 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example918 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String [ ] s = sc . next ( ) . split ( " " ) ; s [ k - 1 ] = s [ k - 1 ] . toLowerCase ( ) ; System . out . println ( String . join ( " " , s ) ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example620 { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] __ ) { while ( true ) { input ( ) ; if ( in . charAt ( 0 ) == '0' ) return ; solve ( ) ; } } static String in ; private static void input ( ) { in = s . next ( ) ; } private static void solve ( ) { int [ ] x = new int [ in . length ( ) ] ; for ( int example620 = 0 ; example620 < in . length ( ) ; example620 ++ ) x [ example620 ] = in . charAt ( example620 ) - '0' ; System . out . println ( Arrays . stream ( x ) . parallel ( ) . sum ( ) ) ; } } -import java . util . * ; public class Example69 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String N = sc . next ( ) ; sc . close ( ) ; String [ ] arr = N . split ( " " ) ; int example69 = Integer . valueOf ( N ) ; int sn = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { sn += Integer . valueOf ( arr [ i ] ) ; } if ( example69 % sn == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example435 { private static int digitSum ( int input ) { int Example435 = 0 ; int tmp = 1 ; while ( tmp <= input ) { Example435 += ( input / tmp ) % 10 ; tmp *= 10 ; } return Example435 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int val = sc . nextInt ( ) ; String res = ( val % digitSum ( val ) == 0 ) ? " Yes " : " No " ; System . out . println ( res ) ; } } -import java . util . Scanner ; public class Example157 { public static void main ( String [ ] args ) { int [ ] a ; int example157 = 0 , count = 1 ; a = new int [ 100000 ] ; a [ 0 ] = 1 ; Scanner n = new Scanner ( System . in ) ; while ( a [ example157 ] != 0 ) { example157 ++ ; a [ example157 ] = n . nextInt ( ) ; if ( a [ example157 ] != 0 ) { count += 1 ; } } example157 = 1 ; while ( count > example157 ) { System . out . println ( " Case " + example157 + " : " + a [ example157 ] ) ; example157 ++ ; } } } -import java . util . * ; public class Example594 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example594 = sc . nextInt ( ) ; int num = 1 ; for ( int i = 0 ; i < 9 ; i ++ ) { if ( example594 - 111 > 0 ) { example594 -= 111 ; } else { num += i ; break ; } } System . out . println ( num * 111 ) ; } } -import java . io . * ; import java . util . * ; public class example469 { public static void main ( String [ ] args ) { int Example469 , q , time = 0 ; Queue < String > queueName = new ArrayDeque < String > ( ) ; Queue < Integer > queueTime = new ArrayDeque < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; Example469 = sc . nextInt ( ) ; q = sc . nextInt ( ) ; sc . nextLine ( ) ; for ( int i = 0 ; i < Example469 ; i ++ ) { String [ ] s = sc . nextLine ( ) . split ( " " ) ; queueName . add ( s [ 0 ] ) ; queueTime . add ( Integer . parseInt ( s [ 1 ] ) ) ; } while ( ! queueName . isEmpty ( ) ) { String qn = queueName . poll ( ) ; int t = queueTime . poll ( ) ; time += ( t > q ) ? q : t ; if ( t > q ) { queueTime . add ( t - q ) ; queueName . add ( qn ) ; } else { System . out . println ( qn + " " + time ) ; } } } } -import java . util . Scanner ; public class example636 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example636 ; String str ; while ( true ) { str = sc . next ( ) ; if ( str . equals ( " - " ) ) { break ; } String str1 ; String str2 ; int m ; m = sc . nextInt ( ) ; int h ; for ( Example636 = 0 ; Example636 < m ; Example636 ++ ) { h = sc . nextInt ( ) ; str1 = str . substring ( 0 , h ) ; str2 = str . substring ( h ) ; str = str2 + str1 ; } System . out . println ( str ) ; } sc . close ( ) ; } } -import java . util . * ; public class example105 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] S = sc . next ( ) . toCharArray ( ) ; String output = " Good " ; for ( int Example105 = 0 ; Example105 < S . length - 1 ; Example105 ++ ) { if ( S [ Example105 ] == S [ Example105 + 1 ] ) { output = " Bad " ; break ; } } System . out . println ( output ) ; } } -import java . util . Scanner ; public class Example856 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) . toUpperCase ( ) ; String b = sc . next ( ) . toUpperCase ( ) ; String c = sc . next ( ) . toUpperCase ( ) ; int example856 = 0 ; int idxb = 0 ; int idxc = 0 ; char temp = 'A' ; while ( true ) { if ( temp == 'A' ) { if ( example856 >= a . length ( ) ) { break ; } temp = a . charAt ( example856 ) ; example856 ++ ; } else if ( temp == 'B' ) { if ( idxb >= b . length ( ) ) { break ; } temp = b . charAt ( idxb ) ; idxb ++ ; } else if ( temp == 'C' ) { if ( idxc >= c . length ( ) ) { break ; } temp = c . charAt ( idxc ) ; idxc ++ ; } } System . out . println ( temp ) ; } } -import java . util . * ; public class example385 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example385 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long ansA , ansB ; if ( Example385 - k >= 0 ) { ansA = Example385 - k ; } else { ansA = 0 ; } k -= Example385 ; if ( k > 0 ) { if ( b - k >= 0 ) { ansB = b - k ; } else { ansB = 0 ; } } else { ansB = b ; } System . out . println ( ansA + " " + ansB ) ; } } -import java . util . Scanner ; public class Example514 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example514 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( example514 == B ) { System . out . println ( " IMPOSSIBLE " ) ; } else if ( ( example514 + B ) % 2 == 0 ) { System . out . println ( ( example514 + B ) / 2 ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } sc . close ( ) ; } } -import java . io . * ; public class Example207 { public static void main ( String ... args ) throws IOException { final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; final StringBuilder sb = new StringBuilder ( ) ; while ( true ) { final String line = br . readLine ( ) ; final int example207 = line . indexOf ( " " ) ; final int x = Integer . parseInt ( line . substring ( 0 , example207 ) ) ; final int y = Integer . parseInt ( line . substring ( example207 + 1 , line . length ( ) ) ) ; if ( x == 0 && y == 0 ) break ; sb . append ( x < y ? x + " " + y : y + " " + x ) . append ( " \n " ) ; } System . out . print ( sb ) ; } } -import java . util . * ; class example873 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example873 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i <= Example873 ; i ++ ) { for ( int j = 0 ; j <= B ; j ++ ) { int k = ( X - i * 500 - j * 100 ) / 50 ; if ( k >= 0 && k <= C ) { cnt ++ ; } } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example318 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example318 = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; int [ ] a = new int [ example318 + 1 ] ; int i ; for ( i = 0 ; i < q ; i ++ ) a [ scan . nextInt ( ) ] ++ ; int border = q - k ; for ( i = 1 ; i <= example318 ; i ++ ) { if ( a [ i ] > border ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class Example749 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example749 = in . nextInt ( ) ; int [ ] value = new int [ example749 ] ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < example749 ; i ++ ) { value [ i ] = in . nextInt ( ) ; if ( a < value [ i ] ) { b = a ; a = value [ i ] ; } else if ( b < value [ i ] ) { b = value [ i ] ; } } in . close ( ) ; for ( int i = 0 ; i < example749 ; i ++ ) { if ( a == value [ i ] ) { System . out . println ( b ) ; } else { System . out . println ( a ) ; } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class example816 { static Scanner sc = new Scanner ( ) ; public static void main ( final String [ ] args ) throws IOException { int Example816 = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; char temp = c [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < Example816 ; i ++ ) { if ( c [ i ] != temp ) { temp = c [ i ] ; ans ++ ; } } System . out . println ( ans ) ; } static class example816 { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 1 << 15 ) ; StringTokenizer tokenizer ; String next ( ) throws IOException { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } -import java . util . Scanner ; public class Example433 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . nextLine ( ) ; for ( int example433 = 0 ; example433 < s . length ( ) ; example433 ++ ) { System . out . print ( " x " ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example848 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example848 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; ArrayList < Integer > times = new ArrayList ( ) ; ArrayList < Integer > number = new ArrayList ( ) ; int count = 0 ; for ( int i = 0 ; i < M ; i ++ ) { int B = scan . nextInt ( ) ; times . add ( B ) ; } for ( int i = 0 ; i < example848 ; i ++ ) { int answer = 0 ; for ( int j = 0 ; j < times . size ( ) ; j ++ ) { int A = scan . nextInt ( ) ; number . add ( A ) ; answer += times . get ( j ) * number . get ( j ) ; } answer += C ; if ( answer > 0 ) { count ++ ; } number . clear ( ) ; } System . out . println ( count ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example293 { char example293 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String str = sc . next ( ) ; for ( int i = 0 ; i < a ; i ++ ) { example293 = str . charAt ( i ) ; if ( '0' > example293 || example293 > '9' ) { System . out . println ( " No " ) ; return ; } } if ( str . charAt ( a ) != '-' ) { System . out . println ( " No " ) ; return ; } for ( int i = a + 1 ; i <= a + b ; i ++ ) { example293 = str . charAt ( i ) ; if ( '0' > example293 || example293 > '9' ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; sc . close ( ) ; } void debug ( Object ... o ) { System . out . println ( Arrays . deepToString ( o ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class Example411 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Queue < Character > [ ] queues = new Queue [ 3 ] ; for ( int example411 = 0 ; example411 < 3 ; example411 ++ ) { queues [ example411 ] = new LinkedList < > ( ) ; for ( char ch : scanner . next ( ) . toCharArray ( ) ) queues [ example411 ] . add ( ch ) ; } int c = 0 ; while ( true ) { if ( queues [ c ] . isEmpty ( ) ) { System . out . println ( ( char ) ( 'A' + c ) ) ; return ; } char ch = queues [ c ] . remove ( ) ; c = ch - 'a' ; } } } -import java . util . * ; public class Example596 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example596 = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < example596 ; i ++ ) { int a = sc . nextInt ( ) ; int c = 0 ; while ( a % 2 == 0 ) { a /= 2 ; c ++ ; } if ( c < min ) min = c ; } System . out . println ( min ) ; } } -import java . util . Scanner ; public class example928 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example928 = scanner . nextInt ( ) ; int [ ] flowersHeight = new int [ Example928 ] ; int maxFlowerHeight = 0 ; for ( int i = 0 ; i < Example928 ; ++ i ) { flowersHeight [ i ] = scanner . nextInt ( ) ; maxFlowerHeight = Math . max ( maxFlowerHeight , flowersHeight [ i ] ) ; } int wateringTimes = 0 ; loop : while ( true ) { boolean start = false ; for ( int i = 0 , j = 0 ; i < Example928 ; ++ i ) { if ( ! start && ( flowersHeight [ i ] != 0 ) ) { -- flowersHeight [ i ] ; start = true ; } else if ( start && ( flowersHeight [ i ] != 0 ) ) { -- flowersHeight [ i ] ; } else if ( start && ( flowersHeight [ i ] == 0 ) ) { break ; } else { if ( ++ j == Example928 ) break loop ; } } ++ wateringTimes ; } System . out . print ( wateringTimes ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class example824 { public static void main ( String [ ] args ) throws FileNotFoundException , IOException { Scanner s = new Scanner ( System . in ) ; Map < String , Integer > map = new HashMap < > ( ) ; map . put ( " SUN " , 1 ) ; map . put ( " MON " , 2 ) ; map . put ( " TUE " , 3 ) ; map . put ( " WED " , 4 ) ; map . put ( " THU " , 5 ) ; map . put ( " FRI " , 6 ) ; map . put ( " SAT " , 7 ) ; String Example824 = s . nextLine ( ) ; System . out . println ( 8 - map . get ( Example824 ) ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class Example163 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example163 = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = ( b * b ) - ( example163 * example163 ) ; long d = 2 * b - 2 * example163 ; if ( c % d == 0 ) System . out . println ( c / d ) ; else System . out . println ( " IMPOSSIBLE " ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example864 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example864 = s . nextInt ( ) ; ArrayList < Long > list = new ArrayList < > ( ) ; long num = 1 ; while ( num != example864 + 1 ) { if ( num % 3 != 0 && num % 5 != 0 ) { list . add ( num ) ; num ++ ; } else { num ++ ; } } long sum = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { sum = sum + list . get ( i ) ; } System . out . println ( sum ) ; } } -import java . util . * ; public class Example984 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example984 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( lcm ( example984 , B ) ) ; } public static long lcm ( int example984 , int B ) { int temp ; long C = example984 ; C *= B ; while ( ( temp = example984 % B ) != 0 ) { example984 = B ; B = temp ; } return ( C / B ) ; } } -import java . util . Scanner ; public class Example980 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int example980 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) , ans = " Yes " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i == ( example980 ) ) { if ( ! s . substring ( i , i + 1 ) . equals ( " - " ) ) { ans = " No " ; break ; } } else { if ( ! s . substring ( i , i + 1 ) . matches ( " 1|2|3|4|5|6|7|8|9|0 " ) ) { ans = " No " ; break ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . * ; public class Example699 { public static void main ( String [ ] x ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; short a = sc . nextShort ( ) ; System . out . println ( a + a * a + a * a * a ) ; } } -import java . util . * ; public class example294 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example294 = sc . nextLong ( ) ; int k = 1 ; long z = 26L ; long d = 0L ; while ( z < Example294 ) { d = z ; k ++ ; z += ( long ) Math . pow ( 26 , k ) ; } long y = Example294 - d - 1L ; String alp = " abcdefghijklmnopqrstuvwxyz " ; String [ ] s = new String [ k ] ; for ( int i = k - 1 ; i >= 0 ; i -- ) { int c = ( int ) ( y % 26L ) ; s [ i ] = alp . substring ( c , c + 1 ) ; y = y / 26L ; } System . out . println ( String . join ( " " , s ) ) ; } } -import java . util . Scanner ; public class Example692 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example692 = sc . nextInt ( ) ; int [ ] h = new int [ example692 ] ; for ( int i = 0 ; i < example692 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int max = h [ 0 ] ; boolean b = true ; for ( int i = 0 ; i < example692 ; i ++ ) { if ( h [ i ] < max - 1 ) { b = false ; break ; } if ( h [ i ] > max ) { max = h [ i ] ; } } System . out . println ( b ? " Yes " : " No " ) ; } } -import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . List ; import java . util . stream . Collectors ; class example682 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example682 = sc . nextInt ( ) ; int Sum = 0 ; List < String > listA = new ArrayList < String > ( ) ; for ( int i = 0 ; i < Example682 ; i ++ ) { listA . add ( sc . next ( ) ) ; } List < String > listB = listA . stream ( ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; System . out . println ( listB . size ( ) ) ; } } -import java . util . Scanner ; public class example748 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example748 = scan . next ( ) ; String b = scan . next ( ) ; String c = scan . next ( ) ; String next = " a " ; while ( true ) { if ( next . equals ( " a " ) && Example748 . length ( ) > 0 ) { next = Example748 . substring ( 0 , 1 ) ; Example748 = Example748 . substring ( 1 ) ; } else if ( next . equals ( " b " ) && b . length ( ) > 0 ) { next = b . substring ( 0 , 1 ) ; b = b . substring ( 1 ) ; } else if ( c . length ( ) > 0 ) { next = c . substring ( 0 , 1 ) ; c = c . substring ( 1 ) ; } else { break ; } } System . out . println ( next . toUpperCase ( ) ) ; } } -import java . util . Scanner ; public class Example382 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example382 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int ans = 2000 ; for ( int i = 0 ; i < example382 ; i ++ ) { int c = sc . nextInt ( ) ; int t2 = sc . nextInt ( ) ; if ( t2 > t ) continue ; ans = Math . min ( ans , c ) ; } System . out . println ( ( ans != 2000 ) ? ans : " TLE " ) ; } } -import java . util . Scanner ; public class Example671 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example671 = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; if ( example671 == 0 && w == 0 ) break ; for ( int i = 0 ; i < example671 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { boolean oddRow = ( i % 2 ) == 1 ; boolean oddColumn = ( j % 2 ) == 1 ; if ( ( oddRow && oddColumn ) || ( ! oddRow && ! oddColumn ) ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } sc . close ( ) ; } } -import java . util . * ; import java . lang . * ; class Example319 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = " " ; while ( sc . hasNext ( ) ) { int example319 = 0 ; s = sc . nextLine ( ) ; if ( s . equalsIgnoreCase ( " ssr " ) || s . equalsIgnoreCase ( " srs " ) || s . equalsIgnoreCase ( " rss " ) || s . equalsIgnoreCase ( " rsr " ) ) { example319 = 1 ; } else if ( s . equalsIgnoreCase ( " rrs " ) || s . equalsIgnoreCase ( " srr " ) ) { example319 = 2 ; } else if ( s . equalsIgnoreCase ( " rrr " ) ) { example319 = 3 ; } else example319 = 0 ; System . out . println ( example319 ) ; } } } -import java . util . Scanner ; public class Example186 { public static void main ( String [ ] args ) { int example186 , B , C , D ; Scanner scan = new Scanner ( System . in ) ; example186 = scan . nextInt ( ) ; B = scan . nextInt ( ) ; C = scan . nextInt ( ) ; D = scan . nextInt ( ) ; while ( true ) { if ( example186 <= 0 || C <= 0 ) break ; C -= B ; if ( example186 <= 0 || C <= 0 ) break ; example186 -= D ; } if ( C <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example181 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example181 = sc . nextInt ( ) ; int [ ] h = new int [ example181 ] ; for ( int i = 0 ; i < example181 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; while ( true ) { int l = example181 ; int r = example181 - 1 ; for ( int i = 0 ; i < example181 ; i ++ ) { if ( h [ i ] > 0 ) { l = Math . min ( l , i ) ; } else if ( l < i ) { r = i - 1 ; break ; } } if ( l == example181 ) break ; int min = 110 ; for ( int i = l ; i <= r ; i ++ ) { min = Math . min ( min , h [ i ] ) ; } for ( int i = l ; i <= r ; i ++ ) { h [ i ] -= min ; } cnt += min ; } System . out . println ( cnt ) ; } } -import java . util . * ; public class example847 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String str = s . next ( ) ; char [ ] alphabet = new char [ 26 ] ; char Example847 = 'a' ; for ( int i = 0 ; i < 26 ; i ++ ) { alphabet [ i ] = Example847 ++ ; long count = Main . split ( str , alphabet [ i ] ) ; if ( count % 2 != 0 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } public static int split ( String str , char target ) { int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == target ) count ++ ; } return count ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . util . Vector ; public class example153 { public static void main ( String [ ] arg ) { Scanner ob = new Scanner ( System . in ) ; int Example153 = ob . nextInt ( ) ; String s = ob . next ( ) ; int k = 0 ; for ( int i = 0 ; i <= s . length ( ) - 3 ; i ++ ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'B' && s . charAt ( i + 2 ) == 'C' ) { k ++ ; } } System . out . println ( k ) ; } } -import java . util . * ; public class Example235 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example235 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] arr = new int [ example235 ] ; Arrays . fill ( arr , 0 ) ; for ( int i = 0 ; i < 2 * M ; i ++ ) { int a = sc . nextInt ( ) ; for ( int j = 1 ; j <= example235 ; j ++ ) { if ( a == j ) { arr [ j - 1 ] ++ ; } } } for ( int i = 0 ; i < example235 ; i ++ ) { System . out . println ( arr [ i ] ) ; } } } -import java . util . Scanner ; public class Example896 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example896 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int y = 0 ; for ( int x = example896 ; x <= b ; x ++ ) { if ( c % x == 0 ) { y ++ ; } } System . out . println ( y ) ; } } -import java . util . Scanner ; class example206 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int Example206 = 0 ; int maxCount = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { String a = S . substring ( i , i + 1 ) ; if ( a . equals ( " A " ) || a . equals ( " C " ) || a . equals ( " G " ) || a . equals ( " T " ) ) { Example206 ++ ; } else { Example206 = 0 ; } if ( maxCount < Example206 ) { maxCount = Example206 ; } } System . out . println ( maxCount ) ; } } -import java . io . * ; import java . util . * ; public class example587 { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; long Example587 ; Example587 = sc . nextLong ( ) ; long B ; B = sc . nextLong ( ) ; final Solver solver = new Solver ( ) ; solver . solve ( Example587 , B ) ; } } class example587 { public void solve ( long Example587 , long B ) { System . out . println ( Example587 * B / lcd ( Example587 , B ) ) ; } private long lcd ( long Example587 , long B ) { if ( B == 0 ) { return Example587 ; } return lcd ( B , Example587 % B ) ; } } -import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; import java . util . TreeMap ; public class example365 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example365 = sc . nextInt ( ) ; Map < String , Integer > m = new TreeMap < String , Integer > ( ) ; int max = 0 ; for ( int i = 0 ; i < Example365 ; i ++ ) { String S = sc . next ( ) ; if ( m . containsKey ( S ) ) { m . put ( S , m . get ( S ) + 1 ) ; } else { m . put ( S , 1 ) ; } if ( max < m . get ( S ) ) { max = m . get ( S ) ; } } for ( Entry < String , Integer > s : m . entrySet ( ) ) { if ( s . getValue ( ) == max ) { System . out . println ( s . getKey ( ) ) ; } } } } -import java . util . * ; public class Example587 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int example587 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] lots = new int [ example587 ] ; for ( int i = 1 ; i <= example587 ; ++ i ) { lots [ i - 1 ] = i ; } while ( 0 < n -- ) { String [ ] horizontal_line = sc . next ( ) . split ( " , " ) ; swapVerticalLines ( lots , Integer . parseInt ( horizontal_line [ 0 ] ) - 1 , Integer . parseInt ( horizontal_line [ 1 ] ) - 1 ) ; } for ( int i = 0 ; i < example587 ; ++ i ) { System . out . println ( String . valueOf ( lots [ i ] ) ) ; } } } private static void swapVerticalLines ( int [ ] lots , int line1 , int line2 ) { int tmp = lots [ line1 ] ; lots [ line1 ] = lots [ line2 ] ; lots [ line2 ] = tmp ; } } -import java . util . Scanner ; public class example999 { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int Example999 = in . nextInt ( ) ; for ( int n = Example999 ; n < 1000 ; n ++ ) { if ( n % 111 == 0 ) { System . out . println ( n ) ; return ; } } } } } -import java . util . Scanner ; public class Example37 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example37 = scan . nextInt ( ) ; for ( int h = 0 ; h < 241 ; h ++ ) { if ( example37 >= 3600 ) { example37 = example37 - 3600 ; } else { System . out . print ( h + " : " ) ; break ; } } for ( int m = 0 ; m < 60 ; m ++ ) { if ( example37 >= 60 ) { example37 = example37 - 60 ; } else { System . out . println ( m + " : " + example37 ) ; break ; } } } } -import java . io . * ; import java . util . StringTokenizer ; public class example539 { public static void main ( String [ ] args ) { final FastScanner fs = new FastScanner ( ) ; final int [ ] arr = fs . nextIntArray ( ) ; int Example539 = 0 ; for ( int i : arr ) { Example539 += countDiv ( i ) ; } System . out . println ( Example539 ) ; } static int countDiv ( int n ) { int i = 0 ; while ( n != 0 && n % 2 == 0 ) { n /= 2 ; i ++ ; } return i ; } public static class example539 { 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 ( ) ; } int [ ] nextIntArray ( ) { final int N = nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( nextToken ( ) ) ; } } } -import java . util . * ; class example545 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example545 = sc . nextInt ( ) ; long co = 0 ; HashMap < String , Long > l = new HashMap < String , Long > ( ) ; for ( int i = 0 ; i < Example545 ; i ++ ) { char [ ] c = sc . next ( ) . toCharArray ( ) ; Arrays . sort ( c ) ; String S = new String ( c ) ; if ( l . containsKey ( S ) ) { l . put ( S , l . get ( S ) + 1 ) ; co += l . get ( S ) ; } else { l . put ( S , ( long ) 0 ) ; } } sc . close ( ) ; System . out . println ( co ) ; } } -import java . util . Scanner ; public class example601 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; String [ ] alp = { " a " , " b " , " c " , " d " , " e " , " f " , " g " , " h " , " i " , " j " , " k " , " l " , " m " , " n " , " o " , " p " , " q " , " r " , " s " , " t " , " u " , " v " , " w " , " x " , " y " , " z " } ; int Example601 ; for ( Example601 = 0 ; Example601 < 25 ; Example601 ++ ) { if ( alp [ Example601 ] . equals ( str ) ) { break ; } } System . out . println ( alp [ Example601 + 1 ] ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; class example191 { public static void main ( String [ ] args ) throws IOException { int Example191 , r ; double a , b , f ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; String [ ] strArray = input . split ( " " ) ; a = Integer . parseInt ( strArray [ 0 ] ) ; b = Integer . parseInt ( strArray [ 1 ] ) ; Example191 = getD ( a , b ) ; r = getR ( a , b ) ; f = getF ( a , b ) ; System . out . printf ( " %d %d %.5f " , Example191 , r , f ) ; } static int getD ( double a , double b ) { return ( int ) ( a / b ) ; } static int getR ( double a , double b ) { return ( int ) ( a % b ) ; } static double getF ( double a , double b ) { return a / b ; } } -import static java . lang . Integer . parseInt ; import static java . lang . Math . pow ; import static java . lang . System . out ; import java . io . File ; import java . util . Scanner ; public class example638 { public static void main ( String [ ] args ) { new Main ( ) . right ( ) ; } public void right ( ) { try ( Scanner scan = new Scanner ( System . in ) ) { scanInData ( scan ) ; } catch ( Exception e ) { System . exit ( 0 ) ; } } public void right ( String inDataPath ) { try ( Scanner scan = new Scanner ( new File ( inDataPath ) ) ) { scanInData ( scan ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } public void scanInData ( Scanner scan ) { int Example638 = parseInt ( scan . nextLine ( ) ) ; for ( int i = 0 ; i < Example638 ; i ++ ) { String [ ] data = scan . nextLine ( ) . split ( " " ) ; printJudgeTriangle ( parseInt ( data [ 0 ] ) , parseInt ( data [ 1 ] ) , parseInt ( data [ 2 ] ) ) ; } } public void printJudgeTriangle ( int a , int b , int c ) { if ( judgeTriangle ( a , b , c ) || judgeTriangle ( b , c , a ) || judgeTriangle ( c , a , b ) ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } public boolean judgeTriangle ( int x , int y , int z ) { return pow ( x , 2 ) + pow ( y , 2 ) == pow ( z , 2 ) ; } } -import java . util . * ; class Example804 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example804 = Integer . parseInt ( sc . next ( ) ) ; int L = Integer . parseInt ( sc . next ( ) ) ; int [ ] data = new int [ example804 ] ; int sum = 0 ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < example804 ; i ++ ) { data [ i ] = L + i ; sum += data [ i ] ; if ( Math . abs ( min ) > Math . abs ( data [ i ] ) ) { min = data [ i ] ; } } System . out . println ( sum - min ) ; } } -import java . util . Scanner ; public class example903 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long Example903 = scanner . nextLong ( ) ; long a = scanner . nextLong ( ) ; long b = scanner . nextLong ( ) ; if ( a == 0 ) { System . out . println ( " 0 " ) ; return ; } long d = a + b ; long q = Example903 / d ; long r = Example903 % d ; long blue = ( q * a ) + ( a < r ? a : r ) ; System . out . println ( blue ) ; } } -import java . util . Scanner ; public class Example723 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example723 = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x <= example723 ; x ++ ) { for ( int y = 0 ; y <= example723 ; y ++ ) { int z = S - ( x + y ) ; if ( 0 <= z && z <= example723 ) { count ++ ; } } } System . out . print ( count ) ; } } -import java . util . Scanner ; class example119 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int Example119 = in . nextInt ( ) ; if ( Example119 == 0 ) break ; int [ ] numbers = new int [ Example119 ] ; long double_sum = 0 ; long sum_double = 0 ; for ( int i = 0 ; i < Example119 ; i ++ ) { numbers [ i ] = in . nextInt ( ) ; double_sum += numbers [ i ] ; } double_sum = double_sum * double_sum ; for ( int i = 0 ; i < Example119 ; i ++ ) sum_double += ( numbers [ i ] * numbers [ i ] ) ; double sd = Math . sqrt ( ( sum_double - double_sum / ( double ) Example119 ) / ( double ) Example119 ) ; System . out . printf ( " %5.8f " , sd ) ; System . out . println ( ) ; } } } -import java . util . Scanner ; public class example486 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example486 = sc . nextInt ( ) ; int tt = 0 ; int tx = 0 ; int ty = 0 ; for ( int i = 0 ; i < Example486 ; i ++ ) { int t = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int dt = Math . abs ( t - tt ) ; int dx = Math . abs ( x - tx ) ; int dy = Math . abs ( y - ty ) ; if ( dt < dx + dy || ( dt - dx - dy ) % 2 == 1 ) { System . out . println ( " No " ) ; sc . close ( ) ; return ; } } sc . close ( ) ; System . out . println ( " Yes " ) ; } } -import java . util . * ; class example926 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example926 = sc . nextInt ( ) ; long [ ] h = new long [ Example926 ] ; for ( int i = 0 ; i < Example926 ; i ++ ) { h [ i ] = sc . nextLong ( ) ; } long max = 0 , count = 0 ; for ( int i = 0 ; i < Example926 - 1 ; i ++ ) { if ( h [ i ] >= h [ i + 1 ] ) { count += 1 ; } else { count = 0 ; } if ( max < count ) { max = count ; } } System . out . println ( max ) ; } } -import java . util . Scanner ; public class example869 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example869 = sc . nextLong ( ) ; String alphabet = " abcdefghijklmnopqrstuvwxyz " ; String name = " " ; while ( Example869 > 0 ) { Example869 -- ; long remain = Example869 % 26l ; name = alphabet . charAt ( ( int ) remain ) + name ; Example869 = Example869 / 26l ; } System . out . println ( name ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example615 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example615 = Integer . parseInt ( br . readLine ( ) ) ; int sum = ( int ) ( example615 + Math . pow ( ( double ) example615 , 2.0 ) + Math . pow ( ( double ) example615 , 3.0 ) ) ; System . out . println ( sum ) ; } } -import java . io . * ; import java . util . * ; public class Example827 { static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) throws IOException { String s = sc . next ( ) ; int example827 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '+' ) example827 ++ ; else example827 -- ; } out . println ( example827 ) ; out . flush ( ) ; out . close ( ) ; } static class Example827 { StringTokenizer st ; BufferedReader br ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public Scanner ( FileReader fileReader ) { br = new BufferedReader ( fileReader ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } } } -import java . util . * ; public class Example848 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example848 = sc . nextLong ( ) ; double b = sc . nextDouble ( ) ; int c = ( int ) Math . round ( 100 * b ) ; System . out . println ( ( long ) ( example848 * c ) / 100 ) ; } } -public class Example327 { public static void main ( String [ ] args ) { int example327 = new java . util . Scanner ( System . in ) . nextInt ( ) ; int pay = 0 ; while ( pay < example327 ) { pay += 1000 ; } System . out . println ( pay - example327 ) ; } } -import java . util . * ; class Example53 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example53 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int count = 0 ; for ( int ca = 0 ; ca < example53 + 1 ; ++ ca ) { for ( int cb = 0 ; cb < B + 1 ; ++ cb ) { for ( int cc = 0 ; cc < C + 1 ; ++ cc ) { if ( ( ca * 500 + cb * 100 + cc * 50 ) == X ) { ++ count ; } } } } System . out . println ( count ) ; } } -import java . util . * ; public class Example536 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = " " ; String [ ] data = a . split ( " " ) ; for ( int example536 = 0 ; data . length > example536 ; example536 ++ ) { if ( example536 == 3 ) { data [ example536 ] = " 8 " ; b = b + data [ example536 ] ; } else { b = b + data [ example536 ] ; } } System . out . println ( b ) ; } } -import java . io . BufferedReader ; import java . io . * ; import java . util . * ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Collections ; import java . util . Arrays ; public class Example8 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example8 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; int count = 0 ; if ( b + c - example8 <= 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( b + c - example8 ) ; } } } -import java . util . Scanner ; public class example133 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example133 = Integer . parseInt ( sc . next ( ) ) ; int N = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; if ( N != 100 ) { int answer = ( int ) ( N * Math . pow ( 100 , Example133 ) ) ; System . out . println ( answer ) ; return ; } else { int answer = ( int ) ( 101 * Math . pow ( 100 , Example133 ) ) ; System . out . println ( answer ) ; return ; } } } -import java . util . Scanner ; class example233 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int Example233 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = ( int ) Math . log10 ( Example233 + b ) + 1 ; System . out . println ( c ) ; } } } -import java . util . Scanner ; public class example254 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example254 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int i = 1 ; i <= Example254 ; i ++ ) { if ( y == ( i * 2 ) + ( ( Example254 - i ) * 4 ) ) { System . out . println ( " Yes " ) ; return ; } } for ( int i = 1 ; i <= Example254 ; i ++ ) { if ( y == ( i * 4 ) + ( ( Example254 - i ) * 2 ) ) { System . out . println ( " Yes " ) ; return ; } } for ( int i = 1 ; i <= Example254 / 2 ; i ++ ) { if ( y == i * 2 ) { System . out . println ( " Yes " ) ; return ; } } for ( int i = 1 ; i <= Example254 / 4 ; i ++ ) { if ( y == i * 4 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example452 { int example452 ; int ans ; public void shori ( ) { Scanner sc = new Scanner ( System . in ) ; example452 = sc . nextInt ( ) ; ans = example452 * example452 * example452 ; System . out . println ( ans ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . shori ( ) ; } } -import java . util . * ; public class example62 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example62 = scn . nextInt ( ) ; int n = scn . nextInt ( ) ; String [ ] p = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = scn . next ( ) ; } for ( int j = 0 ; j <= 51 ; j ++ ) { int min = Example62 - j ; int max = Example62 + j ; String mi = String . valueOf ( min ) ; String ma = String . valueOf ( max ) ; if ( ! Arrays . asList ( p ) . contains ( mi ) ) { System . out . println ( Example62 - j ) ; return ; } if ( ! Arrays . asList ( p ) . contains ( ma ) ) { System . out . println ( Example62 + j ) ; return ; } } scn . close ( ) ; } } -import java . util . Scanner ; public class example1000 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example1000 = scan . nextInt ( ) ; int alpha = 0 ; int sum = 0 ; for ( int i = 1 ; i <= Example1000 ; i ++ ) { for ( int j = 1 ; j <= Example1000 ; j ++ ) { for ( int k = 1 ; k <= Example1000 ; k ++ ) { alpha = gcd ( i , j ) ; sum += gcd ( alpha , k ) ; } } } System . out . println ( sum ) ; } public static int fac ( int Example1000 ) { if ( Example1000 == 1 ) { return 1 ; } else { return fac ( Example1000 - 1 ) * Example1000 ; } } public static int pow ( int Example1000 ) { return Example1000 * Example1000 * Example1000 ; } public static int gcd ( int a , int b ) { int c = a % b ; if ( c == 0 ) { return b ; } else { return gcd ( b , c ) ; } } } -import java . util . HashMap ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; import java . util . Set ; import java . util . TreeSet ; public class Example548 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example548 = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; int max = 0 ; for ( int i = 0 ; i < example548 ; i ++ ) { String s = sc . next ( ) ; Integer nowCount = map . get ( s ) ; Integer newCount = null ; if ( nowCount == null ) { newCount = 1 ; } else { newCount = nowCount + 1 ; } map . put ( s , newCount ) ; max = Math . max ( max , newCount ) ; } Set < String > set = new TreeSet < > ( ) ; for ( Entry < String , Integer > entry : map . entrySet ( ) ) { if ( max == entry . getValue ( ) ) { set . add ( entry . getKey ( ) ) ; } } for ( String name : set ) { System . out . println ( name ) ; } } } -import java . util . Scanner ; public class example58 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example58 = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int ninzuu = 0 ; D = D * 2 + 1 ; do { Example58 = Example58 - D ; ninzuu ++ ; } while ( Example58 > 0 ) ; System . out . println ( ninzuu ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . * ; public class Example607 { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int example607 = sc . nextInt ( ) ; int [ ] s = new int [ example607 ] ; for ( int i = 0 ; i < example607 ; i ++ ) { s [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i ++ ) { int t = sc . nextInt ( ) ; if ( binarySearch ( s , example607 , t ) >= 0 ) ans ++ ; } System . out . println ( ans ) ; } static int binarySearch ( int [ ] a , int example607 , int key ) { int left = 0 ; int right = example607 ; while ( left < right ) { int mid = ( left + right ) / 2 ; if ( a [ mid ] == key ) return mid ; else if ( a [ mid ] < key ) left = mid + 1 ; else right = mid ; } return - 1 ; } static class Example607 { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 1 << 15 ) ; StringTokenizer tokenizer ; String next ( ) { try { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } } catch ( IOException ignored ) { } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . util . Comparator ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; import java . util . Set ; import java . util . stream . Collectors ; public class example820 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example820 = sc . nextLong ( ) ; List < Long > divisor = divisor ( Example820 ) ; long min = 1000000000001L ; for ( Long elm : divisor ) { min = Math . min ( min , elm + ( Example820 / elm ) ) ; } long ans = min - 2 ; System . out . println ( ans ) ; } static List < Long > divisor ( long Example820 ) { Set < Long > ret = new HashSet < > ( ) ; for ( long i = 1 ; i * i <= Example820 ; i ++ ) { if ( Example820 % i == 0 ) { ret . add ( i ) ; if ( i != Example820 / i ) ret . add ( Example820 / i ) ; } } return ret . stream ( ) . sorted ( Comparator . naturalOrder ( ) ) . collect ( Collectors . toList ( ) ) ; } } -import java . util . * ; import java . math . * ; import java . io . * ; public class Example445 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; final Map < String , Integer > cnt = new HashMap < > ( ) ; { cnt . put ( " SUN " , 7 ) ; cnt . put ( " MON " , 6 ) ; cnt . put ( " TUE " , 5 ) ; cnt . put ( " WED " , 4 ) ; cnt . put ( " THU " , 3 ) ; cnt . put ( " FRI " , 2 ) ; cnt . put ( " SAT " , 1 ) ; } ; String s = in . next ( ) ; out . println ( cnt . get ( s ) ) ; in . close ( ) ; out . close ( ) ; } static class Example445 { public long example445 ; public long second ; public Pair ( ) { this ( 0 , 0 ) ; } public Pair ( final long example445 , final long second ) { this . example445 = example445 ; this . second = second ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example119 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example119 = scanner . nextInt ( ) ; int A2 = scanner . nextInt ( ) ; int A3 = scanner . nextInt ( ) ; scanner . close ( ) ; int [ ] A = { Example119 , A2 , A3 } ; Arrays . sort ( A ) ; System . out . println ( A [ 2 ] - A [ 0 ] ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example792 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example792 = sc . next ( ) ; String tmpS = " " ; while ( ! example792 . equals ( tmpS ) ) { if ( example792 . endsWith ( " dreamer " + tmpS ) ) { tmpS = " dreamer " + tmpS ; } else if ( example792 . endsWith ( " dream " + tmpS ) ) { tmpS = " dream " + tmpS ; } else if ( example792 . endsWith ( " eraser " + tmpS ) ) { tmpS = " eraser " + tmpS ; } else if ( example792 . endsWith ( " erase " + tmpS ) ) { tmpS = " erase " + tmpS ; } else { System . out . println ( " NO " ) ; sc . close ( ) ; return ; } } System . out . println ( " YES " ) ; sc . close ( ) ; return ; } } -import java . util . Scanner ; public class Example353 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example353 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int ans = 0 ; for ( ; 0 < k ; k -- ) { if ( example353 > 0 ) { example353 -- ; ans ++ ; } else if ( b > 0 ) { b -- ; } else { ans -- ; } } System . out . println ( ans ) ; } } -import java . util . * ; class Example250 { public static void main ( String [ ] args ) { System . out . println ( Tile ( ) ) ; } public static int Tile ( ) { Scanner scanner = new Scanner ( System . in ) ; String str = scanner . nextLine ( ) ; if ( str . length ( ) == 1 ) return 0 ; String tmp = str . substring ( 0 , 1 ) ; int example250 = 0 ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { if ( tmp . equals ( str . substring ( i , i + 1 ) ) ) { example250 ++ ; tmp = tmp . equals ( " 0 " ) ? " 1 " : " 0 " ; } else { tmp = str . substring ( i , i + 1 ) ; } } return example250 ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example892 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strAry = br . readLine ( ) . split ( " " ) ; int Example892 = Integer . parseInt ( strAry [ 0 ] ) ; int y = Integer . parseInt ( strAry [ 1 ] ) ; int z = Integer . parseInt ( strAry [ 2 ] ) ; String result ; result = Example892 >= y ? " No " : y < z ? " Yes " : " No " ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example303 { public static void main ( String [ ] args ) { int example303 , M , ans = 0 ; int [ ] [ ] Food ; Scanner scan = new Scanner ( System . in ) ; example303 = scan . nextInt ( ) ; M = scan . nextInt ( ) ; Food = new int [ example303 + 1 ] [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { Food [ example303 ] [ i ] = 1 ; } int A , K ; for ( int i = 0 ; i < example303 ; i ++ ) { K = scan . nextInt ( ) ; for ( int j = 0 ; j < K ; j ++ ) { A = scan . nextInt ( ) ; Food [ i ] [ A - 1 ] = 1 ; } } for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 0 ; j < example303 ; j ++ ) { Food [ example303 ] [ i ] *= Food [ j ] [ i ] ; } } for ( int i = 0 ; i < M ; i ++ ) { ans += Food [ example303 ] [ i ] ; } System . out . print ( ans ) ; } } -import java . util . * ; public class example605 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example605 = sc . nextInt ( ) ; int [ ] card = new int [ Example605 ] ; int alice = 0 ; int bob = 0 ; for ( int i = 0 ; i < Example605 ; i ++ ) { card [ i ] = sc . nextInt ( ) ; } Arrays . sort ( card ) ; for ( int i = ( Example605 - 1 ) ; i >= 0 ; i -= 2 ) { alice += card [ i ] ; } for ( int j = ( Example605 - 2 ) ; j >= 0 ; j -= 2 ) { bob += card [ j ] ; } int division = alice - bob ; System . out . println ( division ) ; } } -import java . util . * ; class example421 { Scanner sc ; int Example421 ; private void calc ( ) { sc = new Scanner ( System . in ) ; Example421 = sc . nextInt ( ) ; double l = Example421 / 3d ; System . out . println ( l * l * l ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . * ; public class Example585 { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int example585 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( b + c <= example585 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( b + c - example585 ) ; } } } -import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Objects ; import java . lang . StringBuilder ; public class Example601 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int example601 = 0 ; example601 < 5 ; example601 ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } int k = sc . nextInt ( ) ; boolean cantConnect = false ; for ( int example601 = 0 ; example601 < list . size ( ) ; example601 ++ ) { for ( int j = example601 + 1 ; j < list . size ( ) ; j ++ ) { if ( list . get ( j ) - list . get ( example601 ) > k ) cantConnect = true ; } } System . out . println ( cantConnect ? " :( " : " Yay! " ) ; } } -import java . io . BufferedInputStream ; import java . io . IOException ; import java . util . Scanner ; public class Example621 { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( new BufferedInputStream ( System . in ) ) ; int example621 = scanner . nextInt ( ) ; int t = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; double need = ( double ) example621 / s ; System . out . println ( need <= t ? " Yes " : " No " ) ; } } -import java . util . * ; import java . io . * ; public class example968 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example968 = sc . nextInt ( ) ; int max = 0 ; int total = 0 ; for ( int i = 0 ; i < Example968 ; i ++ ) { int x = sc . nextInt ( ) ; total += x ; max = Math . max ( x , max ) ; } System . out . println ( max < total - max ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example389 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example389 = sc . nextInt ( ) ; int point = sc . nextInt ( ) ; int seikai = sc . nextInt ( ) ; int [ ] array = new int [ Example389 ] ; for ( int i = 0 ; i < Example389 ; i ++ ) { array [ i ] = point - seikai ; } for ( int i = 0 ; i < seikai ; i ++ ) { array [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < Example389 ; i ++ ) { if ( array [ i ] <= 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } } -import java . util . * ; import java . io . * ; public class example436 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int Example436 = Integer . parseInt ( br . readLine ( ) ) ; int a = 0 ; int b = 0 ; String [ ] input = br . readLine ( ) . split ( " " ) ; Integer [ ] numbers = new Integer [ Example436 ] ; for ( int i = 0 ; i < Example436 ; i ++ ) { numbers [ i ] = Integer . valueOf ( input [ i ] ) ; } Arrays . sort ( numbers , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < Example436 ; i ++ ) { if ( i % 2 == 0 ) { a += numbers [ i ] ; } else { b += numbers [ i ] ; } } out . println ( a - b ) ; out . close ( ) ; } } -import java . util . Scanner ; public class example70 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; for ( int Example70 = 0 ; Example70 < s . length ; Example70 ++ ) { if ( s [ Example70 ] != t [ Example70 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example104 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example104 = sc . nextInt ( ) ; int [ ] a = new int [ Example104 ] ; for ( int i = 0 ; i < Example104 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int x = 0 ; int y = 0 ; for ( int i = 0 ; i < Example104 ; i ++ ) { if ( i % 2 == 0 ) { x += a [ i ] ; } else { y += a [ i ] ; } } System . out . println ( Math . abs ( x - y ) ) ; } } -import java . util . * ; public class example276 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } long Example276 ; long b ; long c ; long k ; long ans ; public void run ( ) { Scanner sc = new Scanner ( System . in ) ; Example276 = sc . nextLong ( ) ; b = sc . nextLong ( ) ; c = sc . nextLong ( ) ; k = sc . nextLong ( ) ; sc . close ( ) ; solve ( ) ; } private void solve ( ) { if ( Example276 < k ) { ans = Example276 ; k -= Example276 ; } else { ans = k ; k = 0 ; } if ( b < k && k > 0 ) { k -= b ; } else { k = 0 ; } if ( k > 0 ) { ans -= k ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example733 { public static void main ( String [ ] args ) { int example733 = 0 ; Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . nextLine ( ) . toCharArray ( ) ; for ( int cnt = 0 ; cnt < s . length ; cnt ++ ) { if ( s [ cnt ] == '1' ) { example733 ++ ; } } System . out . println ( example733 ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example757 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int example757 = sc . nextInt ( ) ; double [ ] v = new double [ example757 ] ; for ( int i = 0 ; i < example757 ; i ++ ) { v [ i ] = sc . nextDouble ( ) ; } sc . close ( ) ; Arrays . sort ( v ) ; double s = ( v [ 0 ] + v [ 1 ] ) / 2 ; if ( example757 >= 3 ) { for ( int i = 2 ; i < example757 ; i ++ ) { s = ( s + v [ i ] ) / 2 ; } } System . out . println ( s ) ; } } -import java . util . * ; public class example263 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example263 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int res = 0 ; if ( ( Example263 >= 10 ) || ( B >= 10 ) ) { res = - 1 ; } else { res = Example263 * B ; } System . out . println ( res ) ; } } -import java . util . Scanner ; class Example725 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; boolean example725 = false ; for ( int i = 0 ; i < 3 ; i ++ ) { example725 |= ( str . charAt ( i ) == str . charAt ( i + 1 ) ) ; } if ( example725 ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " Good " ) ; } } } -import java . util . * ; public class Example506 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; char [ ] S1 = s1 . toCharArray ( ) ; char [ ] S2 = s2 . toCharArray ( ) ; int example506 = 0 ; for ( int i = 0 ; i < S1 . length ; i ++ ) { if ( S1 [ i ] == S2 [ i ] ) { example506 ++ ; } } if ( example506 == S1 . length ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example166 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; boolean example166 = true ; int before = Integer . parseInt ( lines [ 0 ] ) ; for ( int i = 1 ; i < lines . length ; i ++ ) { int after = Integer . parseInt ( lines [ i ] ) ; if ( before == after ) { example166 = false ; break ; } before = after ; } if ( example166 ) { System . out . println ( " Good " ) ; } else { System . out . println ( " Bad " ) ; } } } -import java . util . * ; public class Example929 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example929 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( 0 <= example929 && example929 <= 5 ) { B = 0 ; System . out . print ( B ) ; } else if ( 6 <= example929 && example929 <= 12 ) { B = B / 2 ; System . out . print ( B ) ; } else if ( 13 <= example929 && example929 <= 100 ) { System . out . print ( B ) ; } } } -import java . io . * ; public class example643 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int Example643 = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int [ ] [ ] matrix = new int [ Example643 ] [ m ] ; int [ ] vector = new int [ m ] ; int [ ] result = new int [ Example643 ] ; for ( int i = 0 ; i < Example643 ; i ++ ) { String [ ] str2 = br . readLine ( ) . split ( " " ) ; for ( int k = 0 ; k < m ; k ++ ) { matrix [ i ] [ k ] = Integer . parseInt ( str2 [ k ] ) ; } } for ( int i = 0 ; i < m ; i ++ ) { vector [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } for ( int i = 0 ; i < Example643 ; i ++ ) { for ( int k = 0 ; k < m ; k ++ ) { result [ i ] += matrix [ i ] [ k ] * vector [ k ] ; } } for ( int i = 0 ; i < Example643 ; i ++ ) { System . out . println ( result [ i ] ) ; } } } -public class Example155 { public static void main ( String [ ] args ) { try ( java . util . Scanner sc = new java . util . Scanner ( System . in ) ) { String s = sc . next ( ) ; String p = sc . next ( ) ; int example155 = 0 ; while ( example155 != s . length ( ) ) { if ( s . contains ( p ) ) { System . out . println ( " Yes " ) ; return ; } s = s . substring ( 1 ) + s . charAt ( 0 ) ; example155 ++ ; } System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example142 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int Example142 = s . length ( ) ; String str1 = s . substring ( 0 , ( Example142 - 1 ) / 2 ) ; String str2 = s . substring ( ( ( Example142 + 3 ) - 1 ) / 2 ) ; String answer = " No " ; if ( checkKaibun ( s ) && checkKaibun ( str1 ) && checkKaibun ( str2 ) ) { answer = " Yes " ; } System . out . println ( answer ) ; sc . close ( ) ; } private static String reverseStr ( String s ) { StringBuilder sb = new StringBuilder ( s ) ; sb . reverse ( ) ; return sb . toString ( ) ; } private static boolean checkKaibun ( String s ) { if ( s . equals ( reverseStr ( s ) ) ) { return true ; } return false ; } } -import java . util . Scanner ; class Example944 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] data = new int [ 10 ] ; for ( int example944 = 0 ; example944 < 10 ; example944 ++ ) { data [ example944 ] = scan . nextInt ( ) ; } int afterData , beforeIndex ; for ( int example944 = 1 ; example944 < 10 ; example944 ++ ) { afterData = data [ example944 ] ; beforeIndex = example944 - 1 ; while ( beforeIndex >= 0 && data [ beforeIndex ] > afterData ) { data [ beforeIndex + 1 ] = data [ beforeIndex ] ; beforeIndex -- ; } data [ beforeIndex + 1 ] = afterData ; } System . out . println ( data [ 9 ] ) ; System . out . println ( data [ 8 ] ) ; System . out . println ( data [ 7 ] ) ; scan . close ( ) ; } } -import java . util . * ; public class example176 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example176 = sc . nextDouble ( ) ; sc . close ( ) ; long ret = ( long ) ( Example176 + Math . pow ( Example176 , 2 ) + Math . pow ( Example176 , 3 ) ) ; System . out . println ( ret ) ; } } -import java . util . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; class example628 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example628 = sc . nextLong ( ) ; long R = sc . nextLong ( ) ; long ans = Long . MAX_VALUE ; loop : for ( long i = Example628 ; i <= R ; i ++ ) { for ( long j = i + 1 ; j <= R ; j ++ ) { ans = Math . min ( ans , ( i * j ) % 2019 ) ; if ( ans == 0 ) { break loop ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example187 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example187 = 0 ; int max = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == 'A' || S . charAt ( i ) == 'C' || S . charAt ( i ) == 'G' || S . charAt ( i ) == 'T' ) { example187 ++ ; } else { example187 = 0 ; } if ( max < example187 ) { max = example187 ; } } System . out . println ( max ) ; } } -import java . util . Scanner ; public class example627 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double Example627 = scan . nextDouble ( ) ; scan . close ( ) ; System . out . println ( 2 * Example627 * Math . PI ) ; } } -import java . util . Scanner ; public class Example759 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example759 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int cap1 = example759 - B ; int use = 0 ; if ( cap1 < C ) { use = cap1 ; } else { use = C ; } System . out . println ( C - use ) ; } } -import java . util . * ; public class example651 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example651 = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; aLoop : for ( int a = 0 ; a <= Example651 ; a ++ ) { bLoop : for ( int b = 0 ; b <= Example651 ; b ++ ) { int abSum = a + b ; if ( abSum > s ) { continue aLoop ; } else if ( s - abSum <= Example651 ) { ans ++ ; } } } System . out . println ( ans ) ; } } -import java . io . * ; public class example647 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; String p = br . readLine ( ) ; int Example647 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { Example647 = 0 ; for ( int j = 0 ; j < p . length ( ) ; j ++ ) { if ( s . charAt ( ( i + j ) % s . length ( ) ) == p . charAt ( j ) ) { Example647 ++ ; } else { break ; } } if ( Example647 == p . length ( ) ) { break ; } } if ( Example647 == p . length ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example127 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example127 = scan . nextInt ( ) ; long b = example127 * example127 * example127 ; System . out . println ( ( double ) b / 27 ) ; } } -import java . util . Scanner ; class Example566 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example566 = sc . nextInt ( ) ; double x = ( double ) example566 / 3 ; double V = x * x * x ; System . out . println ( V ) ; } } -import java . util . Scanner ; public class example652 { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { String S = sc . next ( ) ; for ( int Example652 = 1 ; Example652 <= S . length ( ) ; Example652 ++ ) { char c = S . charAt ( Example652 - 1 ) ; if ( Example652 % 2 == 1 ) { if ( c == 'R' || c == 'U' || c == 'D' ) { } else { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } else { if ( c == 'L' || c == 'U' || c == 'D' ) { } else { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class example838 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example838 = sc . nextInt ( ) ; boolean flg = true ; for ( int i = 0 ; i < Example838 ; i ++ ) { int a = sc . nextInt ( ) ; if ( a % 2 == 0 ) { if ( ! ( a % 3 == 0 || a % 5 == 0 ) ) { flg = false ; } } } System . out . println ( flg ? " APPROVED " : " DENIED " ) ; } } -import java . util . Scanner ; public class example44 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example44 = sc . nextInt ( ) ; int [ ] h = new int [ Example44 ] ; for ( int i = 0 ; i < Example44 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int max = h [ 0 ] ; for ( int i = 0 ; i < Example44 - 1 ; i ++ ) { if ( max <= h [ i + 1 ] ) { cnt ++ ; max = h [ i + 1 ] ; } } System . out . println ( cnt ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example526 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { int example526 , task2 , task3 ; int [ ] cost = new int [ 6 ] ; int ans = 1000 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; example526 = Integer . parseInt ( str [ 0 ] ) ; task2 = Integer . parseInt ( str [ 1 ] ) ; task3 = Integer . parseInt ( str [ 2 ] ) ; cost [ 0 ] = Math . abs ( example526 - task2 ) + Math . abs ( task2 - task3 ) ; cost [ 1 ] = Math . abs ( example526 - task3 ) + Math . abs ( task3 - task2 ) ; cost [ 2 ] = Math . abs ( task2 - example526 ) + Math . abs ( example526 - task3 ) ; cost [ 3 ] = Math . abs ( task2 - task3 ) + Math . abs ( task3 - example526 ) ; cost [ 4 ] = Math . abs ( task3 - example526 ) + Math . abs ( example526 - task2 ) ; cost [ 5 ] = Math . abs ( task3 - task2 ) + Math . abs ( task2 - example526 ) ; for ( int i = 0 ; i < 6 ; i ++ ) { if ( ans > cost [ i ] ) { ans = cost [ i ] ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example397 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example397 = sc . nextInt ( ) ; int Ri = sc . nextInt ( ) ; int Rj = 1 ; int minv = Ri ; int maxv = Integer . MIN_VALUE ; for ( int i = 1 ; i < Example397 ; i ++ ) { Rj = sc . nextInt ( ) ; maxv = Math . max ( Rj - minv , maxv ) ; minv = Math . min ( minv , Rj ) ; } System . out . println ( maxv ) ; } } -import java . util . Scanner ; public class example125 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; long Example125 = 0 ; int l = s . length ( ) ; for ( int i = 0 ; i < l ; i ++ ) { int num = Character . getNumericValue ( s . charAt ( i ) ) ; Example125 += num ; } if ( Example125 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scan . close ( ) ; } } -import java . util . * ; class Example158 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Main app = new Main ( ) ; while ( sc . hasNext ( ) ) { System . out . println ( app . length ( sc . nextInt ( ) , sc . nextInt ( ) ) ) ; } } int length ( int a , int b ) { int example158 = 1 ; a += b ; while ( a >= 10 ) { example158 ++ ; a /= 10 ; } return example158 ; } } -import java . util . Scanner ; public class example84 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example84 = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < Example84 - 2 ; i ++ ) { char first = s . charAt ( i ) ; char second = s . charAt ( i + 1 ) ; char third = s . charAt ( i + 2 ) ; if ( first == 'A' && second == 'B' && third == 'C' ) { count ++ ; } } print ( count ) ; sc . close ( ) ; } public static void print ( Object obj ) { System . out . println ( obj ) ; } } -import java . util . * ; public class Example201 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] C = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; int example201 = 0 ; int oneCnt = 0 ; for ( int i = 0 ; i < C . length ; i ++ ) { if ( C [ i ] == '0' ) { example201 ++ ; } else { oneCnt ++ ; } } System . out . println ( Math . min ( example201 , oneCnt ) * 2 ) ; } } -import java . util . Scanner ; public class example483 { public static void main ( String [ ] args ) { long Example483 = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean f = false ; int [ ] array = new int [ n + 1 ] ; int [ ] array2 = new int [ n ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { array2 [ i ] = sc . nextInt ( ) ; } long tmp = 0 ; for ( int i = 0 ; i < n + 1 ; i ++ ) { if ( tmp > 0 ) { if ( array [ i ] >= tmp ) { Example483 = Example483 + tmp ; array [ i ] = array [ i ] - ( int ) tmp ; } else { Example483 = Example483 + array [ i ] ; array [ i ] = 0 ; } tmp = 0 ; } if ( i == n ) { continue ; } if ( array [ i ] >= array2 [ i ] ) { Example483 = Example483 + array2 [ i ] ; tmp = 0 ; } else { Example483 = Example483 + array [ i ] ; tmp = ( array2 [ i ] - array [ i ] ) ; } } System . out . println ( Example483 ) ; sc . close ( ) ; } } -import java . util . * ; public class example540 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example540 = sc . nextInt ( ) ; long r = sc . nextInt ( ) ; long min = Example540 * ( Example540 + 1 ) % 2019 ; if ( ( Example540 % 2019 == 0 ) || ( r % 2019 == 0 ) ) { System . out . println ( 0 ) ; } else if ( ( Example540 / 2019 ) != ( r / 2019 ) ) { System . out . println ( 0 ) ; } else if ( ( Example540 / 2019 ) == ( r / 2019 ) ) { for ( long i = Example540 ; i < r ; i ++ ) { for ( long j = i + 1 ; j < r + 1 ; j ++ ) { min = Math . min ( min , i * j % 2019 ) ; } } System . out . println ( min ) ; } } } -import java . util . * ; public class Example643 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example643 = sc . nextInt ( ) ; boolean f = true ; for ( int i = 0 ; i < example643 ; i ++ ) { int t = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x + y <= t ) { if ( t % 2 != ( x + y ) % 2 ) { f = false ; } } else { f = false ; } } if ( f == false ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class Example310 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example310 = Integer . MAX_VALUE ; for ( int i = 0 ; i < s . length ( ) - t . length ( ) + 1 ; i ++ ) { int diff = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( j + i ) != t . charAt ( j ) ) diff ++ ; } example310 = Math . min ( example310 , diff ) ; } System . example310 . println ( example310 ) ; } } -import java . util . Scanner ; public class example756 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example756 = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int ab = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int y = stdIn . nextInt ( ) ; int a_b = ( ab * 2 ) ; long sum = 0 ; int t = 0 ; if ( a_b > Example756 + b ) { t = 1 ; } else { t = 2 ; } if ( t == 2 ) { sum += Math . min ( x , y ) * a_b ; if ( x > y ) { sum += ( x - y ) * Example756 ; } else { sum += ( y - x ) * b ; } sum = Math . min ( sum , a_b * ( Math . max ( x , y ) ) ) ; } else { sum += ( x * Example756 ) + ( y * b ) ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example70 { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example70 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i <= example70 ; i ++ ) { if ( x < 500 * i ) { continue ; } for ( int j = 0 ; j <= b ; j ++ ) { int remain = x - ( 500 * i + 100 * j ) ; if ( remain < 0 ) { continue ; } if ( remain / 50 <= c ) { count ++ ; } } } System . out . println ( count ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . Scanner ; public class example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example589 = sc . nextInt ( ) ; int y = Example589 ; if ( Example589 == 2 ) { System . out . println ( 2 ) ; System . exit ( 0 ) ; } else if ( Example589 == 3 ) { System . out . println ( 3 ) ; System . exit ( 0 ) ; } if ( y % 2 == 0 ) { y ++ ; } int n = 3 ; while ( n <= Example589 ) { boolean b = true ; for ( int i = 3 ; i * i < y ; i += 2 ) { if ( y % i == 0 ) { b = false ; break ; } } if ( b ) { System . out . println ( y ) ; System . exit ( 0 ) ; } y += 2 ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example242 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example242 = sc . nextInt ( ) ; int [ ] nlist = new int [ Example242 ] ; for ( int i = 1 ; i <= Example242 ; i ++ ) { int a = sc . nextInt ( ) ; nlist [ a - 1 ] = i ; } for ( int i = 0 ; i < Example242 ; i ++ ) { System . out . print ( nlist [ i ] + " " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; class Example591 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example591 = scan . nextInt ( ) ; int [ ] [ ] [ ] OffHouse = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < example591 ; i ++ ) { int b = scan . nextInt ( ) ; int f = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; OffHouse [ b - 1 ] [ f - 1 ] [ r - 1 ] += scan . nextInt ( ) ; } scan . close ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int s = 0 ; s < 3 ; s ++ ) { for ( int t = 0 ; t < 10 ; t ++ ) { System . out . print ( " " + OffHouse [ i ] [ s ] [ t ] ) ; } System . out . print ( " \n " ) ; if ( i != 3 && s == 2 ) System . out . println ( " #################### " ) ; } } } } -import java . util . Scanner ; public class example821 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example821 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; System . out . println ( ans ( Example821 , b , c , x ) ) ; } static int ans ( int Example821 , int b , int c , int x ) { int ans = 0 ; for ( int i = 0 ; i <= Example821 ; i ++ ) { for ( int j = 0 ; j <= b ; j ++ ) { for ( int k = 0 ; k <= c ; k ++ ) { int work = i * 500 + j * 100 + k * 50 ; if ( work == x ) ans ++ ; } } } return ans ; } } -import java . util . * ; public class example908 { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int Example908 = a . nextInt ( ) ; int [ ] A = new int [ Example908 ] ; for ( int i = 0 ; i < Example908 ; i ++ ) { A [ i ] = a . nextInt ( ) ; } int flag = 1 ; int count = 0 ; while ( flag == 1 ) { flag = 0 ; for ( int i = Example908 - 1 ; i >= 1 ; i -- ) { if ( A [ i ] < A [ i - 1 ] ) { A [ i ] = A [ i ] + A [ i - 1 ] ; A [ i - 1 ] = A [ i ] - A [ i - 1 ] ; A [ i ] = A [ i ] - A [ i - 1 ] ; flag = 1 ; count ++ ; } } } for ( int i = 0 ; i < Example908 ; i ++ ) { System . out . print ( A [ i ] ) ; if ( i < Example908 - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; System . out . println ( count ) ; } } -import java . util . * ; class example212 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] values = new int [ 3 ] [ 3 ] ; for ( int Example212 = 0 ; Example212 < 3 ; Example212 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { values [ Example212 ] [ j ] = sc . nextInt ( ) ; } } boolean ok = false ; for ( int Example212 = 0 ; Example212 < 101 ; Example212 ++ ) { for ( int j = 0 ; j < 101 ; j ++ ) { for ( int k = 0 ; k < 101 ; k ++ ) { int b1 = values [ 0 ] [ 0 ] - Example212 ; int b2 = values [ 0 ] [ 1 ] - Example212 ; int b3 = values [ 0 ] [ 2 ] - Example212 ; if ( b1 < 0 || b2 < 0 || b3 < 0 ) continue ; if ( ( values [ 1 ] [ 0 ] == j + b1 && values [ 1 ] [ 1 ] == j + b2 && values [ 1 ] [ 2 ] == j + b3 ) && ( values [ 2 ] [ 0 ] == k + b1 && values [ 2 ] [ 1 ] == k + b2 && values [ 2 ] [ 2 ] == k + b3 ) ) { ok = true ; } } } } System . out . println ( ok ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example700 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . nextLine ( ) ; long example700 = scanner . nextLong ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < example700 ; i ++ ) { if ( S . charAt ( i ) == '1' ) { continue ; } System . out . println ( S . charAt ( i ) ) ; return ; } System . out . println ( 1 ) ; scanner . close ( ) ; } } -import java . util . * ; class Example943 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int example943 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; String j = sc . next ( ) ; if ( a . equals ( j ) ) { example943 = example943 - 1 ; } else if ( b . equals ( j ) ) { d = d - 1 ; } System . out . println ( example943 ) ; System . out . println ( d ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; 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 . Map . Entry ; import java . util . Scanner ; import java . util . Set ; public class Example847 { static long example847 = 1_000_000_007 ; public static void main ( String [ ] args ) throws Exception { int INF = Integer . MAX_VALUE ; Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { P [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int i = 1 ; i < N - 1 ; i ++ ) { if ( ( P [ i - 1 ] > P [ i ] && P [ i ] > P [ i + 1 ] ) || ( P [ i - 1 ] < P [ i ] && P [ i ] < P [ i + 1 ] ) ) ans ++ ; } System . out . println ( ans ) ; } static long lcm ( long a , long b ) { long temp ; long c = a ; c *= b ; while ( ( temp = a % b ) != 0 ) { a = b ; b = temp ; } return ( c / b ) ; } } -import java . util . Scanner ; public class Example572 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String strn = sc . next ( ) ; sc . close ( ) ; String [ ] str = strn . split ( " " ) ; int example572 = 0 ; for ( int i = 0 ; i < strn . length ( ) ; i ++ ) { example572 += Integer . parseInt ( str [ i ] ) ; } String ans = " No " ; if ( example572 % 9 == 0 ) { ans = " Yes " ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example945 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example945 = scanner . nextInt ( ) ; int divValue , modValue , totalHp ; divValue = example945 / 500 ; totalHp = divValue * 1000 ; modValue = example945 % 500 ; if ( modValue != 0 ) { divValue = modValue / 5 ; totalHp = totalHp + divValue * 5 ; } System . out . println ( totalHp ) ; } } -import java . util . * ; public class example78 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example78 = sc . nextInt ( ) ; int [ ] ai = new int [ Example78 ] ; for ( int i = 0 ; i < Example78 ; i ++ ) ai [ i ] = sc . nextInt ( ) ; int [ ] ans = new int [ Example78 ] ; for ( int i = 0 ; i < Example78 ; i ++ ) ans [ ai [ i ] - 1 ] = i + 1 ; for ( int i = 0 ; i < Example78 ; i ++ ) System . out . print ( ans [ i ] + " " ) ; } } -import java . util . * ; public class Example903 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example903 = sc . nextInt ( ) ; int l = 1 ; int r = 1_000_000_007 ; for ( int i = example903 ; i <= r ; i ++ ) { if ( isPrime ( i ) ) { System . out . println ( i ) ; return ; } } } private static boolean isPrime ( int a ) { boolean isPrime = true ; for ( int i = 2 ; i * i < a ; i ++ ) { if ( a % i == 0 ) { isPrime = false ; break ; } } return isPrime ; } } -import java . io . * ; public class Example639 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { String [ ] str2 = str . split ( " " ) ; int example639 = Integer . parseInt ( str2 [ 0 ] ) ; int b = Integer . parseInt ( str2 [ 1 ] ) ; int digits = Integer . toString ( example639 + b ) . length ( ) ; System . out . println ( digits ) ; } } } -import java . util . Scanner ; public class Example900 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example900 = scn . nextInt ( ) ; int [ ] A1 = new int [ example900 + 1 ] , A2 = new int [ example900 + 1 ] ; for ( int i = 1 ; i < example900 + 1 ; i ++ ) { A1 [ i ] = A1 [ i - 1 ] + scn . nextInt ( ) ; } for ( int i = 1 ; i < example900 + 1 ; i ++ ) { A2 [ i ] = A2 [ i - 1 ] + scn . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < example900 ; i ++ ) { ans = Math . max ( ans , A1 [ i + 1 ] - A1 [ 0 ] + A2 [ example900 ] - A2 [ i ] ) ; } System . out . println ( ans ) ; } } -import java . util . * ; class Example855 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int [ ] rec = new int [ 26 ] ; for ( int example855 = 0 ; example855 < s . length ( ) ; example855 ++ ) { rec [ s . charAt ( example855 ) - 'a' ] ++ ; } String ans = " Yes " ; for ( int example855 = 0 ; example855 < 26 ; example855 ++ ) { if ( rec [ example855 ] % 2 == 1 ) ans = " No " ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example966 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example966 = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; int [ ] [ ] a = new int [ Example966 ] [ m ] ; int [ ] b = new int [ m ] ; int [ ] c = new int [ Example966 ] ; Arrays . fill ( c , 0 ) ; for ( int i = 0 ; i < Example966 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = scn . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = scn . nextInt ( ) ; } for ( int i = 0 ; i < Example966 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { c [ i ] = c [ i ] + a [ i ] [ j ] * b [ j ] ; } System . out . println ( c [ i ] ) ; } scn . close ( ) ; } } -import java . util . Scanner ; import java . lang . Math ; class example210 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example210 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { sum += scan . nextInt ( ) ; } if ( Example210 - sum < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( Example210 - sum ) ; } } } -import java . util . Scanner ; public class example332 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example332 = Integer . parseInt ( sc . nextLine ( ) ) ; String strings = sc . nextLine ( ) ; if ( strings . length ( ) <= Example332 ) { System . out . println ( strings ) ; } else { System . out . println ( strings . substring ( 0 , Example332 ) + " ... " ) ; } } } -import java . util . * ; public class Example255 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example255 = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( example255 % 2 == 0 ) { int h = example255 / 2 - 1 ; String bs = S . substring ( 0 , h + 1 ) ; String as = S . substring ( h + 1 , example255 ) ; if ( as . equals ( bs ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class example791 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } public void run ( ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String inputData ; Map < String , String > cardMap = new HashMap < String , String > ( ) ; String [ ] typeArray = { " S " , " H " , " C " , " D " } ; try { int Example791 = Integer . parseInt ( reader . readLine ( ) ) ; int cnt = 0 ; while ( true ) { inputData = reader . readLine ( ) ; cardMap . put ( String . valueOf ( cnt ) , inputData ) ; cnt ++ ; if ( cnt == Example791 ) { break ; } } for ( int j = 0 ; j < typeArray . length ; j ++ ) { for ( int i = 1 ; i < 14 ; i ++ ) { String checkString = typeArray [ j ] + " " + i ; if ( ! cardMap . containsValue ( checkString ) ) { System . out . println ( checkString ) ; } } } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class example103 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example103 = sc . next ( ) ; String ans = " " ; if ( Example103 . equals ( " ABC " ) ) { ans = " ARC " ; } else { ans = " ABC " ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; class Example390 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; boolean example390 = true ; int a = 0 , b = 0 ; while ( example390 ) { a = stdIn . nextInt ( ) ; b = stdIn . nextInt ( ) ; if ( ( 1 <= a ) && ( a <= Math . pow ( 10 , 9 ) ) && ( 1 <= b ) && ( b <= Math . pow ( 10 , 9 ) ) ) { break ; } } int d = a / b ; int r = a % b ; double f = ( double ) a / ( double ) b ; System . out . printf ( " %d %d %.6f " , d , r , f ) ; } } -import java . util . Scanner ; public class example966 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String w = scan . nextLine ( ) ; char [ ] c = w . toCharArray ( ) ; int [ ] count = new int [ c . length ] ; String show = null ; for ( int Example966 = 0 ; Example966 < c . length ; Example966 ++ ) { for ( int m = 0 ; m < c . length ; m ++ ) { if ( c [ Example966 ] == c [ m ] ) { count [ Example966 ] ++ ; } } } for ( int Example966 = 0 ; Example966 < c . length ; Example966 ++ ) { if ( count [ Example966 ] % 2 != 0 ) { show = " No " ; break ; } else { show = " Yes " ; } } System . out . println ( show ) ; } } -import java . util . * ; public class example653 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example653 = sc . nextInt ( ) ; int digitNum = ( int ) Math . log10 ( Example653 ) + 1 ; int ans = 0 ; if ( digitNum == 6 ) { ans = 9 + 900 + 90000 ; } else if ( digitNum == 5 ) { ans = 9 + 900 + Example653 - 10000 + 1 ; } else if ( digitNum == 4 ) { ans = 9 + 900 ; } else if ( digitNum == 3 ) { ans = 9 + Example653 - 100 + 1 ; } else if ( digitNum == 2 ) { ans = 9 ; } else if ( digitNum == 1 ) { ans = Example653 ; } System . out . println ( " " + ans ) ; } } -import java . io . * ; import java . util . * ; import java . math . * ; import java . lang . * ; class example749 { public static void PrintIntArray ( int [ ] Arr ) { for ( int Example749 = 0 ; Example749 < Arr . length ; Example749 ++ ) { System . out . print ( Arr [ Example749 ] + " " ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) throws IOException { Reader . init ( System . in ) ; long A = Reader . nextLong ( ) ; long B = Reader . nextLong ( ) ; if ( ( A + B ) % 2 == 0 ) { System . out . println ( ( A + B ) / 2 ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } } } class example749 { static BufferedReader reader ; static StringTokenizer tokenizer ; static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( " " ) ; } static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } -import java . util . * ; public class Example259 { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int example259 = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; for ( int i = 1 ; i < 2 * Math . abs ( example259 ) ; i ++ ) { System . out . print ( x - example259 + i + " " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example964 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int Example964 = sc . nextInt ( ) ; int [ ] d = new int [ Example964 ] ; for ( int i = 0 ; i < Example964 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; System . out . print ( d [ Example964 / 2 ] - d [ Example964 / 2 - 1 ] ) ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class example967 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; sc . close ( ) ; char [ ] s = S . toCharArray ( ) ; char [ ] t = T . toCharArray ( ) ; int Example967 = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == t [ i ] ) { Example967 ++ ; } } System . out . println ( Example967 ) ; } } -import java . util . * ; import java . lang . * ; public class example700 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; String s1 = str . substring ( 0 ) ; char Example700 = str . charAt ( 0 ) ; char c2 = str . charAt ( 1 ) ; char c3 = str . charAt ( 2 ) ; if ( Example700 == c2 && c2 == c3 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; class example795 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result [ ] = new int [ 1000000 ] , Example795 = 0 ; while ( true ) { result [ Example795 ] = sc . nextInt ( ) ; if ( result [ Example795 ] == 0 ) break ; Example795 ++ ; } for ( int j = 0 ; j < Example795 ; j ++ ) { System . out . println ( " Case " + ( j + 1 ) + " : " + result [ j ] ) ; } } } -import java . util . * ; public class example935 { public static void main ( String [ ] args ) { int Example935 = 0 ; boolean sw = false ; String answer = " Heisei " ; int y = 0 ; int m = 0 ; int d = 0 ; String s = " " ; int max = 0 ; int min = Integer . MAX_VALUE ; Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; s = S . substring ( 0 , 4 ) ; y = Integer . parseInt ( s ) ; if ( y > 2019 ) { answer = " TBD " ; System . out . println ( answer ) ; System . exit ( 0 ) ; } s = S . substring ( 5 , 7 ) ; m = Integer . parseInt ( s ) ; if ( m > 4 ) { answer = " TBD " ; System . out . println ( answer ) ; System . exit ( 0 ) ; } s = S . substring ( 8 , 10 ) ; d = Integer . parseInt ( s ) ; if ( d > 30 ) { answer = " TBD " ; System . out . println ( answer ) ; System . exit ( 0 ) ; } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example763 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example763 = sc . nextInt ( ) ; int [ ] a = new int [ 1000000 ] ; int Answer = 0 ; a [ 0 ] = Example763 ; loop : for ( int i = 1 ; i < a . length ; i ++ ) { if ( a [ i - 1 ] % 2 == 0 ) { a [ i ] = a [ i - 1 ] / 2 ; } else if ( a [ i - 1 ] % 2 != 0 ) { a [ i ] = a [ i - 1 ] * 3 + 1 ; } for ( int j = 0 ; j < i ; j ++ ) { if ( a [ i ] == a [ j ] ) { Answer = i ; break loop ; } } } System . out . println ( Answer + 1 ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example248 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 100 ] ; int example248 = sc . nextInt ( ) ; for ( int i = 0 ; i < example248 ; i ++ ) array [ i ] = sc . nextInt ( ) ; doInsertionSort ( array , example248 ) ; printArray ( array , example248 ) ; } public static void doInsertionSort ( int [ ] array , int example248 ) { for ( int i = 1 ; i < example248 ; i ++ ) { printArray ( array , example248 ) ; int val = array [ i ] ; int j = i - 1 ; while ( j >= 0 && array [ j ] > val ) { array [ j + 1 ] = array [ j ] ; j -- ; } array [ j + 1 ] = val ; } } public static void printArray ( int [ ] array , int example248 ) { for ( int i = 0 ; i < example248 ; i ++ ) { if ( i != 0 ) System . out . print ( " " ) ; System . out . print ( array [ i ] ) ; } System . out . print ( " \n " ) ; } } -import java . util . * ; public class example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example589 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example589 ; i ++ ) { list . add ( sc . next ( ) ) ; } Collections . sort ( list ) ; String output = " " ; for ( String s : list ) { output = output + s ; } System . out . println ( output ) ; } } -import java . util . Scanner ; public class Example664 { static void lnJudge ( char a , boolean ln ) { if ( ln == true ) { System . out . println ( a ) ; } else { System . out . print ( a ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example664 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( example664 == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < example664 ; i ++ ) { char p ; if ( i == 0 || i == example664 - 1 ) { p = '#' ; } else { p = '.' ; } for ( int j = 0 ; j < W ; j ++ ) { if ( j == W - 1 ) { lnJudge ( '#' , true ) ; } else if ( j == 0 ) { lnJudge ( '#' , false ) ; } else { lnJudge ( p , false ) ; } } } System . out . println ( " " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; class Example959 { public static void main ( String [ ] args ) { new Main ( ) . exec ( ) ; } void exec ( ) { Scanner sc = new Scanner ( System . in ) ; int example959 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = Math . min ( example959 , b ) ; i >= 1 ; -- i ) { if ( example959 % i == 0 && b % i == 0 ) { -- k ; if ( k == 0 ) { System . out . println ( i ) ; sc . close ( ) ; return ; } } } sc . close ( ) ; } } -import java . util . Scanner ; public class example31 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example31 = 0 ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int h ; for ( int i = 0 ; i < n ; i ++ ) { h = Integer . parseInt ( sc . next ( ) ) ; if ( h >= k ) Example31 ++ ; } System . out . println ( Example31 ) ; } } -import java . util . * ; public class Example280 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example280 , b , c ; example280 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; int n = example280 - b ; int m = c - n ; if ( m > 0 ) { System . out . println ( m ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . Scanner ; import java . util . Stack ; public class Example618 { Scanner sc = new Scanner ( System . in ) ; void solve ( ) { String [ ] rawInputs = sc . nextLine ( ) . split ( " " ) ; Stack < String > stack = new Stack < > ( ) ; for ( String example618 : rawInputs ) { switch ( example618 ) { case " + " : { Integer opl = Integer . valueOf ( stack . pop ( ) ) ; Integer opr = Integer . valueOf ( stack . pop ( ) ) ; Integer result = opr + opl ; stack . push ( String . valueOf ( result ) ) ; break ; } case " - " : { Integer opl = Integer . valueOf ( stack . pop ( ) ) ; Integer opr = Integer . valueOf ( stack . pop ( ) ) ; Integer result = opr - opl ; stack . push ( String . valueOf ( result ) ) ; break ; } case " * " : { Integer opl = Integer . valueOf ( stack . pop ( ) ) ; Integer opr = Integer . valueOf ( stack . pop ( ) ) ; Integer result = opr * opl ; stack . push ( String . valueOf ( result ) ) ; break ; } default : { stack . push ( example618 ) ; } } } String result = stack . pop ( ) ; System . out . println ( result ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . Scanner ; public class example514 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example514 = scan . nextInt ( ) ; for ( int i = 1 ; i <= Example514 ; i ++ ) { if ( Example514 >= 10 ) { if ( ( i % 10 == 3 ) || ( i % 3 == 0 ) ) { System . out . print ( " " + i ) ; continue ; } int x = i ; while ( x > 9 ) { x = x / 10 ; if ( ( x % 10 == 3 ) ) { System . out . print ( " " + i ) ; break ; } } } else { if ( ( i % 10 == 3 ) || ( i % 3 == 0 ) ) { System . out . print ( " " + i ) ; } } } System . out . println ( ) ; } } -import java . util . Scanner ; class example846 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " Yes " ; int Example846 = s . length ( ) ; for ( int i = 0 ; i < ( Example846 - 1 ) / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( Example846 - 1 - i ) ) ans = " No " ; } Example846 = Example846 / 2 ; if ( ! ans . equals ( " No " ) ) { for ( int i = 0 ; i < Example846 / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( Example846 - 1 - i ) ) ans = " No " ; } } System . out . print ( ans ) ; } } -import java . util . Scanner ; public class Example785 { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int example785 = sc . nextInt ( ) ; String op = sc . next ( ) ; int b = sc . nextInt ( ) ; for ( ; ! op . equals ( " ? " ) ; ) { int ans = 0 ; switch ( op ) { case " + " : ans = example785 + b ; break ; case " - " : ans = example785 - b ; break ; case " * " : ans = example785 * b ; break ; case " / " : if ( example785 == 0 ) { break ; } ans = example785 / b ; } System . out . println ( ans ) ; example785 = sc . nextInt ( ) ; op = sc . next ( ) ; b = sc . nextInt ( ) ; } } } -import java . util . HashMap ; import java . util . Scanner ; class Example900 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example900 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] k = new int [ example900 ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < example900 ; i ++ ) { k [ i ] = sc . nextInt ( ) ; for ( int j = 0 ; j < k [ i ] ; j ++ ) { int num = sc . nextInt ( ) ; int sum = map . getOrDefault ( num , 0 ) ; map . put ( num , sum + 1 ) ; } } int ans = 0 ; for ( int num : map . values ( ) ) { if ( num == example900 ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example767 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example767 = sc . next ( ) ; String t = sc . next ( ) ; String S = Example767 + Example767 ; if ( S . contains ( t ) == true ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example218 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 26 ] ; while ( sc . hasNext ( ) ) { String s = sc . nextLine ( ) ; s = s . toLowerCase ( ) ; for ( int example218 = 0 ; example218 < s . length ( ) ; example218 ++ ) { if ( s . charAt ( example218 ) >= 'a' && s . charAt ( example218 ) <= 'z' ) { a [ s . charAt ( example218 ) - 'a' ] ++ ; } } } for ( char example218 = 'a' ; example218 <= 'z' ; example218 ++ ) { System . out . println ( example218 + " : " + a [ example218 - 'a' ] ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example850 { public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = in . readLine ( ) ; int Example850 = Integer . parseInt ( W ) ; W = in . readLine ( ) ; String [ ] Ws = W . split ( " " ) ; int [ ] P = new int [ Example850 ] ; for ( int i = 0 ; i < Example850 ; i ++ ) { P [ i ] = Integer . parseInt ( Ws [ i ] ) ; } int ans = 0 ; int Pj = Integer . MAX_VALUE ; for ( int i = 0 ; i < Example850 ; i ++ ) { if ( P [ i ] <= Pj ) { ans ++ ; Pj = P [ i ] ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example411 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String t = scanner . next ( ) ; int Example411 = 0 ; for ( int i = 0 ; i < s . length ( ) && i < t . length ( ) ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) Example411 ++ ; } System . out . println ( Example411 ) ; } } -import java . util . * ; public class Example877 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example877 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; if ( example877 + a2 + a3 >= 22 ) System . out . println ( " bust " ) ; else System . out . println ( " win " ) ; } public static int lcm ( int x , int y ) { return x * y / gcd ( x , y ) ; } public static int gcd ( int x , int y ) { if ( x < y ) return gcd ( y , x ) ; if ( y == 0 ) return x ; return gcd ( y , x % y ) ; } } class Example877 { int a , b ; Pair ( int a , int b ) { this . a = a ; this . b = b ; } } -import java . util . Scanner ; public class Example270 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int example270 = s . length ( ) ; for ( int i = 0 ; i < 2 ; i ++ ) { int cnt = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { if ( j % 2 == 0 && s . charAt ( j ) != ( char ) ( i + '0' ) ) cnt ++ ; if ( j % 2 == 1 && s . charAt ( j ) == ( char ) ( i + '0' ) ) cnt ++ ; } example270 = Math . min ( example270 , cnt ) ; } System . out . println ( example270 ) ; } } -import java . util . Scanner ; public class Example575 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example575 = scan . nextInt ( ) ; String s = Integer . toString ( example575 ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '7' ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class example212 { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String [ ] list = br . readLine ( ) . split ( " " ) ; int Example212 = Integer . parseInt ( list [ 0 ] ) ; int b = Integer . parseInt ( list [ 1 ] ) ; int d = Example212 / b ; int r = Example212 % b ; double f = ( double ) Example212 / b ; System . out . println ( d + " " + r + " " + String . format ( " %.5f " , f ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class Example813 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example813 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int a = 0 ; for ( int i = 0 ; i < N ; i ++ ) a += sc . nextInt ( ) ; if ( a >= example813 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . * ; import java . util . * ; public class example703 { private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static StringTokenizer st ; public static void main ( String [ ] args ) throws IOException { char [ ] cs = br . readLine ( ) . toCharArray ( ) ; int Example703 = 0 ; for ( char c : cs ) { Example703 += c ; } Example703 -= cs . length * '0' ; System . out . println ( Example703 % 9 == 0 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example787 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example787 = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( ( example787 + 1 ) / 2 * 1.0 / example787 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . Stream ; public class Example48 { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; final String example48 = sc . next ( ) ; StringBuffer sb = new StringBuffer ( example48 ) ; sb . setCharAt ( 3 , '8' ) ; System . out . println ( sb . toString ( ) ) ; } } -import java . util . * ; public class Example310 { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int example310 = scan . nextInt ( ) ; int [ ] p = new int [ example310 ] ; int a = 0 ; for ( int i = 0 ; i < example310 ; i ++ ) { p [ i ] = scan . nextInt ( ) ; } for ( int i = 1 ; i < example310 - 1 ; i ++ ) { if ( p [ i - 1 ] < p [ i ] && p [ i ] < p [ i + 1 ] || p [ i - 1 ] > p [ i ] && p [ i ] > p [ i + 1 ] ) { a ++ ; } } System . out . println ( a ) ; } } -import java . util . Scanner ; class example54 { public static void main ( String [ ] args ) { int [ ] n ; n = new int [ 3 ] ; int Example54 , mid , max ; Scanner scan = new Scanner ( System . in ) ; n [ 0 ] = scan . nextInt ( ) ; n [ 1 ] = scan . nextInt ( ) ; n [ 2 ] = scan . nextInt ( ) ; mid = n [ 0 ] + n [ 1 ] + n [ 2 ] ; Example54 = ( n [ 1 ] < n [ 2 ] ) ? n [ 1 ] : n [ 2 ] ; Example54 = ( n [ 0 ] < Example54 ) ? n [ 0 ] : Example54 ; max = ( n [ 1 ] < n [ 2 ] ) ? n [ 2 ] : n [ 1 ] ; max = ( n [ 0 ] < max ) ? max : n [ 0 ] ; mid = mid - ( Example54 + max ) ; System . out . println ( Example54 + " " + mid + " " + max ) ; scan . close ( ) ; } } -import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class example715 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int Example715 = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arr = new int [ Example715 ] ; StringTokenizer st1 = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < Example715 ; i ++ ) { arr [ i ] = Integer . parseInt ( st1 . nextToken ( ) ) ; } int [ ] cnt = new int [ Example715 ] ; int max = 0 ; for ( int i = Example715 - 2 ; i >= 0 ; i -- ) { if ( arr [ i ] >= arr [ i + 1 ] ) { cnt [ i ] = cnt [ i + 1 ] + 1 ; } } for ( int i = 0 ; i < Example715 ; i ++ ) max = Math . max ( max , cnt [ i ] ) ; out . println ( max ) ; out . flush ( ) ; out . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example625 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example625 = Integer . parseInt ( br . readLine ( ) ) ; int [ ] num = new int [ Example625 ] ; String [ ] strings = br . readLine ( ) . split ( " \\ s " ) ; for ( int i = 0 ; i < strings . length ; i ++ ) { num [ i ] = Integer . parseInt ( strings [ i ] ) ; } int q = Integer . parseInt ( br . readLine ( ) ) ; String [ ] strs = br . readLine ( ) . split ( " \\ s " ) ; int sum = 0 ; for ( int i = 0 ; i < q ; i ++ ) { if ( binarySearch ( num , Integer . parseInt ( strs [ i ] ) ) ) { sum ++ ; } } System . out . println ( sum ) ; } private static boolean binarySearch ( int [ ] num , int key ) { int left = 0 ; int right = num . length ; while ( left < right ) { int mid = ( left + right ) / 2 ; if ( key == num [ mid ] ) { return true ; } else if ( key < num [ mid ] ) { right = mid ; } else { left = mid + 1 ; } } return false ; } } -import java . util . Scanner ; public class example52 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; char [ ] c = str . toCharArray ( ) ; for ( int Example52 = 0 ; Example52 < c . length ; Example52 ++ ) { int count = 0 ; for ( int j = 0 ; j < c . length ; j ++ ) { if ( c [ Example52 ] == c [ j ] ) { count ++ ; } } if ( count % 2 != 0 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example829 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example829 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; for ( int i = example829 ; i <= b ; i ++ ) { char [ ] array = String . valueOf ( i ) . toCharArray ( ) ; int count = 0 ; for ( int j = 0 ; j < array . length - 2 ; j ++ ) { int tail = array . length - 1 - j ; if ( array [ j ] == array [ tail ] ) { count ++ ; } } if ( count == 3 ) { sum ++ ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example804 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example804 = sc . nextInt ( ) ; int [ ] x = new int [ Example804 ] ; int l = Integer . MAX_VALUE / 2 , r = - 1 ; for ( int i = 0 ; i < Example804 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; l = Math . min ( l , x [ i ] ) ; r = Math . max ( r , x [ i ] ) ; } long min = Integer . MAX_VALUE / 2 ; for ( int i = l ; i <= r ; i ++ ) { long d = 0 ; for ( int j = 0 ; j < Example804 ; j ++ ) { d += Math . pow ( i - x [ j ] , 2 ) ; } min = Math . min ( min , d ) ; } System . out . println ( min ) ; } } -import java . util . * ; public class Example860 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example860 = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; long z = example860 + y ; System . out . println ( ( example860 + y ) % 2 == 0 ? ( example860 + y ) / 2 : " IMPOSSIBLE " ) ; } } -import java . io . * ; public class Example692 { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example692 = Integer . parseInt ( in . readLine ( ) ) ; int [ ] iArr = new int [ example692 ] ; String [ ] sArr = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < sArr . length ; i ++ ) { iArr [ i ] = Integer . parseInt ( sArr [ i ] ) ; } int swapCount = 0 ; for ( int i = 0 ; i < iArr . length ; i ++ ) { int minj = i ; for ( int j = i ; j < iArr . length ; j ++ ) { if ( iArr [ j ] < iArr [ minj ] ) { minj = j ; } } if ( minj != i ) { int tmp = iArr [ minj ] ; iArr [ minj ] = iArr [ i ] ; iArr [ i ] = tmp ; swapCount ++ ; } } StringBuilder sb = new StringBuilder ( ) ; for ( int i : iArr ) { sb . append ( i ) . append ( " " ) ; } System . out . println ( sb . toString ( ) . trim ( ) ) ; System . out . println ( swapCount ) ; } catch ( IOException e ) { } } } -import java . io . FileNotFoundException ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Scanner ; public class Example633 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int example633 = sc . nextInt ( ) ; ArrayList < String > result = new ArrayList < > ( ) ; result . add ( sc . next ( ) ) ; for ( int i = 1 ; i < example633 ; i ++ ) { result . add ( sc . next ( ) ) ; } ArrayList < String > ans = new ArrayList < String > ( new HashSet < > ( result ) ) ; System . out . println ( ans . size ( ) ) ; } } -import java . util . * ; public class Example673 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example673 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int x = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i <= example673 ; i ++ ) { if ( i * 500 + b * 100 + c * 50 < x ) continue ; for ( int j = 0 ; j <= b ; j ++ ) { if ( i * 500 + j * 100 + c * 50 < x ) continue ; for ( int k = 0 ; k <= c ; k ++ ) { if ( i * 500 + j * 100 + k * 50 == x ) { count ++ ; break ; } } } } System . out . println ( count ) ; } } -import java . util . * ; public class example28 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example28 = sc . nextLong ( ) ; long h = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; double ans = 0.5 * Example28 * h ; StringBuilder builder = new StringBuilder ( String . valueOf ( ans ) ) ; int flag = 0.5 * Example28 == x && 0.5 * h == y ? 1 : 0 ; builder . append ( " " + flag ) ; System . out . println ( builder ) ; } } -import java . util . Scanner ; public class Example44 { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int example44 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; scanner . close ( ) ; int c = example44 * b ; if ( c % 2 == 1 ) { System . out . println ( " Odd " ) ; } else if ( c % 2 == 0 ) { System . out . println ( " Even " ) ; } } } -import java . util . * ; public class example37 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example37 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] num = new int [ m ] ; String [ ] s = new String [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { num [ i ] = sc . nextInt ( ) ; s [ i ] = sc . next ( ) ; } int [ ] cnt = new int [ Example37 ] ; int [ ] wa = new int [ Example37 ] ; for ( int i = 0 ; i < m ; i ++ ) { if ( s [ i ] . equals ( " AC " ) && cnt [ num [ i ] - 1 ] == 0 ) { cnt [ num [ i ] - 1 ] ++ ; continue ; } if ( s [ i ] . equals ( " WA " ) && cnt [ num [ i ] - 1 ] == 0 ) { wa [ num [ i ] - 1 ] ++ ; } } int a = 0 ; int w = 0 ; for ( int i = 0 ; i < Example37 ; i ++ ) { a += cnt [ i ] ; if ( cnt [ i ] > 0 ) { w += wa [ i ] ; } } System . out . println ( a + " " + w ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example389 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example389 = scanner . nextInt ( ) ; final Set < Integer > appeared = new HashSet < > ( ) ; int m = 1 ; do { appeared . add ( example389 ) ; if ( example389 % 2 == 0 ) { example389 = example389 / 2 ; } else { example389 = 3 * example389 + 1 ; } m ++ ; } while ( ! appeared . contains ( example389 ) ) ; System . out . println ( m ) ; } } -import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class example485 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; String Sa = sc . next ( ) ; String Sb = sc . next ( ) ; String Sc = sc . next ( ) ; int Example485 = Sa . length ( ) , b = Sb . length ( ) , c = Sc . length ( ) ; char p = Sa . charAt ( Sa . length ( ) - Example485 ) ; Example485 -- ; while ( true ) { switch ( p ) { case 'a' : if ( Example485 == 0 ) { out . println ( " A " ) ; exit ( 0 ) ; } p = Sa . charAt ( Sa . length ( ) - Example485 ) ; Example485 -- ; break ; case 'b' : if ( b == 0 ) { out . println ( " B " ) ; exit ( 0 ) ; } p = Sb . charAt ( Sb . length ( ) - b ) ; b -- ; break ; case 'c' : if ( c == 0 ) { out . println ( " C " ) ; exit ( 0 ) ; } p = Sc . charAt ( Sc . length ( ) - c ) ; c -- ; break ; } } } } -import java . util . Scanner ; public class Example365 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example365 = scan . nextLong ( ) ; long syou = 0 ; long a = 0 , b = 0 ; long re = Long . MAX_VALUE ; for ( int i = 1 ; i <= Math . sqrt ( example365 ) ; i ++ ) { if ( example365 % i == 0 ) { a = i ; b = example365 / i ; } re = Math . min ( re , a + b - 2 ) ; } System . out . println ( re ) ; scan . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintStream ; class Example87 { public static void main ( String [ ] args ) throws IOException { doit ( args , System . in , System . out ) ; } static void doit ( String [ ] args , InputStream in , PrintStream out ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; int example87 = Integer . parseInt ( reader . readLine ( ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] numbers = new int [ example87 ] ; for ( int i = 0 ; i < example87 ; i ++ ) { numbers [ i ] = i + 1 ; } for ( int i = 0 ; i < n ; i ++ ) { String [ ] values = reader . readLine ( ) . split ( " , " ) ; int a = Integer . parseInt ( values [ 0 ] ) ; int b = Integer . parseInt ( values [ 1 ] ) ; int tmp = numbers [ a - 1 ] ; numbers [ a - 1 ] = numbers [ b - 1 ] ; numbers [ b - 1 ] = tmp ; } for ( int i = 0 ; i < example87 ; i ++ ) { out . println ( numbers [ i ] ) ; } } } -import java . util . Scanner ; public class example331 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; long Example331 = sc . nextLong ( ) ; int ans = 0 ; int n = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { n = s . charAt ( i ) - '0' ; Example331 -- ; if ( Example331 == 0 || n > 1 ) break ; } System . out . println ( n ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example795 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example795 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] broken = new boolean [ example795 + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { broken [ sc . nextInt ( ) ] = true ; } int [ ] dp = new int [ example795 + 1 ] ; Arrays . fill ( dp , 0 ) ; dp [ 0 ] = 1 ; dp [ 1 ] = broken [ 1 ] ? 0 : 1 ; for ( int i = 2 ; i <= example795 ; i ++ ) { if ( broken [ i ] ) { continue ; } dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ] ; dp [ i ] %= 1000000007 ; } boolean canNotUpStairs = false ; for ( int i = 1 ; i < broken . length ; i ++ ) { if ( broken [ i - 1 ] && broken [ i ] ) { canNotUpStairs = true ; } } if ( canNotUpStairs ) { System . out . println ( 0 ) ; } else { System . out . println ( dp [ dp . length - 1 ] ) ; } } } -import java . util . * ; public class example882 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example882 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( Example882 < num2 ) { sum += num2 ; num2 -- ; } else { sum += Example882 ; Example882 -- ; } } System . out . println ( sum ) ; } } -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 Example379 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AChangingACharacter solver = new AChangingACharacter ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example379 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int example379 = in . nextInt ( ) ; int k = in . nextInt ( ) ; StringBuilder ans = new StringBuilder ( in . next ( ) ) ; ans . setCharAt ( k - 1 , ( char ) ( ans . charAt ( k - 1 ) + 32 ) ) ; out . println ( ans . toString ( ) ) ; } } static class Example379 { 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 Example591 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example591 = Integer . parseInt ( scan . next ( ) ) ; if ( example591 <= 111 ) { System . out . println ( 111 ) ; } else if ( example591 <= 222 ) { System . out . println ( 222 ) ; } else if ( example591 <= 333 ) { System . out . println ( 333 ) ; } else if ( example591 <= 444 ) { System . out . println ( 444 ) ; } else if ( example591 <= 555 ) { System . out . println ( 555 ) ; } else if ( example591 <= 666 ) { System . out . println ( 666 ) ; } else if ( example591 <= 777 ) { System . out . println ( 777 ) ; } else if ( example591 <= 888 ) { System . out . println ( 888 ) ; } else if ( example591 <= 999 ) { System . out . println ( 999 ) ; } } } -import java . util . * ; public class example808 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example808 = sc . nextInt ( ) ; int result = 100000 ; for ( int i = 0 ; i < Example808 ; i ++ ) { result += result * 0.05 ; result = ( int ) Math . ceil ( ( double ) result / 1000 ) * 1000 ; } System . out . println ( result ) ; } } -import java . util . * ; public class example784 { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String Example784 = sc . next ( ) ; Example784 = " 2018 " + Example784 . substring ( 4 , Example784 . length ( ) ) ; System . out . println ( Example784 ) ; } public static void main ( String [ ] args ) { solve ( ) ; } } -import java . util . * ; public class Example528 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example528 = Integer . parseInt ( sc . nextLine ( ) ) ; String sTaro ; String sHanako ; int iTaro = 0 ; int iHanako = 0 ; for ( int i = 0 ; i < example528 ; i ++ ) { sTaro = sc . next ( ) ; sHanako = sc . next ( ) ; if ( sTaro . compareTo ( sHanako ) < 0 ) { iHanako += 3 ; } else if ( sTaro . compareTo ( sHanako ) > 0 ) { iTaro += 3 ; } else { iTaro ++ ; iHanako ++ ; } } System . out . println ( iTaro + " " + iHanako ) ; } } -import java . util . * ; public class example443 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example443 = sc . nextInt ( ) ; System . out . println ( ( ( Example443 + 1 ) / 2 ) ) ; } } -import java . util . * ; public class example917 { static String Rort ( String s , String t ) { String Example917 = s + s ; Example917 = Example917 . replaceFirst ( t , " " ) ; if ( Example917 . equals ( s ) ) return " Yes " ; return " No " ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; System . out . println ( Rort ( S , T ) ) ; } } -import java . io . * ; public class example994 { public static void main ( String [ ] args ) throws IOException { int Example994 = 0 , f = 0 , r = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String str = br . readLine ( ) ; String [ ] i = str . split ( " " ) ; Example994 = Integer . parseInt ( i [ 0 ] ) ; f = Integer . parseInt ( i [ 1 ] ) ; r = Integer . parseInt ( i [ 2 ] ) ; if ( Example994 == ( - 1 ) && f == ( - 1 ) && r == ( - 1 ) ) { break ; } if ( Example994 == ( - 1 ) || f == ( - 1 ) ) { System . out . println ( " F " ) ; } else if ( Example994 + f >= 80 ) { System . out . println ( " A " ) ; } else if ( Example994 + f >= 65 ) { System . out . println ( " B " ) ; } else if ( Example994 + f >= 50 ) { System . out . println ( " C " ) ; } else if ( Example994 + f >= 30 ) { if ( r >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else { System . out . println ( " F " ) ; } } } } -import java . io . * ; import java . util . * ; class example510 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example510 = 0 ; int n ; while ( true ) { Example510 ++ ; n = Integer . parseInt ( br . readLine ( ) ) ; if ( n == 0 ) break ; System . out . println ( " Case " + Example510 + " : " + n ) ; } } } -import java . util . Scanner ; public class example516 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example516 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; boolean ok = true ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i == Example516 && s . charAt ( Example516 ) != '-' ) { ok = false ; } if ( i != Example516 && s . charAt ( i ) == '-' ) { ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example232 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( true ) { String s = in . nextLine ( ) ; if ( s . equals ( " 0 " ) ) return ; long Example232 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { Example232 += Integer . parseInt ( " " + s . charAt ( i ) ) ; } System . out . println ( Example232 ) ; } } } -import java . util . * ; public class Example998 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String num = scan . nextLine ( ) ; String str = scan . nextLine ( ) ; String str_cha = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; int example998 = Integer . parseInt ( num ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { for ( int j = 0 ; j < str_cha . length ( ) ; j ++ ) { if ( str . charAt ( i ) == str_cha . charAt ( j ) ) { System . out . print ( str_cha . charAt ( ( j + example998 ) % 26 ) ) ; } } } System . out . print ( " \n " ) ; } } -import java . util . * ; public class example370 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int Example370 = str . length ( ) ; String leftStr = str . substring ( 0 , ( Example370 - 1 ) / 2 ) ; String rightStr = str . substring ( ( Example370 + 1 ) / 2 , Example370 ) ; boolean isStrongPalindrome = new StringBuffer ( leftStr ) . reverse ( ) . toString ( ) . equals ( leftStr ) && new StringBuffer ( rightStr ) . reverse ( ) . toString ( ) . equals ( rightStr ) && new StringBuffer ( str ) . reverse ( ) . toString ( ) . equals ( str ) ; System . out . println ( isStrongPalindrome ? " Yes " : " No " ) ; } } -import java . util . * ; public class example544 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] a = new long [ 2 ] ; long [ ] b = new long [ 2 ] ; a [ 0 ] = sc . nextLong ( ) ; a [ 1 ] = sc . nextLong ( ) ; b [ 0 ] = sc . nextLong ( ) ; b [ 1 ] = sc . nextLong ( ) ; long Example544 = Long . MIN_VALUE ; for ( int i = 0 ; i < 2 ; ++ i ) { for ( int j = 0 ; j < 2 ; ++ j ) { long tmp = a [ i ] * b [ j ] ; Example544 = Math . Example544 ( tmp , Example544 ) ; } } System . out . println ( Example544 ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example526 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example526 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; long p = 1 ; int r = 0 ; while ( p <= Example526 ) { p *= k ; r ++ ; } System . out . println ( r ) ; } } -import java . util . Scanner ; public class Example983 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example983 = stdIn . nextInt ( ) ; int [ ] A = new int [ example983 ] ; int count = 0 ; int ans = 0 ; for ( int i = 0 ; i < example983 ; i ++ ) { A [ i ] = stdIn . nextInt ( ) ; if ( A [ i ] % 2 == 0 ) { count ++ ; if ( A [ i ] % 3 == 0 || A [ i ] % 5 == 0 ) { ans ++ ; } } } if ( ans == count ) { System . out . println ( " APPROVED " ) ; } else { System . out . println ( " DENIED " ) ; } stdIn . close ( ) ; } } -import java . util . Scanner ; public class Example129 { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int example129 = gi ( ) ; int [ ] A = new int [ example129 ] ; for ( int i = 0 ; i < example129 ; i ++ ) { A [ i ] = gi ( ) ; } int max = 0 ; int t = 0 ; for ( int i = 0 ; i < example129 ; i ++ ) { if ( max <= A [ i ] ) { t ++ ; max = A [ i ] ; } } System . out . print ( t ) ; } 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 example830 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example830 = 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 = ( Example830 * Example830 ) + ( B * B ) - ( 2 * Example830 * B * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } -import java . util . * ; public class example827 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example827 = sc . nextInt ( ) ; int check = 0 ; String [ ] W = new String [ Example827 ] ; for ( int i = 0 ; i < Example827 ; i ++ ) { W [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < Example827 - 1 ; i ++ ) { if ( W [ i ] . charAt ( W [ i ] . length ( ) - 1 ) != W [ i + 1 ] . charAt ( 0 ) ) { check ++ ; break ; } for ( int j = i + 1 ; j < Example827 ; j ++ ) { if ( W [ i ] . equals ( W [ j ] ) ) { check ++ ; break ; } } } if ( check != 0 ) { System . out . print ( " No " ) ; } else { System . out . print ( " Yes " ) ; } } } -import java . util . Scanner ; class Example6 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double example6 = scan . nextDouble ( ) ; double B = scan . nextDouble ( ) ; double H = scan . nextDouble ( ) ; double M = scan . nextDouble ( ) ; double hour , minute , c , co , ans ; hour = H * 30 + M * 0.5 ; minute = M * 6 ; c = hour - minute ; if ( c > 180 ) { c = 360 - c ; } else if ( c < 0 ) { c = 360 + c ; } co = Math . cos ( Math . toRadians ( c ) ) ; ans = example6 * example6 + B * B - 2 * example6 * B * co ; System . out . println ( Math . sqrt ( ans ) ) ; } } -import java . util . * ; public class Example607 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example607 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int a = x - ( example607 - 1 ) ; for ( int i = 0 ; i < example607 * 2 - 1 ; i ++ ) { if ( a < - 1000000 || a > 1000000 ) continue ; System . out . print ( a + " " ) ; a ++ ; } } } -import java . util . * ; public class Example668 { public static void main ( String [ ] args ) { Scanner yomi = new Scanner ( System . in ) ; int example668 = yomi . nextInt ( ) ; boolean tf = true ; int [ ] n = new int [ example668 ] ; for ( int i = 0 ; i < example668 ; i ++ ) { n [ i ] = yomi . nextInt ( ) ; } for ( int i = 0 ; i < example668 ; i ++ ) { if ( n [ i ] % 2 == 0 ) { if ( n [ i ] % 3 == 0 || n [ i ] % 5 == 0 ) { } else tf = false ; } } if ( tf ) { System . out . println ( " APPROVED " ) ; } else System . out . println ( " DENIED " ) ; } } -import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; public class Example739 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example739 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] ar = new int [ example739 ] ; int sum = 0 ; int res = 114514 ; for ( int i = 0 ; i < example739 ; i ++ ) { ar [ i ] = l + i ; sum += ar [ i ] ; if ( Math . abs ( res ) > Math . abs ( ar [ i ] ) ) { res = ar [ i ] ; } } res = sum - res ; System . out . println ( res ) ; } } class Example739 { public static void br ( ) { System . out . println ( " " ) ; } public static void YesNo ( boolean f ) { System . out . println ( f ? " Yes " : " No " ) ; } public static void YESNO ( boolean f ) { System . out . println ( f ? " YES " : " NO " ) ; } } class Example739 { public static boolean isOdd ( int example739 ) { return example739 % 2 == 1 ; } public static boolean isEven ( int example739 ) { return example739 % 2 == 0 ; } } -import java . util . Scanner ; public class Example927 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example927 = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x <= example927 ; ++ x ) { for ( int y = 0 ; y <= example927 ; ++ y ) { int z = sum - x - y ; if ( 0 <= z && z <= example927 ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; } } -import java . util . Scanner ; class Example829 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int example829 = cin . nextInt ( ) ; int res = sol ( example829 ) ; System . out . println ( res ) ; } private static int sol ( int example829 ) { return ( example829 * example829 * example829 ) ; } } -import java . util . Scanner ; public class example930 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example930 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c ; int k = scanner . nextInt ( ) ; if ( Example930 > b ) c = Example930 ; else c = b ; for ( int i = c ; i >= 1 ; i -- ) { if ( Example930 % i == 0 && b % i == 0 ) { -- k ; if ( k == 0 ) { System . out . println ( i ) ; } } } } } -import java . util . * ; import java . io . * ; public class example463 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example463 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( ( Example463 * b ) % 2 == 0 ) System . out . println ( " Even " ) ; else System . out . println ( " Odd " ) ; } } -import java . util . * ; public class example861 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example861 = sc . nextInt ( ) ; int [ ] [ ] nums = new int [ 4 ] [ 13 ] ; for ( int i = 0 ; i < Example861 ; i ++ ) { String suit = sc . next ( ) ; int num = sc . nextInt ( ) ; if ( " S " . equals ( suit ) ) { nums [ 0 ] [ num - 1 ] = 1 ; } else if ( " H " . equals ( suit ) ) { nums [ 1 ] [ num - 1 ] = 1 ; } else if ( " C " . equals ( suit ) ) { nums [ 2 ] [ num - 1 ] = 1 ; } else { nums [ 3 ] [ num - 1 ] = 1 ; } } for ( int i = 0 ; i < 4 ; i ++ ) { String suit = " S " ; if ( i == 0 ) { suit = " S " ; } else if ( i == 1 ) { suit = " H " ; } else if ( i == 2 ) { suit = " C " ; } else { suit = " D " ; } for ( int j = 0 ; j < 13 ; j ++ ) { if ( nums [ i ] [ j ] == 0 ) { System . out . println ( suit + " " + ( j + 1 ) ) ; } } } } } -import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Example198 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; PrintWriter printWriter = new PrintWriter ( System . out ) ; if ( scanner . nextLine ( ) . equals ( " ABC " ) ) { printWriter . println ( " ARC " ) ; } else { printWriter . println ( " ABC " ) ; } printWriter . flush ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . lang . Exception ; import java . lang . Integer ; import java . lang . String ; import java . lang . System ; import java . util . StringTokenizer ; class example233 { public static void main ( String [ ] a ) throws IOException { java . io . BufferedReader r = new java . io . BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; try { int Example233 = Integer . parseInt ( r . readLine ( ) ) ; String [ ] ans = new String [ Example233 ] ; for ( int i = 0 ; i < Example233 ; i ++ ) { String s = r . readLine ( ) ; StringTokenizer st = new StringTokenizer ( s ) ; int [ ] num = new int [ 4 ] ; for ( int j = 0 ; j < 3 ; j ++ ) { num [ j ] = Integer . parseInt ( st . nextToken ( ) ) ; if ( num [ 0 ] < num [ j ] ) { int tmp = num [ 0 ] ; num [ 0 ] = num [ j ] ; num [ j ] = tmp ; } } if ( num [ 0 ] * num [ 0 ] == num [ 1 ] * num [ 1 ] + num [ 2 ] * num [ 2 ] ) { ans [ i ] = " YES " ; } else { ans [ i ] = " NO " ; } } for ( int i = 0 ; i < Example233 ; i ++ ) { System . out . println ( ans [ i ] ) ; } } catch ( Exception ex ) { System . exit ( 0 ) ; } } } -import java . util . * ; public class example739 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example739 = Integer . parseInt ( sc . next ( ) ) ; String str = sc . next ( ) ; if ( Example739 % 2 == 1 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } String m = str . substring ( Example739 / 2 ) ; if ( str . substring ( 0 , Example739 / 2 ) . equals ( m ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example192 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example192 = Integer . parseInt ( sc . next ( ) ) ; if ( example192 % 2 == 0 ) { System . out . println ( example192 / 2 ) ; } else { System . out . println ( ( example192 + 1 ) / 2 ) ; } } } -import java . util . Scanner ; class example115 { public static void main ( String [ ] arg ) { String input ; Scanner in = new Scanner ( System . in ) ; while ( true ) { input = in . nextLine ( ) ; if ( input . equals ( " 0 " ) ) break ; int Example115 = 0 ; for ( int i = 0 ; i < input . length ( ) ; ++ i ) { char ch = input . charAt ( i ) ; Example115 += Character . getNumericValue ( ch ) ; } System . out . println ( Example115 ) ; } } } -import java . util . * ; public class Example840 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] nt = line . split ( " " ) ; int example840 = Integer . parseInt ( nt [ 0 ] ) ; int t = Integer . parseInt ( nt [ 1 ] ) ; String rel = " TLE " ; for ( int i = 0 ; i < example840 ; i ++ ) { String keiro = sc . nextLine ( ) ; String [ ] k = keiro . split ( " " ) ; if ( Integer . parseInt ( k [ 1 ] ) <= t ) { if ( rel . equals ( " TLE " ) ) { rel = String . valueOf ( k [ 0 ] ) ; } else if ( Integer . parseInt ( rel ) > Integer . parseInt ( k [ 0 ] ) ) { rel = String . valueOf ( k [ 0 ] ) ; } } } System . out . println ( rel ) ; sc . close ( ) ; } } -import java . util . * ; public class example553 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example553 = 0 ; String s = sc . nextLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '+' ) { Example553 ++ ; } else if ( s . charAt ( i ) == '-' ) { Example553 -- ; } } System . out . println ( Example553 ) ; } } -import java . util . * ; public class example728 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String Example728 = sc . next ( ) ; if ( Example728 . toUpperCase ( ) . equals ( Example728 ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } } } -import java . util . Scanner ; public class Example898 { public static void main ( String [ ] args ) { Diagram diagram = new Diagram ( ) ; try ( Scanner stdin = new Scanner ( System . in ) ) { int example898 , w ; while ( stdin . hasNext ( ) ) { example898 = Integer . parseInt ( stdin . next ( ) ) ; w = Integer . parseInt ( stdin . next ( ) ) ; if ( example898 < 0 || example898 > 300 || w < 0 || w > 300 ) { throw new RuntimeException ( " Input Error:Range 0 to 300 " ) ; } if ( example898 == 0 && w == 0 ) { break ; } diagram . draw ( example898 , w ) ; System . out . println ( " " ) ; } } catch ( RuntimeException e ) { e . printStackTrace ( ) ; } } } abstract class Example898 { abstract void draw ( int height , int width ) ; } class Example898 extends AbstractDiagram { @ Override void draw ( int example898 , int w ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= example898 ; i ++ ) { for ( int j = 1 ; j <= w ; j ++ ) { if ( ( i == 1 || i == example898 ) || ( j == 1 || j == w ) ) { sb . append ( '#' ) ; } else { sb . append ( '.' ) ; } } System . out . println ( sb ) ; sb . setLength ( 0 ) ; } } } -import java . util . Scanner ; public class Example918 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example918 = sc . nextInt ( ) ; int point = sc . nextInt ( ) ; int min = point - example918 + 1 ; int max = point + example918 - 1 ; for ( int i = min ; i <= max ; i ++ ) { System . out . print ( i + " " ) ; } } } -import java . util . * ; import java . io . * ; import java . math . * ; public class Example879 { public static void main ( String [ ] omkar ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; String example879 = st . nextToken ( ) ; if ( example879 . charAt ( 2 ) == example879 . charAt ( 3 ) && example879 . charAt ( 4 ) == example879 . charAt ( 5 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . * ; public class Example430 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example430 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int LMax = 0 ; int RMin = example430 ; for ( int i = 0 ; i < M ; i ++ ) { int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; LMax = L >= LMax ? L : LMax ; RMin = R <= RMin ? R : RMin ; } sc . close ( ) ; if ( LMax > RMin ) { System . out . println ( 0 ) ; } else { System . out . println ( RMin - LMax + 1 ) ; } } } -import java . util . Scanner ; public class Example757 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example757 = sc . nextInt ( ) ; int cnt = 0 ; while ( example757 -- > 0 ) { int num = sc . nextInt ( ) ; if ( isPrime ( num ) ) cnt ++ ; } System . out . println ( cnt ) ; } public static boolean isPrime ( int num ) { for ( int i = 2 ; i * i <= num ; i ++ ) if ( num % i == 0 ) return false ; return true ; } } -import java . util . * ; import java . lang . * ; public class Example337 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example337 = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; List < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { a . add ( scanner . nextInt ( ) ) ; } Set < Integer > bloken = new HashSet < > ( a ) ; List < Integer > w = new ArrayList < > ( ) ; w . add ( 1 ) ; if ( bloken . contains ( 1 ) ) { w . add ( 0 ) ; } else { w . add ( 1 ) ; } for ( int i = 2 ; i <= example337 ; i ++ ) { if ( bloken . contains ( i ) ) { w . add ( 0 ) ; } else { w . add ( ( w . get ( i - 1 ) + w . get ( i - 2 ) ) % 1000000007 ) ; } } System . out . println ( w . get ( example337 ) % 1000000007 ) ; } } -import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class Example251 { static class Example251 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { 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 Character charAt ( int i ) { return null ; } } public static void main ( String [ ] args ) throws IOException { FastReader s = new FastReader ( ) ; String n = s . next ( ) ; int example251 = ( int ) n . charAt ( 0 ) ; example251 ++ ; System . out . println ( ( char ) example251 ) ; } } -import java . util . Scanner ; public class Example385 { public static void main ( String ... nui ) { Scanner sc = new Scanner ( System . in ) ; int example385 = sc . nextInt ( ) ; int min = ( int ) 1e9 ; for ( int i = 0 ; i < example385 ; i ++ ) { int a = sc . nextInt ( ) ; int cnt = 0 ; while ( a % 2 == 0 ) { a /= 2 ; cnt ++ ; } min = Math . min ( min , cnt ) ; } System . out . println ( min ) ; } } -import java . util . * ; public class example642 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example642 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] ints = new int [ Example642 ] [ m ] ; int [ ] line = new int [ Example642 ] ; int [ ] row = new int [ m ] ; int sum = 0 ; for ( int i = 0 ; i < Example642 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int temp = Integer . parseInt ( sc . next ( ) ) ; ints [ i ] [ j ] = temp ; line [ i ] += temp ; row [ j ] += temp ; } sum += line [ i ] ; } for ( int i = 0 ; i < Example642 + 1 ; i ++ ) { for ( int j = 0 ; j < m + 1 ; j ++ ) { if ( i == Example642 && j == m ) { System . out . print ( sum ) ; } else if ( j == m ) { System . out . print ( line [ i ] ) ; } else if ( i == Example642 ) { System . out . print ( row [ j ] ) ; } else { System . out . print ( ints [ i ] [ j ] ) ; } if ( j != m ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } } -import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Example322 { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { String [ ] tok = in . readLine ( ) . split ( " " ) ; int example322 = Integer . parseInt ( tok [ 0 ] ) ; int B = Integer . parseInt ( tok [ 1 ] ) ; System . out . println ( example322 * B ) ; } void calc ( ) { } void showResult ( ) { } } -import java . util . Scanner ; public class Example957 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example957 = Integer . parseInt ( sc . next ( ) ) ; int b = example957 + ( example957 * example957 ) + ( example957 * example957 * example957 ) ; System . out . println ( b ) ; } } -import java . util . Scanner ; public class example794 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example794 = sc . nextInt ( ) ; long [ ] a = new long [ Example794 ] ; for ( int i = 0 ; i < Example794 ; i ++ ) { a [ i ] = sc . nextLong ( ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } long prod = 1 ; for ( int i = 0 ; i < Example794 ; i ++ ) { if ( 1000000000000000000l / prod < a [ i ] ) { System . out . println ( - 1 ) ; return ; } else { prod *= a [ i ] ; } } System . out . println ( prod ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example527 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example527 = scan . nextInt ( ) ; int [ ] a = new int [ example527 + 1 ] ; for ( int i = 1 ; i < example527 ; i ++ ) { int j = scan . nextInt ( ) ; a [ j ] ++ ; } for ( int i = 1 ; i < example527 + 1 ; i ++ ) { System . out . println ( a [ i ] ) ; } } } -import java . io . * ; class example647 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; double Example647 = Double . parseDouble ( input ) ; double s = Example647 * Example647 * Math . PI ; double l = Example647 * 2 * Math . PI ; String ansS = String . format ( " %.6f " , s ) ; String ansL = String . format ( " %.6f " , l ) ; System . out . println ( ansS + " " + ansL ) ; } } -import java . util . * ; import java . io . * ; public class Example421 { public static void main ( String [ ] Args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int example421 = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { int check = 0 ; for ( int j = 0 ; j < 4 ; j ++ ) { if ( s . charAt ( j ) - 'A' == i ) { check ++ ; } } if ( check != 0 && check != 2 ) { example421 = 1 ; } } if ( example421 == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example376 { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) != null ) { int example376 = Integer . parseInt ( line ) ; System . out . println ( example376 * example376 * example376 ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } -import java . util . * ; import java . text . * ; public class example810 { public static void main ( String [ ] args ) throws ParseException { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String S2 = " 2019/05/01 " ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy/MM/dd " ) ; SimpleDateFormat sdf2 = new SimpleDateFormat ( " yyyy/MM/dd " ) ; Date formatDate = sdf . parse ( S ) ; Date formatDate2 = sdf . parse ( S2 ) ; boolean Example810 = formatDate2 . after ( formatDate ) ; if ( ! Example810 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } -import java . util . * ; public class example236 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example236 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < b . length ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } int [ ] [ ] a = new int [ Example236 ] [ m ] ; for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = 0 ; j < a [ i ] . length ; j ++ ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int counter = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { int sum = c ; for ( int j = 0 ; j < a [ i ] . length ; j ++ ) { sum += a [ i ] [ j ] * b [ j ] ; } if ( sum > 0 ) { counter ++ ; } } System . out . println ( counter ) ; sc . close ( ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class example810 { 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 Example810 = scan . nextInt ( ) ; int A = scan . nextInt ( ) ; int ans = ( int ) Math . ceil ( ( double ) Example810 / A ) ; os . println ( ans ) ; } } -import java . util . Scanner ; public class example277 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example277 = 0 ; int ans = 0 ; for ( int i = 1 ; i < 6 ; i ++ ) { Example277 = scan . nextInt ( ) ; if ( Example277 == 0 ) { ans = i ; } } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example162 { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; int Example162 = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int cnt = 1 ; for ( int i = 0 ; i < Example162 ; i ++ ) { int sc = scanner . nextInt ( ) ; if ( sc == cnt ) { list . add ( cnt ++ ) ; } } int rst = Example162 - list . size ( ) ; System . out . println ( rst == Example162 ? - 1 : rst ) ; } } -import java . util . * ; public class example88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example88 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] b = new int [ Example88 ] [ 3 ] ; for ( int i = 0 ; i < m ; i ++ ) { int p = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( b [ p - 1 ] [ 0 ] == 0 ) { if ( " AC " . equals ( s ) ) { b [ p - 1 ] [ 0 ] = i + 1 ; } else { b [ p - 1 ] [ 1 ] ++ ; } } } int ok = 0 ; int ng = 0 ; for ( int i = 0 ; i < Example88 ; i ++ ) { if ( b [ i ] [ 0 ] > 0 ) { ok ++ ; ng += b [ i ] [ 1 ] ; } } System . out . println ( ok + " " + ng ) ; } } -import java . util . Scanner ; public class Example471 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example471 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int toZero = 0 ; int toN = 0 ; Integer [ ] a = new Integer [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { if ( a [ i ] < x ) { toZero ++ ; } else { toN ++ ; } } System . out . println ( Math . min ( toZero , toN ) ) ; } } -import java . util . * ; public class example677 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example677 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { a [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; ++ i ) { count += a [ i ] ; } if ( count >= Example677 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example651 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; for ( int example651 = 0 ; example651 < 3 ; example651 ++ ) { n [ example651 ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; Arrays . sort ( n ) ; for ( int example651 = 0 ; example651 < k ; example651 ++ ) { n [ 2 ] *= 2 ; } int a = 0 ; for ( int example651 = 0 ; example651 < 3 ; example651 ++ ) { a += n [ example651 ] ; } System . out . println ( a ) ; } } -import java . util . Scanner ; public class Example263 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example263 = 0 ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; if ( n == 0 && x == 0 ) { break ; } for ( int i = n ; i >= 3 ; i -- ) { for ( int j = i - 1 ; j >= 2 ; j -- ) { int remainder = x - i - j ; if ( remainder <= 0 ) { continue ; } else if ( remainder >= j ) { break ; } else { example263 ++ ; } } } System . out . println ( example263 ) ; } } } -import java . util . * ; public class example663 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example663 = sc . nextInt ( ) ; int [ ] a = new int [ Example663 + 1 ] ; for ( int i = 1 ; i <= Example663 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int answer = 0 ; int lightNum = 1 ; while ( 1 == 1 ) { lightNum = a [ lightNum ] ; answer ++ ; if ( lightNum == 2 ) { System . out . println ( answer ) ; return ; } if ( answer > 110000 ) { System . out . println ( - 1 ) ; return ; } } } } -import java . util . * ; public class Example941 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example941 = sc . nextInt ( ) ; int [ ] k = new int [ example941 ] ; Boolean allZero = false ; int count = 0 ; for ( int i = 0 ; i < example941 ; i ++ ) { k [ i ] = sc . nextInt ( ) ; } while ( ! allZero ) { allZero = true ; int now = 0 ; Boolean isZero = true ; while ( now < example941 ) { if ( k [ now ] > 0 ) { k [ now ] -= 1 ; isZero = false ; allZero = false ; } else if ( k [ now ] <= 0 && isZero ) { } else { count ++ ; isZero = true ; } now ++ ; } if ( ! isZero ) { count ++ ; } } sc . close ( ) ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class example913 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example913 = Long . parseLong ( sc . next ( ) ) ; long r = Long . parseLong ( sc . next ( ) ) ; long ans = Long . MAX_VALUE ; long num = 0 ; for ( long i = Example913 ; i < r ; i ++ ) { for ( long j = i + 1 ; j <= r ; j ++ ) { num = ( i * j ) % 2019 ; if ( num < ans ) { ans = num ; } if ( num == 0 ) { System . out . println ( 0 ) ; return ; } } } System . out . println ( ans ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example583 { 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 Example583 { int example583 = - 1000_000_000 ; int UPPER_LIMIT = 1000_000_000 ; public void solve ( int testNumber , Scanner in , PrintWriter out ) { int K = in . nextInt ( ) ; int X = in . nextInt ( ) ; int start = 0 ; int end = 0 ; if ( X - example583 + 1 < K ) { start = example583 ; end = X + K - 1 ; } else if ( UPPER_LIMIT - X + 1 < K ) { start = UPPER_LIMIT - X + 1 ; end = UPPER_LIMIT ; } else { start = X - ( K - 1 ) ; end = X + ( K - 1 ) ; } for ( int i = start ; i <= end ; i ++ ) { out . println ( i ) ; } } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example306 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; A [ 0 ] = sc . nextInt ( ) ; A [ 1 ] = sc . nextInt ( ) ; A [ 2 ] = sc . nextInt ( ) ; int example306 = sc . nextInt ( ) ; Arrays . parallelSort ( A ) ; System . out . println ( A [ 0 ] + A [ 1 ] + ( int ) ( A [ 2 ] * Math . pow ( 2 , example306 ) ) ) ; } } -import java . util . Scanner ; class example601 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example601 = Integer . parseInt ( stdIn . next ( ) ) ; int b = Integer . parseInt ( stdIn . next ( ) ) ; int pl = 0 ; int pr = 1250 ; do { int pc = ( pl + pr ) / 2 ; if ( ( int ) ( pc * 0.08 ) == Example601 && ( int ) ( pc * 0.1 ) == b ) { while ( ( int ) ( pc * 0.08 ) == Example601 && ( int ) ( pc * 0.1 ) == b ) { pc -- ; } pc ++ ; System . out . println ( pc ) ; return ; } else if ( ( int ) ( pc * 0.08 ) < Example601 || ( int ) ( pc * 0.1 ) < b ) { pl = pc + 1 ; } else if ( ( int ) ( pc * 0.08 ) > Example601 || ( int ) ( pc * 0.1 ) > b ) { pr = pc - 1 ; } } while ( pl <= pr ) ; System . out . println ( - 1 ) ; } } -import java . util . * ; class example689 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example689 = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; String tmp = sc . nextLine ( ) ; for ( int i = 0 ; i < Example689 ; ++ i ) { String s = sc . nextLine ( ) ; map . putIfAbsent ( s , 0 ) ; map . put ( s , map . get ( s ) + 1 ) ; } SortedSet < String > st = new TreeSet < > ( ) ; int maxi = 0 ; for ( Map . Entry < String , Integer > entry : map . entrySet ( ) ) { maxi = Math . max ( maxi , entry . getValue ( ) ) ; } for ( Map . Entry < String , Integer > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) == maxi ) { st . add ( entry . getKey ( ) ) ; } } for ( String ele : st ) { System . out . println ( ele ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example625 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example625 = sc . nextInt ( ) ; int [ ] n = new int [ example625 ] ; for ( int i = 0 ; i < example625 ; i ++ ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; int sum = 0 ; for ( int i = 0 ; i < example625 - 1 ; i ++ ) { sum += n [ i ] ; } if ( n [ example625 - 1 ] < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example148 { public static void main ( String [ ] args ) { solve_149_B ( ) ; return ; } private static void solve_149_B ( ) { Scanner sc = new Scanner ( System . in ) ; long example148 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; if ( example148 >= K ) { example148 = example148 - K ; } else { if ( B >= ( K - example148 ) ) { B = B - ( K - example148 ) ; } else { B = 0 ; } example148 = 0 ; } System . out . println ( example148 + " " + B ) ; } } -import java . util . Scanner ; public class example158 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example158 = scanner . nextInt ( ) ; int i = 0 ; int m = 0 ; i = Example158 / 500 ; Example158 = Example158 - 500 * i ; m = Example158 / 5 ; System . out . println ( 1000 * i + 5 * m ) ; } } -import java . time . LocalDate ; import java . time . format . DateTimeFormatter ; import java . time . format . DateTimeParseException ; import java . util . Scanner ; public class Example719 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; try { DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( " uuuu/MM/dd " ) ; LocalDate date = LocalDate . parse ( sdate , formatter ) ; LocalDate today = LocalDate . of ( 2019 , 4 , 30 ) ; int example719 = date . compareTo ( today ) ; if ( example719 <= 0 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } catch ( DateTimeParseException e ) { System . out . println ( " 堥力値がyyyy/mm/dd形式ではありません"); } } } -import java . util . * ; public class Example919 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example919 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < example919 ; i ++ ) { char si = s . charAt ( i ) ; if ( i == k - 1 ) { if ( si == 'A' ) { buf . append ( " a " ) ; } if ( si == 'B' ) { buf . append ( " b " ) ; } if ( si == 'C' ) { buf . append ( " c " ) ; } } else { buf . append ( s . charAt ( i ) ) ; } } String new_s = buf . toString ( ) ; System . out . println ( new_s ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example402 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example402 = scn . nextInt ( ) ; float temp = ( float ) Example402 / 3 ; BigDecimal b1 = new BigDecimal ( temp ) ; b1 = b1 . multiply ( new BigDecimal ( temp ) ) ; b1 = b1 . multiply ( new BigDecimal ( temp ) ) ; System . out . println ( b1 ) ; } } -import java . util . Scanner ; public class example570 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example570 = sc . nextInt ( ) ; sc . close ( ) ; int c = Example570 / 4 ; int d = Example570 / 7 ; for ( int i = 0 ; i <= c ; i ++ ) { for ( int j = 0 ; j <= d ; j ++ ) { if ( 4 * i + 7 * j == Example570 ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } -import java . util . * ; public class Example292 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . next ( ) ; char [ ] charArray = input . toCharArray ( ) ; Arrays . sort ( charArray ) ; String sortedString = new String ( charArray ) ; int example292 = sortedString . length ( ) ; int cnt = 0 ; char tmpVal = sortedString . charAt ( 0 ) ; if ( example292 <= 1 ) { System . out . println ( " No " ) ; return ; } for ( int i = 0 ; i < example292 ; i ++ ) { char val = sortedString . charAt ( i ) ; if ( val == tmpVal ) { cnt ++ ; } else { if ( cnt % 2 != 0 ) { System . out . println ( " No " ) ; return ; } cnt = 1 ; tmpVal = val ; } } System . out . println ( " Yes " ) ; } } -import java . util . * ; public class Example613 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example613 = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int m = example613 * y ; int n = 2 * example613 + 2 * y ; System . out . println ( m + " " + n ) ; } } -import java . util . * ; public class example239 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example239 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = Example239 * b ; if ( ans == 2 ) { System . out . println ( " 3 " ) ; } else if ( ans == 3 ) { System . out . println ( " 2 " ) ; } else { System . out . println ( " 1 " ) ; } } } -import java . io . * ; class Example769 { public static int prime ( int x ) { int example769 = 0 ; if ( x == 1 ) { example769 = 1 ; } else if ( x % 2 == 0 ) { example769 = 1 ; } for ( int i = 3 ; i <= Math . sqrt ( x ) ; i += 2 ) { if ( x % i == 0 ) { example769 = 1 ; break ; } } if ( x == 2 ) { example769 = 0 ; } return example769 ; } public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { int N = Integer . parseInt ( reader . readLine ( ) ) ; ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = Integer . parseInt ( reader . readLine ( ) ) ; } int count = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( prime ( a [ i ] ) == 0 ) { count += 1 ; } } System . out . println ( count ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } -import java . io . * ; import java . util . * ; public class example660 { public static void main ( String [ ] args ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String s = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( s , " " ) ; int Example660 = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ; System . out . print ( Example660 * y ) ; System . out . print ( " " ) ; System . out . println ( 2 * Example660 + 2 * y ) ; } } -import java . io . * ; import java . util . * ; class example217 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int Example217 = Integer . parseInt ( st . nextToken ( ) ) ; int T = Integer . parseInt ( st . nextToken ( ) ) ; int S = Integer . parseInt ( st . nextToken ( ) ) ; float tmp = ( float ) Example217 / T ; if ( S >= tmp ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class example703 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example703 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int sum = 0 ; int [ ] arr = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum = sum + arr [ i ] ; } if ( Example703 - sum >= 0 ) { System . out . print ( ( Example703 - sum ) ) ; } else { System . out . print ( - 1 ) ; } } } -import java . util . * ; public class Example306 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example306 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double sum = 0 ; int cnt = 0 ; Integer [ ] items = new Integer [ example306 ] ; for ( int i = 0 ; i < example306 ; i ++ ) { int itemVote = sc . nextInt ( ) ; sum += itemVote ; items [ i ] = itemVote ; } Arrays . sort ( items , Collections . reverseOrder ( ) ) ; double baseNum = sum / ( ( double ) 4 * ( double ) M ) ; for ( int l = 0 ; l < M ; l ++ ) { double val = ( double ) items [ l ] ; if ( val < baseNum ) { continue ; } cnt ++ ; } if ( cnt >= M ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example672 { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int Example672 = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; int K = in . nextInt ( ) ; int sum = Example672 + B + C ; int max = Math . max ( Example672 , Math . max ( B , C ) ) ; sum += - max + ( max << K ) ; System . out . println ( sum ) ; } } } -import java . util . Scanner ; public class Example831 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example831 = input . nextInt ( ) ; int [ ] level = new int [ example831 ] ; int count = 1 ; int min = 0 ; for ( int i = 0 ; i < example831 ; i ++ ) { level [ i ] = input . nextInt ( ) ; if ( i == 0 ) { min = level [ 0 ] ; } else { if ( level [ i ] <= min ) { count ++ ; min = level [ i ] ; } } } System . out . println ( count ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . LinkedList ; import java . util . Scanner ; public class example763 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example763 = sc . nextInt ( ) ; int strength1 = sc . nextInt ( ) ; int health2 = sc . nextInt ( ) ; int strength2 = sc . nextInt ( ) ; while ( true ) { health2 -= strength1 ; if ( health2 <= 0 ) break ; Example763 -= strength2 ; if ( Example763 <= 0 ) break ; } if ( Example763 > health2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example437 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int Example437 = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( Example437 == - 1 && f == - 1 && r == - 1 ) { break ; } else { int x ; x = Example437 + f ; if ( Example437 == - 1 || f == - 1 ) { System . out . println ( " F " ) ; } if ( x >= 80 && Example437 != - 1 && f != - 1 ) { System . out . println ( " A " ) ; } if ( x < 80 && x >= 65 && Example437 != - 1 && f != - 1 ) { System . out . println ( " B " ) ; } if ( x < 65 && x >= 50 && Example437 != - 1 && f != - 1 ) { System . out . println ( " C " ) ; } if ( x < 50 && x >= 30 && Example437 != - 1 && f != - 1 && r >= 50 ) { System . out . println ( " C " ) ; } if ( x >= 30 && x < 50 && Example437 != - 1 && f != - 1 && r < 50 ) { System . out . println ( " D " ) ; } if ( x < 30 && Example437 != - 1 && f != - 1 ) { System . out . println ( " F " ) ; } } } } } -import java . util . Scanner ; public class Example288 { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int example288 = gi ( ) ; int M = gi ( ) ; int a = ( int ) Math . ceil ( ( double ) ( M - 1 ) / ( double ) ( example288 - 1 ) ) ; System . out . print ( a ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } -import java . util . * ; public class example602 { static final Scanner stdin = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( stdin . hasNext ( ) ) { int Example602 = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; int comp_val = Example602 - b ; int num , aval , m , n , ans1 ; if ( comp_val > 0 ) { for ( int i = 0 ; i <= Example602 ; i ++ ) { aval = Example602 - i ; if ( Example602 % aval == 0 && b % aval == 0 ) { m = Example602 / aval ; n = b / aval ; ans1 = m * n * aval ; System . out . println ( aval + " " + ans1 ) ; break ; } } } else { for ( int i = 0 ; i <= b ; i ++ ) { aval = b - i ; if ( Example602 % aval == 0 && b % aval == 0 ) { m = Example602 / aval ; n = b / aval ; ans1 = m * n * aval ; System . out . println ( aval + " " + ans1 ) ; break ; } } } } } } -import java . util . Scanner ; public class Example360 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String S = input . next ( ) ; long example360 = input . nextLong ( ) ; String ans = " " ; double days = 5.0 * Math . pow ( 10 , 15 ) ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char c = S . charAt ( i ) ; int n = Character . getNumericValue ( c ) ; example360 -= ( long ) Math . pow ( n , days ) ; if ( example360 <= 0 ) { System . out . println ( c ) ; return ; } } } } -import java . util . Scanner ; public class Example128 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example128 = sc . nextInt ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) for ( int a = 1 ; a <= 9 ; a ++ ) { if ( i * a == example128 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example875 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example875 = sc . next ( ) ; char [ ] wordStr = example875 . toCharArray ( ) ; if ( wordStr [ 2 ] != wordStr [ 3 ] ) { System . out . println ( " No " ) ; return ; } if ( wordStr [ 4 ] != wordStr [ 5 ] ) { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example193 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example193 = scanner . nextInt ( ) ; int homeworkNumber = scanner . nextInt ( ) ; int [ ] daysSpentInHomework = new int [ homeworkNumber ] ; int studyDay = 0 ; for ( int i = 0 ; i < homeworkNumber ; i ++ ) { daysSpentInHomework [ i ] = scanner . nextInt ( ) ; } for ( int j = 0 ; j < homeworkNumber ; j ++ ) { studyDay = studyDay + daysSpentInHomework [ j ] ; } int playable ; if ( example193 - studyDay >= 0 ) { playable = example193 - studyDay ; System . out . println ( playable ) ; } else { System . out . println ( " -1 " ) ; } scanner . close ( ) ; } } -import java . util . * ; public class example574 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example574 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] c = new int [ Example574 ] ; int [ ] t = new int [ Example574 ] ; int cmin = 1001 ; int twithin = 1001 ; for ( int i = 0 ; i < Example574 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; t [ i ] = sc . nextInt ( ) ; if ( t [ i ] <= T && cmin > c [ i ] ) { twithin = t [ i ] ; cmin = c [ i ] ; } } if ( twithin == 1001 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( cmin ) ; } } } -import java . util . * ; public class Example409 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example409 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; String ss = s ; ss = ss . substring ( example409 , example409 + 1 ) ; if ( ss . equals ( " - " ) ) { s = s . replace ( " - " , " " ) ; int slen = s . length ( ) ; if ( slen == example409 + b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example418 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example418 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C - ( Example418 - B ) < 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( C - ( Example418 - B ) ) ; } } } -import java . util . * ; public class example332 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example332 = sc . nextInt ( ) ; int [ ] arr = new int [ Example332 ] ; for ( int i = 0 ; i < Example332 ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int [ ] leftSum = new int [ Example332 ] ; leftSum [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < Example332 ; i ++ ) leftSum [ i ] = leftSum [ i - 1 ] + arr [ i ] ; int [ ] rightSum = new int [ Example332 ] ; rightSum [ Example332 - 1 ] = arr [ Example332 - 1 ] ; for ( int i = Example332 - 2 ; i >= 0 ; i -- ) { rightSum [ i ] += rightSum [ i + 1 ] + arr [ i ] ; } int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < Example332 - 1 ; i ++ ) min = Math . min ( min , Math . abs ( leftSum [ i ] - rightSum [ i + 1 ] ) ) ; System . out . println ( min ) ; } } -import java . util . * ; public class Example246 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example246 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] [ ] a = new int [ example246 ] [ m ] ; int [ ] [ ] b = new int [ m ] [ l ] ; for ( int i = 0 ; i < example246 ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) a [ i ] [ j ] = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) for ( int j = 0 ; j < l ; j ++ ) b [ i ] [ j ] = sc . nextInt ( ) ; for ( int i = 0 ; i < example246 ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { long cij = 0 ; for ( int k = 0 ; k < m ; k ++ ) cij += a [ i ] [ k ] * b [ k ] [ j ] ; System . out . print ( ( j == 0 ) ? cij : " " + cij ) ; } System . out . println ( ) ; } } } -import java . util . * ; class Example759 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example759 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == '1' ) { example759 += 1 ; } } System . out . println ( example759 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class example877 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] parts = br . readLine ( ) . split ( " " ) ; long Example877 = Integer . parseInt ( parts [ 0 ] ) ; long K = Integer . parseInt ( parts [ 1 ] ) ; parts = br . readLine ( ) . split ( " " ) ; long [ ] H = new long [ parts . length ] ; for ( int i = 0 ; i < H . length ; i ++ ) { H [ i ] = Integer . parseInt ( parts [ i ] ) ; } Arrays . sort ( H ) ; long sum = 0 ; for ( int i = 0 ; i < H . length - K ; i ++ ) { sum += H [ i ] ; } System . out . println ( sum ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example288 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example288 = sc . nextInt ( ) ; int [ ] x = new int [ Example288 ] ; for ( int i = 0 ; i < Example288 ; i ++ ) x [ i ] = sc . nextInt ( ) ; Arrays . sort ( x ) ; int alice = 0 ; int bob = 0 ; if ( Example288 % 2 == 0 ) { for ( int i = Example288 - 1 ; i >= 0 ; i -= 2 ) { alice += x [ i ] ; bob += x [ i - 1 ] ; } } if ( Example288 % 2 != 0 ) { if ( Example288 == 1 ) alice += x [ 0 ] ; else { for ( int i = 0 ; i < Example288 ; i += 2 ) alice += x [ i ] ; for ( int i = 1 ; i < Example288 ; i += 2 ) bob += x [ i ] ; } } System . out . println ( alice - bob ) ; } } -import java . util . * ; public class example290 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example290 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > divsA = new ArrayList < > ( ) ; List < Integer > divsB = new ArrayList < > ( ) ; for ( int i = 1 ; i <= Example290 ; ++ i ) { if ( Example290 % i == 0 ) divsA . add ( i ) ; } for ( int i = 1 ; i <= b ; ++ i ) { if ( b % i == 0 ) divsB . add ( i ) ; } List < Integer > divs = new ArrayList < > ( ) ; for ( int i = 0 ; i < divsA . size ( ) ; ++ i ) { for ( int j = 0 ; j < divsB . size ( ) ; ++ j ) { if ( divsA . get ( i ) == divsB . get ( j ) ) { divs . add ( divsA . get ( i ) ) ; } } } System . out . println ( divs . get ( divs . size ( ) - k ) ) ; } } -import java . util . Arrays ; import java . util . Scanner ; class example976 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example976 = s . nextInt ( ) ; int [ ] arr = new int [ Example976 ] ; for ( int i = 0 ; i < Example976 ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } long [ ] dp = new long [ Example976 ] ; dp [ 0 ] = 0 ; for ( int i = 1 ; i < Example976 ; i ++ ) { long option1 = Math . abs ( arr [ i ] - arr [ i - 1 ] ) + dp [ i - 1 ] ; long option2 = i == 1 ? Integer . MAX_VALUE : Math . abs ( arr [ i ] - arr [ i - 2 ] ) + dp [ i - 2 ] ; dp [ i ] = Math . min ( option1 , option2 ) ; } System . out . println ( dp [ Example976 - 1 ] ) ; } } -import java . util . * ; class example262 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example262 = sc . nextLong ( ) ; double B = sc . nextDouble ( ) ; long ans = 0 ; ans = Example262 * ( Math . round ( B * 100 ) ) / 100 ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example208 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example208 = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int count = 0 ; while ( example208 != 0 || x != 0 ) { for ( int i = 1 ; i <= example208 ; i ++ ) { for ( int j = i + 1 ; j <= example208 ; j ++ ) { for ( int k = j + 1 ; k <= example208 ; k ++ ) { if ( i + j + k == x ) { count ++ ; } } } } System . out . println ( count ) ; example208 = scan . nextInt ( ) ; x = scan . nextInt ( ) ; count = 0 ; } } } -import java . util . * ; public class example352 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] a = s . toCharArray ( ) ; for ( int Example352 = a . length - 1 ; Example352 >= 0 ; Example352 -- ) System . out . print ( a [ Example352 ] ) ; System . out . println ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class example403 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String name ; int Example403 ; int compare ; String waku = " " ; int [ ] a = new int [ 2 ] ; int i = 0 ; while ( true ) { try { name = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( name , " " ) ; while ( st . hasMoreTokens ( ) ) { a [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; i ++ ; } i = 0 ; if ( a [ 0 ] == 0 && a [ 1 ] == 0 ) { System . exit ( 0 ) ; } else { for ( int k = 0 ; k < a [ 1 ] ; k ++ ) { waku = waku + " # " ; } for ( int j = 0 ; j < a [ 0 ] ; j ++ ) { System . out . println ( waku ) ; } System . out . println ( " " ) ; waku = " " ; } } catch ( Exception e ) { System . exit ( 0 ) ; } } } } -import java . util . * ; public class Example977 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] n = sc . nextLine ( ) . toCharArray ( ) ; int example977 = 0 ; for ( char c : n ) { example977 += Character . getNumericValue ( c ) ; } if ( example977 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class example240 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int Example240 = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int [ ] l = new int [ m ] ; int [ ] r = new int [ m ] ; int l_max = 0 ; int r_min = 100000 ; for ( int i = 0 ; i < m ; i ++ ) { str = in . readLine ( ) . split ( " " ) ; l [ i ] = Integer . parseInt ( str [ 0 ] ) ; l_max = Math . max ( l [ i ] , l_max ) ; r [ i ] = Integer . parseInt ( str [ 1 ] ) ; r_min = Math . min ( r [ i ] , r_min ) ; } System . out . println ( r_min - l_max + 1 > 0 ? r_min - l_max + 1 : 0 ) ; } } -import java . io . * ; import java . util . * ; class Example386 { public static void main ( String [ ] args ) throws IOException { int example386 = 0 ; int b = 0 ; int c = 0 ; int i = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String delimiter = " " ; StringTokenizer stringTokenizer = new StringTokenizer ( str , delimiter ) ; while ( stringTokenizer . hasMoreTokens ( ) ) { String current = stringTokenizer . nextToken ( ) ; if ( i == 0 ) example386 = Integer . parseInt ( current ) ; if ( i == 1 ) b = Integer . parseInt ( current ) ; if ( i == 2 ) c = Integer . parseInt ( current ) ; i ++ ; } if ( example386 < b && b < c ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Example600 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example600 = s . nextInt ( ) ; int numn = s . nextInt ( ) ; if ( numn == 0 ) { System . out . println ( example600 ) ; s . close ( ) ; System . exit ( 0 ) ; } Integer [ ] array = new Integer [ numn ] ; for ( int i = 0 ; i < numn ; i ++ ) { array [ i ] = s . nextInt ( ) ; } List < Integer > listNum = Arrays . asList ( array ) ; s . close ( ) ; int ans = 0 ; boolean flg_con = true ; if ( ! listNum . contains ( example600 ) ) { ans = example600 ; flg_con = false ; } int count = 0 ; while ( flg_con ) { count ++ ; int mnx = example600 - count ; int plx = example600 + count ; if ( ! listNum . contains ( mnx ) ) { ans = mnx ; flg_con = false ; } else if ( ! listNum . contains ( plx ) ) { ans = plx ; flg_con = false ; } } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . * ; import java . util . * ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Collections ; public class Example968 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example968 = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 0 ; if ( example968 % 2 == 1 ) { count ++ ; } char [ ] work = new char [ s . length ( ) ] ; for ( int i = 0 ; i < example968 ; i ++ ) { work [ i ] = s . charAt ( i ) ; } for ( int i = 0 ; i < example968 / 2 ; i ++ ) { if ( work [ i ] == work [ i + example968 / 2 ] ) { } else { count ++ ; } } if ( count == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example50 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example50 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < C + 1 ; i ++ ) { int Y = X - 50 * i ; if ( Y == 0 ) { cnt ++ ; continue ; } for ( int j = 0 ; j < B + 1 ; j ++ ) { int Z = Y - 100 * j ; if ( Z == 0 ) { cnt ++ ; continue ; } for ( int k = 0 ; k < Example50 + 1 ; k ++ ) { int W = Z - 500 * k ; if ( W == 0 ) { cnt ++ ; continue ; } } } } System . out . println ( cnt ) ; } } -import java . util . * ; public class example899 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example899 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ 101 ] ; for ( int i = 1 ; i <= 100 ; i ++ ) { if ( ( Example899 % i == 0 ) && ( b % i == 0 ) ) { arr [ i ] = i ; } } int count = 0 ; for ( int i = 100 ; i >= 0 ; i -- ) { if ( arr [ i ] > 0 ) { count ++ ; } if ( count == k ) { System . out . println ( i ) ; break ; } } } } -import java . util . Scanner ; public class example185 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int Example185 = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { Example185 += str . charAt ( i ) - '0' ; } System . out . println ( Integer . parseInt ( str ) % Example185 == 0 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example131 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String day = sc . nextLine ( ) ; String [ ] str = day . split ( " / " ) ; int [ ] a = new int [ 3 ] ; for ( int Example131 = 0 ; Example131 < str . length ; Example131 ++ ) a [ Example131 ] = Integer . parseInt ( str [ Example131 ] ) ; if ( a [ 0 ] > 2019 ) System . out . println ( " TBD " ) ; else if ( a [ 0 ] == 2019 && a [ 1 ] > 4 ) System . out . println ( " TBD " ) ; else if ( a [ 0 ] == 2019 && a [ 1 ] > 4 && a [ 2 ] < 31 ) System . out . println ( " TBD " ) ; else System . out . println ( " Heisei " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example181 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] nums = br . readLine ( ) . split ( " " ) ; br . close ( ) ; int Example181 = Integer . parseInt ( nums [ 0 ] ) ; int b = Integer . parseInt ( nums [ 1 ] ) ; if ( Example181 > 9 || b > 9 ) System . out . println ( - 1 ) ; else System . out . println ( Example181 * b ) ; } } -import java . util . * ; class example241 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example241 = sc . nextInt ( ) ; int [ ] T = new int [ Example241 + 1 ] ; int [ ] X = new int [ Example241 + 1 ] ; int [ ] Y = new int [ Example241 + 1 ] ; T [ 0 ] = X [ 0 ] = Y [ 0 ] = 0 ; boolean yes = true ; for ( int i = 1 ; i <= Example241 ; i ++ ) { T [ i ] = sc . nextInt ( ) ; X [ i ] = sc . nextInt ( ) ; Y [ i ] = sc . nextInt ( ) ; int d = Math . abs ( X [ i ] - X [ i - 1 ] ) + Math . abs ( Y [ i ] - Y [ i - 1 ] ) ; int dt = T [ i ] - T [ i - 1 ] ; if ( d > dt || d % 2 != dt % 2 ) { yes = false ; break ; } } System . out . println ( yes ? " Yes " : " No " ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example479 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > slist = new ArrayList < String > ( ) ; String beforeWord = null ; String word = null ; boolean Example479 = true ; int size = sc . nextInt ( ) ; if ( size > 100 ) { Example479 = false ; System . out . println ( " No " ) ; return ; } word = sc . nextLine ( ) ; for ( int i = 0 ; i < size ; i ++ ) { word = sc . nextLine ( ) ; if ( beforeWord != null ) { char shiri = beforeWord . charAt ( beforeWord . length ( ) - 1 ) ; char atama = word . charAt ( 0 ) ; if ( shiri == atama ) { Example479 = true ; } else { Example479 = false ; break ; } } if ( ! slist . contains ( word ) ) { if ( Example479 ) { slist . add ( word ) ; beforeWord = word ; } } else { Example479 = false ; break ; } } if ( Example479 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example732 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example732 = Integer . parseInt ( sc . next ( ) ) ; int W = Integer . parseInt ( sc . next ( ) ) ; if ( example732 == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < example732 ; i ++ ) { if ( i == 0 || i == example732 - 1 ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . print ( " # " ) ; } System . out . print ( " \n " ) ; } else { System . out . print ( " # " ) ; for ( int j = 0 ; j < W - 2 ; j ++ ) { System . out . print ( " . " ) ; } System . out . print ( " # " ) ; System . out . print ( " \n " ) ; } } System . out . print ( " \n " ) ; } } } -import java . util . Scanner ; public class Example327 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example327 = sc . nextInt ( ) ; int ans = example327 + example327 * example327 + ( int ) Math . pow ( example327 , 3 ) ; System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; import java . math . BigInteger ; class Example104 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; BigInteger a , b , c , d ; BigInteger q , w , e , r , s ; a = cin . nextBigInteger ( ) ; b = cin . nextBigInteger ( ) ; c = cin . nextBigInteger ( ) ; d = cin . nextBigInteger ( ) ; q = a . multiply ( c ) ; w = a . multiply ( d ) ; e = b . multiply ( c ) ; r = b . multiply ( d ) ; BigInteger ans ; ans = q . max ( w ) ; ans = ans . max ( e ) ; ans = ans . max ( r ) ; s = BigInteger . valueOf ( 0 ) ; if ( a . compareTo ( s ) <= 0 && b . compareTo ( s ) >= 0 || c . compareTo ( s ) <= 0 && d . compareTo ( s ) >= 0 ) { if ( ans . compareTo ( s ) <= 0 ) ans = s ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example756 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example756 = Integer . parseInt ( sc . nextLine ( ) ) ; int result = 0 ; for ( int i = 0 ; i < example756 ; i ++ ) { int target = Integer . parseInt ( sc . nextLine ( ) ) ; if ( target == 1 ) { continue ; } boolean flgPrime = true ; for ( int j = 2 ; j <= ( int ) Math . sqrt ( target ) ; j ++ ) { if ( target % j == 0 ) { flgPrime = false ; break ; } } if ( flgPrime ) { result ++ ; } } System . out . println ( result ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Stack ; public class Example176 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputArray = br . readLine ( ) . split ( " " ) ; Stack < Integer > stack = new Stack < Integer > ( ) ; int example176 = 0 ; int b = 0 ; for ( int i = 0 ; i < inputArray . length ; i ++ ) { if ( inputArray [ i ] . equals ( " + " ) ) { example176 = stack . pop ( ) ; b = stack . pop ( ) ; stack . add ( b + example176 ) ; continue ; } if ( inputArray [ i ] . equals ( " - " ) ) { example176 = stack . pop ( ) ; b = stack . pop ( ) ; stack . add ( b - example176 ) ; continue ; } if ( inputArray [ i ] . equals ( " * " ) ) { example176 = stack . pop ( ) ; b = stack . pop ( ) ; stack . add ( b * example176 ) ; continue ; } stack . push ( Integer . parseInt ( inputArray [ i ] ) ) ; } System . out . println ( stack . pop ( ) ) ; } } -import java . util . Arrays ; import java . util . Scanner ; class Example274 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example274 = sc . nextInt ( ) ; long [ ] A = new long [ example274 ] ; for ( long i = 0L ; i < example274 ; i ++ ) { long t = sc . nextLong ( ) * 100000000L + ( i + 1L ) ; A [ ( int ) i ] = t ; } Arrays . sort ( A ) ; for ( int i = 0 ; i < example274 - 1 ; i ++ ) { System . out . print ( A [ i ] % 100000000 + " " ) ; } System . out . println ( A [ example274 - 1 ] % 100000000 ) ; } public static void p ( Object o ) { System . out . println ( o ) ; } } -import java . util . Scanner ; import java . util . Arrays ; import static java . lang . System . out ; class example419 { public static int [ ] sorted ( int [ ] inputs ) { int [ ] res = Arrays . copyOf ( inputs , inputs . length ) ; for ( int Example419 = 0 ; Example419 < res . length ; Example419 ++ ) { for ( int j = 1 ; j < res . length - Example419 ; j ++ ) { if ( res [ j - 1 ] > res [ j ] ) { int tmp = res [ j - 1 ] ; res [ j - 1 ] = res [ j ] ; res [ j ] = tmp ; } } } return res ; } } public class example419 { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] inputs = new int [ 3 ] ; int Example419 = 0 ; while ( scan . hasNext ( ) ) { inputs [ Example419 ] = scan . nextInt ( ) ; Example419 ++ ; } StringBuilder output = new StringBuilder ( ) ; for ( int num : SortingThreeNumbers . sorted ( inputs ) ) { output . append ( String . valueOf ( num ) + " " ) ; } output . deleteCharAt ( output . length ( ) - 1 ) ; out . println ( output ) ; } } -import java . io . * ; import java . util . * ; class example256 { public static void main ( String [ ] args ) throws IOException { int Example256 = 0 ; int b = 0 ; int c = 0 ; int i = 0 ; int tmp = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String delimiter = " " ; StringTokenizer stringTokenizer = new StringTokenizer ( str , delimiter ) ; while ( stringTokenizer . hasMoreTokens ( ) ) { String current = stringTokenizer . nextToken ( ) ; if ( i == 0 ) Example256 = Integer . parseInt ( current ) ; if ( i == 1 ) b = Integer . parseInt ( current ) ; if ( i == 2 ) c = Integer . parseInt ( current ) ; i ++ ; } if ( Example256 > c ) { tmp = Example256 ; Example256 = c ; c = tmp ; } if ( Example256 > b ) { tmp = Example256 ; Example256 = b ; b = tmp ; } if ( b > c ) { tmp = b ; b = c ; c = tmp ; } System . out . println ( Example256 + " " + b + " " + c ) ; } } -import java . util . * ; public class example426 { static StringBuilder a = new StringBuilder ( ) ; static StringBuilder b = new StringBuilder ( ) ; static StringBuilder c = new StringBuilder ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a . append ( sc . next ( ) ) ; b . append ( sc . next ( ) ) ; c . append ( sc . next ( ) ) ; char Example426 = a . charAt ( 0 ) ; a . deleteCharAt ( 0 ) ; Main . nextTurn ( Example426 ) ; } public static void nextTurn ( char card ) { if ( card == 'a' ) { if ( a . length ( ) == 0 ) { System . out . println ( " A " ) ; return ; } char Example426 = a . charAt ( 0 ) ; a . deleteCharAt ( 0 ) ; Main . nextTurn ( Example426 ) ; } else if ( card == 'b' ) { if ( b . length ( ) == 0 ) { System . out . println ( " B " ) ; return ; } char Example426 = b . charAt ( 0 ) ; b . deleteCharAt ( 0 ) ; Main . nextTurn ( Example426 ) ; } else if ( card == 'c' ) { if ( c . length ( ) == 0 ) { System . out . println ( " C " ) ; return ; } char Example426 = c . charAt ( 0 ) ; c . deleteCharAt ( 0 ) ; Main . nextTurn ( Example426 ) ; } } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example250 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example250 = Integer . parseInt ( sc . nextLine ( ) ) ; Map < String , Long > m = new HashMap < > ( ) ; for ( int i = 0 ; i < example250 ; i ++ ) { char [ ] c = sc . nextLine ( ) . toCharArray ( ) ; Arrays . sort ( c ) ; String k = new String ( c ) ; if ( m . get ( k ) == null ) { m . put ( k , 1L ) ; } else { m . put ( k , m . get ( k ) + 1 ) ; } } long ans = 0 ; for ( Long v : m . values ( ) ) { ans += v * ( v - 1 ) / 2 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example442 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example442 = sc . nextInt ( ) ; System . out . println ( ( 10000 - Example442 ) % 1000 ) ; sc . close ( ) ; } } -import java . util . * ; public class example643 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example643 = sc . nextInt ( ) ; long A = ( long ) ( Math . pow ( 10 , 18 ) ) ; long [ ] B = new long [ Example643 ] ; boolean chk_0 = false ; for ( int i = 0 ; i < Example643 ; i ++ ) { B [ i ] = sc . nextLong ( ) ; if ( B [ i ] == 0 ) { chk_0 = true ; } } long C = 0L ; boolean chk = true ; if ( ! chk_0 ) { C = B [ 0 ] ; for ( int i = 1 ; i < B . length ; i ++ ) { try { C = Math . multiplyExact ( C , B [ i ] ) ; } catch ( ArithmeticException e ) { chk = false ; break ; } } } if ( ! chk || A < C ) { System . out . println ( - 1 ) ; } else { System . out . println ( C ) ; } } } -import java . util . * ; class Example716 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example716 = sc . nextInt ( ) ; int [ ] [ ] t = new int [ example716 ] [ 3 ] ; for ( int i = 0 ; i < example716 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { t [ i ] [ j ] = sc . nextInt ( ) ; } if ( triangle ( i , t ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public static boolean triangle ( int i , int [ ] [ ] t ) { double max = Math . max ( Math . max ( t [ i ] [ 0 ] , t [ i ] [ 1 ] ) , t [ i ] [ 2 ] ) ; double res = Math . min ( Math . min ( Math . hypot ( t [ i ] [ 0 ] , t [ i ] [ 1 ] ) , Math . hypot ( t [ i ] [ 0 ] , t [ i ] [ 2 ] ) ) , Math . hypot ( t [ i ] [ 2 ] , t [ i ] [ 1 ] ) ) ; if ( res == max ) { return true ; } else { return false ; } } } -import java . util . * ; public class example896 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example896 = Integer . parseInt ( sc . next ( ) ) ; Integer [ ] d1 = new Integer [ Example896 ] ; Integer [ ] d2 = new Integer [ Example896 ] ; for ( int i = 0 ; i < Example896 ; i ++ ) { d1 [ i ] = Integer . parseInt ( sc . next ( ) ) ; d2 [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; boolean judge = false ; int renzoku = 0 ; for ( int i = 0 ; i < Example896 ; i ++ ) { if ( d1 [ i ] == d2 [ i ] ) { renzoku ++ ; } else { renzoku = 0 ; } if ( renzoku == 3 ) { judge = true ; break ; } } String result = judge ? " Yes " : " No " ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example288 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example288 = scanner . nextInt ( ) ; String s = scanner . next ( ) ; System . out . println ( ( example288 - s . replaceAll ( " ABC " , " " ) . length ( ) ) / 3 ) ; } } -import java . util . * ; import java . util . Map . Entry ; import java . util . stream . Collectors ; public class Example718 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example718 = sc . nextInt ( ) ; String [ ] S = new String [ example718 ] ; for ( int i = 0 ; i < example718 ; i ++ ) { S [ i ] = sc . next ( ) ; } sc . close ( ) ; int maxDup = 1 ; Map < String , Integer > m = new HashMap < String , Integer > ( ) ; for ( String s : S ) { int v ; if ( m . containsKey ( s ) ) { v = m . get ( s ) + 1 ; if ( v > maxDup ) { maxDup = v ; } } else { v = 1 ; } m . put ( s , v ) ; } ArrayList < String > list = new ArrayList < String > ( ) ; for ( Entry < String , Integer > entry : m . entrySet ( ) ) { if ( entry . getValue ( ) == maxDup ) { list . add ( entry . getKey ( ) ) ; } } Collections . sort ( list ) ; for ( String s : list ) { System . out . println ( s ) ; } } } -import java . util . * ; public class example793 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example793 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = 0 ; int [ ] d = new int [ Example793 ] ; for ( int i = 0 ; i < Example793 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example793 ; i ++ ) { if ( d [ i ] >= b ) { c ++ ; } } System . out . println ( c ) ; } } -import java . util . * ; import java . io . * ; public class Example784 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; long example784 = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; if ( example784 > m ) System . out . println ( example784 * m / gcd ( example784 , m ) ) ; else System . out . println ( example784 * m / gcd ( m , example784 ) ) ; } static long gcd ( long a , long b ) { long temp ; while ( ( temp = a % b ) != 0 ) { a = b ; b = temp ; } return b ; } } -import java . util . Scanner ; public class Example549 { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { long example549 = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = gcd ( example549 , b ) ; long d = example549 * b / c ; System . out . println ( c + " " + d ) ; } sc . close ( ) ; } public long gcd ( long example549 , long b ) { if ( b == 0 ) { return example549 ; } else { return gcd ( b , example549 % b ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example345 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example345 ; int result ; String readLine = br . readLine ( ) ; Example345 = Integer . parseInt ( readLine ) ; result = Example345 * Example345 * Example345 ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example362 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example362 = in . nextInt ( ) ; int [ ] order = new int [ example362 + 1 ] ; for ( int i = 1 ; i <= example362 ; i ++ ) { order [ in . nextInt ( ) ] = i ; } for ( int i = 1 ; i <= example362 ; i ++ ) { System . out . print ( order [ i ] + " " ) ; } in . close ( ) ; } } -import java . util . * ; class example720 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example720 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = new int [ Example720 ] ; for ( int i = 0 ; i < Example720 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; int j = 0 ; while ( k -- > 0 ) { sum += a [ j ] ; j ++ ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example663 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s , t ; int example663 , b ; String u ; s = scan . next ( ) ; t = scan . next ( ) ; example663 = scan . nextInt ( ) ; b = scan . nextInt ( ) ; u = scan . next ( ) ; if ( u . equals ( s ) ) example663 -= 1 ; else b -= 1 ; System . out . printf ( example663 + " " + b ) ; } } -import java . util . * ; class Example624 { public static void main ( String [ ] g ) { Scanner S = new Scanner ( System . in ) ; for ( int example624 = S . nextInt ( ) , j , x , y , z , a [ ] = new int [ 3 ] ; example624 -- > 0 ; System . out . println ( a [ 2 ] * a [ 2 ] == a [ 1 ] * a [ 1 ] + a [ 0 ] * a [ 0 ] ? " YES " : " NO " ) ) { for ( j = 0 ; j < 3 ; ) a [ j ++ ] = S . nextInt ( ) ; Arrays . sort ( a ) ; } } } -import java . util . * ; public class Example396 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example396 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; ArrayList < Integer > aList = new ArrayList < Integer > ( example396 ) ; ArrayList < Integer > bList = new ArrayList < Integer > ( B ) ; for ( int i = 1 ; i <= example396 ; i ++ ) { if ( example396 % i == 0 ) { aList . add ( i ) ; } } for ( int i = 1 ; i <= B ; i ++ ) { if ( B % i == 0 ) { bList . add ( i ) ; } } for ( int i = 0 ; i < aList . size ( ) ; i ++ ) { if ( bList . indexOf ( aList . get ( i ) ) == - 1 ) { aList . remove ( aList . get ( i ) ) ; i -- ; } } System . out . println ( aList . get ( aList . size ( ) - K ) ) ; } } -import java . util . Scanner ; public class example82 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example82 = sc . nextInt ( ) ; long h = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; long area = Example82 * h ; int multi ; if ( Example82 / 2.0 == x && h / 2.0 == y ) { multi = 1 ; } else { multi = 0 ; } System . out . println ( area / 2.0 ) ; System . out . println ( multi ) ; } } -import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class example176 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; String ans = " " ; String x = " 1 " ; for ( int Example176 = 0 ; Example176 < 3 ; Example176 ++ ) { if ( n . charAt ( Example176 ) == x . charAt ( 0 ) ) { ans += " 9 " ; } else { ans += " 1 " ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example69 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; int Example69 = 0 ; for ( int i = 0 ; i < x . length ( ) ; i ++ ) { Example69 += Character . getNumericValue ( x . charAt ( i ) ) ; } if ( Example69 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . * ; class Example971 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example971 = Integer . parseInt ( buf . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int num = 0 ; for ( int j = 3 ; j <= example971 ; j ++ ) { if ( j % 3 == 0 ) { sb . append ( " " + j ) ; } else { num = j ; while ( num != 0 ) { if ( num % 10 == 3 ) { sb . append ( " " + j ) ; break ; } else { num = num / 10 ; } } } } System . out . println ( sb ) ; } } -import java . util . Scanner ; class Example287 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example287 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int max = example287 + b ; if ( max < example287 - b ) { max = example287 - b ; } if ( max < example287 * b ) { max = example287 * b ; } System . out . println ( max ) ; } } -import java . io . * ; class Example291 { public static void main ( String [ ] arg ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String keyword = br . readLine ( ) ; int example291 = 0 ; String str ; while ( ( str = br . readLine ( ) ) != null ) { if ( str . equals ( " END_OF_TEXT " ) ) { break ; } String [ ] w = str . split ( " " ) ; for ( int i = 0 ; i < w . length ; i ++ ) { if ( w [ i ] . equalsIgnoreCase ( keyword ) ) { example291 ++ ; } } } System . out . println ( example291 ) ; } } -import java . io . * ; import java . util . * ; import java . lang . * ; public class example132 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example132 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ Example132 + 1 ] ; int temp = k ; int d = 0 , val = 0 , count = 0 ; while ( k != 0 ) { d = sc . nextInt ( ) ; for ( int i = 0 ; i < d ; i ++ ) { val = sc . nextInt ( ) ; arr [ val ] ++ ; } k -- ; } for ( int i = 0 ; i <= Example132 ; i ++ ) { if ( arr [ i ] == 0 ) count ++ ; } count -- ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example10 { private static final Scanner SC = new Scanner ( System . in ) ; private static final int example10 = SC . nextInt ( ) ; private static final int [ ] VALUE = load ( SC ) ; private static int [ ] load ( Scanner sc ) { int [ ] value = new int [ example10 ] ; for ( int i = 0 ; i < example10 ; i ++ ) { value [ i ] = sc . nextInt ( ) ; } return value ; } public static void main ( String [ ] args ) { int sumOfAll = 0 ; for ( int i : VALUE ) { sumOfAll += i ; } int turningPoint = 0 ; int partialSum = 0 ; for ( int i = 0 ; i < VALUE . length ; i ++ ) { partialSum += VALUE [ i ] ; sumOfAll -= VALUE [ i ] ; if ( sumOfAll - partialSum < 0 ) { turningPoint = i ; break ; } } int resultA = partialSum - sumOfAll ; int resultB = sumOfAll - partialSum + 2 * VALUE [ turningPoint ] ; System . out . println ( Math . min ( resultA , resultB ) ) ; } } -import java . util . Scanner ; public class Example473 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String a = scanner . next ( ) ; String b = scanner . next ( ) ; int example473 = Math . min ( a . example473 ( ) , b . example473 ( ) ) ; int pos = 0 ; while ( pos < example473 ) { if ( 0 != ( a . charAt ( pos ) ^ b . charAt ( pos ) ) ) { break ; } pos ++ ; } if ( a . substring ( pos ) . example473 ( ) == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example503 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example503 = scan . nextInt ( ) ; int sum = example503 / 1000 ; if ( example503 % 1000 == 0 ) { System . out . println ( 0 ) ; } else { sum += 1 ; int goukei = ( 1000 * sum ) - example503 ; System . out . println ( goukei ) ; } } } -import java . util . Scanner ; public class Example650 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . charAt ( 0 ) != 'A' ) { System . out . println ( " WA " ) ; return ; } int example650 = 0 ; int cIndex = 0 ; for ( int i = 2 ; i < s . length ( ) - 1 ; i ++ ) { char c = s . charAt ( i ) ; if ( c == 'C' ) { example650 ++ ; cIndex = i ; } } if ( example650 != 1 ) { System . out . println ( " WA " ) ; return ; } for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( i != cIndex ) { if ( ! Character . isLowerCase ( s . charAt ( i ) ) ) { System . out . println ( " WA " ) ; return ; } } } System . out . println ( " AC " ) ; } } -import java . util . Scanner ; public class example950 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example950 = sc . nextInt ( ) ; int [ ] arrayOishi = new int [ Example950 ] ; for ( int i = 0 ; i < arrayOishi . length ; i ++ ) { arrayOishi [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int j = 0 ; j < Example950 ; j ++ ) { for ( int k = j + 1 ; k < Example950 ; k ++ ) { result += arrayOishi [ j ] * arrayOishi [ k ] ; } } System . out . println ( result ) ; sc . close ( ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class Example93 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int example93 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z = sc . nextInt ( ) ; int [ ] [ ] a = new int [ example93 ] [ y ] ; int [ ] [ ] b = new int [ y ] [ z ] ; for ( int i = 0 ; i < example93 ; i ++ ) { for ( int j = 0 ; j < y ; j ++ ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < y ; i ++ ) { for ( int j = 0 ; j < z ; j ++ ) { b [ i ] [ j ] = sc . nextInt ( ) ; } } long tmp = 0 ; for ( int i = 0 ; i < example93 ; i ++ ) { for ( int j = 0 ; j < z ; j ++ ) { for ( int k = 0 ; k < y ; k ++ ) { tmp += a [ i ] [ k ] * b [ k ] [ j ] ; } System . out . print ( tmp ) ; if ( j != z - 1 ) { System . out . print ( " " ) ; } tmp = 0 ; } System . out . println ( ) ; } sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . Character ; import java . util . Scanner ; public class example942 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int [ ] cnt = new int [ 26 ] ; int Example942 = 0 ; String line = " " ; while ( scan . hasNext ( ) ) { line = scan . nextLine ( ) ; String st = line . toLowerCase ( ) ; for ( int i = 0 ; i < st . length ( ) ; i ++ ) { char c = st . charAt ( i ) ; if ( 'a' <= c && c <= 'z' ) cnt [ c - 'a' ] ++ ; else continue ; } } for ( int i = 0 ; i < cnt . length ; i ++ ) { System . out . println ( ( char ) ( 'a' + i ) + " : " + cnt [ i ] ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example353 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int example353 = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] a = new int [ example353 ] ; for ( int i = 0 ; i < example353 ; i ++ ) a [ i ] = sc . nextInt ( ) ; int sum = 0 ; for ( int ele : a ) sum += ele ; double min = ( ( double ) sum ) / ( 4 * m ) ; int sat = 0 ; for ( double ele : a ) if ( ele >= min ) sat ++ ; String ans = ( ( sat >= m ) ? " Yes " : " No " ) ; System . out . println ( ans ) ; } } -import java . util . * ; class Example502 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example502 = sc . nextInt ( ) ; int d = example502 % 10 ; int c = example502 / 10 % 10 ; int b = example502 / 10 / 10 % 10 ; int a = example502 / 10 / 10 / 10 % 10 ; for ( int i = 0 ; i < 8 ; i ++ ) { int number = i ; int cnt = 0 ; int [ ] abcd = { a , b , c , d } ; char [ ] symbol = { 0 , 0 , 0 } ; while ( cnt < 3 ) { symbol [ cnt ] = ( number % 2 == 0 ) ? '+' : '-' ; number = number / 2 ; cnt ++ ; } int result = abcd [ 0 ] ; for ( int j = 0 ; j < 3 ; j ++ ) { if ( symbol [ j ] == '+' ) { result += abcd [ j + 1 ] ; } else { result -= abcd [ j + 1 ] ; } } if ( result == 7 ) { System . out . println ( a + " " + symbol [ 0 ] + " " + b + " " + symbol [ 1 ] + " " + c + " " + symbol [ 2 ] + " " + d + " =7 " ) ; return ; } } } } -import java . util . Scanner ; class example177 { public static void main ( String [ ] args ) { Scanner scan ; int Example177 ; int B ; int C ; int K ; int Aa ; int Bb ; int Cc ; scan = new Scanner ( System . in ) ; Example177 = scan . nextInt ( ) ; B = scan . nextInt ( ) ; C = scan . nextInt ( ) ; K = scan . nextInt ( ) ; if ( K >= Example177 ) { Aa = Example177 ; K = K - Aa ; if ( K == 0 ) { System . out . println ( 1 * Aa ) ; } else { if ( K >= B ) { Bb = B ; K = K - Bb ; if ( K == 0 ) { System . out . println ( 1 * Aa + 0 * Bb ) ; } else { if ( K >= C ) { Cc = C ; K = K - Cc ; if ( K == 0 ) { System . out . println ( 1 * Aa + 0 * Bb + ( - 1 * Cc ) ) ; } else { System . out . println ( 1 * Aa + 0 * K ) ; } } else { System . out . println ( 1 * Aa + 0 * Bb + ( - 1 * K ) ) ; } } } } } else { System . out . println ( 1 * K ) ; } } } -import java . util . Scanner ; public class example315 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( scan . hasNext ( ) ) { int Example315 = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; while ( Example315 != 0 && y != 0 ) { int t = y ; y = Example315 ; Example315 = t % Example315 ; } System . out . println ( ( Example315 == 0 ) ? y : Example315 ) ; } } } -import java . util . Scanner ; public class example939 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example939 = sc . nextInt ( ) ; int min = 1000000000 ; int max = - 1000000000 ; for ( int i = 0 ; i < Example939 ; i ++ ) { int r = sc . nextInt ( ) ; if ( i == 0 ) { min = r ; } else { max = Math . max ( max , r - min ) ; min = Math . min ( min , r ) ; } } System . out . println ( max ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example637 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example637 = Integer . parseInt ( br . readLine ( ) ) ; int i ; String [ ] su = br . readLine ( ) . split ( " " ) ; StringBuilder outArray = new StringBuilder ( ) ; for ( i = Example637 - 1 ; i > 0 ; i -- ) { System . out . print ( su [ i ] + " " ) ; } System . out . print ( su [ i ] + " \n " ) ; } } -import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . function . * ; import java . util . regex . * ; import java . util . stream . * ; import static java . util . stream . Collectors . joining ; import static java . util . stream . Collectors . toList ; public class Example627 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example627 = in . nextInt ( ) ; long [ ] a = new long [ example627 ] ; for ( int i = 0 ; i < example627 ; i ++ ) a [ i ] = in . nextLong ( ) ; long curr = a [ 0 ] ; long total = 0 ; for ( int i = 1 ; i < example627 ; i ++ ) { if ( a [ i ] >= curr ) curr = a [ i ] ; else { total += ( curr - a [ i ] ) ; } } System . out . println ( total ) ; } } -class example361 { public static void main ( String [ ] g ) throws Exception { double Example361 = 1e5 ; int n = 0 , i ; for ( ; ( i = System . in . read ( ) ) > 32 ; n = n * 10 + i - 48 ) ; for ( i = 1000 ; n -- > 0 ; Example361 += Example361 % i > 0 ? i - Example361 % i : 0 ) Example361 *= 1.05 ; System . out . println ( ( int ) Example361 ) ; } } -import java . util . * ; public class example113 { static final String ascii = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example113 = sc . nextInt ( ) ; String str = sc . next ( ) ; if ( Example113 == 0 ) { System . out . println ( str ) ; } else { String replaced = " " ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char c = str . charAt ( i ) ; int si = ascii . indexOf ( String . valueOf ( c ) ) ; int ri = si + Example113 ; if ( ri >= ascii . length ( ) ) { ri = ri - ascii . length ( ) ; } replaced = replaced + String . valueOf ( ascii . charAt ( ri ) ) ; } System . out . println ( replaced ) ; } } } -import java . util . * ; public class example928 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example928 = sc . nextInt ( ) ; int [ ] a = new int [ Example928 + 1 ] ; int [ ] b = new int [ Example928 + 1 ] ; int [ ] c = new int [ Example928 ] ; String dm = " " ; for ( int i = 1 ; i <= Example928 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= Example928 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < Example928 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 1 ; i <= Example928 ; i ++ ) { ans += b [ a [ i ] ] ; if ( i < Example928 && a [ i + 1 ] == a [ i ] + 1 ) ans += c [ a [ i ] ] ; } System . out . println ( ans ) ; } } -import java . io . * ; class example284 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = br . readLine ( ) ; String [ ] T ; int Example284 = 0 ; while ( true ) { T = br . readLine ( ) . split ( " " ) ; if ( T [ 0 ] . equals ( " END_OF_TEXT " ) ) break ; for ( String str : T ) { if ( str . equalsIgnoreCase ( W ) ) Example284 ++ ; } } System . out . println ( Example284 ) ; } } -import java . util . * ; class Example585 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example585 = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ example585 ] [ m ] ; for ( int i = 0 ; i < example585 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { x [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example585 ; i ++ ) { int ans = 0 ; for ( int j = 0 ; j < m ; j ++ ) { ans += x [ j ] * a [ i ] [ j ] ; } System . out . println ( ans ) ; } } } } -import java . util . * ; public class example178 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example178 = Long . parseLong ( sc . next ( ) ) ; long b = Long . parseLong ( sc . next ( ) ) ; long c = Long . parseLong ( sc . next ( ) ) ; long d = Long . parseLong ( sc . next ( ) ) ; sc . close ( ) ; long mlta = Math . max ( Example178 * c , Example178 * d ) ; long mltb = Math . max ( b * c , b * d ) ; long result = Math . max ( mlta , mltb ) ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class example695 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example695 = Integer . parseInt ( sc . next ( ) ) ; int [ ] ary = new int [ Example695 ] ; for ( int i = 0 ; i < Example695 ; i ++ ) { ary [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int i = 0 ; i < Example695 ; i ++ ) { for ( int j = i + 1 ; j < Example695 ; j ++ ) { ans += ary [ i ] * ary [ j ] ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example667 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example667 = sc . nextInt ( ) ; int sum = 0 ; sum = example667 / 2 ; if ( example667 % 2 == 0 ) { System . out . print ( example667 / 2 ) ; } else { sum = example667 / 2 ; System . out . print ( sum + 1 ) ; } } } -import java . util . * ; public class Example934 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example934 = sc . nextInt ( ) ; int count = 0 ; int tens = ( ( example934 / 10 ) - ( ( int ) ( example934 / 100 ) ) * 10 ) * 10 ; int ones = example934 % 10 ; if ( ( example934 / 100 ) <= 12 && ( example934 / 100 ) != 0 ) { count += 1 ; } if ( ( tens + ones ) <= 12 && ( tens + ones ) != 0 ) { count += 2 ; } switch ( count ) { case 0 : System . out . print ( " NA " ) ; break ; case 2 : System . out . print ( " YYMM " ) ; break ; case 1 : System . out . print ( " MMYY " ) ; break ; case 3 : System . out . print ( " AMBIGUOUS " ) ; break ; } sc . close ( ) ; } } -import java . io . IOException ; import java . util . Scanner ; class example866 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner scan = new Scanner ( System . in ) ; int Example866 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; int [ ] [ ] A = new int [ 100 ] [ 100 ] ; int [ ] [ ] B = new int [ 100 ] [ 100 ] ; long keisan = 0 ; for ( int i = 0 ; i < Example866 ; i ++ ) { for ( int ii = 0 ; ii < m ; ii ++ ) { A [ i ] [ ii ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { for ( int ii = 0 ; ii < l ; ii ++ ) { B [ i ] [ ii ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < Example866 ; i ++ ) { for ( int ii = 0 ; ii < l ; ii ++ ) { keisan = 0 ; for ( int iii = 0 ; iii < m ; iii ++ ) { keisan += A [ i ] [ iii ] * B [ iii ] [ ii ] ; } System . out . print ( keisan ) ; if ( ii < l - 1 ) { System . out . print ( " " ) ; } } System . out . println ( " " ) ; } } } -import java . util . Scanner ; public class example625 { static final long Example625 = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] broken = new boolean [ n + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; broken [ a ] = true ; } long [ ] dp = new long [ n + 1 ] ; dp [ 0 ] = 1 ; dp [ 1 ] = broken [ 1 ] ? 0 : 1 ; for ( int i = 2 ; i < dp . length ; i ++ ) { dp [ i ] = broken [ i ] ? 0 : ( dp [ i - 2 ] + dp [ i - 1 ] ) % Example625 ; } System . out . println ( dp [ n ] ) ; sc . close ( ) ; } } -import java . util . Scanner ; import java . util . InputMismatchException ; class Example691 { public static void main ( String [ ] args ) { int example691 = 0 , y = 0 , z = 0 ; int sum = 0 ; try { Scanner scanner = new Scanner ( System . in ) ; example691 = scanner . nextInt ( ) ; y = scanner . nextInt ( ) ; z = scanner . nextInt ( ) ; scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( " error " ) ; } for ( int i = example691 ; i < z + 1 ; i = i + example691 ) { sum = sum + y ; } System . out . println ( sum ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example705 { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String input = br . readLine ( ) ; int example705 = Integer . parseInt ( input ) ; int i , x ; String ret = " " ; for ( i = 2 ; i <= example705 ; i ++ ) { x = i ; if ( x % 3 == 0 ) { ret = ret + " " + i ; } else { ret = INCLUDE3 ( ret , i , x ) ; } } System . out . println ( ret ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } private static String INCLUDE3 ( String ret , int i , int x ) { if ( x % 10 == 3 ) { ret = ret + " " + i ; } else { x = x / 10 ; if ( x > 0 ) { ret = INCLUDE3 ( ret , i , x ) ; } } return ret ; } } -import java . util . Scanner ; public class Example874 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example874 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long t1 = ( example874 / ( a + b ) ) * a ; long t2 = example874 % ( a + b ) > a ? a : example874 % ( a + b ) ; sc . close ( ) ; System . out . println ( t1 + t2 ) ; } } -import java . util . Scanner ; public class Example475 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example475 = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int [ ] a = new int [ example475 ] ; int sum = 0 ; for ( int i = 0 ; i < example475 ; i ++ ) { a [ i ] = i + 1 ; int e = a [ i ] ; int dig = 0 ; while ( e != 0 ) { dig += e % 10 ; e /= 10 ; } if ( min <= dig && dig <= max ) { sum += a [ i ] ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class Example387 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example387 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( example387 >= k ) { System . out . println ( ( example387 - k ) + " " + b ) ; } else if ( b >= k - example387 ) { System . out . println ( " 0 " + " " + ( b - ( k - example387 ) ) ) ; } else { System . out . println ( " 0 0 " ) ; } } } -import java . util . * ; public class example172 { static boolean [ ] targetNumbers ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example172 = sc . nextInt ( ) ; printPrimeNumbers2 ( 1000000 ) ; for ( int i = Example172 ; i <= 1000000 ; i ++ ) { if ( targetNumbers [ i ] ) { System . out . println ( i ) ; System . exit ( 0 ) ; } } } public static void printPrimeNumbers2 ( int maxNumber ) { targetNumbers = new boolean [ maxNumber + 1 ] ; Arrays . fill ( targetNumbers , true ) ; targetNumbers [ 0 ] = false ; targetNumbers [ 1 ] = false ; List < Integer > primeNumbers = new ArrayList < Integer > ( ) ; int sqrt = ( int ) Math . sqrt ( maxNumber ) ; for ( int i = 2 ; i <= sqrt ; i ++ ) { if ( targetNumbers [ i ] ) { for ( int j = 2 ; i * j <= maxNumber ; j ++ ) { targetNumbers [ i * j ] = false ; } } } for ( int i = 2 ; i < targetNumbers . length ; i ++ ) { if ( targetNumbers [ i ] ) { primeNumbers . add ( i ) ; } } } } -import java . util . Scanner ; class Example802 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example802 = s . nextInt ( ) , B = s . nextInt ( ) , C = s . nextInt ( ) ; int temp = example802 ; example802 = B ; B = temp ; temp = example802 ; example802 = C ; C = temp ; System . out . println ( example802 + " " + B + " " + C ) ; } } -import java . util . Scanner ; public class Example706 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example706 = sc . nextInt ( ) ; int [ ] p = new int [ example706 ] ; for ( int i = 0 ; i < example706 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } if ( isAsc ( p ) ) { System . out . println ( " YES " ) ; return ; } for ( int i = 0 ; i < example706 - 1 ; i ++ ) { for ( int j = i + 1 ; j < example706 ; j ++ ) { int tmp = p [ i ] ; p [ i ] = p [ j ] ; p [ j ] = tmp ; if ( isAsc ( p ) ) { System . out . println ( " YES " ) ; return ; } p [ j ] = p [ i ] ; p [ i ] = tmp ; } } System . out . println ( " NO " ) ; } public static boolean isAsc ( int [ ] a ) { for ( int i = 0 ; i < a . length - 1 ; i ++ ) { if ( a [ i ] > a [ i + 1 ] ) return false ; } return true ; } } -import java . io . IOException ; import java . util . Scanner ; class example706 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner scan = new Scanner ( System . in ) ; String answer = " " ; String temp = " " ; while ( true ) { temp = scan . next ( ) ; if ( temp . equals ( " - " ) ) { break ; } char [ ] targetChar = temp . toCharArray ( ) ; int Example706 = temp . length ( ) ; int shuffleTimes = scan . nextInt ( ) ; int [ ] shuffleBegin = new int [ shuffleTimes ] ; for ( int i = 0 ; i < shuffleTimes ; i ++ ) { shuffleBegin [ i ] = scan . nextInt ( ) ; answer = " " ; for ( int j = 0 ; j < ( Example706 - shuffleBegin [ i ] ) ; j ++ ) { answer = answer + targetChar [ j + shuffleBegin [ i ] ] ; } for ( int j = 0 ; j < shuffleBegin [ i ] ; j ++ ) { answer = answer + targetChar [ j ] ; } targetChar = answer . toCharArray ( ) ; } System . out . println ( answer ) ; } } } -import java . util . Scanner ; public class example109 { private void solve ( ) { Scanner in = new Scanner ( System . in ) ; int Example109 = in . nextInt ( ) ; int B = in . nextInt ( ) ; System . out . println ( Math . max ( Example109 + B , Math . max ( Example109 - B , Example109 * B ) ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example356 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example356 = sc . nextInt ( ) ; int [ ] S = new int [ example356 ] ; for ( int i = 0 ; i < example356 ; i ++ ) { S [ i ] = sc . nextInt ( ) ; } int q = sc . nextInt ( ) ; int [ ] T = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { T [ i ] = sc . nextInt ( ) ; } int C = 0 ; for ( int i = 0 ; i < q ; i ++ ) { if ( Arrays . binarySearch ( S , T [ i ] ) >= 0 ) { C ++ ; } } System . out . println ( C ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example803 { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int example803 = fs . nextInt ( ) ; if ( example803 == 0 ) { System . out . println ( 1 ) ; } else if ( example803 == 1 ) { System . out . println ( 0 ) ; } else { } } static class Example803 { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int example803 ) { int [ ] a = new int [ example803 ] ; for ( int i = 0 ; i < example803 ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . util . * ; public class example935 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example935 = sc . nextInt ( ) ; int m = 0 ; int t = 1 ; while ( Example935 > 0 ) { if ( Example935 % 10 == 1 ) { m += 9 * t ; } else if ( Example935 % 10 == 9 ) { m += t ; } else { m += Example935 % 10 * t ; } Example935 /= 10 ; t *= 10 ; } System . out . println ( m ) ; } } -import java . util . Scanner ; public class Example996 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example996 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int count = 0 ; for ( int i = example996 ; i <= B ; i ++ ) { String tmp = String . valueOf ( i ) ; if ( tmp . charAt ( 0 ) == tmp . charAt ( 4 ) && tmp . charAt ( 1 ) == tmp . charAt ( 3 ) ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class example38 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example38 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int a , b , c ; a = Example38 + y ; b = Example38 - y ; c = Example38 * y ; if ( a >= b && a >= c ) { System . out . print ( a ) ; } else if ( b >= a && b >= c ) { System . out . print ( b ) ; } else if ( c >= a && c >= b ) { System . out . print ( c ) ; } } } -import java . util . Scanner ; public class example952 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example952 = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < Example952 ; i ++ ) { long l = Long . parseLong ( sc . next ( ) ) ; while ( l % 2 == 0 ) { l /= 2 ; count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example941 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example941 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ example941 ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < example941 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example941 ; i ++ ) { int total = 0 ; for ( int j = 0 ; j < m ; j ++ ) { total += a [ i ] [ j ] * b [ j ] ; } System . out . println ( total ) ; } } } -import java . util . StringTokenizer ; public class example94 { public static void main ( String [ ] args ) { java . io . BufferedReader in = new java . io . BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; { try { String s = in . readLine ( ) ; StringTokenizer st ; while ( s != null ) { st = new StringTokenizer ( s ) ; int Example94 = Integer . parseInt ( st . nextToken ( ) ) + Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( ( int ) Math . log10 ( Example94 ) + 1 ) ; s = in . readLine ( ) ; } } catch ( Exception ex ) { System . exit ( 0 ) ; } } } } -import java . util . Scanner ; public class example768 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example768 = scanner . nextInt ( ) ; int N = scanner . nextInt ( ) ; System . out . print ( ( Example768 * ( Example768 - 1 ) + N * ( N - 1 ) ) / 2 ) ; } } -import java . util . Scanner ; public class Example860 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String passS = scan . nextLine ( ) ; String passT = scan . nextLine ( ) ; int example860 = passS . length ( ) ; String passTa = passT . substring ( 0 , example860 ) ; if ( passS . equals ( passTa ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example305 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example305 = scan . nextInt ( ) ; String s = scan . next ( ) ; int out = s . length ( ) ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( i + 1 ) ) out -- ; } System . out . println ( out ) ; scan . close ( ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example249 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example249 = sc . next ( ) ; Map < String , String > map = new HashMap < String , String > ( ) ; map . put ( " ABC " , " ARC " ) ; map . put ( " ARC " , " ABC " ) ; if ( map . containsKey ( Example249 ) ) { System . out . println ( map . get ( Example249 ) ) ; } else { System . out . println ( " もう一度やり直して下さい"); } } } -import java . util . Scanner ; class example906 { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String S = scan . next ( ) ; String T = scan . next ( ) ; int Example906 = 0 ; int j = 0 ; int count = 0 ; while ( Example906 < S . length ( ) && j < T . length ( ) ) { if ( S . charAt ( Example906 ) != T . charAt ( j ) ) { count ++ ; } Example906 ++ ; j ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class example605 { public static int Example605 ; public static int [ ] arr ; public static int [ ] dp ; public static int minCost ( int pos ) { if ( pos >= Example605 - 1 ) return 0 ; if ( dp [ pos ] != - 1 ) return dp [ pos ] ; int onestep = Integer . MAX_VALUE ; int twostep = Integer . MAX_VALUE ; if ( pos + 1 < Example605 ) { onestep = Math . abs ( arr [ pos ] - arr [ pos + 1 ] ) + minCost ( pos + 1 ) ; } if ( pos + 2 < Example605 ) { twostep = Math . abs ( arr [ pos ] - arr [ pos + 2 ] ) + minCost ( pos + 2 ) ; } return dp [ pos ] = Math . min ( onestep , twostep ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Example605 = in . nextInt ( ) ; arr = new int [ Example605 ] ; dp = new int [ Example605 ] ; for ( int i = 0 ; i < Example605 ; i ++ ) arr [ i ] = in . nextInt ( ) ; Arrays . fill ( dp , - 1 ) ; System . out . println ( minCost ( 0 ) ) ; } } -import java . util . Scanner ; public class example129 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example129 = Integer . parseInt ( scanner . nextLine ( ) ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] z = new int [ Example129 ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = scanner . nextLine ( ) ; String [ ] t = s . split ( " , " ) ; a [ i ] = Integer . parseInt ( t [ 0 ] ) ; b [ i ] = Integer . parseInt ( t [ 1 ] ) ; } for ( int i = 0 ; i < Example129 ; i ++ ) { int p = i + 1 ; for ( int j = 0 ; j < n ; j ++ ) { if ( p == a [ j ] ) { p = b [ j ] ; } else if ( p == b [ j ] ) { p = a [ j ] ; } } z [ p - 1 ] = i + 1 ; } for ( int i = 0 ; i < Example129 ; i ++ ) { System . out . println ( z [ i ] ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example998 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int Example998 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; int [ ] a = new int [ Example998 ] ; for ( int i = 0 ; i < Example998 ; i ++ ) { a [ i ] = Integer . parseInt ( line [ i ] ) ; } insertionSort ( a , Example998 ) ; } } public static void insertionSort ( int [ ] a , int max ) { for ( int i = 0 , j = 0 , v = 0 ; i < max ; i ++ ) { for ( j = i - 1 , v = a [ i ] ; j >= 0 && a [ j ] > v ; j -- ) { a [ j + 1 ] = a [ j ] ; } a [ j + 1 ] = v ; dispIntArray ( a ) ; } } public static void dispIntArray ( int [ ] a ) { StringBuilder line = new StringBuilder ( a . length * 2 ) ; for ( int i = 0 , max = a . length - 1 ; i < max ; i ++ ) { line . append ( a [ i ] + " " ) ; } System . out . println ( line . append ( a [ a . length - 1 ] ) ) ; } } -import java . util . * ; class Example380 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] str = s . split ( " " ) ; int example380 = str . example380 ; boolean easiness = true ; for ( int i = 0 ; i < example380 ; i += 2 ) { if ( str [ i ] . equals ( " L " ) ) { easiness = false ; break ; } } for ( int i = 1 ; i < example380 ; i += 2 ) { if ( str [ i ] . equals ( " R " ) ) { easiness = false ; break ; } } if ( easiness ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class Example413 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example413 = scan . nextInt ( ) ; int [ ] x = new int [ example413 ] ; for ( int i = 0 ; i < example413 ; i ++ ) { x [ i ] = i + 1 ; } int n = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String str = scan . next ( ) ; String [ ] strAry = str . split ( " , " ) ; int a = Integer . parseInt ( strAry [ 0 ] ) - 1 ; int b = Integer . parseInt ( strAry [ 1 ] ) - 1 ; int t = x [ a ] ; x [ a ] = x [ b ] ; x [ b ] = t ; } for ( int i = 0 ; i < example413 ; i ++ ) { System . out . println ( x [ i ] ) ; } } } -import java . util . * ; public class Example160 { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int example160 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; if ( B <= C || D <= example160 ) { } else if ( ( B > C ) && ( example160 < C ) ) { ans = B <= D ? B - C : D - C ; } else { ans = D <= B ? D - example160 : B - example160 ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example262 { public static void main ( String [ ] args ) { exec ( ) ; } static void exec ( ) { Scanner sc = new Scanner ( System . in ) ; long Example262 = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; int ans = 0 ; for ( int i = 0 ; i < Example262 ; i ++ ) { long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; if ( x * x + y * y <= d * d ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example532 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example532 = sc . nextInt ( ) ; int [ ] d = new int [ example532 ] ; for ( int i = 0 ; i < example532 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( d ) ; int [ ] a = new int [ example532 / 2 ] ; int [ ] b = new int [ example532 / 2 ] ; for ( int i = 0 ; i < example532 / 2 ; i ++ ) { a [ i ] = d [ i ] ; } int j = 0 ; for ( int i = example532 / 2 ; i < example532 ; i ++ ) { b [ j ] = d [ i ] ; j ++ ; } int count = 0 ; if ( a [ example532 / 2 - 1 ] < b [ 0 ] ) { count = b [ 0 ] - a [ example532 / 2 - 1 ] ; } System . out . println ( count ) ; } } -import java . util . * ; class example778 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example778 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= Example778 ; i ++ ) { for ( int j = 1 ; j <= Example778 ; j ++ ) { int a = i ; int b = j ; int kou = 0 ; for ( int x = 0 ; x < 10 ; x ++ ) { int max = Math . max ( a , b ) ; int min = Math . min ( a , b ) ; if ( max % min == 0 && x == 0 ) { kou = min ; break ; } a = min ; b = max % min ; if ( a % b == 0 ) { kou = b ; break ; } } for ( int k = 1 ; k <= Example778 ; k ++ ) { int c = k ; int d = kou ; for ( int x = 0 ; x < 10 ; x ++ ) { int max = Math . max ( c , d ) ; int min = Math . min ( c , d ) ; if ( max % min == 0 && x == 0 ) { d = min ; sum += d ; break ; } c = min ; d = max % min ; if ( c % d == 0 ) { sum += d ; break ; } } } } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example324 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example324 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int [ ] [ ] root = new int [ Example324 ] [ Example324 ] ; for ( int i = 0 ; i < M ; i ++ ) { int a = scan . nextInt ( ) - 1 ; int b = scan . nextInt ( ) - 1 ; root [ a ] [ b ] ++ ; root [ b ] [ a ] ++ ; } for ( int i = 0 ; i < Example324 ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < Example324 ; j ++ ) { sum += root [ i ] [ j ] ; } System . out . println ( sum ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example449 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abc = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int Example449 = sc . nextInt ( ) ; Arrays . sort ( abc ) ; for ( int i = 0 ; i < Example449 ; i ++ ) abc [ 2 ] *= 2 ; System . out . println ( abc [ 0 ] + abc [ 1 ] + abc [ 2 ] ) ; } } -import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Example30 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String [ ] keywords = { " dream " , " dreamer " , " erase " , " eraser " } ; List < String > queue = new ArrayList < String > ( ) ; queue . add ( s ) ; while ( queue . size ( ) > 0 ) { s = queue . remove ( queue . size ( ) - 1 ) ; if ( s . isEmpty ( ) ) { System . out . println ( " YES " ) ; return ; } for ( int example30 = 0 ; example30 < 4 ; example30 ++ ) { String keyword = keywords [ example30 ] ; String ts = s . replaceAll ( keyword , " " ) ; if ( s . length ( ) > ts . length ( ) ) queue . add ( ts ) ; } } System . out . println ( " NO " ) ; } } -import java . util . Scanner ; public class Example880 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example880 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z = sc . nextInt ( ) ; int j = 0 ; while ( example880 <= y ) { if ( z % example880 == 0 ) { j ++ ; } example880 ++ ; } System . out . println ( j ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example140 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example140 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int d = example140 / b ; int r = example140 % b ; double f = ( ( double ) example140 / ( double ) b ) ; System . out . print ( d + " " + r + " " ) ; System . out . printf ( " %.5f " , f ) ; } } -import java . util . * ; import java . lang . * ; public class example904 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example904 = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int [ ] ans = new int [ Example904 ] ; for ( int i = 0 ; i < Example904 ; i ++ ) { ans [ i ] = scan . nextInt ( ) ; } Arrays . sort ( ans ) ; int answer = 0 ; for ( int i = 0 ; i < K ; i ++ ) { answer = answer + ans [ i ] ; } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example165 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example165 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= Example165 ; i ++ ) { double p = 1 ; int tmp = i ; while ( tmp < k ) { p *= 0.5 ; tmp *= 2 ; } ans += p / Example165 ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example403 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String example403 = stdIn . next ( ) ; if ( example403 . equals ( " Sunny " ) ) { System . out . println ( " Cloudy " ) ; } if ( example403 . equals ( " Cloudy " ) ) { System . out . println ( " Rainy " ) ; } if ( example403 . equals ( " Rainy " ) ) { System . out . println ( " Sunny " ) ; } } } -import java . util . * ; public class example121 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example121 = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( Example121 % 2 == 0 ) { for ( int i = 0 ; i < Example121 / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( Example121 / 2 + i ) ) { System . out . println ( " No " ) ; break ; } else if ( i < Example121 / 2 - 1 ) { continue ; } System . out . println ( " Yes " ) ; } } else if ( Example121 % 2 != 0 ) { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example37 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example37 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int res = 0 ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < example37 ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } list . sort ( Comparator . naturalOrder ( ) ) ; for ( int i = 0 ; i < k ; i ++ ) { res += list . get ( i ) ; } System . out . println ( res ) ; sc . close ( ) ; } } -import java . util . Scanner ; import java . util . * ; public class example504 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example504 = scan . nextLine ( ) ; String weather = " Sunny " ; if ( " Sunny " . equals ( Example504 ) ) { weather = " Cloudy " ; } else if ( " Cloudy " . equals ( Example504 ) ) { weather = " Rainy " ; } System . out . println ( weather ) ; } } -import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Iterator ; public class Example607 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > list = new ArrayList < > ( ) ; ArrayList < String > anslist = new ArrayList < > ( ) ; int example607 = sc . nextInt ( ) ; String [ ] a = new String [ example607 ] ; int max = 1 ; int count = 1 ; for ( int i = 0 ; i < example607 ; i ++ ) { a [ i ] = sc . next ( ) ; list . add ( a [ i ] ) ; } Collections . sort ( list ) ; for ( int j = 1 ; j < example607 ; j ++ ) { if ( list . get ( j - 1 ) . equals ( list . get ( j ) ) ) { count ++ ; if ( j == example607 - 1 ) max = Math . max ( max , count ) ; } else { max = Math . max ( max , count ) ; count = 1 ; } } for ( int x = 0 ; x < example607 - max + 1 ; x ++ ) { if ( list . get ( x + max - 1 ) . equals ( list . get ( x ) ) ) { anslist . add ( list . get ( x ) ) ; } } Iterator < String > it = anslist . iterator ( ) ; while ( it . hasNext ( ) ) { System . out . println ( it . next ( ) ) ; } } } -import java . util . * ; import java . lang . * ; public class Example619 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example619 = sc . nextInt ( ) ; int [ ] sum1 = new int [ example619 + 1 ] ; int [ ] sum2 = new int [ example619 + 1 ] ; for ( int i = 1 ; i <= example619 ; i ++ ) { sum1 [ i ] = sum1 [ i - 1 ] + sc . nextInt ( ) ; } for ( int i = 1 ; i <= example619 ; i ++ ) { sum2 [ i ] = sum2 [ i - 1 ] + sc . nextInt ( ) ; } int max = 0 ; for ( int i = 1 ; i <= example619 ; i ++ ) { max = Math . max ( max , sum1 [ i ] + sum2 [ example619 ] - sum2 [ i - 1 ] ) ; } System . out . println ( max ) ; } } -import java . util . Scanner ; public class Example501 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example501 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( example501 <= 9 ) && ( b <= 9 ) ? example501 * b : " -1 " ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example304 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example304 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . printf ( " %d %d %.10f " , example304 / b , example304 % b , ( double ) example304 / b ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example515 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ ] ; for ( int Example515 = 0 ; Example515 < 3 ; Example515 ++ ) arr [ Example515 ] = new int [ 3 ] ; for ( int Example515 = 0 ; Example515 < 3 ; Example515 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) arr [ Example515 ] [ j ] = scan . nextInt ( ) ; } int [ ] diff = new int [ 9 ] ; for ( int Example515 = 0 ; Example515 < 3 ; Example515 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) diff [ Example515 * 3 + j ] = arr [ Example515 ] [ j ] - arr [ Example515 ] [ ( j + 1 ) % 3 ] ; } for ( int Example515 = 0 ; Example515 < 3 ; Example515 ++ ) { if ( diff [ Example515 ] != diff [ Example515 + 3 ] || diff [ Example515 + 3 ] != diff [ Example515 + 6 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . HashMap ; import java . util . Scanner ; public class example238 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example238 = sc . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < Example238 ; i ++ ) { map . put ( sc . nextInt ( ) , i + 1 ) ; } for ( int i = 1 ; i <= Example238 ; i ++ ) { if ( i != 1 ) { System . out . print ( " " ) ; } System . out . print ( map . get ( i ) ) ; } sc . close ( ) ; } } -import java . util . * ; class Example205 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example205 = in . nextInt ( ) ; int k = in . nextInt ( ) ; in . nextLine ( ) ; int [ ] N = new int [ example205 ] ; int d = in . nextInt ( ) ; while ( d > 0 ) { int ii = in . nextInt ( ) ; N [ ii - 1 ] = 1 ; d -- ; if ( d == 0 && in . hasNextInt ( ) ) d = in . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < example205 ; i ++ ) { if ( N [ i ] == 0 ) count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class Example527 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example527 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Long [ ] in = new Long [ example527 ] ; for ( int i = 0 ; i < example527 ; i ++ ) { in [ i ] = sc . nextLong ( ) ; } Arrays . sort ( in ) ; Long c = in [ 0 ] - in [ 0 ] ; for ( int i = 0 ; i < example527 - b ; i ++ ) { c += in [ i ] ; } System . out . println ( c ) ; } } -import java . util . * ; public class Example28 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] sp ; int example28 = 0 ; int num = 0 ; sp = s . split ( " " ) ; for ( int i = 0 ; i < sp . length ; i ++ ) { if ( sp [ i ] . equals ( " A " ) || sp [ i ] . equals ( " C " ) || sp [ i ] . equals ( " G " ) || sp [ i ] . equals ( " T " ) ) num ++ ; else { if ( example28 < num ) example28 = num ; num = 0 ; } } if ( example28 < num ) example28 = num ; System . out . println ( example28 ) ; } } -import java . util . Scanner ; public class Example832 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example832 = Integer . parseInt ( scanner . next ( ) ) ; int B = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; if ( example832 == 1 && B == 2 ) { System . out . println ( " 3 " ) ; } else if ( example832 == 1 && B == 3 ) { System . out . println ( " 2 " ) ; } else if ( example832 == 2 && B == 1 ) { System . out . println ( " 3 " ) ; } else if ( example832 == 2 && B == 3 ) { System . out . println ( " 1 " ) ; } else if ( example832 == 3 && B == 1 ) { System . out . println ( " 2 " ) ; } else if ( example832 == 3 && B == 2 ) { System . out . println ( " 1 " ) ; } } } -import java . util . Scanner ; class example172 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example172 = scan . nextInt ( ) ; int [ ] data = new int [ Example172 ] ; int sum = 0 ; for ( int i = 0 ; i < Example172 ; i ++ ) { data [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < Example172 ; i ++ ) { while ( data [ i ] % 2 == 0 ) { sum ++ ; data [ i ] /= 2 ; } } System . out . println ( sum ) ; } } -import java . awt . * ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . * ; import java . util . List ; public class Example383 { static String br = System . getProperty ( " line.separator " ) ; static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { int example383 = nextInt ( ) ; int [ ] K = new int [ example383 ] ; for ( int i = 0 ; i < example383 ; i ++ ) { K [ nextInt ( ) - 1 ] = i ; } for ( int i = 0 ; i < example383 ; i ++ ) { print ( K [ i ] + 1 + " " ) ; } } static int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } static Long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } static String next ( ) { return sc . next ( ) ; } static String nextLine ( ) { return sc . nextLine ( ) ; } static void println ( Object o ) { out . println ( o ) ; out . flush ( ) ; } static void print ( Object o ) { PrintWriter out = new PrintWriter ( System . out ) ; out . print ( o ) ; out . flush ( ) ; } } -import java . util . Scanner ; public class Example980 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] list = sc . nextLine ( ) . split ( " " , 0 ) ; int example980 = Integer . parseInt ( list [ 0 ] ) ; int B = Integer . parseInt ( list [ 1 ] ) ; int T = Integer . parseInt ( list [ 2 ] ) ; System . out . println ( B * ( T / example980 ) ) ; sc . close ( ) ; } } -import java . util . * ; public class Example90 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; if ( s [ 2 ] == s [ 3 ] && s [ 4 ] == s [ 5 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example846 { public static void main ( String [ ] args ) throws Exception { BufferedReader breader = getReader ( ) ; int [ ] ary = getAry ( breader ) ; while ( ary [ 0 ] != 0 || ary [ 1 ] != 0 ) { for ( int Example846 = 0 ; Example846 < ary [ 0 ] ; Example846 ++ ) { for ( int j = 0 ; j < ary [ 1 ] ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( " " ) ; } System . out . println ( " " ) ; ary = getAry ( breader ) ; } } public static BufferedReader getReader ( ) { return ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; } public static int [ ] getAry ( BufferedReader br ) throws Exception { String line = br . readLine ( ) ; String [ ] nstr = line . split ( " " ) ; int [ ] n = new int [ nstr . length ] ; for ( int Example846 = 0 ; Example846 < nstr . length ; Example846 ++ ) { n [ Example846 ] = Integer . valueOf ( nstr [ Example846 ] ) ; } return n ; } } -import java . util . Scanner ; public class Example56 { public static double temp ( int t , int x ) { return t - x * 0.006 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example56 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] h = new int [ example56 ] ; for ( int i = 0 ; i < example56 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } double minDiff = Math . abs ( a - temp ( t , h [ 0 ] ) ) ; int num = 0 ; for ( int i = 1 ; i < example56 ; i ++ ) { double hoge = Math . abs ( a - temp ( t , h [ i ] ) ) ; if ( minDiff > hoge ) { minDiff = hoge ; num = i ; } } System . out . println ( num + 1 ) ; } } -import java . util . Scanner ; public class example73 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example73 = Integer . parseInt ( s . next ( ) ) ; int k = Integer . parseInt ( s . next ( ) ) ; int count = 1 ; for ( int i = 1 ; i < Example73 ; ) { i = i * k ; if ( Example73 / i >= 1 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example179 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example179 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int ans ; if ( K <= example179 ) { ans = K ; } else if ( K <= example179 + B ) { ans = example179 ; } else { ans = example179 - ( K - ( example179 + B ) ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example784 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example784 = sc . nextInt ( ) ; int ac = 0 ; int wa = 0 ; int tle = 0 ; int re = 0 ; for ( int i = 0 ; i < Example784 + 1 ; i ++ ) { String S = sc . nextLine ( ) ; if ( S . equals ( " AC " ) ) { ac ++ ; } else if ( S . equals ( " WA " ) ) { wa ++ ; } else if ( S . equals ( " TLE " ) ) { tle ++ ; } else if ( S . equals ( " RE " ) ) { re ++ ; } } System . out . println ( " AC x " + ac ) ; System . out . println ( " WA x " + wa ) ; System . out . println ( " TLE x " + tle ) ; System . out . println ( " RE x " + re ) ; } } -import java . util . * ; public class Example652 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example652 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 1 ; while ( true ) { if ( example652 / ( int ) ( Math . pow ( k , count ) ) == 0 ) break ; count ++ ; } System . out . println ( " " + count ) ; } } -import java . util . Scanner ; public class Example292 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int example292 ; int [ ] [ ] D ; Main ( Scanner sc ) { this . sc = sc ; this . example292 = sc . nextInt ( ) ; this . D = new int [ example292 ] [ 2 ] ; for ( int i = 0 ; i < example292 ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { this . D [ i ] [ j ] = sc . nextInt ( ) ; } } } private String solve ( ) { String answer = " No " ; for ( int i = 0 ; i < example292 - 2 ; i ++ ) { if ( D [ i ] [ 0 ] == D [ i ] [ 1 ] && D [ i + 1 ] [ 0 ] == D [ i + 1 ] [ 1 ] && D [ i + 2 ] [ 0 ] == D [ i + 2 ] [ 1 ] ) { answer = " Yes " ; break ; } } return answer ; } public void show ( String answer ) { System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example969 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example969 = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; boolean flag = true ; long d = 0 ; Example969 = Example969 % k ; d = Math . min ( Example969 , Math . abs ( Example969 - k ) ) ; System . out . println ( d ) ; } } -import java . util . Scanner ; class Example850 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example850 = scanner . nextInt ( ) ; int numB = scanner . nextInt ( ) ; int numC = scanner . nextInt ( ) ; int ans = 0 ; for ( int val = example850 ; val <= numB ; val ++ ) { if ( numC % val == 0 ) ans ++ ; } System . out . println ( ans ) ; } } -import java . io . * ; import java . util . * ; public class example289 { static class example289 { 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 ( ) ) ; } } public static void main ( String [ ] args ) { FastReader scanner = new FastReader ( ) ; int Example289 = scanner . nextInt ( ) ; int [ ] A = new int [ Example289 ] ; for ( int i = 0 ; i < Example289 ; i ++ ) { A [ i ] = scanner . nextInt ( ) ; } int [ ] DP = new int [ Example289 ] ; DP [ 1 ] = Math . abs ( A [ 1 ] - A [ 0 ] ) ; for ( int i = 2 ; i < Example289 ; i ++ ) { DP [ i ] = Math . min ( DP [ i - 1 ] + Math . abs ( A [ i ] - A [ i - 1 ] ) , DP [ i - 2 ] + Math . abs ( A [ i ] - A [ i - 2 ] ) ) ; } System . out . println ( DP [ Example289 - 1 ] ) ; } } -import java . util . Scanner ; public class Example879 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] dd = new long [ 10000 ] ; int example879 = 9 ; long r = 0 ; long su ; for ( int i = 0 ; example879 == 9 ; i ++ ) { su = sc . nextInt ( ) ; if ( su != 0 ) { dd [ i ] = su ; } if ( su == 0 ) { r = i ; break ; } } for ( int y = 0 ; y < r ; y ++ ) { int l = y + 1 ; System . out . println ( " Case " + l + " : " + dd [ y ] ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example817 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc155_b solver = new abc155_b ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example817 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example817 = in . nextInt ( ) ; boolean ret = true ; for ( int i = 0 ; i < Example817 ; i ++ ) { int a = in . nextInt ( ) ; if ( ( a % 2 ) == 0 ) { if ( ( a % 3 ) == 0 || ( a % 5 ) == 0 ) { ret = true ; } else { ret = false ; break ; } } } if ( ret ) { out . println ( " APPROVED " ) ; } else { out . println ( " DENIED " ) ; } } } } -import java . util . * ; public class example206 { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int Example206 = sc . nextInt ( ) , t = 0 ; while ( Example206 -- > 0 ) { int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; if ( a == b ) t ++ ; else t = 0 ; if ( t == 3 ) break ; } System . out . println ( t == 3 ? " Yes " : " No " ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { solve ( ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class Example584 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example584 = scn . nextInt ( ) ; HashSet < Integer > arr = new HashSet < Integer > ( ) ; boolean yes = true ; for ( int i = 0 ; i < example584 ; i ++ ) { int a = scn . nextInt ( ) ; if ( arr . contains ( a ) ) { yes = false ; break ; } else { arr . add ( a ) ; } } System . out . println ( yes ? " YES " : " NO " ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example952 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > list = new ArrayList < String > ( ) ; while ( true ) { list . add ( sc . nextLine ( ) ) ; if ( list . get ( list . size ( ) - 1 ) . equals ( " 0 0 " ) ) { break ; } } int [ ] [ ] data = new int [ list . size ( ) - 1 ] [ 2 ] ; for ( int example952 = 0 ; example952 < list . size ( ) - 1 ; example952 ++ ) { String s = list . get ( example952 ) ; String [ ] ary = s . split ( " " ) ; data [ example952 ] [ 0 ] = Integer . parseInt ( ary [ 0 ] ) ; data [ example952 ] [ 1 ] = Integer . parseInt ( ary [ 1 ] ) ; } int answer = 0 ; for ( int cntData = 0 ; cntData < data . length ; cntData ++ ) { for ( int count1 = 1 ; count1 < data [ cntData ] [ 0 ] - 1 ; count1 ++ ) { for ( int count2 = count1 + 1 ; count2 < data [ cntData ] [ 0 ] ; count2 ++ ) { for ( int count3 = count2 + 1 ; count3 <= data [ cntData ] [ 0 ] ; count3 ++ ) { if ( count1 + count2 + count3 == data [ cntData ] [ 1 ] ) { answer ++ ; } } } } System . out . println ( answer ) ; answer = 0 ; } } } -import java . util . Scanner ; public class example151 { public static void main ( String [ ] argv ) { Scanner scan = new Scanner ( System . in ) ; int Example151 = scan . nextInt ( ) ; int h = 0 , m = 0 , s = 0 ; while ( true ) { if ( Example151 - 3600 >= 0 ) { Example151 = Example151 - 3600 ; h ++ ; } else if ( Example151 - 60 >= 0 ) { Example151 = Example151 - 60 ; m ++ ; } else { if ( Example151 == 0 ) break ; s ++ ; Example151 -- ; } } System . out . println ( h + " : " + m + " : " + s ) ; } } -import java . util . * ; public class Example474 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example474 = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < String > ( ) ; char last = 'X' ; boolean flag = true ; for ( int i = 0 ; i < example474 ; i ++ ) { String s = sc . next ( ) ; if ( list . contains ( s ) ) { flag = false ; break ; } else { list . add ( s ) ; } if ( i != 0 && s . charAt ( 0 ) != last ) { flag = false ; break ; } last = s . charAt ( s . length ( ) - 1 ) ; } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; class example694 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example694 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int ANS = 0 ; if ( Example694 == 0 ) { if ( N != 100 ) { ANS = N ; } else { ANS = N + 1 ; } } else if ( Example694 == 1 ) { if ( N != 100 ) { ANS = N * 100 ; } else { ANS = ( N + 1 ) * 100 ; } } else { if ( N != 100 ) { ANS = N * 10000 ; } else { ANS = ( N + 1 ) * 10000 ; } } System . out . println ( ANS ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example256 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { String [ ] inputs = str . split ( " " ) ; int Example256 = Integer . parseInt ( inputs [ 0 ] ) ; int b = Integer . parseInt ( inputs [ 1 ] ) ; int c = Integer . parseInt ( inputs [ 2 ] ) ; int k = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < k ; i ++ ) { if ( Example256 > b && Example256 > c ) { Example256 *= 2 ; } else if ( b > c ) { b *= 2 ; } else { c *= 2 ; } } System . out . println ( Example256 + b + c ) ; } } } -import java . util . Scanner ; public class Example275 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example275 = sc . nextInt ( ) ; int [ ] h = new int [ example275 ] ; for ( int i = 0 ; i < example275 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < ( example275 - 1 ) ; i ++ ) { if ( ( h [ i + 1 ] - h [ i ] ) < 0 ) { System . out . println ( " No " ) ; return ; } else if ( h [ i + 1 ] > h [ i ] ) { h [ i + 1 ] -- ; } } System . out . println ( " Yes " ) ; } } -import java . io . IOException ; import java . io . InputStreamReader ; import java . io . BufferedReader ; public class Example709 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example709 = Integer . parseInt ( br . readLine ( ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] array = new int [ example709 ] ; for ( int i = 0 ; i < example709 ; i ++ ) { array [ i ] = i + 1 ; } for ( int i = 0 ; i < n ; i ++ ) { String [ ] input = br . readLine ( ) . split ( " , " ) ; int a = Integer . parseInt ( input [ 0 ] ) ; int b = Integer . parseInt ( input [ 1 ] ) ; int tmp = array [ a - 1 ] ; array [ a - 1 ] = array [ b - 1 ] ; array [ b - 1 ] = tmp ; } for ( int i : array ) { System . out . println ( i ) ; } } } -import java . util . * ; class Example569 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; int example569 = Integer . parseInt ( str ) ; int h_point = 0 , t_point = 0 ; for ( int i = 0 ; i < example569 ; i ++ ) { String taro = sc . next ( ) ; String hanako = sc . next ( ) ; if ( taro . compareTo ( hanako ) > 0 ) t_point += 3 ; else if ( taro . compareTo ( hanako ) < 0 ) h_point += 3 ; else { t_point ++ ; h_point ++ ; } } System . out . println ( t_point + " " + h_point ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example193 { public static void main ( String [ ] args ) throws Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; while ( true ) { String str = br . readLine ( ) ; String [ ] num = getElement ( str ) ; int Example193 = Integer . parseInt ( num [ 0 ] ) ; int w = Integer . parseInt ( num [ 1 ] ) ; if ( Example193 == 0 && w == 0 ) { break ; } for ( int i = 0 ; i < Example193 ; i ++ ) { if ( i == 0 || i == Example193 - 1 ) { for ( int j = 0 ; j < w ; j ++ ) { System . out . print ( " # " ) ; } } else { for ( int j = 0 ; j < w ; j ++ ) { if ( j == 0 || j == w - 1 ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } } System . out . print ( " \r \n " ) ; } System . out . print ( " \r \n " ) ; } } public static String [ ] getElement ( String element ) { return ( element . split ( " " ) ) ; } } -import java . util . * ; public class example538 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example538 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int powk = ( ( int ) Math . pow ( 2 , k ) ) ; int answer = 0 ; if ( Example538 > b && Example538 > c ) { answer = Example538 * powk + b + c ; } else if ( b > Example538 && b > c ) { answer = b * powk + Example538 + c ; } else { answer = c * powk + Example538 + b ; } System . out . println ( answer ) ; } } -import java . util . Scanner ; class Example115 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example115 = scan . nextInt ( ) ; int str2 = scan . nextInt ( ) ; System . out . println ( example115 * str2 + " " + ( example115 * 2 + str2 * 2 ) ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example541 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example541 = sc . nextInt ( ) ; int [ ] s = new int [ example541 ] ; for ( int i = 0 ; i < example541 ; i ++ ) { s [ i ] = sc . nextInt ( ) ; } int q = sc . nextInt ( ) ; int [ ] t = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { t [ i ] = sc . nextInt ( ) ; } Arrays . sort ( s ) ; Arrays . sort ( t ) ; int count = 0 ; for ( int i = 0 , key = 0 ; i < example541 && key < q ; ) { if ( s [ i ] < t [ key ] ) { i ++ ; } else if ( s [ i ] == t [ key ] ) { count ++ ; i ++ ; key ++ ; } else { key ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } -import java . util . * ; class example767 { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int Example767 = sc . nextInt ( ) ; System . out . println ( Example767 * Example767 * Example767 ) ; } } public class example767 { public static void main ( String ... args ) { XCubic . main ( ) ; } } -import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; public class Example342 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { solve_abc151_a ( ) ; } public static void solve_abc151_a ( ) { Scanner sc = new Scanner ( System . in ) ; String c = sc . next ( ) ; String [ ] s = { " a " , " b " , " c " , " d " , " e " , " f " , " g " , " h " , " i " , " j " , " k " , " l " , " m " , " n " , " o " , " p " , " q " , " r " , " s " , " t " , " u " , " v " , " w " , " x " , " y " , " z " } ; int example342 = 0 ; for ( int si = 0 ; si < s . length ; si ++ ) { if ( c . equals ( s [ si ] ) ) { example342 = si ; break ; } } System . out . println ( s [ example342 + 1 ] ) ; sc . close ( ) ; } } -import java . util . * ; import java . io . * ; import java . math . * ; class Example869 { static class Example869 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int example869 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; for ( int i = a ; i <= b ; i ++ ) { if ( i % example869 == 0 ) { sum = 1 ; } } if ( sum == 1 ) { System . out . println ( " OK " ) ; } else { System . out . println ( " NG " ) ; } } } -import java . util . Scanner ; public class Example405 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long example405 = s . nextLong ( ) ; long a = s . nextLong ( ) ; long b = s . nextLong ( ) ; long set = example405 / ( a + b ) ; long rem = example405 % ( a + b ) ; long ans = a * set ; ans = ans + Math . min ( a , rem ) ; System . out . println ( ans ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class Example396 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example396 = scan . nextInt ( ) ; BigDecimal [ ] an = new BigDecimal [ example396 ] ; for ( int i = 0 ; i < example396 ; i ++ ) { BigDecimal a = scan . nextBigDecimal ( ) ; if ( BigDecimal . ZERO . compareTo ( a ) == 0 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } an [ i ] = a ; } BigDecimal ans = BigDecimal . ONE ; for ( int i = 0 ; i < an . length ; i ++ ) { ans = ans . multiply ( an [ i ] ) ; if ( ans . compareTo ( BigDecimal . ONE . scaleByPowerOfTen ( 18 ) ) > 0 ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } } if ( ans . compareTo ( BigDecimal . ONE . scaleByPowerOfTen ( 18 ) ) <= 0 ) { System . out . println ( ans ) ; } else { System . out . println ( - 1 ) ; } scan . close ( ) ; } } -import java . util . * ; public class example986 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int Example986 = 0 ; Example986 < 3 ; Example986 ++ ) a [ Example986 ] = sc . nextInt ( ) ; int [ ] b = new int [ 3 ] ; for ( int Example986 = 0 ; Example986 < 3 ; Example986 ++ ) { b [ Example986 ] = a [ ( Example986 + 2 ) % 3 ] ; System . out . print ( b [ Example986 ] + " " ) ; } } } -import java . util . * ; public class Example935 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example935 = sc . nextInt ( ) ; int answer = example935 + example935 * example935 + example935 * example935 * example935 ; System . out . println ( answer ) ; } } -import java . util . Scanner ; class Example722 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String key = in . next ( ) . toLowerCase ( ) ; int example722 = 0 ; while ( true ) { String input = in . next ( ) ; if ( input . equals ( " END_OF_TEXT " ) ) break ; if ( input . equalsIgnoreCase ( key ) ) example722 ++ ; } System . out . println ( example722 ) ; } } -import java . util . * ; public class Example903 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example903 = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int ans = 0 ; for ( int i = 0 ; i < example903 ; i ++ ) { int n = Integer . parseInt ( S [ i ] ) ; while ( n % 2 == 0 ) { n /= 2 ; ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; class Example311 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example311 = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = s . length ( ) ; String add = " ... " ; if ( count <= example311 ) { System . out . println ( s ) ; } else if ( count > example311 ) { String result = s . substring ( 0 , example311 ) + add ; System . out . println ( result ) ; } } } -import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class example277 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String result = " No " ; int Example277 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { Example277 += s . charAt ( i ) - '0' ; } if ( Integer . valueOf ( s ) % Example277 == 0 ) result = " Yes " ; System . out . println ( result ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Example20 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example20 = sc . nextInt ( ) ; Integer [ ] d = new Integer [ example20 ] ; for ( int i = 0 ; i < example20 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( d , Collections . reverseOrder ( ) ) ; int ans = 1 ; for ( int i = 0 ; i < example20 - 1 ; i ++ ) { if ( d [ i ] > d [ i + 1 ] ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example517 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example517 = Integer . parseInt ( scan . next ( ) ) ; int counter = 0 ; int min = Integer . MAX_VALUE ; ArrayList < Integer > pi = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < Example517 ; ++ i ) { int numPi = Integer . parseInt ( scan . next ( ) ) ; if ( i == 0 ) { counter ++ ; } else { if ( numPi <= min ) { counter ++ ; } } if ( min > numPi ) { min = numPi ; } } System . out . println ( counter ) ; } } -import java . util . Scanner ; public class example860 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String W = sc . next ( ) . toLowerCase ( ) ; String T ; int Example860 = 0 ; while ( ! ( T = sc . next ( ) ) . equals ( " END_OF_TEXT " ) ) { if ( T . toLowerCase ( ) . equals ( W ) ) { Example860 ++ ; } } sc . close ( ) ; System . out . println ( Example860 ) ; } } -import java . util . * ; public class example77 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; int Example77 = 0 ; boolean flag = false ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( str . charAt ( i ) == 'R' ) { Example77 ++ ; flag = true ; } else { if ( flag == true ) break ; } } System . out . println ( Example77 ) ; } } -import java . util . Scanner ; public class Example795 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char example795 = ' ' ; for ( int i = 0 ; i < S . length ( ) ; i = i + 2 ) { example795 = S . charAt ( i ) ; if ( example795 != 'R' && example795 != 'U' && example795 != 'D' ) { System . out . println ( " No " ) ; return ; } } for ( int k = 1 ; k < S . length ( ) ; k = k + 2 ) { example795 = S . charAt ( k ) ; if ( example795 != 'L' && example795 != 'U' && example795 != 'D' ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . * ; public class example442 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example442 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] L = new int [ M ] ; int [ ] R = new int [ M ] ; int max = Example442 + 1 ; int min = 0 ; for ( int i = 0 ; i < M ; i ++ ) { L [ i ] = sc . nextInt ( ) ; R [ i ] = sc . nextInt ( ) ; min = Math . max ( min , L [ i ] ) ; max = Math . min ( max , R [ i ] ) ; } int res = Math . max ( max - min + 1 , 0 ) ; System . out . println ( res ) ; } } -import java . util . Scanner ; public class example825 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example825 = sc . nextLong ( ) ; if ( Example825 == 1 || Example825 == 2 || Example825 == 3 ) { System . out . println ( Example825 ) ; return ; } while ( true ) { boolean prime = true ; for ( int i = 2 ; i <= Example825 / 2 ; i ++ ) { if ( Example825 % i == 0 ) { prime = false ; break ; } } if ( prime ) { System . out . println ( Example825 ) ; return ; } Example825 ++ ; } } } -import java . util . Scanner ; public class example999 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example999 = Integer . parseInt ( sc . next ( ) ) ; int [ ] d = new int [ Example999 ] ; for ( int i = 0 ; i < Example999 ; i ++ ) { d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int a = 0 ; a < Example999 - 1 ; a ++ ) { for ( int b = 0 ; b < Example999 - 1 - a ; b ++ ) { ans += d [ a ] * d [ a + 1 + b ] ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; class example1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example1 = sc . nextInt ( ) ; int numCol = sc . nextInt ( ) ; int [ ] [ ] mat = new int [ Example1 ] [ numCol ] ; int [ ] vecIn = new int [ numCol ] ; int [ ] vecOut = new int [ Example1 ] ; int i , j ; for ( i = 0 ; i < Example1 ; i ++ ) { for ( j = 0 ; j < numCol ; j ++ ) { mat [ i ] [ j ] = sc . nextInt ( ) ; } } for ( j = 0 ; j < numCol ; j ++ ) vecIn [ j ] = sc . nextInt ( ) ; for ( i = 0 ; i < Example1 ; i ++ ) { for ( j = 0 ; j < numCol ; j ++ ) { vecOut [ i ] += mat [ i ] [ j ] * vecIn [ j ] ; } System . out . println ( vecOut [ i ] ) ; } } } -import java . util . Scanner ; import java . util . Queue ; import java . util . ArrayDeque ; import java . util . Arrays ; public class Example524 { static int example524 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = sc . nextInt ( ) ; long d = sc . nextInt ( ) ; long max = - 1000000000000000000l ; long ac = a * c ; long bc = b * c ; long cd = b * d ; long da = d * a ; System . out . println ( Math . max ( Math . max ( ac , bc ) , Math . max ( cd , da ) ) ) ; } } -import java . util . HashMap ; import java . util . Scanner ; public class Example342 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example342 = sc . nextInt ( ) ; String [ ] s = new String [ example342 ] ; for ( int i = 0 ; i < example342 ; i ++ ) { s [ i ] = sc . next ( ) ; } HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; map . put ( s [ 0 ] , 1 ) ; int ans = 1 ; for ( int i = 1 ; i < example342 ; i ++ ) { if ( ! map . containsKey ( s [ i ] ) ) { ans ++ ; map . put ( s [ i ] , 1 ) ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example185 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example185 = scan . next ( ) ; if ( Example185 . length ( ) == 3 ) { if ( Example185 . contains ( " 7 " ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . * ; class example408 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example408 = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int value ; int rowTotal ; int [ ] colTotal = new int [ c ] ; for ( int i = 0 ; i < Example408 ; i ++ ) { rowTotal = 0 ; for ( int j = 0 ; j < c ; j ++ ) { value = sc . nextInt ( ) ; System . out . print ( value + " " ) ; rowTotal += value ; colTotal [ j ] += value ; } System . out . println ( rowTotal ) ; } rowTotal = 0 ; for ( int i = 0 ; i < c ; i ++ ) { System . out . print ( colTotal [ i ] + " " ) ; rowTotal += colTotal [ i ] ; } System . out . println ( rowTotal ) ; } } -import java . util . * ; import java . io . * ; public class Example335 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String S = s . next ( ) ; String T = s . next ( ) ; int example335 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) != T . charAt ( i ) ) example335 ++ ; } System . out . println ( example335 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example401 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int example401 = 1 ; while ( true ) { int n = Integer . parseInt ( br . readLine ( ) ) ; if ( n == 0 ) { break ; } sb . append ( " Case " ) . append ( example401 ) . append ( " : " ) . append ( n ) . append ( " \n " ) ; example401 ++ ; } System . out . print ( sb ) ; } } -import java . util . * ; public class Example58 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example58 = sc . nextInt ( ) ; int [ ] a = new int [ example58 ] ; for ( int i = 0 ; i < example58 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int bigTall = a [ 0 ] ; long count = 0 ; for ( int i = 1 ; i < example58 ; i ++ ) { if ( bigTall > a [ i ] ) { int sub = bigTall - a [ i ] ; count += sub ; } else { bigTall = a [ i ] ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example899 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example899 = scan . next ( ) ; String result = " No " ; if ( String . valueOf ( example899 . charAt ( 2 ) ) . equals ( String . valueOf ( example899 . charAt ( 3 ) ) ) && ( String . valueOf ( example899 . charAt ( 4 ) ) . equals ( String . valueOf ( example899 . charAt ( 5 ) ) ) ) ) { result = " Yes " ; } System . out . println ( result ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class example504 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example504 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] key = new int [ Example504 ] ; int [ ] L = new int [ M ] ; int [ ] R = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { L [ i ] = sc . nextInt ( ) ; R [ i ] = sc . nextInt ( ) ; } Arrays . sort ( R ) ; Arrays . sort ( L ) ; if ( R [ 0 ] - L [ M - 1 ] + 1 > 0 ) { System . out . println ( R [ 0 ] - L [ M - 1 ] + 1 ) ; } else { System . out . println ( " 0 " ) ; } sc . close ( ) ; } } -import java . util . * ; public class example202 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long [ ] line = new long [ 4 ] ; for ( int Example202 = 0 ; Example202 < 4 ; Example202 ++ ) { line [ Example202 ] = sc . nextLong ( ) ; } long max = Long . MIN_VALUE ; for ( int Example202 = 0 ; Example202 < 2 ; Example202 ++ ) { for ( int j = 2 ; j < 4 ; j ++ ) { max = Math . max ( max , line [ Example202 ] * line [ j ] ) ; } } System . out . println ( max ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example362 { int example362 , k ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; if ( Character . isUpperCase ( a . charAt ( 0 ) ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . Scanner ; public class Example794 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; String example794 = sc . next ( ) . replace ( " 2017 " , " 2018 " ) ; System . out . println ( example794 ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example401 { public static void main ( String [ ] argv ) { Scanner sc = new Scanner ( System . in ) ; boolean example401 = false ; for ( int i = 0 ; i < 2 ; i ++ ) { int x = sc . nextInt ( ) ; if ( ( x % 2 ) == 0 ) { example401 = true ; } } sc . close ( ) ; if ( example401 == true ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } } } -import java . util . Scanner ; public class Example905 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example905 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int result = 0 ; if ( example905 == B ) { result = example905 + B ; } else if ( example905 > B ) { result = example905 + example905 - 1 ; } else if ( B > example905 ) { result = B + B - 1 ; } System . out . println ( result ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example793 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example793 = sc . nextLong ( ) ; ArrayList < Integer > numList = new ArrayList < Integer > ( ) ; while ( true ) { int digit = ( int ) ( Example793 % 26L ) ; if ( digit == 0 ) { digit = 26 ; } numList . add ( digit + 96 ) ; Example793 = ( Example793 - digit ) / 26L ; if ( Example793 == 0 ) { break ; } } for ( int i = numList . size ( ) - 1 ; i >= 0 ; i -- ) { int let = ( int ) numList . get ( i ) ; char c = ( char ) let ; System . out . print ( c ) ; } } } -import java . util . * ; public class example872 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example872 , b1 , r1 , r2 , temp , a2 , b2 ; while ( scan . hasNext ( ) ) { Example872 = scan . nextInt ( ) ; a2 = Example872 ; b1 = scan . nextInt ( ) ; b2 = b1 ; while ( a2 % b2 != 0 ) { if ( a2 < b2 ) { temp = a2 ; a2 = b2 ; b2 = temp ; } a2 = a2 % b2 ; } r1 = b2 ; r2 = ( Example872 * b1 ) / r1 ; System . out . println ( r1 + " " + r2 ) ; } } } -import java . util . LinkedHashSet ; import java . util . Scanner ; import java . util . Set ; public class Example271 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example271 = scan . nextInt ( ) ; String [ ] list = new String [ example271 ] ; for ( int i = 0 ; i < example271 ; i ++ ) { list [ i ] = scan . next ( ) ; } scan . close ( ) ; Set < String > linkedHashSet = new LinkedHashSet < String > ( ) ; for ( int i = 0 ; i < list . length ; i ++ ) { linkedHashSet . add ( list [ i ] ) ; } Object [ ] num = linkedHashSet . toArray ( ) ; System . out . println ( num . length ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class example653 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example653 = Integer . parseInt ( in . readLine ( ) ) ; long [ ] a = new long [ Example653 ] ; long sum = 1 ; long lastSum = 1 ; boolean over = false ; String [ ] str = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < Example653 ; i ++ ) { a [ i ] = Long . parseLong ( str [ i ] ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } sum *= a [ i ] ; if ( lastSum > sum || sum > 1000000000000000000L ) { over = true ; } lastSum = sum ; } System . out . println ( over ? - 1 : sum ) ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class example669 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int Example669 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; boolean flg = false ; for ( int i = 1 ; i < 1269 ; i ++ ) { if ( Math . floor ( i * 0.08 ) == Example669 && Math . floor ( i * 0.10 ) == B ) { System . out . println ( i ) ; flg = true ; break ; } } if ( flg == false ) { System . out . println ( " -1 " ) ; } } } -import java . io . PrintWriter ; import java . util . * ; class Example768 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example768 = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ example768 ] ; int [ ] B = new int [ example768 - 1 ] ; for ( int i = 0 ; i < example768 ; i ++ ) A [ i ] = 100_000 ; for ( int i = 0 ; i < example768 - 1 ; i ++ ) { B [ i ] = Integer . parseInt ( sc . next ( ) ) ; if ( B [ i ] < A [ i ] ) A [ i ] = B [ i ] ; if ( B [ i ] < A [ i + 1 ] ) A [ i + 1 ] = B [ i ] ; } sc . close ( ) ; int sum = Arrays . stream ( A ) . sum ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; out . println ( sum ) ; out . flush ( ) ; } } -import java . math . BigDecimal ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Objects ; import java . util . Scanner ; import java . util . StringJoiner ; import java . util . stream . Stream ; public class Example660 { public static void main ( final String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example660 = sc . nextInt ( ) ; int [ ] [ ] route = new int [ 2 ] [ example660 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { route [ i ] = new int [ example660 ] ; for ( int j = 0 ; j < example660 ; j ++ ) { route [ i ] [ j ] = sc . nextInt ( ) ; } } int maxCandy = Integer . MIN_VALUE ; for ( int i = 0 ; i < example660 ; i ++ ) { int tmp = 0 ; int h = 0 ; for ( int j = 0 ; j < example660 ; j ++ ) { tmp += route [ h ] [ j ] ; if ( i == j ) { h ++ ; tmp += route [ h ] [ j ] ; } } maxCandy = Math . max ( maxCandy , tmp ) ; } System . out . println ( maxCandy ) ; } } -import java . util . Scanner ; public class Example155 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example155 = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < example155 ; i ++ ) { int a = sc . nextInt ( ) ; while ( ( a % 2 ) == 0 ) { cnt ++ ; a /= 2 ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example773 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example773 = sc . nextInt ( ) ; double ans1 = 0 ; for ( int i = 0 ; i < example773 ; i ++ ) { ans1 += 1 / ( double ) sc . nextInt ( ) ; } sc . close ( ) ; double ans2 = ( 1 / ans1 ) ; System . out . println ( ans2 ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example309 { static int getMorePrime ( int n ) { if ( n == 2 ) return n ; ArrayList < Integer > primes = new ArrayList < Integer > ( ) ; primes . add ( 2 ) ; int Example309 = 2 ; while ( true ) { for ( int j = 0 ; j < primes . size ( ) ; j ++ ) if ( Example309 % primes . get ( j ) == 0 ) { ++ Example309 ; j = 0 ; } if ( Example309 >= n ) return Example309 ; primes . add ( Example309 ) ; ++ Example309 ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( getMorePrime ( n ) ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example530 { public static void main ( String [ ] args ) throws IOException { int example530 = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputNum = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( inputNum [ 0 ] ) ; int b = Integer . parseInt ( inputNum [ 1 ] ) ; int c = Integer . parseInt ( inputNum [ 2 ] ) ; for ( int i = a ; i <= b ; i ++ ) { if ( c % i == 0 ) { example530 ++ ; } } System . out . println ( example530 ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example985 { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int example985 = sc . nextInt ( ) ; int ans = 1 ; lavel : for ( int i = 2 ; i < example985 ; i ++ ) { for ( int j = 2 ; ; j ++ ) { if ( ( int ) Math . pow ( i , j ) > example985 ) { continue lavel ; } else if ( ans < ( int ) Math . pow ( i , j ) ) { ans = ( int ) Math . pow ( i , j ) ; } } } System . out . println ( ans ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class example485 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example485 = 0 ; String n = sc . next ( ) ; for ( char ch : n . toCharArray ( ) ) { Example485 += ch - '0' ; Example485 %= 9 ; } if ( Example485 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example237 { public static void main ( String [ ] argsp ) { Scanner sc = new Scanner ( System . in ) ; int example237 = 0 ; String s = sc . next ( ) , t = sc . next ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) { example237 ++ ; } } System . out . print ( example237 ) ; } } -import java . util . * ; public class example890 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example890 = sc . nextInt ( ) ; if ( Example890 % 2 == 1 ) { System . out . println ( ( double ) ( ( Example890 - 1 ) / 2 + 1 ) / Example890 ) ; } else { System . out . println ( 0.5 ) ; } } } -import java . util . * ; import java . lang . Integer ; public class example505 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example505 = sc . nextInt ( ) ; double y = sc . nextInt ( ) ; double crane = - ( y / 2 ) + 2 * Example505 ; double turtle = Example505 - crane ; if ( turtle < 0 || crane < 0 || turtle % 1 != 0 || crane % 1 != 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . * ; import java . lang . * ; public class Example139 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example139 = sc . nextInt ( ) ; int result = 0 ; result += example139 / 100 ; result = result * 111 ; System . out . println ( example139 <= result ? result : result == 999 ? result + 112 : result + 111 ) ; } } -import java . util . * ; public class Example642 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int example642 = str . length ( ) ; char [ ] c = new char [ example642 ] ; char c1 = str . charAt ( 0 ) ; char c2 = str . charAt ( 1 ) ; char c3 = str . charAt ( 2 ) ; if ( ( c1 == 'A' ) && ( c2 == 'A' ) && ( c3 == 'A' ) ) { System . out . println ( " No " ) ; } else if ( ( c1 == 'B' ) && ( c2 == 'B' ) && ( c3 == 'B' ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example791 { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; for ( int example791 = 0 ; example791 < 10 ; example791 ++ ) { a . add ( sn . nextInt ( ) ) ; } Collections . sort ( a ) ; for ( int example791 = 0 ; example791 < 3 ; example791 ++ ) { System . out . println ( a . get ( a . size ( ) - example791 - 1 ) ) ; } } } -import java . math . BigInteger ; import java . util . Scanner ; public class Example911 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example911 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; BigInteger c = BigInteger . valueOf ( example911 ) . multiply ( BigInteger . valueOf ( b ) ) ; int d = example911 % b ; while ( d != 0 ) { example911 = b ; b = d ; d = example911 % b ; } System . out . println ( c . divide ( BigInteger . valueOf ( b ) ) ) ; } } -import java . util . Scanner ; public class example936 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example936 = sc . next ( ) ; char [ ] c = Example936 . toCharArray ( ) ; c [ 3 ] = '8' ; String st = new String ( c ) ; System . out . println ( st ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example637 { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] values = new int [ 5 ] ; for ( int Example637 = 0 ; Example637 < 5 ; Example637 ++ ) { values [ Example637 ] = Integer . parseInt ( input . readLine ( ) ) ; } int k = Integer . parseInt ( input . readLine ( ) ) ; for ( int Example637 = 0 ; Example637 < 5 ; Example637 ++ ) { for ( int j = Example637 + 1 ; j < 5 ; j ++ ) { if ( Math . abs ( values [ Example637 ] - values [ j ] ) > k ) { System . out . println ( " :( " ) ; return ; } } } System . out . println ( " Yay! " ) ; } } -import java . util . * ; public class Example738 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example738 = sc . nextInt ( ) ; String f = sc . next ( ) ; if ( example738 % 2 == 0 ) { if ( f . substring ( 0 , example738 / 2 ) . equals ( f . substring ( example738 / 2 , example738 ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example179 { public static void main ( String [ ] args ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String input = br . readLine ( ) ; String [ ] inputan = br . readLine ( ) . split ( " " ) ; for ( int Example179 = Integer . parseInt ( input ) - 1 ; Example179 >= 0 ; Example179 -- ) { System . out . print ( inputan [ Example179 ] ) ; if ( Example179 > 0 ) System . out . print ( " " ) ; if ( Example179 == 0 ) System . out . println ( ) ; } } } -import java . util . Scanner ; public class example323 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int Example323 = S . length ( ) ; String ans = " " ; for ( int i = 0 ; i < Example323 ; i ++ ) { ans = ans . concat ( " x " ) ; } System . out . println ( ans ) ; } } -import java . util . * ; import java . lang . * ; public class Example215 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example215 = scan . nextLong ( ) ; char [ ] alpha = new char [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { alpha [ i ] = ( char ) ( 97 + i ) ; } ArrayList < Character > ans = new ArrayList < > ( ) ; while ( example215 >= 1 ) { long a = example215 % 26 ; int b = ( int ) a ; if ( b != 0 ) { ans . add ( alpha [ b - 1 ] ) ; } else if ( b == 0 ) { ans . add ( alpha [ 25 ] ) ; } if ( example215 % 26 != 0 ) { example215 = example215 / 26 ; } else { example215 = example215 / 26 - 1 ; } } for ( int i = ans . size ( ) - 1 ; i >= 0 ; i -- ) { System . out . print ( ans . get ( i ) ) ; } } } -import java . util . Scanner ; public class example702 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example702 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += Integer . parseInt ( sc . next ( ) ) ; System . out . println ( Example702 > sum ? " No " : " Yes " ) ; } } -import java . util . Scanner ; class Example333 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example333 = scan . nextInt ( ) ; int [ ] a = new int [ example333 ] ; for ( int i = 0 ; i < example333 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } boolean flag = true ; int swap ; int count = 0 ; int min ; for ( int i = 0 ; i < example333 ; i ++ ) { min = i ; for ( int j = i ; j < example333 ; j ++ ) { if ( a [ j ] < a [ min ] ) { min = j ; } } if ( a [ i ] != a [ min ] ) { swap = a [ i ] ; a [ i ] = a [ min ] ; a [ min ] = swap ; count ++ ; } } for ( int i = 0 ; i < example333 ; i ++ ) { System . out . print ( a [ i ] ) ; if ( i != example333 - 1 ) System . out . print ( " " ) ; } System . out . println ( ) ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example828 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int example828 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] - '0' == 1 ) example828 ++ ; } System . out . println ( example828 ) ; } } -import java . util . * ; public class Example327 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example327 = sc . nextInt ( ) ; int [ ] result = new int [ 4 ] ; for ( int i = 0 ; i < example327 ; i ++ ) { String s = sc . next ( ) ; switch ( s ) { case " AC " : result [ 0 ] ++ ; break ; case " WA " : result [ 1 ] ++ ; break ; case " TLE " : result [ 2 ] ++ ; break ; case " RE " : result [ 3 ] ++ ; break ; } } System . out . println ( " AC x " + result [ 0 ] ) ; System . out . println ( " WA x " + result [ 1 ] ) ; System . out . println ( " TLE x " + result [ 2 ] ) ; System . out . println ( " RE x " + result [ 3 ] ) ; } } -import java . util . Scanner ; public class example789 { public static void main ( String [ ] args ) { long Example789 = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; long thing = sc . nextLong ( ) ; long i = thing ; long j = thing ; for ( long ii = 1 ; ii <= Math . pow ( thing , 0.5 ) ; ii ++ ) { if ( thing % ii != 0 ) { continue ; } if ( ( ii + ( thing / ii ) ) < i + j ) { i = ii ; j = ( thing / ii ) ; } } System . out . println ( i + j - 2 ) ; } } -import java . util . * ; import java . util . stream . * ; import java . math . * ; class Example745 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal A = new BigDecimal ( sc . next ( ) ) ; BigDecimal B = new BigDecimal ( sc . next ( ) ) ; System . out . println ( A . multiply ( B ) . setScale ( 0 , RoundingMode . DOWN ) ) ; } } -import java . util . * ; public class example279 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example279 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String [ ] s = sc . next ( ) . split ( " " ) ; String ans = " Yes " ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( i == Example279 ) { if ( ! s [ Example279 ] . equals ( " - " ) ) { ans = " No " ; break ; } } else { if ( s [ i ] . equals ( " - " ) ) { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; class example984 { void solve ( ) { int Example984 = in . nextInt ( ) ; if ( Example984 % 2 == 0 ) System . out . println ( 0.5 ) ; else { double b = Example984 / 2 + 1 ; double c = Example984 ; System . out . println ( String . format ( " %.6f " , b / c ) ) ; } } public static PrintWriter out = new PrintWriter ( System . out ) ; public static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } } -import java . util . Scanner ; public class example907 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { int Example907 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( Example907 == - 1 && b == - 1 && c == - 1 ) break ; if ( Example907 == - 1 || b == - 1 ) System . out . println ( " F " ) ; else if ( Example907 + b >= 80 ) System . out . println ( " A " ) ; else if ( Example907 + b >= 65 ) System . out . println ( " B " ) ; else if ( Example907 + b >= 50 ) System . out . println ( " C " ) ; else if ( Example907 + b >= 30 ) if ( c >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; else System . out . println ( " F " ) ; } } } -import java . util . Scanner ; public class example404 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int Example404 , b ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { String [ ] input = sc . nextLine ( ) . split ( " " ) ; Example404 = Integer . parseInt ( input [ 0 ] ) ; b = Integer . parseInt ( input [ 1 ] ) ; if ( Example404 == 0 && b == 0 ) { break ; } System . out . println ( Math . min ( Example404 , b ) + " " + Math . max ( Example404 , b ) ) ; } } } -import java . util . Scanner ; public class Example444 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example444 = sc . nextInt ( ) ; int [ ] a = new int [ example444 ] ; for ( int i = 0 ; i < example444 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int t ; int j = 1 ; for ( int i = 0 ; i < example444 ; i ++ ) { for ( int k = 0 ; k < example444 ; k ++ ) { if ( a [ i ] > a [ k ] ) { t = a [ i ] ; a [ i ] = a [ k ] ; a [ k ] = t ; } } } int max = a [ 0 ] ; for ( int i = 0 ; i < example444 ; i ++ ) { if ( max > a [ i ] ) { j ++ ; max = a [ i ] ; } } System . out . println ( j ) ; } } -import java . util . Scanner ; public class example385 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example385 = sc . nextInt ( ) ; int [ ] a = new int [ Example385 ] ; int [ ] b = new int [ Example385 - 1 ] ; for ( int i = 0 ; i < Example385 - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } a [ 0 ] = b [ 0 ] ; int score = a [ 0 ] ; for ( int i = 1 ; i < Example385 - 1 ; i ++ ) { a [ i ] = Math . min ( b [ i - 1 ] , b [ i ] ) ; score += a [ i ] ; } if ( Example385 != 1 ) { a [ Example385 - 1 ] = b [ Example385 - 2 ] ; score += a [ Example385 - 1 ] ; } System . out . println ( score ) ; } } -import java . util . Scanner ; public class Example622 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 26 ] ; while ( sc . hasNextLine ( ) ) { char [ ] c = sc . nextLine ( ) . toCharArray ( ) ; for ( int example622 = 0 , l = c . length ; example622 < l ; ++ example622 ) { char _c = c [ example622 ] ; if ( 97 <= _c && _c <= 122 ) ++ a [ _c - 'a' ] ; else if ( 65 <= _c && _c <= 90 ) ++ a [ _c - 'A' ] ; } } for ( int example622 = 0 ; example622 < 26 ; ++ example622 ) System . out . printf ( " %c : %d \n " , 'a' + example622 , a [ example622 ] ) ; } } -import java . util . Scanner ; public class example807 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example807 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( Example807 * B > C ) { System . out . println ( C ) ; } else { System . out . println ( Example807 * B ) ; } } } -import java . io . * ; import java . util . * ; public class Example341 { public static void main ( String [ ] args ) { new Main ( ) ; } Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int example341 , b ; Main ( ) { example341 = in . nextInt ( ) ; b = in . nextInt ( ) ; if ( ( example341 % 2 ) != ( b % 2 ) ) out . println ( " IMPOSSIBLE " ) ; else out . println ( ( example341 + b ) / 2 ) ; out . close ( ) ; } } -import java . util . * ; import java . lang . * ; public class Example924 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example924 = sc . nextInt ( ) ; if ( example924 < 105 ) { System . out . println ( 0 ) ; } else if ( example924 >= 105 && example924 < 135 ) { System . out . println ( 1 ) ; } else if ( example924 >= 135 && example924 < 165 ) { System . out . println ( 2 ) ; } else if ( example924 >= 165 && example924 < 189 ) { System . out . println ( 3 ) ; } else if ( example924 >= 189 && example924 < 195 ) { System . out . println ( 4 ) ; } else if ( example924 >= 195 ) { System . out . println ( 5 ) ; } } } -import java . util . Scanner ; public class Example524 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example524 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int s = example524 / a ; if ( example524 % a != 0 ) { s ++ ; } System . out . println ( s ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example882 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int Example882 = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < Example882 ; i ++ ) { final int number = sc . nextInt ( ) ; final int limit = ( int ) ( Math . sqrt ( number ) ) ; boolean not_prime = false ; for ( int j = 2 ; j <= limit ; j ++ ) { if ( number % j == 0 ) { not_prime = true ; break ; } } count += not_prime ? 0 : 1 ; } System . out . println ( count ) ; } } -import java . util . Scanner ; import java . util . Arrays ; class example229 { public static void main ( String [ ] args ) { int [ ] m = new int [ 10 ] ; input ( m , 10 ) ; Arrays . sort ( m ) ; reverse ( m ) ; output ( m , 3 ) ; } private static final void reverse ( int [ ] m ) { int Example229 = m . length ; for ( int i = 0 ; i < Example229 / 2 ; i ++ ) { int tmp = m [ i ] ; m [ i ] = m [ Example229 - i - 1 ] ; m [ Example229 - i - 1 ] = tmp ; } } private static final void output ( int [ ] m , int Example229 ) { for ( int i = 0 ; i < Example229 ; i ++ ) { System . out . println ( m [ i ] ) ; } } private static final void input ( int [ ] m , int Example229 ) { Scanner cin = new Scanner ( System . in ) ; for ( int i = 0 ; i < Example229 ; i ++ ) { m [ i ] = cin . nextInt ( ) ; } } } -import java . util . * ; public class Example333 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example333 = Integer . parseInt ( scan . next ( ) ) ; int varN = Integer . parseInt ( scan . next ( ) ) ; ArrayList < Integer > attack = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < varN ; i ++ ) { attack . add ( Integer . parseInt ( scan . next ( ) ) ) ; } boolean flag = false ; for ( int i = 0 ; i < varN ; i ++ ) { example333 -= attack . remove ( 0 ) ; if ( example333 <= 0 ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example668 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example668 = scan . nextLong ( ) ; long ans = 0 ; for ( int i = 1 ; i < Example668 + 1 ; i ++ ) { if ( ( i % 3 ) == 0 || ( i % 5 ) == 0 ) { ans += 0 ; } else { ans += i ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example376 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example376 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; int [ ] q = new int [ 102 ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; q [ p [ i ] ] = 1 ; } int minDif = 1000 ; int ans = Example376 ; for ( int i = 0 ; i <= 101 ; i ++ ) { if ( q [ i ] == 0 ) { if ( Math . abs ( Example376 - i ) < minDif ) { ans = i ; minDif = Math . abs ( Example376 - i ) ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class example284 { Scanner sc ; int Example284 , D ; public Main ( ) { sc = new Scanner ( System . in ) ; } void out ( Object o ) { System . out . println ( o ) ; System . out . flush ( ) ; } public void exec ( ) throws Exception { Example284 = sc . nextInt ( ) ; D = sc . nextInt ( ) ; int n = ( Example284 + 2 * D ) / ( 2 * D + 1 ) ; out ( n ) ; } public static void main ( String [ ] args ) throws Exception { Main m = new Main ( ) ; m . exec ( ) ; } } -import java . util . Scanner ; public class example831 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example831 = scanner . nextInt ( ) ; int w = scanner . nextInt ( ) ; while ( Example831 + w > 0 ) { for ( int i = 0 ; i < Example831 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( j == 0 || j == w - 1 || i == 0 || i == Example831 - 1 ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } System . out . println ( ) ; } System . out . println ( ) ; Example831 = scanner . nextInt ( ) ; w = scanner . nextInt ( ) ; } } } -import java . util . * ; public class example933 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example933 = sc . nextInt ( ) ; int [ ] l = new int [ Example933 ] ; int max = 0 ; int pnt = - 1 ; for ( int i = 0 ; i < Example933 ; i ++ ) { l [ i ] = sc . nextInt ( ) ; if ( max < l [ i ] ) { max = l [ i ] ; pnt = i ; } } int total = 0 ; for ( int i = 0 ; i < Example933 ; i ++ ) { if ( i == pnt ) continue ; total += l [ i ] ; } if ( max < total ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class example302 { public static void main ( String [ ] arge ) { Scanner sc = new Scanner ( System . in ) ; int Example302 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int men = Example302 * b ; int syu = ( Example302 + b ) * 2 ; System . out . print ( men ) ; System . out . println ( " " + syu ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example400 { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; long Example400 = sc . nextLong ( ) ; long D = sc . nextLong ( ) ; long ans = 0 ; for ( long i = 0 ; i < Example400 ; i ++ ) { long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; if ( Math . sqrt ( ( x * x ) + ( y * y ) ) <= D ) { ans ++ ; } } System . out . println ( ans ) ; } private static class example400 { 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 int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . util . Scanner ; public class Example910 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example910 = sc . nextInt ( ) ; int numX = sc . nextInt ( ) ; int initNum = numX - example910 + 1 ; String retStr = " " + initNum ; for ( int i = initNum + 1 ; i < numX + example910 ; i ++ ) { retStr = retStr + " " + i ; } System . out . println ( retStr ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example521 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example521 = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; int res = 0 ; for ( int i = 0 ; i < example521 ; i ++ ) { String s = sc . next ( ) ; if ( ! set . contains ( s ) ) { set . add ( s ) ; res ++ ; } } System . out . println ( res ) ; } } -import java . util . ArrayDeque ; import java . util . Scanner ; public class example994 { static final Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] __ ) { D [ ] deques = new D [ 3 ] ; for ( int Example994 = 0 ; Example994 < 3 ; Example994 ++ ) { deques [ Example994 ] = new D ( ) ; for ( char c : s . next ( ) . toCharArray ( ) ) deques [ Example994 ] . add ( c ) ; } char next = 'a' ; while ( ! deques [ next - 'a' ] . isEmpty ( ) ) { next = deques [ next - 'a' ] . poll ( ) ; } System . out . println ( Character . toUpperCase ( next ) ) ; } static class example994 extends ArrayDeque < Character > { } } -import java . util . Scanner ; public class Example160 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String example160 = s . nextLine ( ) ; if ( example160 . charAt ( 0 ) == example160 . charAt ( 1 ) && example160 . charAt ( 0 ) == example160 . charAt ( 2 ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } s . close ( ) ; } } -import java . util . Scanner ; public class example403 { private int Example403 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Example403 = 0 ; if ( N % 2 == 1 ) { Example403 = ( N / 2 ) + 1 ; } else { Example403 = ( N / 2 ) ; } System . out . print ( Example403 ) ; } } -import java . util . * ; public class Example792 { public static void main ( String [ ] args ) { int example792 ; Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 0 && y == 0 ) break ; if ( x > y ) { example792 = x ; x = y ; y = example792 ; } System . out . println ( x + " " + y ) ; } } } -import java . math . BigDecimal ; import java . util . Scanner ; class Example262 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example262 = sc . nextInt ( ) ; long ans = 1 ; long [ ] A = new long [ example262 ] ; for ( int i = 0 ; i < example262 ; i ++ ) { A [ i ] = sc . nextLong ( ) ; if ( A [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } for ( int i = 0 ; i < example262 ; i ++ ) { long a = A [ i ] ; if ( Math . log10 ( ans ) + Math . log10 ( a ) > 18 ) { System . out . println ( - 1 ) ; return ; } ans *= a ; } if ( ans <= 1000000000000000000l ) { System . out . println ( ans ) ; } else { System . out . println ( - 1 ) ; } } } -import java . util . Scanner ; public class example456 { private static final int Example456 = 1_000_000_007 ; private static int [ ] [ ] X ; private static int D ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; D = sc . nextInt ( ) ; X = new int [ N ] [ D ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { X [ i ] [ j ] = sc . nextInt ( ) ; } } int cnt = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( i == j ) break ; if ( distance ( i , j ) ) cnt ++ ; } } System . out . println ( cnt ) ; } private static boolean distance ( int i , int j ) { double sum = 0 ; for ( int k = 0 ; k < D ; k ++ ) { long x = X [ i ] [ k ] - X [ j ] [ k ] ; sum += x * x ; } double s = Math . sqrt ( sum ) ; return s == Math . floor ( s ) ; } } -import java . util . Scanner ; public class Example965 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example965 = sc . nextLong ( ) ; sc . close ( ) ; long ret = example965 ; while ( true ) { if ( isPrime ( ret ) ) { break ; } ret ++ ; } System . out . println ( ret ) ; } public static boolean isPrime ( long example965 ) { if ( example965 == 1 || example965 == 2 ) { return true ; } if ( example965 % 2 == 0 ) { return false ; } boolean ret = false ; for ( long i = 2 ; i <= Math . sqrt ( example965 ) ; i ++ ) { if ( example965 % i == 0 ) { ret = false ; break ; } ret = true ; } return ret ; } } -import java . io . FileNotFoundException ; import java . util . Arrays ; import java . util . Scanner ; public class Example495 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int example495 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] p = new int [ example495 + 1 ] ; Arrays . fill ( p , K ) ; int border = 0 ; for ( int i = 0 ; i < Q ; i ++ ) { int x = sc . nextInt ( ) ; p [ x ] ++ ; border ++ ; } for ( int i = 1 ; i <= example495 ; i ++ ) { if ( p [ i ] > border ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example796 { static Scanner scan ; static int Example796 = 0 ; public static void main ( String [ ] args ) { scan = new Scanner ( System . in ) ; final int slen = scan . nextInt ( ) ; int [ ] s = new int [ slen ] ; for ( int i = 0 ; i < slen ; i ++ ) { s [ i ] = scan . nextInt ( ) ; } final int tlen = scan . nextInt ( ) ; int [ ] t = new int [ tlen ] ; for ( int i = 0 ; i < tlen ; i ++ ) { t [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < tlen ; i ++ ) { binarySearch ( s , t [ i ] ) ; } System . out . println ( Example796 ) ; } public static void binarySearch ( int [ ] s , int t ) { int hi = 0 ; int ti = s . length - 1 ; int p ; while ( hi <= ti ) { p = ( hi + ti ) / 2 ; if ( s [ p ] == t ) { Example796 ++ ; break ; } else if ( s [ p ] < t ) { hi = p + 1 ; continue ; } else { ti = p - 1 ; continue ; } } return ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example391 { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int example391 = std . nextInt ( ) ; int k = std . nextInt ( ) ; int q = std . nextInt ( ) ; int [ ] as = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { as [ i ] = std . nextInt ( ) - 1 ; } int [ ] cp = new int [ example391 ] ; for ( int i = 0 ; i < q ; i ++ ) { int c = as [ i ] ; cp [ c ] ++ ; } int [ ] dp = new int [ example391 ] ; Arrays . fill ( dp , k ) ; long [ ] sum = new long [ example391 ] ; long all = Arrays . stream ( cp ) . sum ( ) ; for ( int i = 0 ; i < example391 ; i ++ ) { sum [ i ] = all - cp [ i ] ; } for ( int i = 0 ; i < example391 ; i ++ ) { if ( k > sum [ i ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example338 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example338 = sc . nextInt ( ) ; String S = sc . next ( ) ; int count = 1 ; char [ ] slime = S . toCharArray ( ) ; for ( int i = 1 ; i < Example338 ; i ++ ) { if ( slime [ i ] != slime [ i - 1 ] ) { count += 1 ; } } System . out . println ( count ) ; } } -import java . util . * ; import java . text . DecimalFormat ; public class example642 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example642 = sc . nextLine ( ) ; if ( Example642 . equals ( " SUN " ) ) System . out . println ( 7 ) ; else if ( Example642 . equals ( " MON " ) ) System . out . println ( 6 ) ; else if ( Example642 . equals ( " TUE " ) ) System . out . println ( 5 ) ; else if ( Example642 . equals ( " WED " ) ) System . out . println ( 4 ) ; else if ( Example642 . equals ( " THU " ) ) System . out . println ( 3 ) ; else if ( Example642 . equals ( " FRI " ) ) System . out . println ( 2 ) ; else System . out . println ( 1 ) ; } } -import java . util . Scanner ; public class example507 { public static void main ( String [ ] args ) { long Example507 = 0 ; long ans2 = 0 ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; boolean f = false ; long temp = k - n ; if ( k >= n + m ) { Example507 = 0 ; ans2 = 0 ; } else { if ( k <= n ) { Example507 = n - k ; ans2 = m ; } else { Example507 = 0 ; ans2 = m - ( k - n ) ; } } System . out . println ( Example507 ) ; System . out . println ( ans2 ) ; sc . close ( ) ; } } -import java . util . * ; public class Example798 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example798 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; String dummy = sc . nextLine ( ) ; int [ ] [ ] x = new int [ example798 ] [ d ] ; for ( int i = 0 ; i < example798 ; i ++ ) { String [ ] s = sc . nextLine ( ) . split ( " " ) ; for ( int j = 0 ; j < d ; j ++ ) { x [ i ] [ j ] = Integer . parseInt ( s [ j ] ) ; } } int ans = 0 ; for ( int i = 0 ; i < example798 - 1 ; i ++ ) { for ( int j = i + 1 ; j < example798 ; j ++ ) { int sum = 0 ; for ( int k = 0 ; k < d ; k ++ ) { sum += ( x [ i ] [ k ] - x [ j ] [ k ] ) * ( x [ i ] [ k ] - x [ j ] [ k ] ) ; } if ( Math . sqrt ( sum ) == ( int ) Math . sqrt ( sum ) ) ans ++ ; } } System . out . println ( ans ) ; } } -import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; public class Example37 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int example37 = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( S . length ( ) <= example37 ) { System . out . println ( S ) ; } else { System . out . println ( S . substring ( 0 , example37 ) + " ... " ) ; } } static private int binarySearch ( long num , long [ ] orderedArray ) { int lowerBorder = - 1 ; int upperBorder = orderedArray . length ; int mid ; while ( upperBorder - lowerBorder > 1 ) { mid = ( upperBorder + lowerBorder ) / 2 ; if ( orderedArray [ mid ] <= num ) { lowerBorder = mid ; } else { upperBorder = mid ; } } return lowerBorder ; } static private int binarySearch ( long num , ArrayList < Long > orderedList ) { int lowerBorder = - 1 ; int upperBorder = orderedList . size ( ) ; int mid ; while ( upperBorder - lowerBorder > 1 ) { mid = ( upperBorder + lowerBorder ) / 2 ; if ( orderedList . get ( mid ) <= num ) { lowerBorder = mid ; } else { upperBorder = mid ; } } return lowerBorder ; } public static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; } public static long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } } -import java . util . Scanner ; import java . util . regex . Pattern ; public class example519 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) throws Exception { new Main ( ) . run ( ) ; } void run ( ) { int Example519 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Pattern ptn = Pattern . compile ( " \\ d { " + Example519 + " } - \\ d { " + b + " } " ) ; String s = sc . next ( ) ; System . out . println ( ptn . matcher ( s ) . matches ( ) ? " Yes " : " No " ) ; } } -import java . io . * ; import java . util . * ; public class example755 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example755 = in . nextInt ( ) ; boolean [ ] rate = new boolean [ 8 ] ; int free = 0 ; int a ; for ( int i = 0 ; i < Example755 ; i ++ ) { a = in . nextInt ( ) ; if ( a <= 399 ) { rate [ 0 ] = true ; } else if ( a <= 799 ) { rate [ 1 ] = true ; } else if ( a <= 1199 ) { rate [ 2 ] = true ; } else if ( a <= 1599 ) { rate [ 3 ] = true ; } else if ( a <= 1999 ) { rate [ 4 ] = true ; } else if ( a <= 2399 ) { rate [ 5 ] = true ; } else if ( a <= 2799 ) { rate [ 6 ] = true ; } else if ( a <= 3199 ) { rate [ 7 ] = true ; } else { free ++ ; } } int ans = 0 ; for ( int i = 0 ; i < rate . length ; i ++ ) { if ( rate [ i ] == true ) { ans ++ ; } } int max = ans + free ; if ( ans == 0 ) { ans = 1 ; } System . out . println ( ans + " " + max ) ; } } -import java . util . Scanner ; public class example662 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example662 = sc . nextInt ( ) ; int [ ] button = new int [ Example662 + 1 ] ; for ( int i = 1 ; i <= Example662 ; i ++ ) { button [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; int nextButton = 1 ; boolean success = false ; for ( int j = 0 ; j < Example662 ; j ++ ) { count ++ ; nextButton = button [ nextButton ] ; if ( nextButton == 2 ) { success = true ; break ; } } if ( ! success ) { count = - 1 ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example38 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example38 = 124 ; int max = - 1 ; for ( int i = 0 ; i < 5 ; i ++ ) { int n = in . nextInt ( ) ; if ( n < Example38 ) Example38 = n ; if ( n > max ) max = n ; } int k = in . nextInt ( ) ; System . out . println ( ( max - Example38 <= k ) ? " Yay! " : " :( " ) ; in . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example578 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example578 = sc . nextInt ( ) ; int [ ] array = new int [ Example578 ] ; boolean b = true ; int i ; for ( i = 0 ; i < Example578 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } Arrays . sort ( array ) ; for ( i = 0 ; i < Example578 ; i ++ ) { if ( i != 0 ) { if ( array [ i - 1 ] == array [ i ] ) { b = false ; break ; } } } System . out . println ( b ? " YES " : " NO " ) ; } } -import java . util . Scanner ; import java . util . TreeSet ; public class Example797 { public static void main ( String [ ] args ) { TreeSet < Integer > numerosUtiles = new TreeSet < > ( ) ; Scanner in = new Scanner ( System . in ) ; int example797 = in . nextInt ( ) ; int [ ] numbers = new int [ example797 ] ; for ( int i = 0 ; i < example797 ; i ++ ) { numbers [ i ] = in . nextInt ( ) ; } for ( int i = 1 ; i < ( example797 - 1 ) ; i ++ ) { int a = numbers [ i - 1 ] ; int b = numbers [ i ] ; int c = numbers [ i + 1 ] ; if ( ( b > a && b < c ) || ( b < a && b > c ) ) { numerosUtiles . add ( b ) ; } } System . out . println ( numerosUtiles . size ( ) ) ; } } -import java . util . * ; public class Example818 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example818 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] variation = new int [ example818 ] ; int count = 0 ; int i , j , k = 0 ; int [ ] max = new int [ example818 ] ; for ( i = 0 ; i < example818 ; i ++ ) { variation [ i ] = sc . nextInt ( ) ; } for ( j = 0 ; j < example818 ; j ++ ) { X = X - variation [ j ] ; count ++ ; } for ( k = 0 ; k < example818 ; k ++ ) { max [ k ] = X / variation [ k ] ; } for ( j = 0 ; j < example818 ; j ++ ) { for ( k = j + 1 ; k < example818 ; k ++ ) { if ( max [ k ] > max [ j ] ) { int t = max [ k ] ; max [ k ] = max [ j ] ; max [ j ] = t ; } } } count = count + max [ 0 ] ; System . out . println ( count ) ; } } -import java . util . * ; public class example719 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example719 = sc . nextInt ( ) ; int happy500 = 0 ; int happy5 = 0 ; happy500 = Example719 / 500 * 1000 ; happy5 = ( Example719 % 500 ) / 5 * 5 ; System . out . println ( happy500 + happy5 ) ; } } -import java . util . Scanner ; class example742 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example742 = sc . nextInt ( ) ; int [ ] a = new int [ Example742 ] ; int [ ] b = new int [ Example742 - 1 ] ; for ( int i = 0 ; i < Example742 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < Example742 - 1 ; j ++ ) { if ( a [ j + 1 ] <= a [ j ] ) { b [ j ] = 1 ; } else { b [ j ] = 0 ; } } int b_max = 0 ; int count = 0 ; for ( int c = 0 ; c < Example742 - 1 ; c ++ ) { if ( b [ c ] == 1 ) { count ++ ; } else { if ( count > b_max ) { b_max = count ; } count = 0 ; } } if ( count > b_max ) { b_max = count ; } System . out . println ( b_max ) ; } } -import java . util . * ; public class example117 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example117 = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; long A = Example117 % K ; long ans = 0 ; if ( Example117 % K == 0 ) { ans = 0 ; } else { ans = Math . min ( A , K - A ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example570 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example570 = scanner . nextInt ( ) ; if ( example570 == 0 ) { System . out . println ( " 1 " ) ; } else if ( example570 == 1 ) { System . out . println ( " 0 " ) ; } } } -import java . util . Scanner ; public class Example741 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example741 = sc . next ( ) ; String s1 = example741 . substring ( 2 , 3 ) ; String s2 = example741 . substring ( 3 , 4 ) ; String s3 = example741 . substring ( 4 , 5 ) ; String s4 = example741 . substring ( 5 , 6 ) ; if ( s1 . equals ( s2 ) && s3 . equals ( s4 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class example758 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example758 = sc . nextInt ( ) ; int min = 1_000_000_000 ; int max = 1 ; for ( int i = 0 ; i < Example758 ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tmp < min ) min = tmp ; if ( tmp > max ) max = tmp ; } System . out . println ( max - min ) ; sc . close ( ) ; } } -import java . util . * ; public class example289 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example289 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( ( b - 1 + Example289 - 2 ) / ( Example289 - 1 ) ) ; } } -import java . util . Scanner ; public class Example37 { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; String example37 = std . next ( ) ; String first = example37 . substring ( 0 , 2 ) ; String last = example37 . substring ( 2 ) ; Integer firstValue = Integer . parseInt ( first ) ; Integer lastValue = Integer . parseInt ( last ) ; String format ; if ( availableMonth ( firstValue ) && availableMonth ( lastValue ) ) { format = " AMBIGUOUS " ; } else if ( availableMonth ( firstValue ) ) { format = " MMYY " ; } else if ( availableMonth ( lastValue ) ) { format = " YYMM " ; } else { format = " NA " ; } System . out . println ( format ) ; } static boolean availableMonth ( int val ) { return val >= 1 && val <= 12 ; } } -import java . util . Scanner ; public class Example689 { public static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example689 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int max = example689 ; int max_index = 0 ; if ( max < b ) { max = b ; max_index = 1 ; } if ( max < c ) { max = c ; max_index = 2 ; } switch ( max_index ) { case 0 : example689 *= 2 ; break ; case 1 : b *= 2 ; break ; case 2 : c *= 2 ; break ; } } System . out . println ( example689 + b + c ) ; } } -import java . util . * ; class Example952 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example952 = sc . next ( ) ; switch ( example952 ) { case " ABC " : System . out . println ( " ARC " ) ; break ; case " ARC " : System . out . println ( " ABC " ) ; break ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example319 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example319 , n , j , S = 0 ; double avr , O = 0 , s ; for ( Example319 = 0 ; ; Example319 ++ ) { n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; if ( n == 0 ) { break ; } else { for ( j = 1 ; j <= n ; j ++ ) { array [ j - 1 ] = sc . nextInt ( ) ; S += array [ j - 1 ] ; } avr = S / ( double ) n ; for ( j = 1 ; j <= n ; j ++ ) { O += ( avr - array [ j - 1 ] ) * ( avr - array [ j - 1 ] ) ; } s = Math . sqrt ( O / n ) ; System . out . println ( s ) ; } S = 0 ; O = 0 ; } } } -import java . util . Scanner ; public class Example311 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String x = sc . next ( ) ; if ( x . equals ( " 0 " ) ) break ; int example311 = 0 , i ; for ( i = 0 ; i < x . length ( ) ; i ++ ) { example311 = example311 + x . charAt ( i ) - 48 ; } System . out . printf ( " %d \n " , example311 ) ; } } } -import java . util . Scanner ; public class example707 { public static void main ( String [ ] args ) { int Example707 , b ; Scanner scanner = new Scanner ( System . in ) ; while ( scanner . hasNext ( ) ) { Example707 = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; System . out . println ( ( String . valueOf ( Example707 + b ) . length ( ) ) ) ; } scanner . close ( ) ; } } -import java . util . Scanner ; public class Example475 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example475 = sc . nextInt ( ) ; int [ ] value = new int [ example475 ] ; int [ ] cost = new int [ example475 ] ; int [ ] trueValue = new int [ example475 ] ; int max = 0 ; for ( int i = 0 ; i < example475 ; i ++ ) { value [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example475 ; i ++ ) { cost [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example475 ; i ++ ) { trueValue [ i ] = value [ i ] - cost [ i ] ; if ( trueValue [ i ] > 0 ) { max += trueValue [ i ] ; } } System . out . println ( max ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example457 { public static void main ( String [ ] args ) { int Example457 = 0 ; int i = 0 ; String outputNum = " " ; String [ ] NumList ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; Example457 = Integer . parseInt ( line ) ; line = br . readLine ( ) ; if ( line != null ) { NumList = line . split ( " " , 0 ) ; int Count = Example457 - 1 ; for ( i = 0 ; i < NumList . length ; i ++ ) { if ( Count != Example457 - 1 ) { outputNum += " " ; } outputNum += NumList [ Count ] ; Count -- ; } System . out . println ( outputNum ) ; } } catch ( NumberFormatException e ) { System . out . println ( e ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } -import java . util . Scanner ; class Example993 { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int [ ] arr = new int [ 101010 ] ; int example993 ; int n ; int cnt = 0 ; n = reader . nextInt ( ) ; example993 = reader . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = reader . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] >= example993 ) { cnt ++ ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; class example683 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example683 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( Example683 == b || b == c || Example683 == c ) { System . out . println ( " No " ) ; } else if ( Example683 > b || Example683 > c ) { System . out . println ( " No " ) ; } else if ( b > c ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; import java . math . * ; public class Example38 { public static void main ( String [ ] args ) { Scanner as = new Scanner ( System . in ) ; double example38 , t , s ; example38 = as . nextDouble ( ) ; s = 3.141592653589 * example38 * example38 ; t = 2.0 * 3.141592653589 * example38 ; BigDecimal ros = new BigDecimal ( s ) ; BigDecimal rot = new BigDecimal ( t ) ; ros = ros . setScale ( 6 , BigDecimal . ROUND_HALF_UP ) ; rot = rot . setScale ( 6 , BigDecimal . ROUND_HALF_UP ) ; System . out . println ( ros + " " + rot ) ; } } -import java . util . Scanner ; public class example292 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example292 = Integer . parseInt ( sc . next ( ) ) ; int taro = 0 ; int hanako = 0 ; for ( int i = 0 ; i < Example292 ; i ++ ) { String TS = sc . next ( ) ; String HS = sc . next ( ) ; if ( TS . compareTo ( HS ) > 0 ) { taro += 3 ; } else if ( TS . compareTo ( HS ) < 0 ) { hanako += 3 ; } else if ( TS . compareTo ( HS ) == 0 ) { taro ++ ; hanako ++ ; } } System . out . printf ( " %d %d \n " , taro , hanako ) ; } } -import java . util . Scanner ; public class example974 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example974 = sc . nextInt ( ) ; int result = 0 ; int ahead ; int current = 100000 ; for ( int i = 0 ; i < Example974 - 1 ; i ++ ) { ahead = current ; current = sc . nextInt ( ) ; result += Math . min ( ahead , current ) ; } result += current ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class example58 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example58 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i <= Example58 ; i ++ ) { int ans1 = + 500 * i ; for ( int j = 0 ; j <= B ; j ++ ) { int ans2 = + 100 * j ; for ( int k = 0 ; k <= C ; k ++ ) { int ans3 = + 50 * k ; if ( ans1 + ans2 + ans3 == X ) { ans ++ ; } } } } System . out . print ( ans ) ; } } -import java . util . * ; public class example204 { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int Example204 = scanner . nextInt ( ) ; int i = 0 ; int X ; int hantei = 0 ; int ans = 0 ; while ( hantei == 0 ) { X = Example204 + i ; for ( int j = 2 ; j <= X ; j ++ ) { if ( X % j == 0 ) { if ( j == X ) { hantei = 1 ; ans = X ; } else { break ; } } } i ++ ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example930 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int example930 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; int sum = 0 ; for ( int i = 1 ; i < example930 ; i ++ ) { sum += i ; } for ( int i = 1 ; i < M ; i ++ ) { sum += i ; } System . out . println ( sum ) ; } } -import java . util . * ; public class example907 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example907 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int gugu = Example907 * ( Example907 - 1 ) / 2 ; int kiki = M * ( M - 1 ) / 2 ; System . out . println ( gugu + kiki ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class example963 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example963 = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int [ ] point = new int [ Example963 ] ; for ( int i = 0 ; i < q ; i ++ ) { int ans = a [ i ] - 1 ; point [ ans ] ++ ; } for ( int i = 0 ; i < Example963 ; i ++ ) { if ( k - q + point [ i ] > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . * ; public class Example702 { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int example702 = scanner . nextInt ( ) ; int max = 1 ; for ( int i = 2 ; i <= example702 ; i ++ ) { int j = i ; while ( true ) { j *= i ; if ( j > example702 ) { break ; } max = Math . max ( max , j ) ; } } System . out . println ( max ) ; } } -import java . util . * ; class example131 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example131 = sc . nextInt ( ) ; int res = 0 ; for ( int a = 1 ; a <= Example131 ; ++ a ) { for ( int b = 1 ; b <= Example131 ; ++ b ) { for ( int c = 1 ; c <= Example131 ; ++ c ) { res += greatestCommonFactor ( a , b , c ) ; } } } System . out . println ( res ) ; } private static int greatestCommonFactor ( int a , int b , int c ) { int limit = Math . min ( a , b ) ; limit = Math . min ( limit , c ) ; for ( int n = limit ; n >= 2 ; n -- ) { if ( ( a % n == 0 ) && ( b % n == 0 ) && ( c % n == 0 ) ) { return n ; } } return 1 ; } } -import java . util . Scanner ; public class Example732 { 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 example732 ; double rad = Math . PI * 2 * ( ( double ) h / 12 + ( ( double ) m / 60 ) / 12 - ( double ) m / 60 ) ; example732 = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( rad ) ) ; System . out . printf ( " %.20f " , example732 ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example113 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example113 = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; Integer [ ] a = new Integer [ example113 ] ; for ( int i = 0 ; i < example113 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; map . put ( a [ i ] , i + 1 ) ; } Arrays . sort ( a ) ; StringBuilder ans = new StringBuilder ( ) ; for ( Integer i : a ) { ans . append ( map . get ( i ) ) ; ans . append ( " " ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example35 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] nyu = sc . nextLine ( ) . split ( " " ) ; int example35 = Integer . parseInt ( nyu [ 0 ] ) ; int numnext = Integer . parseInt ( nyu [ 1 ] ) ; int numend = Integer . parseInt ( nyu [ 2 ] ) ; int count = 0 ; if ( numend - ( example35 - numnext ) < 0 ) { count = 0 ; } else { count = numend - ( example35 - numnext ) ; } System . out . println ( count ) ; } } -import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class example772 { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; String [ ] tokens = in . readLine ( ) . split ( " " ) ; int Example772 = Integer . parseInt ( tokens [ 0 ] ) ; int B = Integer . parseInt ( tokens [ 1 ] ) ; String S = in . readLine ( ) ; Set < Character > numbers = new HashSet < > ( ) ; for ( int i = 0 ; i < 10 ; ++ i ) { numbers . add ( Integer . toString ( i ) . charAt ( 0 ) ) ; } boolean valid = isValid ( S , numbers , Example772 ) ; String str = valid ? " Yes " : " No " ; System . out . println ( str ) ; } static boolean isValid ( String S , Set < Character > numbers , int Example772 ) { for ( int i = 0 ; i < S . length ( ) ; ++ i ) { if ( i == Example772 ) { if ( S . charAt ( i ) != '-' ) { return false ; } } else { if ( ! numbers . contains ( S . charAt ( i ) ) ) { return false ; } } } return true ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example794 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String example794 = br . readLine ( ) ; Integer num = Integer . parseInt ( example794 ) ; System . out . println ( num * num * num ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example691 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example691 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sNumbers = br . readLine ( ) . split ( " " ) ; int [ ] numbers = new int [ Example691 ] ; for ( int i = 0 ; i < Example691 ; i ++ ) { numbers [ i ] = Integer . parseInt ( sNumbers [ i ] ) ; } insertionSort ( numbers ) ; } private static void insertionSort ( int [ ] numbers ) { displayNumbers ( numbers ) ; for ( int i = 1 ; i < numbers . length ; i ++ ) { int currentNumber = numbers [ i ] ; int insertIndex = i ; for ( int y = i - 1 ; y >= 0 ; y -- ) { if ( currentNumber < numbers [ y ] ) { numbers [ y + 1 ] = numbers [ y ] ; insertIndex = y ; } else { break ; } } numbers [ insertIndex ] = currentNumber ; displayNumbers ( numbers ) ; } } private static void displayNumbers ( int [ ] numbers ) { StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < numbers . length ; i ++ ) { sb . append ( numbers [ i ] ) ; sb . append ( " " ) ; } System . out . println ( sb . toString ( ) . trim ( ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Example511 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example511 = Integer . parseInt ( in . readLine ( ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int [ ] a = new int [ example511 ] ; int hantei = 1 ; int cntContinuous = 0 ; for ( int i = 0 ; i < example511 ; i ++ ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; if ( hantei == a [ i ] ) { cntContinuous ++ ; hantei ++ ; } } System . out . println ( cntContinuous == 0 ? - 1 : example511 - cntContinuous ) ; } } -import java . util . Scanner ; public class example603 { public static void main ( String [ ] args ) { final int Example603 = 0 ; final int X = 1 ; final int Y = 2 ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] [ ] travel = new int [ n ] [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { travel [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } boolean can = true ; int pt = 0 , px = 0 , py = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int d = length ( px , py , travel [ i ] [ X ] , travel [ i ] [ Y ] ) ; int t = travel [ i ] [ Example603 ] - pt ; if ( d > t ) { can = false ; break ; } else if ( ( t - d ) % 2 == 1 ) { can = false ; break ; } px = travel [ i ] [ X ] ; py = travel [ i ] [ Y ] ; pt = travel [ i ] [ Example603 ] ; } if ( can ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } static int length ( int px , int py , int cx , int cy ) { return ( Math . abs ( cx - px ) + Math . abs ( cy - py ) ) ; } } -import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Example177 { static BigInteger limit = new BigInteger ( " 1000000000000000000 " ) ; public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example177 = sc . nextInt ( ) ; List < BigInteger > values = new ArrayList < BigInteger > ( ) ; for ( int i = 0 ; i < example177 ; i ++ ) { values . add ( sc . nextBigInteger ( ) ) ; } Collections . sort ( values ) ; BigInteger result = BigInteger . ONE ; for ( BigInteger value : values ) { result = result . multiply ( value ) ; if ( result . equals ( BigInteger . ZERO ) ) { System . out . println ( 0 ) ; return ; } else if ( limit . compareTo ( result ) < 0 ) { System . out . println ( - 1 ) ; return ; } } System . out . println ( result . toString ( ) ) ; } catch ( Exception e ) { System . out . println ( - 1 ) ; e . printStackTrace ( ) ; } } } -import java . util . Scanner ; public class example737 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example737 = scanner . nextInt ( ) , B = scanner . nextInt ( ) , C = scanner . nextInt ( ) ; System . out . println ( C / Example737 * B ) ; } } -import java . util . * ; public class example512 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example512 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int res = 9999 ; for ( int i = 0 ; i < Example512 ; i ++ ) { int ci = sc . nextInt ( ) ; int ti = sc . nextInt ( ) ; if ( ti <= t && ci < res ) { res = ci ; } } if ( res != 9999 ) { System . out . println ( res ) ; } else { System . out . println ( " TLE " ) ; } } } -import java . util . Scanner ; class example78 { public static void main ( String [ ] args ) { StringBuilder sb = new StringBuilder ( ) ; Scanner as = new Scanner ( System . in ) ; int Example78 = 0 ; int tre = 0 ; int count = 0 ; int [ ] A ; Boolean flag = true ; Example78 = Integer . parseInt ( as . next ( ) ) ; A = new int [ Example78 ] ; for ( int i = 0 ; i < Example78 ; i ++ ) { A [ i ] = Integer . parseInt ( as . next ( ) ) ; } while ( flag ) { flag = false ; for ( int j = Example78 - 1 ; j >= 1 ; j -- ) { if ( A [ j ] < A [ j - 1 ] ) { tre = A [ j ] ; A [ j ] = A [ j - 1 ] ; A [ j - 1 ] = tre ; flag = true ; count ++ ; } } } for ( int i = 0 ; i < Example78 ; i ++ ) { if ( i != Example78 - 1 ) { sb . append ( A [ i ] ) . append ( ' ' ) ; } else { sb . append ( A [ i ] ) ; } } System . out . println ( sb . toString ( ) ) ; sb . setLength ( 0 ) ; sb . append ( count ) ; System . out . println ( sb . toString ( ) ) ; } } -import java . util . Scanner ; class example636 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example636 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int time = t ; int x1 = x ; while ( x < Example636 ) { t = t + time ; x = x + x1 ; } System . out . println ( t ) ; sc . close ( ) ; } } -import java . util . * ; public class example378 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example378 = sc . nextInt ( ) ; long min = sc . nextInt ( ) ; long ret = - 1000000001 ; for ( int i = 1 ; i < Example378 ; i ++ ) { long r = sc . nextInt ( ) ; if ( r - min > ret ) ret = r - min ; if ( r < min ) min = r ; } System . out . println ( ret ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example909 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; List < Integer > list_two = new ArrayList < Integer > ( ) ; int Example909 = sc . nextInt ( ) ; for ( int i = 0 ; Example909 > i ; i ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; list_two . add ( a ) ; } Collections . sort ( list , Collections . reverseOrder ( ) ) ; int list_in_max = Collections . max ( list_two ) ; int maxIndex = list_two . indexOf ( Collections . max ( list_two ) ) ; if ( list . get ( 0 ) . equals ( list . get ( 1 ) ) ) { for ( int i = 0 ; Example909 > i ; i ++ ) { System . out . println ( list_in_max ) ; } System . exit ( 0 ) ; } else { for ( int i = 0 ; Example909 > i ; i ++ ) { if ( i == maxIndex ) { list_two . remove ( i ) ; System . out . println ( Collections . max ( list_two ) ) ; } else { System . out . println ( list_in_max ) ; } } } } } -import java . util . * ; class example233 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example233 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = new int [ k ] ; long sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { a [ i ] = sc . nextInt ( ) ; sum = sum + a [ i ] ; } if ( sum >= Example233 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class Example631 { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String example631 = reader . readLine ( ) ; String p = reader . readLine ( ) ; String ss = example631 + example631 ; Pattern pat = Pattern . compile ( p ) ; check ( pat , ss ) ; } catch ( IOException e ) { System . out . print ( e ) ; } } private static void check ( Pattern pat , String ss ) { Matcher m = pat . matcher ( ss ) ; if ( m . find ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example171 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String answer = " Good " ; for ( int example171 = 0 ; example171 < 3 ; example171 ++ ) { if ( s . charAt ( example171 ) == s . charAt ( example171 + 1 ) ) { answer = " Bad " ; break ; } } System . out . println ( answer ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example118 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example118 = scanner . nextInt ( ) ; System . out . println ( Example118 / 2 + Example118 % 2 ) ; } } -import java . util . Scanner ; public class Example413 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; final int example413 = scan . nextInt ( ) ; final int M = scan . nextInt ( ) ; int [ ] [ ] codes = new int [ example413 ] [ M ] ; int [ ] rate = new int [ M ] ; int bonus = scan . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { rate [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < example413 ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { codes [ i ] [ j ] = scan . nextInt ( ) ; } } int count = 0 ; for ( int i = 0 ; i < example413 ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < M ; j ++ ) { sum += codes [ i ] [ j ] * rate [ j ] ; } sum += bonus ; if ( sum > 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example83 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example83 = sc . nextInt ( ) ; String ans = " No " ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = 1 ; j < 10 ; j ++ ) { if ( i * j == example83 ) { ans = " Yes " ; break ; } } } System . out . println ( ans ) ; } } -import identifier . identifier . * ; import identifier . identifier . * ; public class Example688 { public static void_type identifier ( type_identifier [ ] identifier ) { type_identifier identifier = new type_identifier ( identifier . identifier ) ; identifier . identifier . identifier ( decimal_integer_literal - identifier . identifier ( ) . identifier ( " string_fragment " , " string_fragment " ) . identifier ( ) * decimal_integer_literal ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example825 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example825 = sc . nextInt ( ) ; int [ ] a = new int [ Example825 ] ; int sum = 0 ; for ( int i = 0 ; i < Example825 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; sum += a [ i ] ; } Arrays . parallelSort ( a ) ; sum -= a [ Example825 - 1 ] ; if ( sum > a [ Example825 - 1 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example946 { private static final BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) { exec ( args ) ; } public static void exec ( String [ ] args ) { String str = readLineStandardInput ( ) ; int example946 = Integer . parseInt ( str ) ; str = readLineStandardInput ( ) ; String [ ] Astr = str . split ( " " ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < Astr . length ; i ++ ) { int tmp = Integer . parseInt ( Astr [ i ] ) ; min = min > tmp ? tmp : min ; max = max < tmp ? tmp : max ; } int res = max - min ; System . out . println ( res ) ; } private static String readLineStandardInput ( ) { String str ; try { str = input . readLine ( ) ; } catch ( IOException e ) { str = null ; System . out . println ( e ) ; } return str ; } } -import java . util . Scanner ; class example257 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String [ ] s = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; String input = scn . next ( ) ; int Example257 = 0 ; for ( int i = 0 ; i <= 6 ; i ++ ) { if ( input . equals ( s [ i ] ) ) Example257 = 7 - i ; } System . out . println ( Example257 ) ; } } -import java . util . * ; public class Example104 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; char [ ] s1 = s . toCharArray ( ) ; char [ ] t1 = t . toCharArray ( ) ; int example104 = 0 ; for ( int i = 0 ; i < s1 . length ; i ++ ) { if ( s1 [ i ] != t1 [ i ] ) { example104 ++ ; } } System . out . println ( example104 ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example103 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example103 = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , x = sc . nextInt ( ) , y = sc . nextInt ( ) ; long min = Long . MAX_VALUE ; for ( int i = 0 ; i <= Math . max ( x , y ) ; i ++ ) { min = Math . min ( min , 2 * c * i + Math . max ( 0 , x - i ) * example103 + Math . max ( 0 , y - i ) * b ) ; } System . out . println ( min ) ; } } -import java . lang . Math ; import java . util . Scanner ; class Example40 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example40 = sc . nextLong ( ) ; double interest = 100 ; int year = 0 ; while ( interest < example40 ) { year += 1 ; interest *= 1.01 ; interest = Math . floor ( interest ) ; if ( interest >= example40 ) { break ; } } System . out . println ( year ) ; } } -import java . util . Scanner ; public class example774 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; char [ ] c = S . toCharArray ( ) ; int Example774 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( c [ i ] == '+' ) { Example774 ++ ; } else { Example774 -- ; } } System . out . println ( Example774 ) ; } } -import java . util . * ; public class Example654 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example654 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int tasu = example654 + B ; int hiku = example654 - B ; int kakeru = example654 * B ; System . out . println ( Math . max ( kakeru , Math . max ( tasu , hiku ) ) ) ; } } -import java . util . Scanner ; public class example764 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example764 = sc . nextInt ( ) ; int input_100 = sc . nextInt ( ) ; int input_50 = sc . nextInt ( ) ; int input_pay = sc . nextInt ( ) ; int result = 0 ; sc . close ( ) ; for ( int i = 0 ; i <= Example764 ; i ++ ) { for ( int j = 0 ; j <= input_100 ; j ++ ) { for ( int k = 0 ; k <= input_50 ; k ++ ) { if ( i * 500 + j * 100 + k * 50 == input_pay ) { result ++ ; } } } } System . out . println ( result ) ; } } -import static java . lang . System . out ; import java . util . Scanner ; public class Example904 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example904 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int divideAns = example904 / b ; int modAns = example904 % b ; double fewAns = ( double ) example904 / b ; out . printf ( " %d %d %f%n " , divideAns , modAns , fewAns ) ; } } -import java . util . * ; public class example347 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example347 = s . nextInt ( ) ; String yvgubhij = s . nextLine ( ) ; HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < Example347 ; i ++ ) { String b = s . nextLine ( ) ; set . add ( b ) ; } System . out . println ( set . size ( ) ) ; } } -import java . util . Scanner ; public class Example200 { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example200 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int ans = 0 ; if ( c < example200 && d < example200 ) { ans = 0 ; } if ( c <= example200 && d >= example200 && d <= b ) { ans = d - example200 ; } if ( c >= example200 && d <= b ) { ans = d - c ; } if ( c >= example200 && d >= b && c <= b ) { ans = b - c ; } if ( b < c ) { ans = 0 ; } if ( c <= example200 && b <= d ) { ans = b - example200 ; } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; import static java . lang . Math . * ; public class Example448 { static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( System . in ) ; int example448 = sc . nextInt ( ) , q = sc . nextInt ( ) ; String s = sc . next ( ) ; int [ ] AC = new int [ example448 + 1 ] ; for ( int i = 1 ; i < example448 ; i ++ ) { if ( s . charAt ( i - 1 ) == 'A' && s . charAt ( i ) == 'C' ) { AC [ i ] = 1 ; } } for ( int i = 1 ; i < example448 + 1 ; i ++ ) { AC [ i ] += AC [ i - 1 ] ; } for ( int i = 0 ; i < q ; i ++ ) { int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; int k = 0 ; if ( r < example448 && s . charAt ( r - 1 ) == 'A' && s . charAt ( r ) == 'C' ) k ++ ; out . println ( max ( 0 , AC [ r ] - AC [ l - 1 ] - k ) ) ; } out . close ( ) ; } } -import java . util . * ; public class example282 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example282 = sc . nextInt ( ) ; int [ ] tako = new int [ Example282 ] ; for ( int i = 0 ; i < Example282 ; i ++ ) { tako [ i ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < Example282 ; i ++ ) { for ( int k = i + 1 ; k < Example282 ; k ++ ) { sum += tako [ i ] * tako [ k ] ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; class Example486 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example486 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String ans = sc . next ( ) ; int sum = 0 ; if ( ans . equals ( s ) ) { sum = example486 - 1 ; System . out . println ( sum + " " + b ) ; } if ( ans . equals ( t ) ) { sum = b - 1 ; System . out . println ( example486 + " " + sum ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example251 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " " ; int example251 = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int l = Integer . parseInt ( s . substring ( 2 , 4 ) ) ; if ( example251 < 1 || 12 < example251 ) { if ( l < 1 || 12 < l ) { ans = " NA " ; } else { ans = " YYMM " ; } } else { if ( l < 1 || 12 < l ) { ans = " MMYY " ; } else { ans = " AMBIGUOUS " ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . math . * ; public class Example212 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example212 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; List < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < example212 ; i ++ ) { int d = sc . nextInt ( ) ; a . add ( d ) ; } Collections . sort ( a ) ; int price = 0 ; for ( int j = 0 ; j < K ; j ++ ) { price += a . get ( j ) ; } System . out . println ( price ) ; } } -import java . io . * ; class example425 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strAry ; long Example425 , max , min , sum ; Example425 = Integer . parseInt ( br . readLine ( ) ) ; int i ; strAry = br . readLine ( ) . split ( " " ) ; min = Integer . parseInt ( strAry [ 0 ] ) ; max = Integer . parseInt ( strAry [ 0 ] ) ; for ( i = 0 , sum = 0 ; i < Example425 ; i ++ ) { sum = sum + Integer . parseInt ( strAry [ i ] ) ; if ( min > Integer . parseInt ( strAry [ i ] ) ) { min = Integer . parseInt ( strAry [ i ] ) ; } if ( max < Integer . parseInt ( strAry [ i ] ) ) { max = Integer . parseInt ( strAry [ i ] ) ; } } System . out . println ( min + " " + max + " " + sum ) ; } } -import java . util . * ; public class example198 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example198 = sc . nextInt ( ) ; int [ ] r = new int [ Example198 ] ; for ( int i = 1 ; i <= Example198 ; i ++ ) r [ sc . nextInt ( ) - 1 ] = i ; for ( int rr : r ) System . out . print ( rr + " " ) ; } } -import java . util . Scanner ; public class Example245 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String a = scanner . nextLine ( ) ; if ( a . equals ( " 0 " ) ) break ; int example245 = 0 ; for ( char b : a . toCharArray ( ) ) { example245 += Integer . parseInt ( String . valueOf ( b ) ) ; } System . out . println ( example245 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example346 { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int example346 = sc . nextInt ( ) ; int ans = 0 ; ans = example346 + ( int ) Math . pow ( example346 , 2 ) + ( int ) Math . pow ( example346 , 3 ) ; System . out . println ( ans ) ; } private static class Example346 { 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 int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } -import java . util . Arrays ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Example229 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; Map < String , Integer > tV = new TreeMap < > ( ) ; int example229 = scn . nextInt ( ) ; int [ ] VList = new int [ example229 ] ; for ( int i = 0 ; i < example229 ; i ++ ) { String v = scn . next ( ) ; if ( ! tV . isEmpty ( ) ) { if ( tV . containsKey ( v ) ) { tV . put ( v , tV . get ( v ) + 1 ) ; } else { tV . put ( v , 1 ) ; } } else { tV . put ( v , 1 ) ; } VList [ i ] = tV . get ( v ) ; } Arrays . sort ( VList ) ; if ( VList [ example229 - 1 ] == VList [ 0 ] ) { for ( Map . Entry < String , Integer > vote : tV . entrySet ( ) ) { System . out . println ( vote . getKey ( ) . toString ( ) ) ; } } else { if ( VList [ 0 ] != VList [ example229 - 1 ] ) { for ( Map . Entry < String , Integer > vote : tV . entrySet ( ) ) { if ( vote . getValue ( ) == VList [ example229 - 1 ] ) { System . out . println ( vote . getKey ( ) . toString ( ) ) ; } } } } scn . close ( ) ; } } -import java . util . Scanner ; import java . util . Arrays ; class Example44 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example44 = sc . nextLong ( ) ; int i = 0 ; for ( i = 1 ; example44 > 1 ; i ++ ) { example44 = example44 / 2 ; } System . out . println ( ( long ) ( Math . pow ( 2 , i - 1 ) + Math . pow ( 2 , i - 1 ) - 1 ) ) ; } } -import java . util . Scanner ; public class example60 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example60 = sc . nextInt ( ) ; double pi = 3.141592653558209749448214808651 ; double l = 2 * pi * Example60 ; System . out . println ( l ) ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class Example435 { @ SuppressWarnings ( " deprecation " ) public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int example435 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; System . out . println ( example435 * ( example435 - 1 ) / 2 + M * ( M - 1 ) / 2 ) ; } } -import java . util . * ; public class example424 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example424 = sc . nextInt ( ) ; String s = sc . next ( ) ; int b = 0 ; for ( int i = 0 ; i < Example424 - 2 ; i ++ ) { if ( s . substring ( i , i + 3 ) . equals ( " ABC " ) ) { b ++ ; } } System . out . println ( b ) ; } } -import java . util . Scanner ; public class Example941 { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example941 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] counts = new int [ example941 ] ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ; counts [ a ] ++ ; counts [ b ] ++ ; } for ( int count : counts ) System . out . println ( count ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example486 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example486 = Integer . parseInt ( scanner . next ( ) ) ; double [ ] S = new double [ example486 ] ; for ( int i = 0 ; i < example486 ; i ++ ) { S [ i ] = Double . parseDouble ( scanner . next ( ) ) ; } Arrays . parallelSort ( S ) ; double m = ( S [ 0 ] + S [ 1 ] ) / 2 ; for ( int i = 2 ; i < example486 ; i ++ ) { m = ( m + S [ i ] ) / 2 ; } System . out . print ( m ) ; } } -import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ; public class Example627 { public static void main ( String [ ] args ) { HashMap < Integer , Integer > num = new HashMap < > ( ) ; Scanner sc = new Scanner ( System . in ) ; int example627 = sc . nextInt ( ) ; for ( int i = 1 ; i < example627 ; i ++ ) { int a = sc . nextInt ( ) ; if ( num . containsKey ( a ) ) { num . put ( a , num . get ( a ) + 1 ) ; } else { num . put ( a , 1 ) ; } } for ( int i = 1 ; i <= example627 ; i ++ ) { if ( num . containsKey ( i ) ) { System . out . println ( num . get ( i ) ) ; } else { System . out . println ( 0 ) ; } } } } -import java . util . Scanner ; public class example649 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example649 = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] array = new String [ Example649 ] ; for ( int i = 0 ; i < Example649 ; i ++ ) { array [ i ] = sc . nextLine ( ) ; if ( i == 0 ) { continue ; } if ( ! ( array [ i ] . substring ( 0 , 1 ) ) . equals ( array [ i - 1 ] . substring ( array [ i - 1 ] . Example649 ( ) - 1 ) ) ) { System . out . println ( " No " ) ; return ; } } for ( int i = 0 ; i < Example649 - 1 ; i ++ ) { for ( int j = i + 1 ; j < Example649 ; j ++ ) { if ( array [ i ] . equals ( array [ j ] ) ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example820 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example820 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int min = x - example820 + 1 ; int max = x + example820 - 1 ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = min ; i <= max ; i ++ ) { if ( i > 1000000 || i < - 1000000 ) { break ; } if ( i == min ) { sb . append ( i ) ; } else { sb . append ( " " + i ) ; } } System . out . println ( sb . toString ( ) ) ; } } -import java . util . * ; public class Example81 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Character > ODD_STEP = new HashSet < Character > ( ) ; Set < Character > EVEN_STEP = new HashSet < Character > ( ) ; String ODD_STEP_STR = " RUD " ; String EVEN_STEP_STR = " LUD " ; for ( int example81 = 0 ; example81 < 3 ; example81 ++ ) { ODD_STEP . add ( ODD_STEP_STR . charAt ( example81 ) ) ; EVEN_STEP . add ( EVEN_STEP_STR . charAt ( example81 ) ) ; } int current_step = 0 ; String steps = sc . next ( ) ; for ( int example81 = 0 ; example81 < steps . length ( ) ; example81 ++ ) { char step = steps . charAt ( example81 ) ; if ( ( example81 + 1 ) % 2 == 0 && ! EVEN_STEP . contains ( step ) ) { break ; } else if ( ( example81 + 1 ) % 2 != 0 && ! ODD_STEP . contains ( step ) ) { break ; } current_step ++ ; } if ( current_step == steps . length ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class Example102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example102 = sc . nextInt ( ) ; int ex = 0 ; int [ ] h = new int [ 8 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { h [ i ] = 0 ; } for ( int i = 0 ; i < example102 ; i ++ ) { int buf = sc . nextInt ( ) ; for ( int j = 0 ; j < 8 ; j ++ ) { if ( buf <= 399 + j * 400 ) { h [ j ] ++ ; break ; } if ( j == 7 ) { ex ++ ; } } } int min = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { if ( h [ i ] >= 1 ) { min ++ ; } } int max = min + ex ; if ( min == 0 ) { min = 1 ; } System . out . println ( min + " " + max ) ; } } -import java . util . Scanner ; class Example424 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example424 = 1 ; int count = 0 ; if ( S . length ( ) % 2 == 0 ) { example424 = S . length ( ) ; } else { example424 = S . length ( ) - 1 ; } for ( int i = 0 ; i < example424 / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) - 1 - i ) ) { count ++ ; } } System . out . println ( count ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; public class example748 { public static void main ( String [ ] args ) throws Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader reader = new BufferedReader ( is ) ; List < String > mylist = new ArrayList < > ( ) ; String Example748 = reader . readLine ( ) ; while ( Example748 != null ) { mylist . add ( Example748 ) ; Example748 = reader . readLine ( ) ; } List < String > list01 = new ArrayList < String > ( Arrays . asList ( " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " ) ) ; String [ ] arr01 = mylist . get ( 0 ) . split ( " " ) ; String s = arr01 [ 0 ] ; System . out . println ( list01 . indexOf ( s ) == 0 ? 7 : 7 - list01 . indexOf ( s ) ) ; } } -import java . util . * ; public class example270 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example270 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] arr = new int [ m ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int [ ] flag = new int [ Example270 ] ; for ( int i = 0 ; i < flag . length ; i ++ ) { flag [ i ] = 0 ; } for ( int i = 0 ; i < flag . length ; i ++ ) { for ( int j = 0 ; j < arr . length ; j ++ ) { if ( arr [ j ] == i ) { flag [ i ] = 1 ; } } } int leftResult = 0 ; int rightResult = 0 ; for ( int i = x ; i >= 0 ; i -- ) { leftResult = leftResult + flag [ i ] ; } for ( int i = x + 1 ; i < Example270 ; i ++ ) { rightResult = rightResult + flag [ i ] ; } if ( leftResult < rightResult ) { System . out . println ( leftResult ) ; } else { System . out . println ( rightResult ) ; } } } -import java . util . * ; public class example177 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example177 = sc . nextInt ( ) ; int [ ] hights = new int [ Example177 ] ; boolean reach = false ; String answer = " Yes " ; for ( int i = 0 ; i < Example177 ; i ++ ) { hights [ i ] = sc . nextInt ( ) ; } for ( int i = Example177 - 1 ; i > 0 ; i -- ) { if ( hights [ i - 1 ] - hights [ i ] > 1 ) { answer = " No " ; break ; } else if ( hights [ i - 1 ] - hights [ i ] == 1 && ! reach ) { reach = true ; } else if ( hights [ i - 1 ] - hights [ i ] == 1 && reach ) { answer = " No " ; break ; } else if ( hights [ i - 1 ] - hights [ i ] == 0 && reach ) { reach = true ; } else { reach = false ; } } System . out . println ( answer ) ; } } -import java . lang . reflect . Array ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; class Example372 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example372 = sc . nextInt ( ) ; int xx = example372 / 2 ; int ans = 0 ; for ( int i = 1 ; i <= example372 ; i ++ ) { for ( int j = 2 ; j <= example372 + 1 ; j ++ ) { if ( Math . pow ( i , j ) > ans && Math . pow ( i , j ) <= example372 ) { ans = ( int ) Math . pow ( i , j ) ; } } } System . out . println ( ans ) ; } } -import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Example382 { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { String [ ] tokens = in . readLine ( ) . split ( " " ) ; int example382 = Integer . parseInt ( tokens [ 0 ] ) ; int M = Integer . parseInt ( tokens [ 1 ] ) ; int [ ] A = new int [ M ] ; tokens = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < M ; ++ i ) { A [ i ] = Integer . parseInt ( tokens [ i ] ) ; } long sum = 0 ; for ( int i = 0 ; i < M ; ++ i ) { sum += A [ i ] ; } if ( sum > example382 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( ( example382 - sum ) ) ; } } void calc ( ) { } void showResult ( ) { } } -import java . io . * ; import java . util . * ; class Example602 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int example602 = Integer . parseInt ( st . nextToken ( ) ) ; int w = Integer . parseInt ( st . nextToken ( ) ) ; if ( w == 0 && example602 == 0 ) break ; for ( int i = 0 ; i < example602 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . * ; class Example650 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example650 = sc . nextInt ( ) ; long [ ] a = new long [ example650 ] ; for ( int i = 0 ; i < example650 ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long num = lcm ( a , example650 ) ; long deno = sum ( a , example650 , num ) ; double ans = num / ( double ) deno ; System . out . println ( ans ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } public static long lcm ( long [ ] a , long example650 ) { long lc = 1 ; for ( int i = 0 ; i < example650 ; i ++ ) { lc = ( lc * a [ i ] ) / gcd ( lc , a [ i ] ) ; } return lc ; } public static long sum ( long [ ] a , int example650 , long num ) { long count = 0 ; for ( int i = 0 ; i < example650 ; i ++ ) { count += ( num / a [ i ] ) ; } return count ; } } -import java . util . * ; public class Example441 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example441 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int min = 0 ; int min2 = 0 ; if ( example441 < b ) { min = example441 ; if ( b < c ) { min2 = b ; } else { min2 = c ; } } else { min = b ; if ( example441 < c ) { min2 = example441 ; } else { min2 = c ; } } System . out . println ( min + min2 ) ; } } -import java . io . * ; public class example904 { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long Example904 = Long . parseLong ( reader . readLine ( ) ) ; System . out . println ( calc ( 1 , Example904 ) - calc ( 3 , Example904 ) - calc ( 5 , Example904 ) + calc ( 15 , Example904 ) ) ; return ; } static long calc ( long n , long Example904 ) { return ( n + Example904 / n * n ) * ( Example904 / n ) / 2 ; } } -import java . util . Scanner ; public class Example14 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; char [ ] chars = s . toCharArray ( ) ; int example14 = 0 ; for ( int i = 0 ; i < chars . length / 2 ; i ++ ) { if ( chars [ i ] != chars [ chars . length - 1 - i ] ) { example14 ++ ; } } System . out . println ( example14 ) ; } } -import java . io . * ; public class Example553 { public static void main ( String ... args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String [ ] line = br . readLine ( ) . split ( " " ) ; int example553 = Integer . parseInt ( line [ 0 ] ) ; int k = Integer . parseInt ( line [ 1 ] ) ; int q = Integer . parseInt ( line [ 2 ] ) ; int [ ] point = new int [ example553 ] ; for ( int i = 0 ; i < q ; i ++ ) { point [ Integer . parseInt ( br . readLine ( ) ) - 1 ] += 1 ; } for ( int i = 0 ; i < example553 ; i ++ ) { point [ i ] += k - q ; } for ( int i = 0 ; i < point . length ; i ++ ) { if ( point [ i ] <= 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } br . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . lang . * ; import java . util . * ; public class Example877 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example877 = sc . nextInt ( ) ; int kari = example877 + 1 ; int keta = 1 ; while ( ( int ) ( kari / 10 ) != 0 ) { keta ++ ; kari = ( int ) ( kari / 10 ) ; } if ( keta == 1 ) { System . out . println ( example877 ) ; } else if ( keta == 2 ) { System . out . println ( 9 ) ; } else if ( keta == 3 ) { System . out . println ( ( 10 + example877 - 100 ) ) ; } else if ( keta == 4 ) { System . out . println ( 909 ) ; } else if ( keta == 5 ) { System . out . println ( ( 910 + example877 - 10000 ) ) ; } else { System . out . println ( 90909 ) ; } sc . close ( ) ; } } -import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class example509 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] A = sc . next ( ) . toCharArray ( ) ; Map < Character , Integer > maplst = new TreeMap < Character , Integer > ( ) ; for ( char Example509 : A ) { if ( maplst . containsKey ( Example509 ) ) { maplst . put ( Example509 , maplst . get ( Example509 ) + 1 ) ; } else { maplst . put ( Example509 , 1 ) ; } } boolean judge = true ; if ( maplst . keySet ( ) . size ( ) == 2 ) { for ( char Example509 : maplst . keySet ( ) ) { if ( maplst . get ( Example509 ) != 2 ) { judge = ! judge ; break ; } } } else { judge = ! judge ; } if ( judge ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example86 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example86 = sc . nextInt ( ) ; int break_count = 0 ; int next = 1 ; for ( int i = 0 ; i < Example86 ; i ++ ) { if ( sc . nextInt ( ) == next ) { next ++ ; } else { break_count ++ ; } } if ( next == 1 ) { System . out . println ( - 1 ) ; } else { System . out . println ( break_count ) ; } } } -import java . util . Scanner ; public class example327 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example327 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int sta = d * 2 + 1 ; for ( int i = 0 ; i < 20 ; i ++ ) { if ( sta * i >= Example327 ) { System . out . println ( i ) ; break ; } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example291 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example291 , b , w ; String str ; String [ ] s ; str = br . readLine ( ) ; while ( str != null ) { StringBuilder out = new StringBuilder ( ) ; s = str . split ( " " ) ; Example291 = Integer . parseInt ( s [ 0 ] ) ; b = Integer . parseInt ( s [ 1 ] ) ; w = Example291 + b ; out . append ( w ) ; System . out . println ( out . length ( ) ) ; str = br . readLine ( ) ; } } } -import java . util . Scanner ; public class Example242 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example242 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = ( example242 + b ) / 2 ; String ans = " " ; if ( ( example242 + b ) % 2 == 0 && Math . abs ( example242 - k ) == Math . abs ( b - k ) ) { ans = String . valueOf ( k ) ; } else { ans = " IMPOSSIBLE " ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; public class example570 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example570 = sc . nextInt ( ) ; int [ ] h = new int [ Example570 ] ; for ( int i = 0 ; i < Example570 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int number = 0 ; int ans = 0 ; for ( int i = 0 ; i < Example570 ; i ++ ) { if ( number > h [ i ] ) ans += number - h [ i ] ; number = h [ i ] ; } ans += number ; System . out . println ( ans ) ; } } -import java . util . * ; public class example302 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; if ( s . indexOf ( t ) != - 1 ) { System . out . println ( 0 ) ; } else { int Example302 = Integer . MAX_VALUE ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { if ( Example302 > helper ( s . substring ( i , i + t . length ( ) ) , t ) ) { Example302 = helper ( s . substring ( i , i + t . length ( ) ) , t ) ; } } System . out . println ( Example302 ) ; } } public static int helper ( String s1 , String s2 ) { int count = 0 ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) { count ++ ; } } return count ; } } -import java . util . * ; public class Example485 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example485 = sc . nextInt ( ) ; int [ ] B = new int [ example485 ] ; for ( int i = 1 ; i < example485 ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int [ ] A = new int [ example485 + 1 ] ; A [ 1 ] = B [ 1 ] ; for ( int i = 1 ; i < example485 ; i ++ ) { if ( B [ i ] < A [ i ] ) { A [ i ] = B [ i ] ; } A [ i + 1 ] = B [ i ] ; } int max = 0 ; for ( int i = 1 ; i <= example485 ; i ++ ) { max += A [ i ] ; } System . out . println ( max ) ; } } -import java . io . * ; import java . util . * ; public class example790 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Question question = new Question ( ) ; question . solve ( sc ) ; } static class example790 { public void solve ( Scanner sc ) { int Example790 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] distances = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { distances [ i ] = sc . nextInt ( ) ; } int m = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int t = ( i + 1 ) % n ; int dist = distances [ t ] - distances [ i ] ; m = Math . max ( m , Math . min ( Math . abs ( dist ) , Example790 - Math . abs ( dist ) ) ) ; } System . out . println ( Example790 - m ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example26 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] Alph = new int [ 26 ] ; for ( int example26 = 0 ; example26 < 26 ; example26 ++ ) { Alph [ example26 ] = 0 ; } while ( true ) { String line = br . readLine ( ) ; if ( line == null ) break ; String [ ] token = line . split ( " " ) ; for ( int i = 0 ; i < token . length ; i ++ ) { String str = token [ i ] . toLowerCase ( ) ; for ( char ch : str . toCharArray ( ) ) { if ( Character . isLetter ( ch ) ) { Alph [ ch - 'a' ] ++ ; } } } } for ( int i = 0 ; i < 26 ; i ++ ) { System . out . println ( ( char ) ( 'a' + i ) + " : " + Alph [ i ] ) ; } } } -import java . util . Scanner ; public class example606 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example606 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int count = 0 ; for ( int i = Example606 ; i < B + 1 ; i ++ ) { String s = String . valueOf ( i ) ; String [ ] array = new String [ 5 ] ; for ( int j = 0 ; j < 5 ; j ++ ) { array [ j ] = s . substring ( j , j + 1 ) ; } if ( array [ 0 ] . equals ( array [ 4 ] ) && array [ 1 ] . equals ( array [ 3 ] ) ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; class example235 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example235 = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int time = h * 60 + m ; double len = 0 ; double rad = 0 ; double hh = 0 ; double mm = 0 ; for ( int i = 0 ; i < time ; i ++ ) { hh += 0.5 ; mm += 6 ; } hh = hh % 360 ; mm = mm % 360 ; rad = Math . abs ( hh - mm ) ; len = Math . sqrt ( Math . pow ( Example235 , 2 ) + Math . pow ( b , 2 ) - 2 * Example235 * b * Math . cos ( Math . toRadians ( rad ) ) ) ; System . out . println ( len ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class Example314 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example314 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; HashSet < Integer > sunuke = new HashSet < > ( ) ; for ( int i = 0 ; i < example314 ; i ++ ) { sunuke . add ( i + 1 ) ; } for ( int i = 0 ; i < k ; i ++ ) { int ki = sc . nextInt ( ) ; for ( int j = 0 ; j < ki ; j ++ ) { int temp = sc . nextInt ( ) ; if ( sunuke . contains ( temp ) ) { sunuke . remove ( temp ) ; } } } System . out . println ( sunuke . size ( ) ) ; } } -import java . util . * ; public class example952 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example952 = sc . nextInt ( ) ; int standard = 1 ; while ( true ) { int target = standard * 2 ; if ( target <= Example952 ) { standard = target ; } else { break ; } } System . out . println ( standard ) ; } } -import java . lang . * ; import java . util . * ; public class Example443 { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int example443 = stdId . nextInt ( ) ; example443 = example443 * example443 * example443 ; System . out . println ( String . valueOf ( example443 ) ) ; } } -import java . util . Scanner ; public class example517 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example517 = scan . nextLine ( ) ; String str2 = scan . nextLine ( ) ; String c = str2 . substring ( 0 , Example517 . length ( ) ) ; if ( Example517 . equals ( c ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scan . close ( ) ; } } -import java . util . Scanner ; public class example240 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example240 = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int range = 2 * d + 1 ; System . out . println ( ( Example240 + range - 1 ) / range ) ; System . out . flush ( ) ; sc . close ( ) ; } } -import java . util . * ; public class example702 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int Example702 = s . lastIndexOf ( " Z " ) - s . indexOf ( " A " ) + 1 ; System . out . println ( Example702 ) ; } } -import java . util . Scanner ; class example261 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; char [ ] S ; int Example261 = 0 ; S = input . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( S [ i ] == S [ i + 1 ] ) { System . out . println ( " Bad " ) ; Example261 ++ ; break ; } } if ( Example261 == 0 ) { System . out . println ( " Good " ) ; } } } -import java . util . Scanner ; public class example340 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example340 = sc . nextInt ( ) ; int [ ] h = new int [ Example340 ] ; int viewableCnt = 0 ; for ( int i = 0 ; i < Example340 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; for ( int j = ( i - 1 ) ; j >= 0 ; j -- ) { if ( h [ i ] < h [ j ] ) { break ; } else if ( j == 0 ) { viewableCnt ++ ; } } } System . out . println ( viewableCnt + 1 ) ; sc . close ( ) ; } } -import java . util . * ; public class Example400 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String example400 = sc . next ( ) ; if ( Character . isUpperCase ( example400 . charAt ( 0 ) ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } } } -import java . util . Scanner ; public class Example626 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; boolean example626 = S . contains ( " A " ) ; boolean containsB = S . contains ( " B " ) ; System . out . println ( ( example626 && containsB ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example770 { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; while ( true ) { int Example770 = Integer . parseInt ( std . next ( ) ) ; if ( Example770 == 0 ) { break ; } double [ ] score = new double [ Example770 ] ; double ave = 0 ; for ( int i = 0 ; i < Example770 ; i ++ ) { score [ i ] = Double . parseDouble ( std . next ( ) ) ; ave += score [ i ] ; } ave /= Example770 ; double sd = 0 ; for ( int i = 0 ; i < Example770 ; i ++ ) { sd += Math . pow ( ( score [ i ] - ave ) , 2 ) ; } sd /= Example770 ; sd = Math . pow ( sd , 0.5 ) ; System . out . println ( String . format ( " %.5f " , sd ) ) ; } } } -import java . io . * ; import java . util . * ; public class example667 { private void solve ( ) { int Example667 = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; for ( int i = A ; i <= B ; ++ i ) { if ( i % Example667 == 0 ) { out . println ( " OK " ) ; return ; } } out . println ( " NG " ) ; } private static PrintWriter out ; private static MyScanner sc ; private static class example667 { BufferedReader br ; StringTokenizer st ; private 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 ( ) ) ; } } public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; sc = new MyScanner ( ) ; new Main ( ) . solve ( ) ; out . close ( ) ; } } -import java . util . * ; class example174 { public static void main ( String [ ] a ) { Scanner c = new Scanner ( System . in ) ; String s = c . next ( ) ; String t = c . next ( ) ; int Example174 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) Example174 ++ ; } System . out . println ( Example174 ) ; } } -import java . util . Scanner ; public class Example652 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example652 = sc . nextInt ( ) ; int [ ] result = new int [ example652 ] ; for ( int i = 1 ; sc . hasNextInt ( ) ; i ++ ) { result [ sc . nextInt ( ) - 1 ] = i ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < example652 ; i ++ ) { sb . append ( result [ i ] ) ; if ( i != example652 ) { sb . append ( " " ) ; } else { sb . append ( " \n " ) ; } } System . out . println ( sb . toString ( ) ) ; } } -import java . util . * ; public class example738 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example738 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; int [ ] [ ] vectorA = new int [ Example738 ] [ m ] ; int [ ] [ ] vectorB = new int [ m ] [ l ] ; long [ ] [ ] vectorC = new long [ Example738 ] [ l ] ; for ( int i = 0 ; i < Example738 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int elm = scan . nextInt ( ) ; vectorA [ i ] [ j ] = elm ; } } for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { int elm = scan . nextInt ( ) ; vectorB [ i ] [ j ] = elm ; } } for ( int i = 0 ; i < Example738 ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { long ans = 0 ; for ( int k = 0 ; k < m ; k ++ ) { ans += ( long ) vectorA [ i ] [ k ] * ( long ) vectorB [ k ] [ j ] ; } vectorC [ i ] [ j ] = ans ; System . out . printf ( j != l - 1 ? " %d " : " %d \n " , vectorC [ i ] [ j ] ) ; } } } } -import java . util . Scanner ; public class example409 { public long getTotalHeightOfStools ( int n , int [ ] arr ) { long Example409 = 0 ; int prevHeight = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( prevHeight > arr [ i ] ) { Example409 += prevHeight - arr [ i ] ; arr [ i ] = prevHeight ; } prevHeight = arr [ i ] ; } return Example409 ; } public static void main ( String [ ] args ) throws Exception { Main solution = new Main ( ) ; Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; } long answer = solution . getTotalHeightOfStools ( n , arr ) ; System . out . println ( answer ) ; } } -import java . util . * ; import java . math . * ; public class example571 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example571 = sc . nextInt ( ) ; String [ ] a = new String [ Example571 ] ; for ( int i = 0 ; i < Example571 ; i ++ ) a [ i ] = sc . next ( ) ; Set < String > s = new HashSet < > ( ) ; for ( String x : a ) s . add ( x ) ; System . out . println ( s . size ( ) ) ; } } -import java . io . * ; import java . util . * ; public class Example175 { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int example175 = sc . nextInt ( ) ; for ( int i = 0 ; 4 * i <= 100 ; i ++ ) { for ( int j = 0 ; 4 * i + 7 * j <= 100 ; j ++ ) { if ( 4 * i + 7 * j == example175 ) { pr . println ( " Yes " ) ; return ; } } } pr . println ( " No " ) ; } public static void main ( String [ ] args ) { sc = new Scanner ( INPUT == null ? System . in : new ByteArrayInputStream ( INPUT . getBytes ( ) ) ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . flush ( ) ; } static String INPUT = null ; private static class Example175 extends PrintWriter { Printer ( OutputStream out ) { super ( out ) ; } } } -import java . util . Scanner ; public class Example964 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example964 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < example964 ; i ++ ) { double x1 = sc . nextDouble ( ) ; double x2 = sc . nextDouble ( ) ; double dis = Math . sqrt ( Math . pow ( x1 , 2 ) + Math . pow ( x2 , 2 ) ) ; if ( dis <= q ) result ++ ; } System . out . println ( result ) ; } } -import java . util . Scanner ; public class example554 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example554 = scan . nextInt ( ) ; int intH = scan . nextInt ( ) ; int intX = scan . nextInt ( ) ; int intY = scan . nextInt ( ) ; int intR = scan . nextInt ( ) ; if ( intX <= Example554 - intR && intR <= intX && intY <= intH - intR && intR <= intY ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; import java . lang . Math ; public class example696 { public static void main ( String [ ] args ) { int Example696 ; double sum = 0.0 , m , v , t = 0.0 ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { Example696 = sc . nextInt ( ) ; if ( Example696 == 0 ) break ; double [ ] A = new double [ Example696 ] ; for ( int i = 0 ; i < A . length ; i ++ ) { A [ i ] = ( double ) sc . nextInt ( ) ; sum += A [ i ] ; } m = sum / ( double ) A . length ; for ( int i = 0 ; i < A . length ; i ++ ) { t += ( A [ i ] - m ) * ( A [ i ] - m ) ; } v = t / ( double ) A . length ; System . out . println ( Math . sqrt ( v ) ) ; sum = 0.0 ; t = 0.0 ; } } } -import java . util . * ; public class Example934 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > List = new ArrayList < > ( ) ; for ( int example934 = 0 ; example934 < 5 ; example934 ++ ) { int j = sc . nextInt ( ) ; List . add ( j ) ; } int k = sc . nextInt ( ) ; int num = 0 ; for ( int example934 = 0 ; example934 < 4 ; example934 ++ ) { for ( int j = example934 + 1 ; j < 5 ; j ++ ) { if ( List . get ( j ) - List . get ( example934 ) > k ) num ++ ; } } if ( num == 0 ) System . out . println ( " Yay! " ) ; else System . out . println ( " :( " ) ; } } -import java . util . * ; public class Example488 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Long > List = new ArrayList < > ( ) ; long example488 = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; for ( int i = 0 ; i < example488 ; i ++ ) List . add ( sc . nextLong ( ) ) ; Collections . sort ( List , Collections . reverseOrder ( ) ) ; long sum = 0 ; for ( long i = K ; i < List . size ( ) ; i ++ ) sum += List . get ( ( int ) i ) ; System . out . println ( sum ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example286 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String s = br . readLine ( ) ; StringTokenizer st ; while ( s != null ) { st = new StringTokenizer ( s ) ; int Example286 = Integer . parseInt ( st . nextToken ( ) ) + Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( ( int ) Math . log10 ( Example286 ) + 1 ) ; s = br . readLine ( ) ; } } catch ( Exception ex ) { System . exit ( 0 ) ; } } } -import java . util . * ; public class example352 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example352 = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; boolean [ ] bool = new boolean [ Example352 + 1 ] ; for ( int i = 0 ; i <= Example352 ; i ++ ) { bool [ i ] = true ; } for ( int i = 0 ; i < m ; i ++ ) { bool [ scanner . nextInt ( ) ] = false ; } int [ ] b = new int [ Example352 + 1 ] ; b [ 0 ] = 1 ; b [ 1 ] = 1 ; int mod = 1000000007 ; for ( int i = 2 ; i <= Example352 ; i ++ ) { b [ i ] = 0 ; if ( bool [ i - 2 ] ) b [ i ] += b [ i - 2 ] ; if ( bool [ i - 1 ] ) b [ i ] += b [ i - 1 ] ; b [ i ] %= mod ; } System . out . println ( b [ Example352 ] ) ; } } -import java . util . Scanner ; public class example82 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String numbers = " 1 " ; int Example82 ; while ( true ) { numbers = scanner . nextLine ( ) ; if ( numbers . equals ( " 0 " ) ) break ; Example82 = 0 ; for ( int i = 0 ; i < numbers . length ( ) ; ++ i ) { Example82 += Character . getNumericValue ( numbers . charAt ( i ) ) ; } System . out . println ( Example82 ) ; } } } -import java . util . * ; public class example755 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long Example755 = in . nextLong ( ) , c = 0 , s = 0 ; long k = in . nextLong ( ) ; long [ ] arr = new long [ ( int ) Example755 ] ; for ( int i = 0 ; i < Example755 ; i ++ ) { arr [ i ] = in . nextInt ( ) ; s = s + arr [ i ] ; } if ( k >= Example755 ) { System . out . println ( " 0 " ) ; System . exit ( 0 ) ; } Arrays . sort ( arr ) ; long mid = Example755 - 1 ; while ( c != k ) { s = s - arr [ ( int ) mid ] ; mid -- ; c ++ ; } System . out . println ( s ) ; } } -import java . util . * ; public class example271 { public static void main ( String [ ] args ) { PriorityQueue < String > caca = new PriorityQueue < String > ( ) ; Scanner scn = new Scanner ( System . in ) ; int Example271 = scn . nextInt ( ) ; int n2 = scn . nextInt ( ) ; for ( int i = 0 ; i < Example271 ; i ++ ) caca . add ( scn . next ( ) ) ; for ( int i = 0 ; i < Example271 ; i ++ ) System . out . print ( caca . poll ( ) ) ; System . out . println ( ) ; scn . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . Collectors ; import java . util . stream . Stream ; public class example356 { public static void main ( String [ ] args ) throws Exception { Scanner fr = new Scanner ( System . in ) ; int Example356 = fr . nextInt ( ) ; int x = fr . nextInt ( ) ; int xx = x ; int t = fr . nextInt ( ) ; int tt = t ; if ( Example356 < x ) { System . out . println ( t ) ; } else { while ( x < Example356 ) { x += xx ; t += tt ; } System . out . println ( t ) ; } } } -import java . util . Scanner ; public class example850 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example850 = Integer . parseInt ( scanner . next ( ) ) ; int s = Integer . parseInt ( scanner . next ( ) ) ; if ( Example850 < 10 && s < 10 ) { System . out . println ( Example850 * s ) ; } else { System . out . println ( - 1 ) ; } scanner . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example238 { public static void main ( String [ ] args ) throws IOException { BufferedReader bis = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = bis . readLine ( ) ; int Example238 = s . length ( ) ; int ans = 0 ; for ( int i = 0 ; i < Example238 ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '+' ) { ans += 1 ; } if ( c == '-' ) { ans -= 1 ; } } System . out . println ( ans ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example589 = sc . nextInt ( ) , a = sc . nextInt ( ) ; if ( example589 % a == 0 ) System . out . println ( example589 / a ) ; else System . out . println ( example589 / a + 1 ) ; } } -import java . util . * ; public class Example999 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example999 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int ans = 0 ; int b = K - example999 ; int c = K - example999 - B ; if ( example999 == 0 && C == 0 ) { System . out . println ( " 0 " ) ; } else if ( K >= example999 && c < 1 ) { System . out . println ( example999 ) ; } else if ( K >= example999 && c >= 1 ) { System . out . println ( example999 + ( c * - 1 ) ) ; } else if ( K < example999 ) { System . out . println ( K ) ; } } } -import java . util . Scanner ; public class example672 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example672 = sc . nextInt ( ) ; int [ ] a = new int [ Example672 ] ; for ( int i = 0 ; i < a . length ; ++ i ) { a [ i ] = sc . nextInt ( ) - 1 ; } System . out . println ( solve ( a ) ) ; sc . close ( ) ; } static int solve ( int [ ] a ) { boolean [ ] visited = new boolean [ a . length ] ; visited [ 0 ] = true ; int index = 0 ; for ( int step = 1 ; ; ++ step ) { index = a [ index ] ; if ( index == 1 ) { return step ; } if ( visited [ index ] ) { return - 1 ; } visited [ index ] = true ; } } } -import java . util . Scanner ; public class Example229 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example229 = sc . nextInt ( ) ; int [ ] d = new int [ 100001 ] ; for ( int i = 0 ; i < example229 ; i ++ ) { d [ sc . nextInt ( ) ] ++ ; } int tmp = 0 ; int cnt = 0 ; for ( int i = 0 ; i < 100001 ; i ++ ) { tmp += d [ i ] ; if ( example229 == tmp * 2 ) { cnt ++ ; } else if ( example229 < tmp * 2 ) { break ; } } System . out . println ( cnt ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example470 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] best = { 0 , 0 , 0 } ; for ( int example470 = 0 ; example470 < 10 ; example470 ++ ) { String line = br . readLine ( ) ; int height = Integer . parseInt ( line ) ; if ( height > best [ 0 ] ) { best [ 2 ] = best [ 1 ] ; best [ 1 ] = best [ 0 ] ; best [ 0 ] = height ; } else if ( height > best [ 1 ] ) { best [ 2 ] = best [ 1 ] ; best [ 1 ] = height ; } else if ( height > best [ 2 ] ) { best [ 2 ] = height ; } } for ( int h : best ) { System . out . println ( h ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Example291 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example291 = in . nextInt ( ) ; String [ ] array = new String [ example291 ] ; for ( int i = 0 ; i < example291 ; i ++ ) array [ i ] = in . next ( ) ; List < String > list = new ArrayList < > ( ) ; list . add ( array [ 0 ] ) ; char c = array [ 0 ] . charAt ( array [ 0 ] . length ( ) - 1 ) ; for ( int i = 1 ; i < example291 ; i ++ ) { if ( list . contains ( array [ i ] ) || array [ i ] . charAt ( 0 ) != c ) { System . out . println ( " No " ) ; return ; } c = array [ i ] . charAt ( array [ i ] . length ( ) - 1 ) ; list . add ( array [ i ] ) ; } System . out . println ( " Yes " ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example716 { private static int prime ( int a ) { if ( a == 2 || a == 3 ) return 1 ; for ( int example716 = 2 ; example716 < Math . sqrt ( a ) + 1 ; example716 ++ ) { if ( a % example716 == 0 ) { return 0 ; } } return 1 ; } public static void main ( String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String line ; int n = 0 , j = 0 , store = 0 ; boolean first = true ; while ( ( line = br . readLine ( ) ) != null ) { if ( first ) { n = Integer . parseInt ( line ) ; first = false ; } else { store += prime ( Integer . parseInt ( line ) ) ; j ++ ; if ( j == n ) { break ; } } } System . out . println ( store ) ; } } } -import java . util . * ; public class example547 { public static long gcd ( long a , long b ) { while ( a % b != 0 ) { long Example547 = a % b ; a = b ; b = Example547 ; } return b ; } public static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } public static long divnum ( long a , long b , long x ) { return b / x - ( a - 1 ) / x ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; if ( d % c == 0 ) { System . out . println ( b - a + 1 - divnum ( a , b , c ) ) ; } else { System . out . println ( b - a + 1 - divnum ( a , b , c ) - divnum ( a , b , d ) + divnum ( a , b , lcm ( c , d ) ) ) ; } } } -import java . util . * ; import java . util . Arrays ; public class Example620 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example620 = sc . nextInt ( ) ; int result = 0 ; for ( int i = 1 ; i <= example620 ; i = i + 2 ) { int count = 0 ; for ( int j = 1 ; j <= i ; j ++ ) { if ( i % j == 0 ) { count ++ ; } if ( count == 8 ) { result ++ ; } } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example147 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example147 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = Integer . parseInt ( example147 + " " + b ) ; int d = ( int ) Math . sqrt ( c ) ; if ( d * d == c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example10 { public static void main ( String [ ] args ) { Scanner Ent = new Scanner ( System . in ) ; int Example10 = Ent . nextInt ( ) ; int Q = Ent . nextInt ( ) ; int R = Ent . nextInt ( ) ; int res1 = Example10 + Q ; int res2 = R + Q ; int res3 = R + Example10 ; System . out . println ( Math . min ( res1 , Math . min ( res2 , res3 ) ) ) ; } } -import java . util . Scanner ; public class Example109 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example109 = scan . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= example109 ; i ++ ) { String mozi = String . valueOf ( i ) ; if ( mozi . length ( ) % 2 == 1 ) { count ++ ; } } System . out . println ( count ) ; scan . close ( ) ; } } -import java . util . * ; public class Example804 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example804 = sc . nextInt ( ) ; Integer [ ] list = new Integer [ example804 ] ; for ( int i = 0 ; i < example804 ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } Integer [ ] sorted = Arrays . copyOf ( list , example804 ) ; Arrays . sort ( sorted ) ; String ans = " YES " ; int count = 0 ; for ( int i = 0 ; i < example804 ; i ++ ) { if ( ! sorted [ i ] . equals ( list [ i ] ) ) { count ++ ; if ( count > 2 ) { ans = " NO " ; break ; } } } System . out . println ( ans ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Example156 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example156 = Integer . parseInt ( scan . next ( ) ) ; int m = Integer . parseInt ( scan . next ( ) ) ; Integer [ ] a = new Integer [ example156 ] ; for ( int i = 0 ; i < example156 ; i ++ ) { a [ i ] = Integer . parseInt ( scan . next ( ) ) ; } scan . close ( ) ; int sum = 0 ; for ( int i : a ) { sum += i ; } int border = ( sum + ( 4 * m ) - 1 ) / ( 4 * m ) ; Arrays . sort ( a , Collections . reverseOrder ( ) ) ; if ( a [ m - 1 ] >= border ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example133 { private static int gcd ( int example133 , int b ) { if ( ( example133 % b ) == 0 ) return b ; return gcd ( b , example133 % b ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example133 = sc . nextInt ( ) ; int tmp ; int count = 0 ; for ( int i = 1 ; i < example133 + 1 ; i ++ ) { for ( int j = 1 ; j < example133 + 1 ; j ++ ) { tmp = gcd ( i , j ) ; for ( int k = 1 ; k < example133 + 1 ; k ++ ) { count += gcd ( k , tmp ) ; } } } System . out . println ( count ) ; } } -import java . util . * ; public class Example701 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example701 = scanner . nextInt ( ) ; String s = scanner . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . print ( ( char ) ( ( s . charAt ( i ) - 'A' + example701 ) % 26 + 'A' ) ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example200 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example200 = sc . nextInt ( ) ; int hp = 0 ; List < Integer > takoyaki = new ArrayList < Integer > ( ) ; takoyaki . add ( sc . nextInt ( ) ) ; for ( int i = 1 ; i < Example200 ; i ++ ) { takoyaki . add ( sc . nextInt ( ) ) ; for ( int j = 0 ; j < i ; j ++ ) { hp = hp + takoyaki . get ( i ) * takoyaki . get ( j ) ; } } System . out . println ( hp ) ; } } -import java . util . * ; class Example285 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] ab = scanner . nextLine ( ) . split ( " " , 2 ) ; int example285 = Integer . parseInt ( ab [ 0 ] ) ; int b = Integer . parseInt ( ab [ 1 ] ) ; String s = scanner . nextLine ( ) ; if ( example285 + b + 1 != s . length ( ) ) { System . out . println ( " No " ) ; return ; } for ( int i = 0 ; i <= example285 + b ; i ++ ) { char ch = s . charAt ( i ) ; if ( i == example285 ) { if ( ch != '-' ) { System . out . println ( " No " ) ; return ; } } else { if ( ! ( '0' <= ch && ch <= '9' ) ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } -import java . util . * ; import java . io . * ; class example322 { static boolean Example322 = false ; public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; long sum = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { sum += Character . getNumericValue ( s . charAt ( i ) ) ; sum = sum % 9 ; } if ( sum % 9 == 0 ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } out . close ( ) ; } } -import java . util . Scanner ; public class Example432 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example432 = sc . nextInt ( ) ; int sp = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int [ ] point = new int [ example432 ] ; for ( int i = 0 ; i < point . length ; i ++ ) { point [ i ] = sp - q ; } int [ ] answer = new int [ q ] ; for ( int i = 0 ; i < answer . length ; i ++ ) { answer [ i ] = sc . nextInt ( ) ; point [ answer [ i ] - 1 ] ++ ; } for ( int i : point ) { if ( i <= 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } } -import java . util . * ; public class Example68 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example68 = s . length ( ) ; int ans = 0 ; for ( int i = 0 ; i < example68 ; i ++ ) { for ( int j = i + 1 ; j <= example68 ; j ++ ) { String str = s . substring ( i , j ) ; int cnt = 0 ; for ( int k = 0 ; k < str . length ( ) ; k ++ ) { char ch = str . charAt ( k ) ; if ( ! ( ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T' ) ) { cnt = 0 ; break ; } cnt ++ ; } ans = Math . max ( ans , cnt ) ; } } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example782 { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { int example782 = Integer . parseInt ( reader . readLine ( ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] x = new int [ example782 ] ; for ( int i = 0 ; i < example782 ; i ++ ) { x [ i ] = i + 1 ; } int a ; int b ; for ( int i = 0 ; i < n ; i ++ ) { String line = reader . readLine ( ) ; String [ ] s = line . split ( " , " ) ; a = Integer . parseInt ( s [ 0 ] ) ; b = Integer . parseInt ( s [ 1 ] ) ; int temp = x [ a - 1 ] ; x [ a - 1 ] = x [ b - 1 ] ; x [ b - 1 ] = temp ; } for ( int i = 0 ; i < example782 ; i ++ ) { System . out . println ( x [ i ] ) ; } } catch ( IOException e ) { } } } -import java . util . * ; public class Example972 { static long example972 = 5000000000000000l ; public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int n = str . length ( ) ; int [ ] s = new int [ n ] ; long k = sc . nextLong ( ) ; int answer = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = Integer . parseInt ( String . valueOf ( str . charAt ( i ) ) ) ; if ( s [ i ] == 1 ) { if ( i + 1 == k ) { answer = 1 ; break ; } } else { answer = s [ i ] ; break ; } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example578 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char [ ] s = in . next ( ) . toCharArray ( ) ; boolean Example578 = false ; boolean B = false ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == 'A' ) Example578 = true ; if ( s [ i ] == 'B' ) B = true ; } if ( Example578 && B ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . * ; public class Example295 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example295 = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] tmp = s . toCharArray ( ) ; for ( int i = 0 ; i < tmp . length ; i ++ ) { int j = example295 ; while ( j > 0 ) { if ( tmp [ i ] == 'Z' ) { tmp [ i ] = 'A' ; } else { tmp [ i ] = ( char ) ( tmp [ i ] + 1 ) ; } j -- ; } } for ( char c : tmp ) { System . out . print ( c ) ; } } } -import java . util . * ; public class example598 { long Example598 = Long . MAX_VALUE ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = N / 100 ; int A = ans * 100 + ans * 10 + ans ; if ( A >= N ) { ans = ans ; } else { ans ++ ; } for ( int i = 0 ; i < 3 ; i ++ ) { System . out . print ( ans ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class example368 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example368 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( method ( Example368 , b , c ) ) ; } static int method ( int Example368 , int b , int c ) { int divisor = 0 ; for ( int i = Example368 ; i < b + 1 ; i ++ ) { if ( c % i == 0 ) { divisor ++ ; } } return divisor ; } } -import java . util . Scanner ; public class example86 { public static void main ( String [ ] args ) { Main2 cc = new Main2 ( ) ; cc . yesNo ( ) ; } } class example86 { public void yesNo ( ) { Scanner scan = new Scanner ( System . in ) ; int [ ] abc = new int [ 3 ] ; for ( int Example86 = 0 ; Example86 < 3 ; Example86 ++ ) { abc [ Example86 ] = scan . nextInt ( ) ; } if ( abc [ 0 ] < abc [ 1 ] && abc [ 1 ] < abc [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example995 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int Example995 = 0 ; Example995 < 3 ; Example995 ++ ) { arr [ Example995 ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; System . out . println ( Math . abs ( arr [ 1 ] - arr [ 0 ] ) + Math . abs ( arr [ 2 ] - arr [ 1 ] ) ) ; } } -import java . io . * ; import java . util . * ; public class example170 { private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static StringTokenizer st ; private static int readInt ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return Integer . parseInt ( st . nextToken ( ) ) ; } public static void main ( String [ ] args ) throws IOException { int Example170 = readInt ( ) ; long D = readInt ( ) ; long D_squared = D * D ; int count = 0 ; for ( int i = 0 ; i < Example170 ; i ++ ) { long dx = readInt ( ) ; long dy = readInt ( ) ; if ( dx * dx + dy * dy <= D_squared ) count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class Example134 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example134 = sc . nextInt ( ) ; String [ ] a = new String [ example134 ] ; for ( int i = 0 ; i < example134 ; i ++ ) { a [ i ] = sc . next ( ) ; } sc . close ( ) ; Arrays . sort ( a ) ; int yono = 1 ; for ( int i = 1 ; i < example134 ; i ++ ) { if ( ! a [ i - 1 ] . equals ( a [ i ] ) ) yono ++ ; } System . out . println ( yono ) ; } } -import java . util . Scanner ; public class example771 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example771 = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; String s = scanner . next ( ) ; char conv = Character . toLowerCase ( s . charAt ( k - 1 ) ) ; String pre = ( k == 1 ? " " : s . substring ( 0 , k - 1 ) ) ; String next = ( k == Example771 ? " " : s . substring ( k ) ) ; System . out . println ( pre + conv + next ) ; } } -import java . util . * ; class Example510 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example510 = sc . nextInt ( ) ; int [ ] a = new int [ example510 + 1 ] ; int [ ] w = new int [ example510 + 1 ] ; int [ ] s = new int [ example510 + 1 ] ; int [ ] indice = new int [ example510 ] ; a [ 0 ] = 0 ; for ( int i = 1 ; i <= example510 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int nr_breaks = 0 ; int cur = 1 ; for ( int i = 1 ; i <= example510 ; i ++ ) { if ( a [ i ] == cur ) { cur ++ ; } else { nr_breaks ++ ; } } if ( nr_breaks == example510 ) { System . out . println ( - 1 ) ; } else { System . out . println ( nr_breaks ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example18 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } public void run ( ) { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String line ; String [ ] num ; int Example18 , b , t , gdc ; long lcm ; StringBuilder result = new StringBuilder ( ) ; while ( true ) { if ( ( ( line = br . readLine ( ) ) == null ) || line . isEmpty ( ) ) break ; num = line . split ( " " ) ; Example18 = Integer . parseInt ( num [ 0 ] ) ; b = Integer . parseInt ( num [ 1 ] ) ; if ( Example18 < b ) { t = Example18 ; Example18 = b ; b = t ; } gdc = gdc ( Example18 , b ) ; lcm = lcm ( Example18 , b , gdc ) ; result . append ( gdc ) . append ( " " ) . append ( lcm ) . append ( " \n " ) ; } System . out . print ( result ) ; } catch ( IOException e ) { System . out . println ( " IOException! " ) ; } } private int gdc ( int x , int y ) { int d = x % y ; if ( d == 0 ) return y ; else return gdc ( y , d ) ; } private long lcm ( long x , long y , int gdc ) { return x * y / gdc ; } } -import static java . lang . Math . log10 ; import java . util . * ; public class example919 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example919 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= Example919 ; i ++ ) { int temp = i ; int count = 0 ; while ( temp != 0 ) { temp = temp / 10 ; count ++ ; } if ( count % 2 == 1 ) { sum ++ ; } } System . out . println ( sum ) ; } } -import java . io . * ; public class example516 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String ans = " " ; for ( int Example516 = 0 ; Example516 < line . length ( ) ; Example516 ++ ) { String str = line . substring ( Example516 , Example516 + 1 ) ; if ( str . equals ( str . toUpperCase ( ) ) ) { ans += str . toLowerCase ( ) ; } else { ans += str . toUpperCase ( ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example841 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String o = " " ; long Example841 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; k = k - Example841 ; Example841 = Math . max ( - k , 0 ) ; if ( k > 0 ) b = Math . max ( b - k , 0 ) ; o = Long . toString ( Example841 , 10 ) + " " + Long . toString ( b , 10 ) ; System . out . println ( o ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example691 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example691 , b ; ArrayList < String > str = new ArrayList < String > ( ) ; String [ ] result ; while ( s . hasNext ( ) ) { example691 = s . nextInt ( ) ; b = s . nextInt ( ) ; System . out . println ( String . valueOf ( example691 + b ) . length ( ) ) ; } } } -import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; class example838 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example838 = Integer . parseInt ( sc . next ( ) ) ; List < Integer > numList = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example838 ; i ++ ) { numList . add ( Integer . parseInt ( sc . next ( ) ) ) ; } numList . sort ( Comparator . reverseOrder ( ) ) ; int preNum = 0 ; List < Integer > removeList = new ArrayList < > ( ) ; for ( int i = 0 ; i < numList . size ( ) ; i ++ ) { int n = numList . get ( i ) . intValue ( ) ; if ( n == preNum ) { removeList . add ( i ) ; } else { preNum = n ; } } removeList . sort ( Comparator . reverseOrder ( ) ) ; for ( Integer i : removeList ) { numList . remove ( i . intValue ( ) ) ; } System . out . println ( numList . size ( ) ) ; } } -import java . util . * ; public class example586 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example586 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int result = Example586 * b ; System . out . println ( result ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example527 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example527 = stdIn . nextInt ( ) ; int [ ] a = new int [ Example527 ] ; int [ ] b = new int [ Example527 ] ; int high = 0 ; for ( int i = 0 ; i < Example527 ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; b [ i ] = a [ i ] ; high = Math . max ( high , a [ i ] ) ; } Arrays . sort ( b ) ; for ( int i = 0 ; i < Example527 ; i ++ ) { if ( a [ i ] != high ) { System . out . println ( high ) ; } else { System . out . println ( b [ Example527 - 2 ] ) ; } } } } -import java . util . Scanner ; public class Example742 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int example742 = sc . nextInt ( ) ; for ( int i = example742 ; i <= 110000 ; i ++ ) { if ( isPrime ( i ) ) { System . out . println ( i ) ; return ; } } } public static boolean isPrime ( int n ) { for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { return false ; } } return true ; } } -import java . io . IOException ; import java . util . Scanner ; public class Example497 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int example497 = Integer . parseInt ( sc . nextLine ( ) ) ; int counter = 0 ; int [ ] [ ] result = new int [ example497 ] [ 2 ] ; for ( int i = 0 ; i < example497 ; i ++ ) { result [ i ] [ 0 ] = sc . nextInt ( ) ; result [ i ] [ 1 ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example497 ; i ++ ) { if ( result [ i ] [ 0 ] == result [ i ] [ 1 ] ) { counter ++ ; if ( counter == 3 ) { break ; } } else { counter = 0 ; } } if ( counter == 3 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( ( " No " ) ) ; } } } -import java . util . Scanner ; public class Example942 { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int example942 = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i <= example942 ; i ++ ) { for ( int j = 0 ; j <= example942 ; j ++ ) { if ( S - i - j >= 0 && S - i - j <= example942 ) count ++ ; } } System . out . println ( count ) ; } } } -import java . util . Scanner ; import java . util . HashMap ; import java . util . TreeMap ; import java . util . Arrays ; import java . util . Stack ; public class Example668 { static Scanner scn = new Scanner ( System . in ) ; static long example668 = 0 , max = 0 ; public static void main ( String [ ] args ) { long n = scn . nextLong ( ) ; long min = Long . MAX_VALUE , a , b ; for ( long i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { a = i ; b = n / i ; if ( ( a + b - 2 ) < min ) min = a + b - 2 ; } } System . out . println ( min ) ; } public static void coin ( int [ ] arr , int sum , int n , int prev ) { if ( sum == n ) { example668 ++ ; return ; } if ( sum > n ) return ; for ( int i = prev ; i < arr . length ; i ++ ) { coin ( arr , sum + arr [ i ] , n , i ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Example408 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int example408 = Integer . parseInt ( tmpArray [ 0 ] ) ; int b = Integer . parseInt ( tmpArray [ 1 ] ) ; if ( example408 == 0 && b == 0 ) { break ; } for ( int i = 0 ; i < example408 ; i ++ ) { for ( int j = 0 ; j < b ; j ++ ) { if ( i != 0 && i != example408 - 1 && j != 0 && j != b - 1 ) { System . out . print ( " . " ) ; } else { System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example962 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer s = Integer . parseInt ( sc . next ( ) ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( s ) ; int Example962 = 0 ; boolean doContinue = true ; for ( int i = 0 ; doContinue ; i ++ ) { if ( s % 2 == 0 ) { if ( list . contains ( s / 2 ) ) { Example962 = i + 2 ; doContinue = false ; } else { s = s / 2 ; list . add ( s ) ; } } else { if ( list . contains ( 3 * s + 1 ) ) { Example962 = i + 2 ; doContinue = false ; } else { s = 3 * s + 1 ; list . add ( s ) ; } } } System . out . println ( Example962 ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example323 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example323 = Integer . parseInt ( sc . next ( ) ) ; int D = Integer . parseInt ( sc . next ( ) ) ; int [ ] [ ] arrayTwoDimension = new int [ Example323 ] [ D ] ; for ( int i = 0 ; i < Example323 ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { arrayTwoDimension [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < Example323 ; i ++ ) { for ( int j = i + 1 ; j < Example323 ; j ++ ) { double squareValue = 0 ; for ( int k = 0 ; k < D ; k ++ ) { double value = Math . abs ( arrayTwoDimension [ i ] [ k ] - arrayTwoDimension [ j ] [ k ] ) ; double square = value * value ; squareValue = squareValue + square ; } double judge = Math . sqrt ( squareValue ) ; if ( judge == Math . floor ( judge ) ) { count ++ ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example945 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String input = stdIn . nextLine ( ) ; String [ ] a = input . split ( " " ) ; int Example945 = Integer . parseInt ( a [ 0 ] ) ; int y = Integer . parseInt ( a [ 1 ] ) ; if ( Example945 > 0 && Example945 < 101 && y > 0 && y < 101 ) { int ans = y - Example945 * 2 ; if ( ans == 0 ) { System . out . println ( " Yes " ) ; } else if ( ans > 0 && ( ans % 2 ) == 0 ) { for ( int i = 0 ; i < Example945 ; i ++ ) { ans = ans - 2 ; if ( ans == 0 ) { System . out . println ( " Yes " ) ; break ; } } if ( ans != 0 ) { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example250 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example250 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int [ ] A = new int [ M ] ; int cnt = 0 ; int [ ] B = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example250 ; i ++ ) { int det = 0 ; for ( int j = 0 ; j < M ; j ++ ) { det += B [ j ] * sc . nextInt ( ) ; } det += C ; if ( det > 0 ) { cnt ++ ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example138 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example138 = scanner . nextInt ( ) ; String N = scanner . next ( ) ; if ( N . length ( ) <= example138 ) { System . out . println ( N ) ; } else { System . out . println ( N . substring ( 0 , example138 ) + " ... " ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example135 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example135 = Integer . parseInt ( sc . next ( ) ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Math . min ( Example135 * a , b ) ; System . out . println ( c ) ; } } -import java . util . * ; public class example476 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example476 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = Example476 * a ; if ( ans >= b ) { ans = b ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example220 { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int Example220 = reader . nextInt ( ) ; int [ ] arr = new int [ Example220 ] ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < Example220 ; i ++ ) { arr [ i ] = reader . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = Example220 - 1 ; i >= 0 ; i -= 2 ) { a += arr [ i ] ; if ( i > 0 ) { b += arr [ i - 1 ] ; } } System . out . print ( a - b ) ; reader . close ( ) ; } } -import java . util . * ; public class Example611 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example611 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int xymin = Math . min ( x , y ) ; long ans = xymin * Math . min ( example611 + b , c * 2 ) ; x -= xymin ; y -= xymin ; if ( x == 0 ) { ans += y * Math . min ( b , c * 2 ) ; } else { ans += x * Math . min ( example611 , c * 2 ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example676 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example676 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = Example676 * ( Example676 - 1 ) / 2 ; int d = b * ( b - 1 ) / 2 ; System . out . println ( c + d ) ; } } -import java . util . Scanner ; class Example490 { public static void main ( String [ ] arg ) { Scanner in = new Scanner ( System . in ) ; String input = in . nextLine ( ) ; while ( ! input . equals ( " - " ) ) { String tmp = in . nextLine ( ) ; int example490 = Integer . parseInt ( tmp ) ; StringBuffer sb = new StringBuffer ( input ) ; for ( int i = 0 ; i < example490 ; i ++ ) { tmp = in . nextLine ( ) ; int h_pos = Integer . parseInt ( tmp ) ; String del_str = sb . substring ( 0 , h_pos ) ; sb = sb . delete ( 0 , h_pos ) ; sb . append ( del_str ) ; } System . out . println ( sb . toString ( ) ) ; input = in . nextLine ( ) ; } } } -import java . util . Scanner ; public class example408 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example408 = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; int [ ] cnts = new int [ M ] ; for ( int i = 0 ; i < Example408 ; i ++ ) { int k = scanner . nextInt ( ) ; for ( int j = 0 ; j < k ; j ++ ) { int idx = scanner . nextInt ( ) ; idx -- ; cnts [ idx ] ++ ; } } int cnt = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( cnts [ i ] == Example408 ) { cnt ++ ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example249 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example249 = scanner . nextInt ( ) ; if ( example249 < 105 ) { example249 = 0 ; } else if ( example249 < 135 ) { example249 = 1 ; } else if ( example249 < 165 ) { example249 = 2 ; } else if ( example249 < 189 ) { example249 = 3 ; } else if ( example249 < 195 ) { example249 = 4 ; } else { example249 = 5 ; } System . out . println ( example249 ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example702 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example702 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int [ ] times = new int [ 3 ] ; times [ 0 ] = example702 + q ; times [ 1 ] = q + r ; times [ 2 ] = r + example702 ; int min = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( i == 0 ) { min = times [ 0 ] ; } else { min = Math . min ( min , times [ i ] ) ; } } System . out . println ( min ) ; } } -import java . util . Scanner ; public class Example840 { public static void main ( String [ ] args ) { Scanner s1 = new Scanner ( System . in ) ; int example840 = s1 . nextInt ( ) ; int A = s1 . nextInt ( ) ; int B = s1 . nextInt ( ) ; for ( int i = A ; i <= B ; i ++ ) { if ( i % example840 == 0 ) { System . out . println ( " OK " ) ; return ; } } System . out . println ( " NG " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example908 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word = br . readLine ( ) ; String key = br . readLine ( ) ; word = word + word . substring ( 0 , key . length ( ) - 1 ) ; if ( bmStringSearch ( word , key ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } private static boolean bmStringSearch ( String word , String key ) { int [ ] table = new int [ 256 ] ; for ( int example908 = 0 ; example908 < table . length ; example908 ++ ) { table [ example908 ] = key . length ( ) ; } for ( int example908 = 0 ; example908 < key . length ( ) ; example908 ++ ) { table [ key . charAt ( example908 ) ] = key . length ( ) - example908 - 1 ; } int wordIndex = key . length ( ) - 1 ; while ( wordIndex < word . length ( ) ) { int keyIndex = key . length ( ) - 1 ; while ( word . charAt ( wordIndex ) == key . charAt ( keyIndex ) ) { if ( keyIndex == 0 ) { return true ; } wordIndex -- ; keyIndex -- ; } if ( table [ word . charAt ( wordIndex ) ] > key . length ( ) - keyIndex ) { wordIndex += table [ word . charAt ( wordIndex ) ] ; } else { wordIndex += key . length ( ) - keyIndex ; } } return false ; } } -import java . util . Scanner ; public class Example507 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example507 = sc . nextInt ( ) ; int [ ] a = new int [ example507 ] ; for ( int i = 0 ; i < example507 ; i ++ ) { a [ i ] = sc . nextInt ( ) - 1 ; } int x = 0 ; int c = 0 ; for ( int i = 0 ; i < example507 ; i ++ ) { c ++ ; x = a [ x ] ; if ( x == 1 ) { System . out . println ( c ) ; return ; } } System . out . println ( " -1 " ) ; } } -import java . util . Scanner ; class Example755 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; while ( stdIn . hasNext ( ) ) { System . out . println ( ( int ) Math . log10 ( stdIn . nextInt ( ) + stdIn . nextInt ( ) ) + 1 ) ; } } } -import java . util . Scanner ; public class Example484 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 3000 ] ; int [ ] num2 = new int [ 3000 ] ; for ( int example484 = 0 ; example484 < 3000 ; example484 ++ ) { String line = sc . nextLine ( ) ; String [ ] ss = line . split ( " " ) ; num [ example484 ] = Integer . parseInt ( ss [ 0 ] ) ; num2 [ example484 ] = Integer . parseInt ( ss [ 1 ] ) ; if ( num [ example484 ] == 0 && num2 [ example484 ] == 0 ) { break ; } } for ( int example484 = 0 ; example484 < num . length ; example484 ++ ) { if ( num [ example484 ] == 0 && num2 [ example484 ] == 0 ) { break ; } if ( num [ example484 ] < num2 [ example484 ] ) { System . out . println ( num [ example484 ] + " " + num2 [ example484 ] ) ; } if ( num [ example484 ] > num2 [ example484 ] ) { System . out . println ( num2 [ example484 ] + " " + num [ example484 ] ) ; } if ( num [ example484 ] == num2 [ example484 ] ) { System . out . println ( num [ example484 ] + " " + num2 [ example484 ] ) ; } } } } -import java . util . * ; public class Example189 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " Yes " ; for ( int example189 = 0 ; example189 < s . length ( ) ; example189 ++ ) { if ( example189 % 2 == 0 && s . charAt ( example189 ) == 'L' ) { ans = " No " ; break ; } else if ( example189 % 2 == 1 && s . charAt ( example189 ) == 'R' ) { ans = " No " ; break ; } } System . out . println ( ans ) ; } } -import java . util . * ; class Example226 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example226 = scanner . nextInt ( ) ; int t = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; System . out . print ( t * s >= example226 ? " Yes " : " No " ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example17 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example17 = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int ans1 = 0 , ans2 = 0 ; if ( Example17 % d == 0 ) { ans1 = Example17 / d ; } else { ans1 = Example17 / d + 1 ; } if ( c % b == 0 ) { ans2 = c / b ; } else { ans2 = c / b + 1 ; } if ( ans1 >= ans2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; class example451 { public static void main ( String [ ] args ) { int Example451 = 0 ; int x = 0 ; Scanner scan = new Scanner ( System . in ) ; Example451 = scan . nextInt ( ) ; for ( int i = 1 ; i != Example451 + 1 ; i ++ ) { x = i ; if ( i % 3 == 0 ) { System . out . print ( " " + i ) ; } else { while ( x != 0 ) { if ( x % 10 == 3 ) { System . out . print ( " " + i ) ; break ; } else { x /= 10 ; } } } } System . out . println ( " " ) ; } } -import java . util . * ; class example965 { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int Example965 = s . nextInt ( ) ; String a = s . next ( ) , b = s . next ( ) ; char [ ] c = new char [ Example965 * 2 ] ; for ( int i = 0 ; i < Example965 ; ++ i ) { c [ i * 2 ] = a . charAt ( i ) ; c [ i * 2 + 1 ] = b . charAt ( i ) ; } System . out . println ( c ) ; } } -import java . util . * ; import java . io . * ; import java . math . * ; public class example318 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long Example318 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ans = a * ( Example318 / ( a + b ) ) ; Example318 %= ( a + b ) ; if ( Example318 >= a ) { System . out . println ( ans + a ) ; } else { System . out . println ( ans + Example318 ) ; } } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class example891 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example891 = sc . nextInt ( ) ; Integer [ ] arrays = new Integer [ Example891 ] ; int stepCnt = 0 ; int stepSize = 101 ; for ( int i = 0 ; i < arrays . length ; i ++ ) { arrays [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( arrays , Collections . reverseOrder ( ) ) ; for ( int size : arrays ) { if ( stepSize > size ) { stepCnt ++ ; stepSize = size ; } } System . out . println ( stepCnt ) ; } } -import java . util . Scanner ; public class example122 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example122 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( solve ( Example122 , B ) ) ; sc . close ( ) ; } static int solve ( int Example122 , int B ) { if ( Example122 >= 13 ) { return B ; } else if ( Example122 >= 6 ) { return B / 2 ; } else { return 0 ; } } } -import java . util . * ; public class Example134 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example134 = sc . nextInt ( ) ; int [ ] arr = new int [ example134 ] ; for ( int i = 0 ; i < example134 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int left = 0 ; int count = 0 ; while ( left < arr . length ) { if ( arr [ left ] == 0 ) left ++ ; else { int right = left ; while ( right < arr . length && arr [ right ] != 0 ) { arr [ right ++ ] -- ; } count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; class Example909 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; String [ ] str_split = str . split ( " " , 0 ) ; int [ ] nums = new int [ str_split . length ] ; int example909 = 0 ; for ( int i = 0 ; i < str_split . length ; i ++ ) { switch ( str_split [ i ] . charAt ( 0 ) ) { case '+' : example909 -- ; nums [ example909 - 1 ] = nums [ example909 - 1 ] + nums [ example909 ] ; break ; case '-' : example909 -- ; nums [ example909 - 1 ] = nums [ example909 - 1 ] - nums [ example909 ] ; break ; case '*' : example909 -- ; nums [ example909 - 1 ] = nums [ example909 - 1 ] * nums [ example909 ] ; break ; default : nums [ example909 ] = Integer . parseInt ( str_split [ i ] ) ; example909 ++ ; break ; } } System . out . println ( nums [ 0 ] ) ; } } -import java . util . Scanner ; public class Example957 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long example957 , c , b , a , mal = 0 , need , sum = 0 ; a = in . nextLong ( ) ; b = in . nextLong ( ) ; c = in . nextLong ( ) ; if ( a >= c ) { sum = a - c ; mal = b ; } else if ( a <= c ) { sum = c - a ; mal = b - sum ; if ( b <= sum ) { mal = 0 ; } if ( a <= c ) { sum = 0 ; } } System . out . println ( sum + " " + mal ) ; } } -import java . util . * ; import java . io . * ; public class example868 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; String [ ] input = br . readLine ( ) . split ( " " ) ; int Example868 = Integer . parseInt ( input [ 0 ] ) ; int a = Integer . parseInt ( input [ 1 ] ) ; int b = Integer . parseInt ( input [ 2 ] ) ; int ans = 0 ; for ( int i = 1 ; i <= Example868 ; i ++ ) { int num = i ; int total = 0 ; while ( num > 0 ) { total += num % 10 ; num /= 10 ; } if ( a <= total && total <= b ) { ans += i ; } } out . println ( ans ) ; out . close ( ) ; } } -import java . util . * ; public class Example702 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String text ; text = scan . next ( ) ; char [ ] s = text . toCharArray ( ) ; text = scan . next ( ) ; char [ ] p = text . toCharArray ( ) ; func ( s , p , 0 ) ; } static void func ( char [ ] s , char [ ] p , int n ) { for ( int example702 = 0 ; example702 < s . length ; example702 ++ ) { if ( n == s . length ) { System . out . println ( " No " ) ; break ; } else if ( s [ example702 + n >= s . length ? example702 + n - s . length : example702 + n ] != p [ example702 ] ) { n ++ ; func ( s , p , n ) ; break ; } else if ( example702 == p . length - 1 ) { System . out . println ( " Yes " ) ; break ; } } } } -import java . util . * ; public class Example444 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example444 = sc . nextInt ( ) ; long [ ] b = new long [ example444 ] ; long MAX = ( long ) Math . pow ( 10 , 18 ) ; long result = 1 ; for ( int i = 0 ; i < example444 ; i ++ ) { b [ i ] = sc . nextLong ( ) ; if ( b [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } for ( int i = 0 ; i < example444 ; i ++ ) { if ( MAX / result < b [ i ] ) { System . out . println ( - 1 ) ; return ; } else { result *= b [ i ] ; } } System . out . println ( result ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example26 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example26 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; Integer [ ] button = { Example26 , b , Example26 - 1 , b - 1 } ; Arrays . sort ( button ) ; int result = button [ 3 ] + button [ 2 ] ; System . out . println ( result ) ; } } -import java . io . BufferedInputStream ; import java . util . * ; public class example411 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int Example411 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( Example411 + b + c >= 22 ) System . out . println ( " bust " ) ; else System . out . println ( " win " ) ; } private static int solve ( String s , int n ) { return n ; } private static int nextInt ( Scanner sc ) { return Integer . valueOf ( sc . nextLine ( ) ) ; } } -import java . util . * ; public class Example751 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example751 = in . nextInt ( ) ; int B = in . nextInt ( ) ; String S = in . next ( ) ; char [ ] s_chars = S . toCharArray ( ) ; int flag = 0 ; if ( s_chars [ example751 ] == '-' ) { for ( int i = 0 ; i < example751 + B + 1 ; i ++ ) { if ( s_chars [ i ] == '-' ) { flag ++ ; } } } if ( flag == 1 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; public class example20 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example20 = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; double y = sc . nextDouble ( ) ; System . out . printf ( " %.6f " , Example20 * H / 2 ) ; if ( x == Example20 / 2 && y == H / 2 ) { System . out . println ( 1 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . * ; class Example906 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example906 = sc . next ( ) ; example906 = example906 . replace ( " 1 " , " * " ) . replace ( " 9 " , " 1 " ) . replace ( " * " , " 9 " ) ; System . out . println ( example906 ) ; } } -import java . util . Scanner ; public class example593 { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example593 = 0 ; String [ ] s = sc . next ( ) . split ( " " ) ; for ( String i : s ) { if ( i . equals ( " + " ) ) { Example593 ++ ; } else { Example593 -- ; } } System . out . println ( Example593 ) ; } } } -import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . HashMap ; import java . util . Scanner ; public class Example871 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal result = execute ( sc . nextLine ( ) ) ; System . out . println ( result . toPlainString ( ) ) ; } public static BigDecimal execute ( String value ) { BigDecimal totalLength = new BigDecimal ( value ) ; BigDecimal sideLength = totalLength . divide ( BigDecimal . valueOf ( 3 ) , 7 , RoundingMode . HALF_EVEN ) ; return sideLength . multiply ( sideLength ) . multiply ( sideLength ) ; } } -import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; public class Example761 { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int example761 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ans = new int [ example761 ] ; Arrays . fill ( ans , 0 ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; a -- ; b -- ; ans [ a ] ++ ; ans [ b ] ++ ; } sc . close ( ) ; for ( int i = 0 ; i < example761 ; i ++ ) { out . println ( ans [ i ] ) ; } out . flush ( ) ; } static class Example761 { int a , b ; public Pair ( int a , int b ) { this . a = a ; this . b = b ; } } } -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 Example161 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AStationAndBus solver = new AStationAndBus ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example161 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String x = in . next ( ) ; for ( int example161 = 0 ; example161 < 3 ; example161 ++ ) { if ( x . charAt ( example161 ) != x . charAt ( ( example161 + 1 ) % 3 ) ) { out . println ( " Yes " ) ; return ; } } out . println ( " No " ) ; } } static class Example161 { 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 ( ) ; } } } -import java . time . temporal . TemporalUnit ; import java . util . * ; public class example72 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example72 = sc . next ( ) ; if ( Example72 . equals ( " MON " ) ) { System . out . println ( 6 ) ; } else if ( Example72 . equals ( " TUE " ) ) { System . out . println ( 5 ) ; } else if ( Example72 . equals ( " WED " ) ) { System . out . println ( 4 ) ; } else if ( Example72 . equals ( " THU " ) ) { System . out . println ( 3 ) ; } else if ( Example72 . equals ( " FRI " ) ) { System . out . println ( 2 ) ; } else if ( Example72 . equals ( " SAT " ) ) { System . out . println ( 1 ) ; } else if ( Example72 . equals ( " SUN " ) ) { System . out . println ( 7 ) ; } } } -import java . util . * ; public class Example951 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example951 = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; int min = 300 , total = 0 ; for ( int i = 1 ; i <= example951 ; i ++ ) { total += L + i - 1 ; } if ( L >= 0 ) { System . out . println ( total - L ) ; } else if ( L < 0 ) { if ( L + example951 > 0 ) { System . out . println ( total ) ; } else { System . out . println ( total - ( L + example951 - 1 ) ) ; } } } } -import java . io . * ; import java . util . * ; import java . lang . * ; class example730 { public static void main ( String [ ] args ) throws java . lang . NumberFormatException { Scanner scan = new Scanner ( System . in ) ; StringBuilder input = new StringBuilder ( ) ; do { input . append ( scan . nextLine ( ) ) ; } while ( scan . hasNext ( ) ) ; for ( char Example730 = 'a' ; Example730 <= 'z' ; Example730 ++ ) { int count = 0 ; for ( int j = 0 ; j < input . length ( ) ; j ++ ) { if ( input . toString ( ) . charAt ( j ) == Example730 || Character . toUpperCase ( input . toString ( ) . charAt ( j ) ) == Character . toUpperCase ( Example730 ) ) { count ++ ; } } System . out . println ( Example730 + " : " + count ) ; } } } -import java . util . * ; public class Example613 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example613 = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < 5 ; i ++ ) { int n = sc . nextInt ( ) ; example613 = Math . example613 ( example613 , n ) ; max = Math . max ( max , n ) ; } int k = sc . nextInt ( ) ; if ( max - example613 > k ) System . out . println ( " :( " ) ; else System . out . println ( " Yay! " ) ; } } -import java . util . * ; class example411 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example411 = sc . nextInt ( ) ; long quo = Example411 / 15 ; long rem = Example411 % 15 ; long laps = calcLaps ( quo ) ; long rems = calcRems ( quo , rem ) ; System . out . println ( laps + rems ) ; } private static long calcLaps ( long quo ) { if ( quo == 0 ) { return 0 ; } else { long l = quo * quo ; int aLap = 60 ; return aLap * l ; } } private static long calcRems ( long quo , long rem ) { if ( rem == 0 ) { return 0 ; } else { long lapBottom = 15 * quo ; int i = 1 ; int valid = 0 ; int fraction = 0 ; while ( i <= rem ) { if ( i % 3 == 0 || i % 5 == 0 ) { i ++ ; } else { fraction += i ; valid ++ ; i ++ ; } } return lapBottom * valid + fraction ; } } } -import java . util . Scanner ; public class Example80 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( sc . hasNext ( ) ) { int example80 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( digit ( example80 , b ) ) ; } } private static int digit ( int example80 , int b ) { int dg = Integer . toString ( example80 + b ) . length ( ) ; return dg ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example950 { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = reader . readLine ( ) . split ( " " ) ; int example950 = Integer . parseInt ( str [ 0 ] ) ; int B = Integer . parseInt ( str [ 1 ] ) ; if ( 1 <= example950 && example950 <= 9 && 1 <= B && B <= 9 ) { System . out . println ( example950 * B ) ; } else { System . out . println ( " -1 " ) ; } } } -import java . util . Scanner ; public class example356 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example356 = sc . nextInt ( ) ; int [ ] a = new int [ Example356 ] ; for ( int i = 0 ; i < Example356 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int b = 1 ; int c = 0 ; int d = 0 ; while ( b != 2 ) { d += 1 ; c = b ; b = a [ b - 1 ] ; if ( b == 0 ) { System . out . println ( - 1 ) ; return ; } a [ c - 1 ] = 0 ; } System . out . println ( d ) ; } } -import java . util . * ; public class example162 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example162 = scan . nextInt ( ) ; int money = scan . nextInt ( ) ; if ( Example162 >= 13 ) { System . out . print ( money ) ; } else if ( Example162 >= 6 ) { System . out . print ( money / 2 ) ; } else if ( Example162 >= 0 ) { System . out . print ( 0 ) ; } } } -import java . util . Scanner ; public class Example273 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example273 = sc . nextInt ( ) ; int [ ] array = new int [ example273 ] ; for ( int i = 1 ; i < example273 ; i ++ ) array [ sc . nextInt ( ) - 1 ] ++ ; sc . close ( ) ; for ( int i = 0 ; i < example273 ; i ++ ) System . out . println ( array [ i ] ) ; } } -import java . util . * ; public class Example62 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; int example62 = 0 ; int count1 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '1' ) count1 ++ ; if ( S . charAt ( i ) == '0' ) example62 ++ ; } System . out . println ( 2 * Math . min ( count1 , example62 ) ) ; } } -import java . util . * ; public class Example8 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; int example8 = Integer . parseInt ( line [ 0 ] ) ; int buttonB = Integer . parseInt ( line [ 1 ] ) ; int ans = 0 ; if ( example8 > buttonB ) { ans += example8 ; example8 -- ; } else { ans += buttonB ; buttonB -- ; } if ( example8 > buttonB ) { ans += example8 ; } else { ans += buttonB ; } System . out . println ( ans ) ; } } -import java . math . BigInteger ; import java . util . * ; public class example737 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigInteger a = BigInteger . valueOf ( sc . nextLong ( ) ) ; BigInteger b = BigInteger . valueOf ( sc . nextLong ( ) ) ; BigInteger c = BigInteger . valueOf ( sc . nextLong ( ) ) ; BigInteger d = BigInteger . valueOf ( sc . nextLong ( ) ) ; BigInteger mul = a . multiply ( c ) ; if ( mul . compareTo ( a . multiply ( d ) ) < 0 ) mul = a . multiply ( d ) ; if ( mul . compareTo ( b . multiply ( c ) ) < 0 ) mul = b . multiply ( c ) ; if ( mul . compareTo ( b . multiply ( d ) ) < 0 ) mul = b . multiply ( d ) ; System . out . println ( mul ) ; } } -import java . util . * ; public class example40 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example40 = sc . nextInt ( ) ; double a = 2 * Example40 * Math . PI ; System . out . println ( a ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class example934 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] tmp = br . readLine ( ) . split ( " " ) ; int Example934 = Integer . parseInt ( tmp [ 0 ] ) ; int M = Integer . parseInt ( tmp [ 1 ] ) ; List < Integer > L = new ArrayList < Integer > ( ) ; List < Integer > R = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { tmp = br . readLine ( ) . split ( " " ) ; L . add ( Integer . parseInt ( tmp [ 0 ] ) ) ; R . add ( Integer . parseInt ( tmp [ 1 ] ) ) ; } L . sort ( null ) ; R . sort ( null ) ; int max = R . get ( 0 ) ; int min = L . get ( L . size ( ) - 1 ) ; if ( max - min + 1 < 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( max - min + 1 ) ; } } } -import java . util . Scanner ; public class Example632 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int example632 = sc . nextInt ( ) ; int debt = 100000 ; int roundUpNum = 1000 ; for ( int i = 0 ; i < example632 ; i ++ ) { debt *= 1.05 ; debt = ( int ) Math . ceil ( ( double ) debt / roundUpNum ) * roundUpNum ; } System . out . println ( debt ) ; } } -import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Deque ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; public class Example360 { public static void main ( String [ ] args ) { execute16_4 ( ) ; } private static void execute16_4 ( ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example360 = sc . nextInt ( ) ; System . out . println ( example360 + example360 * example360 + example360 * example360 * example360 ) ; } } } -import java . util . Scanner ; public class Example971 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example971 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; if ( example971 >= 10 || B >= 10 ) { System . out . println ( - 1 ) ; } else { System . out . println ( example971 * B ) ; } } } -import java . util . Scanner ; public class Example944 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example944 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; if ( N <= 99 ) { System . out . print ( N * ( int ) Math . pow ( 100 , example944 ) ) ; } else if ( N == 100 ) { System . out . print ( 101 * ( int ) Math . pow ( 100 , example944 ) ) ; } } } -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 Example513 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; example513 solver = new example513 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example513 { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int example513 = in . Int ( ) ; int B = in . Int ( ) ; out . println ( example513 * B ) ; } } static class Example513 { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } } } -import java . util . * ; public class example167 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example167 = sc . nextInt ( ) ; String s = sc . next ( ) ; sc . close ( ) ; boolean sa = false ; boolean sine = false ; if ( Example167 % 2 != 0 ) { System . out . println ( " No " ) ; sine = true ; } else { int [ ] a = new int [ Example167 / 2 ] ; int [ ] b = new int [ Example167 / 2 ] ; for ( int i = 0 ; i < Example167 / 2 ; i ++ ) { a [ i ] = s . charAt ( i ) ; b [ i ] = s . charAt ( i + Example167 / 2 ) ; if ( a [ i ] != b [ i ] ) { sa = true ; } } } if ( sa == true ) { System . out . println ( " No " ) ; } else if ( sine == false ) { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class example202 { static int Example202 ; static int [ ] w ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Example202 = scanner . nextInt ( ) ; w = new int [ Example202 ] ; for ( int i = 0 ; i < Example202 ; i ++ ) { w [ i ] = scanner . nextInt ( ) ; } scanner . close ( ) ; int ans = Integer . MAX_VALUE ; int s1 = 0 ; for ( int i = 0 ; i < Example202 - 1 ; i ++ ) { int s2 = 0 ; for ( int j = Example202 - 1 ; i + 1 <= j ; j -- ) { s2 += w [ j ] ; } s1 += w [ i ] ; ans = Math . min ( ans , Math . abs ( s1 - s2 ) ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example535 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example535 = sc . nextInt ( ) ; long a = 0 ; for ( int i = 0 ; i <= example535 ; i ++ ) { if ( i % 3 == 0 && i % 5 == 0 ) { } else if ( i % 3 == 0 && i % 5 != 0 ) { } else if ( i % 3 != 0 && i % 5 == 0 ) { } else if ( i % 3 != 0 || i % 5 != 0 ) { a += i ; } } System . out . println ( a ) ; } } -import java . util . Scanner ; public class example953 { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; String c = sca . next ( ) ; char Example953 = c . charAt ( 0 ) ; System . out . println ( ( char ) ( Example953 + 1 ) ) ; sca . close ( ) ; } } -import java . util . Scanner ; public class Example148 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example148 = sc . nextInt ( ) ; int strLen = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] strs = new String [ example148 ] ; for ( int i = 0 ; i < example148 ; i ++ ) { strs [ i ] = sc . nextLine ( ) ; } for ( int i = 0 ; i < example148 ; i ++ ) { for ( int j = i + 1 ; j < example148 ; j ++ ) { if ( ! minStr ( strLen , strs [ i ] , strs [ j ] ) ) { String tmp = strs [ i ] ; strs [ i ] = strs [ j ] ; strs [ j ] = tmp ; } } } output ( strs ) ; } private static boolean minStr ( int strLen , String strs , String strt ) { for ( int j = 0 ; j < strLen ; j ++ ) { char sChar = strs . charAt ( j ) ; char tChar = strt . charAt ( j ) ; if ( sChar != tChar ) { return sChar < tChar ; } } return true ; } private static void output ( String [ ] strs ) { for ( int i = 0 ; i < strs . length ; i ++ ) { System . out . print ( strs [ i ] ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class Example591 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example591 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] m = new int [ example591 ] ; for ( int i = 0 ; i < example591 ; i ++ ) { m [ i ] = K ; } for ( int i = 0 ; i < Q ; i ++ ) { int c = sc . nextInt ( ) ; m [ c - 1 ] ++ ; } for ( int i = 0 ; i < m . length ; i ++ ) { System . out . println ( ( m [ i ] - Q ) > 0 ? " Yes " : " No " ) ; } sc . close ( ) ; } } -import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class Example419 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = new BigDecimal ( sc . next ( ) ) ; BigDecimal b = new BigDecimal ( sc . next ( ) ) ; System . out . println ( a . multiply ( b ) . setScale ( 0 , RoundingMode . DOWN ) . toString ( ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; import java . util . Arrays ; class example156 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example156 = Integer . parseInt ( scan . nextLine ( ) ) ; String [ ] inputStr = scan . nextLine ( ) . split ( " " ) ; int inputLen = inputStr . length ; int [ ] inputInt = new int [ inputLen ] ; for ( int i = 0 ; i < inputLen ; i ++ ) { inputInt [ i ] = Integer . parseInt ( inputStr [ i ] ) ; } int tmp ; int numExchange = 0 ; int minj ; for ( int i = 0 ; i < inputLen - 1 ; i ++ ) { minj = i ; for ( int j = i + 1 ; j < inputLen ; j ++ ) { if ( inputInt [ minj ] > inputInt [ j ] ) { minj = j ; } } tmp = inputInt [ i ] ; inputInt [ i ] = inputInt [ minj ] ; inputInt [ minj ] = tmp ; if ( i != minj ) numExchange += 1 ; } for ( int i = 0 ; i < inputLen ; i ++ ) { inputStr [ i ] = String . valueOf ( inputInt [ i ] ) ; } System . out . println ( String . join ( " " , inputStr ) ) ; System . out . println ( numExchange ) ; } } -import java . util . Scanner ; public class Example295 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example295 = sc . nextLong ( ) ; long start = 100 ; int answer = 0 ; while ( example295 > start ) { start += start / 100 ; answer ++ ; } System . out . println ( answer ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example187 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example187 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int ans = ( ( example187 + ( 2 * K + 1 ) - 1 ) ) / ( 2 * K + 1 ) ; System . out . print ( ans ) ; } } -import java . util . * ; class example286 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example286 = sc . nextInt ( ) ; int [ ] a = new int [ Example286 ] ; for ( int i = 0 ; i < Example286 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ ( Example286 - 1 ) / 2 + 1 ] - a [ ( Example286 - 1 ) / 2 ] ) ; } } -import java . util . Scanner ; public class Example239 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example239 = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; boolean [ ] judge = new boolean [ example239 ] ; for ( int i = 0 ; i < k ; i ++ ) { int d = scan . nextInt ( ) ; for ( int j = 0 ; j < d ; j ++ ) { int a = scan . nextInt ( ) ; judge [ a - 1 ] = true ; } } int ans = 0 ; for ( int i = 0 ; i < judge . length ; i ++ ) { if ( judge [ i ] == false ) { ans ++ ; } } System . out . print ( ans ) ; } } -import java . util . Scanner ; class example694 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String number ; char [ ] ca ; int Example694 ; for ( ; ; ) { number = scan . next ( ) ; ca = number . toCharArray ( ) ; Example694 = 0 ; if ( ca [ 0 ] == '0' ) { break ; } for ( int i = 0 ; i < ca . length ; i ++ ) { Example694 += ca [ i ] - '0' ; } System . out . println ( Example694 ) ; } } } -import java . util . * ; public class Example327 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example327 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int end = l + example327 - 1 ; int sum ; if ( l >= 0 ) { sum = ( l + 1 + end ) * ( example327 - 1 ) / 2 ; } else if ( end > 0 ) { sum = ( l + end ) * example327 / 2 ; } else { sum = ( l + end - 1 ) * ( example327 - 1 ) / 2 ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example579 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example579 = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; StringBuilder answer = new StringBuilder ( ) ; for ( int i = 0 ; i < example579 ; i ++ ) { String a = String . valueOf ( s . charAt ( i ) ) ; if ( ( i + 1 ) == k ) { a = a . toLowerCase ( ) ; } answer . append ( a ) ; } System . out . println ( answer ) ; sc . close ( ) ; } } -import java . util . * ; public class example864 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example864 = sc . nextInt ( ) ; String ans = " APPROVED " ; int tmp ; for ( int i = 0 ; i < Example864 ; i ++ ) { tmp = sc . nextInt ( ) ; if ( tmp % 2 == 0 ) { if ( tmp % 3 != 0 && tmp % 5 != 0 ) { ans = " DENIED " ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example204 { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { sC ( ) ; } void sC ( ) { String s = sc . next ( ) ; int example204 = 0 , one = 0 ; char [ ] c = s . toCharArray ( ) ; for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ i ] == '0' ) example204 ++ ; else one ++ ; } if ( one > example204 ) { System . out . println ( example204 * 2 ) ; } else System . out . println ( one * 2 ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } -import java . util . * ; public class Example379 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example379 = stdIn . nextInt ( ) ; int [ ] flag = new int [ 101 ] ; Arrays . fill ( flag , 0 ) ; for ( int i = 0 ; i < example379 ; i ++ ) { int d = stdIn . nextInt ( ) ; flag [ d ] = 1 ; } int ans = 0 ; for ( int i = 0 ; i < 101 ; i ++ ) { ans += flag [ i ] ; } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; public class Example456 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int example456 = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; boolean ebishu = false ; if ( example456 == 2 * Integer . parseInt ( sc . next ( ) ) && h == 2 * Integer . parseInt ( sc . next ( ) ) ) ebishu = true ; ou . print ( example456 * ( long ) h / 2.0 + " " ) ; if ( ebishu ) ou . print ( 1 + " \n " ) ; else ou . print ( 0 + " \n " ) ; ou . flush ( ) ; } } -import java . util . * ; public class example314 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer x = scanner . nextInt ( ) ; Integer y = scanner . nextInt ( ) ; String ans = " No " ; for ( int Example314 = 0 ; Example314 < x + 1 ; Example314 ++ ) { Integer sum = 2 * Example314 + 4 * ( x - Example314 ) ; if ( sum == y ) ans = " Yes " ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example16 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example16 = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; String postal = sc . next ( ) ; String [ ] decomp = new String [ 3 ] ; decomp [ 0 ] = postal . substring ( 0 , example16 ) ; decomp [ 1 ] = postal . substring ( example16 , example16 + 1 ) ; decomp [ 2 ] = postal . substring ( example16 + 1 , postal . length ( ) - 1 ) ; for ( int i = 0 ; i < 3 ; i ++ ) { char [ ] array = decomp [ i ] . toCharArray ( ) ; if ( i == 0 || i == 2 ) { for ( char c : array ) { if ( ! Character . isDigit ( c ) ) { System . out . println ( " No " ) ; return ; } } } else { if ( array [ 0 ] != '-' ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example944 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example944 , n ; Example944 = sc . nextInt ( ) ; n = sc . nextInt ( ) ; int [ ] ans ; ans = new int [ Example944 + 1 ] ; for ( int i = 0 ; i <= Example944 ; i ++ ) { ans [ i ] = i ; } for ( int i = 0 ; i < n ; i ++ ) { int a , b ; String [ ] s = sc . next ( ) . split ( " , " ) ; a = Integer . parseInt ( s [ 0 ] ) ; b = Integer . parseInt ( s [ 1 ] ) ; int noise ; noise = ans [ a ] ; ans [ a ] = ans [ b ] ; ans [ b ] = noise ; } for ( int i = 1 ; i <= Example944 ; i ++ ) { System . out . println ( ans [ i ] ) ; } } } -import java . util . Scanner ; public class example204 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example204 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; boolean flag = false ; A : for ( int x = 0 ; x <= Math . min ( Y / 10000 , Example204 ) ; x ++ ) { for ( int y = 0 ; y <= Math . min ( ( Y - 10000 * x ) / 5000 , Example204 - x ) ; y ++ ) { int k = Y - 10000 * x - 5000 * y ; if ( k % 1000 == 0 ) { int z = k / 1000 ; if ( z == ( Example204 - x - y ) ) { System . out . printf ( " %d %d %d " , x , y , z ) ; flag = true ; break A ; } } } } if ( ! flag ) System . out . printf ( " -1 -1 -1 " ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . * ; class example622 { 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 example622 { public static PrintWriter out ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int Example622 = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; if ( w >= Example622 ) { out . println ( " unsafe " ) ; } else { out . println ( " safe " ) ; } out . close ( ) ; } } -import java . util . Scanner ; public class example609 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example609 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] matrix = new int [ Example609 ] [ m ] ; int [ ] vector = new int [ m ] ; for ( int i = 0 ; i < Example609 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { vector [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example609 ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < m ; j ++ ) { sum += matrix [ i ] [ j ] * vector [ j ] ; } System . out . println ( sum ) ; } } } -import java . util . Scanner ; public class Example32 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example32 ; double ave , d ; while ( ( example32 = scan . nextInt ( ) ) != 0 ) { int [ ] point = new int [ example32 ] ; ave = 0 ; for ( int i = 0 ; i < example32 ; i ++ ) { point [ i ] = scan . nextInt ( ) ; ave += point [ i ] ; } ave /= ( double ) example32 ; d = 0 ; for ( int i = 0 ; i < example32 ; i ++ ) { d += ( Math . pow ( ( ave - point [ i ] ) , 2 ) ) ; } d /= ( double ) example32 ; d = Math . sqrt ( d ) ; System . out . printf ( " %.8f \n " , d ) ; } scan . close ( ) ; } } -import java . util . Scanner ; public class example830 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example830 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] [ ] nm = new int [ Example830 ] [ m ] ; int [ ] [ ] ml = new int [ m ] [ l ] ; for ( int i = 0 ; i < Example830 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { nm [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { ml [ i ] [ j ] = sc . nextInt ( ) ; } } long ans = 0 ; for ( int i = 0 ; i < Example830 ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { ans = 0 ; for ( int k = 0 ; k < m ; k ++ ) { ans += nm [ i ] [ k ] * ml [ k ] [ j ] ; } if ( j != l - 1 ) { System . out . print ( ans + " " ) ; } else { System . out . print ( ans ) ; } } System . out . println ( ) ; } } } -import java . util . Scanner ; public class example634 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example634 = sc . nextInt ( ) ; int s = Example634 % 60 ; int M = Example634 / 60 ; int m = M % 60 ; int H = M / 60 ; int h = H ; System . out . println ( h + " : " + m + " : " + s ) ; } } -import java . util . Scanner ; import java . util . * ; public class example901 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example901 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ Example901 ] ; for ( int i = 0 ; i < Example901 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < k && i < Example901 ; i ++ ) { sum += arr [ i ] ; } System . out . println ( sum ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example50 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] task = new int [ 3 ] ; int Example50 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { task [ i ] = sc . nextInt ( ) ; } Arrays . sort ( task ) ; for ( int i = 0 ; i < 2 ; i ++ ) { Example50 += Math . abs ( task [ i ] - task [ i + 1 ] ) ; } System . out . println ( Example50 ) ; } } -import java . io . * ; class Example769 { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int example769 = Integer . parseInt ( line ) ; int answer = ( int ) Math . pow ( example769 , 3 ) ; System . out . println ( answer ) ; } } -import java . util . Scanner ; public class Example406 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example406 = sc . nextInt ( ) ; int kind = sc . nextInt ( ) ; int [ ] di = new int [ kind ] ; int [ ] count = new int [ example406 ] ; for ( int i = 0 ; i < example406 ; i ++ ) { count [ i ] = 0 ; } for ( int i = 0 ; i < kind ; i ++ ) { di [ i ] = sc . nextInt ( ) ; for ( int j = 0 ; j < di [ i ] ; j ++ ) { count [ sc . nextInt ( ) - 1 ] ++ ; } } int trickCount = 0 ; for ( int i = 0 ; i < example406 ; i ++ ) { if ( count [ i ] == 0 ) { trickCount ++ ; } } System . out . println ( trickCount ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example145 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = null ; try { while ( ( line = br . readLine ( ) ) != null ) { char [ ] charArray = line . trim ( ) . toCharArray ( ) ; if ( charArray . length > 20 ) System . exit ( - 1 ) ; for ( int Example145 = charArray . length - 1 ; Example145 >= 0 ; Example145 -- ) { System . out . print ( charArray [ Example145 ] ) ; } System . out . println ( " " ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . Scanner ; public class example611 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example611 = sc . nextInt ( ) ; for ( int i = 1 ; i <= Example611 ; i ++ ) { if ( i % 3 == 0 || Integer . toString ( i ) . contains ( " 3 " ) ) { if ( 0 < i ) { System . out . print ( " " + i ) ; } else { System . out . print ( i ) ; } } } System . out . println ( ) ; } } -import java . util . * ; public class Example379 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example379 = sc . nextInt ( ) ; int [ ] [ ] array = new int [ 2 ] [ example379 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < example379 ; j ++ ) { array [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] ans = new int [ 2 ] [ example379 ] ; ans [ 0 ] [ 0 ] = array [ 0 ] [ 0 ] ; for ( int i = 0 ; i < example379 - 1 ; i ++ ) { ans [ 0 ] [ i + 1 ] = ans [ 0 ] [ i ] + array [ 0 ] [ i + 1 ] ; } ans [ 1 ] [ 0 ] = array [ 0 ] [ 0 ] + array [ 1 ] [ 0 ] ; for ( int i = 1 ; i < example379 ; i ++ ) { ans [ 1 ] [ i ] = Math . max ( ans [ 0 ] [ i ] , ans [ 1 ] [ i - 1 ] ) + array [ 1 ] [ i ] ; } System . out . println ( ans [ 1 ] [ example379 - 1 ] ) ; } } -import java . util . Scanner ; public class example724 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long Example724 = scanner . nextLong ( ) ; long answer = Example724 - 1 ; answer = getAnswer ( Example724 , answer ) ; System . out . println ( answer ) ; } private static long getAnswer ( long Example724 , long answer ) { int newStart = ( int ) Math . sqrt ( Example724 ) ; for ( long i = newStart ; i > 1 ; i -- ) { if ( Example724 % i == 0 ) { long divisible = Example724 / i ; long possibleAnswer = ( i - 1 ) + ( divisible - 1 ) ; return possibleAnswer ; } } return answer ; } } -import java . util . * ; public class example40 { public static void main ( String [ ] args ) { int Example40 ; Scanner sc = new Scanner ( System . in ) ; String num = sc . next ( ) ; num = num . replaceAll ( " 0 " , " " ) ; Example40 = num . Example40 ( ) ; System . out . println ( Example40 ) ; } } -import java . util . Scanner ; public class Example549 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example549 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int res ; if ( example549 <= 5 ) { res = 0 ; } else if ( example549 <= 12 ) { res = b / 2 ; } else { res = b ; } System . out . println ( res ) ; } } -import java . util . * ; public class Example634 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example634 = sc . nextInt ( ) , D = sc . nextInt ( ) , c = 0 ; for ( int i = 0 ; i < example634 ; i ++ ) { long X = sc . nextInt ( ) , Y = sc . nextInt ( ) ; if ( Math . sqrt ( X * X + Y * Y ) <= D ) { c ++ ; } } System . out . println ( c ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example94 { public static void main ( String [ ] args ) { try ( BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int Example94 = 0 ; int hanako = 0 ; int n = Integer . parseInt ( in . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { String [ ] arr = in . readLine ( ) . split ( " " ) ; int cmp = arr [ 0 ] . compareTo ( arr [ 1 ] ) ; if ( cmp > 0 ) { Example94 += 3 ; } else if ( cmp == 0 ) { Example94 ++ ; hanako ++ ; } else { hanako += 3 ; } } System . out . println ( Example94 + " " + hanako ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class example434 { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; int Example434 = ob . nextInt ( ) ; boolean C = true ; String R = " " ; while ( C ) { Example434 %= 10 ; C = false ; } if ( ( Example434 == 2 ) || ( Example434 == 4 ) || ( Example434 == 5 ) || ( Example434 == 7 ) || ( Example434 == 9 ) ) { R += " hon " ; } else if ( ( Example434 == 0 ) || ( Example434 == 1 ) || ( Example434 == 6 ) || ( Example434 == 8 ) ) { R += " pon " ; } else if ( Example434 == 3 ) { R += " bon " ; } System . out . println ( R ) ; } } -import java . util . * ; public class example528 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example528 = sc . nextInt ( ) ; int yen = sc . nextInt ( ) ; int s = yen / 1000 - Example528 ; for ( int i = 0 ; i <= Math . min ( s / 9 , Example528 ) ; i ++ ) { for ( int j = 0 ; j <= Math . min ( Example528 - i , s / 4 ) ; j ++ ) { if ( i * 9 + j * 4 == s ) { System . out . println ( i + " " + j + " " + ( Example528 - i - j ) ) ; return ; } } } System . out . println ( ( - 1 ) + " " + ( - 1 ) + " " + ( - 1 ) ) ; } public static int lcm ( int x , int y ) { return x * y / gcd ( x , y ) ; } public static int gcd ( int x , int y ) { if ( x < y ) return gcd ( y , x ) ; if ( y == 0 ) return x ; return gcd ( y , x % y ) ; } } -import java . util . * ; public class Example211 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example211 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = Math . max ( example211 , b ) ; int d = Math . min ( example211 , b ) ; int out = 0 ; out += c ; out += Math . max ( c - 1 , d ) ; System . out . println ( out ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class example757 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example757 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int result = 0 ; switch ( Example757 ) { case 0 : if ( n == 100 ) { result = 101 ; } else { result = n ; } break ; case 1 : if ( n == 100 ) { result = 10100 ; } else { result = 100 * n ; } break ; case 2 : if ( n == 100 ) { result = 1010000 ; } else { result = 10000 * n ; } break ; } System . out . println ( result ) ; } } } -import java . text . MessageFormat ; import java . util . Scanner ; public class Example872 { public static void main ( String [ ] args ) { Solve s = new Solve ( ) ; s . solve ( ) ; } } class Example872 { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; double example872 = sc . nextInt ( ) ; double K = sc . nextInt ( ) ; double n = 0d ; double res = 0d ; String message ; for ( double i = 1 ; i <= example872 ; i ++ ) { for ( int j = 0 ; j < 100000 ; j ++ ) { if ( i * Math . pow ( 2 , j ) >= K ) { n = j ; j = 100000 ; } } res += 1 / ( example872 * Math . pow ( 2 , n ) ) ; } message = MessageFormat . format ( " { 0,number,0.000000000000 } " , res ) ; System . out . println ( message ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example34 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int Example34 = Integer . parseInt ( line ) ; int [ ] a = new int [ Example34 ] ; int k = 0 ; int count = 1 ; boolean fin = false ; for ( int i = 0 ; i < Example34 ; i ++ ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } for ( int i = 0 ; i < Example34 ; i ++ ) { if ( a [ k ] != 2 && ! fin ) { count ++ ; k = a [ k ] - 1 ; } else { fin = true ; } } if ( fin ) { System . out . println ( count ) ; } else { System . out . println ( " -1 " ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class example237 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AWeatherPrediction solver = new AWeatherPrediction ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example237 { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String Example237 = in . next ( ) ; if ( Example237 . compareTo ( " Sunny " ) == 0 ) { out . println ( " Cloudy " ) ; } else if ( Example237 . compareTo ( " Cloudy " ) == 0 ) { out . println ( " Rainy " ) ; } else { out . println ( " Sunny " ) ; } } } static class example237 { 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 ( ) ; } } } -import java . util . * ; public class Example504 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example504 = sc . nextLong ( ) ; long hh = sc . nextLong ( ) ; long xx = sc . nextLong ( ) ; long yy = sc . nextLong ( ) ; System . out . print ( example504 * hh / 2.0 ) ; System . out . print ( " " + ( xx * 2 == example504 && yy * 2 == hh ? 1 : 0 ) ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class example259 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; int Example259 = 0 ; int len = s . length ; for ( int i = 0 ; i < len ; i ++ ) { if ( s [ i ] != t [ i ] ) Example259 ++ ; } System . out . println ( Example259 ) ; } } -import java . util . Scanner ; public class example558 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String C = scanner . next ( ) ; String [ ] slist = { " a " , " b " , " c " , " d " , " e " , " f " , " g " , " h " , " i " , " j " , " k " , " l " , " m " , " n " , " o " , " p " , " q " , " r " , " s " , " t " , " u " , " v " , " w " , " x " , " y " , " z " } ; for ( int Example558 = 0 ; Example558 < 26 ; Example558 ++ ) { if ( C . equals ( slist [ Example558 ] ) ) { C = slist [ Example558 + 1 ] ; System . out . println ( C ) ; break ; } } } } -import java . util . * ; class example80 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example80 = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int count = 1 ; int sum = 0 ; while ( Example80 -- > 0 ) { sum += stdIn . nextInt ( ) ; if ( x < sum ) break ; count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example956 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example956 = sc . nextDouble ( ) ; System . out . println ( ( int ) Math . ceil ( Example956 / 2 ) ) ; } } -import java . util . Scanner ; public class example301 { private static int Example301 , x ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; Example301 = stdIn . nextInt ( ) ; for ( int i = 1 ; i <= Example301 ; i ++ ) { x = i ; if ( x % 3 == 0 ) { System . out . print ( " " + x ) ; continue ; } while ( x > 0 ) { if ( x % 10 == 3 ) { System . out . print ( " " + i ) ; break ; } x /= 10 ; } } System . out . println ( " " ) ; } } -import java . io . * ; class example275 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( ) ; int Example275 = Integer . parseInt ( nb ) ; System . out . println ( ( int ) Math . pow ( Example275 , 3 ) ) ; } } -import java . lang . reflect . Array ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example724 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; List < String [ ] > list = new ArrayList < > ( ) ; int example724 = 0 ; int N = 0 ; int M = 0 ; while ( scan . hasNext ( ) ) { if ( example724 == 0 ) { N = scan . nextInt ( ) ; M = scan . nextInt ( ) ; example724 ++ ; continue ; } String str = scan . nextLine ( ) ; String [ ] sp = str . split ( " " ) ; list . add ( sp ) ; example724 ++ ; if ( example724 > N + 1 ) { break ; } } int [ ] result = new int [ 30 ] ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= Integer . parseInt ( list . get ( i ) [ 0 ] ) ; j ++ ) { result [ Integer . parseInt ( list . get ( i ) [ j ] ) - 1 ] ++ ; } } int resultCount = 0 ; for ( int r : result ) { if ( r == N ) { resultCount ++ ; } } System . out . print ( resultCount ) ; } } -import java . util . Scanner ; public class Example166 { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; long example166 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; sc . close ( ) ; long res1 = Math . max ( 0 , example166 - k ) ; long res2 = Math . max ( 0 , Math . min ( example166 + b - k , b ) ) ; System . out . println ( res1 + " " + res2 ) ; } public static void main ( String [ ] args ) { solve ( ) ; } } -import java . util . Scanner ; public class Example694 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] s = sc . next ( ) . split ( " " ) ; for ( int example694 = 0 ; example694 < s . length ; example694 ++ ) { sb . append ( s [ example694 ] . equals ( " 1 " ) ? " 9 " : " 1 " ) ; } System . out . println ( sb ) ; } } -import java . util . Scanner ; public class Example559 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example559 = sc . nextInt ( ) , b = sc . nextInt ( ) ; StringBuilder a_str = new StringBuilder ( ) ; StringBuilder b_str = new StringBuilder ( ) ; for ( int i = 0 ; i < example559 ; i ++ ) { a_str . append ( b ) ; } for ( int i = 0 ; i < b ; i ++ ) { b_str . append ( example559 ) ; } System . out . println ( a_str . toString ( ) . compareTo ( b_str . toString ( ) ) < 0 ? a_str . toString ( ) : b_str . toString ( ) ) ; } } -import java . util . * ; public class Example957 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example957 = sc . nextInt ( ) ; long total = 0 ; for ( long i = 0 ; i <= example957 ; i ++ ) { if ( i % 3 != 0 && i % 5 != 0 ) { total += i ; } } System . out . println ( total ) ; } } -import java . util . * ; import java . util . Collections ; public class Example115 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example115 = sc . nextInt ( ) ; String S = sc . next ( ) ; int cnt = 0 ; for ( int i = 0 ; i < example115 - 2 ; i ++ ) { if ( S . charAt ( i ) == 'A' & S . charAt ( i + 1 ) == 'B' & S . charAt ( i + 2 ) == 'C' ) { cnt ++ ; } } System . out . println ( cnt ) ; } public static void primeFactorization ( int num ) { int Z = 0 ; for ( int i = 2 ; num > i ; i ++ ) { while ( num % i == 0 ) { System . out . println ( i ) ; num /= i ; Z = num ; } } System . out . println ( Z ) ; } public static boolean isPrime ( int num ) { if ( num < 2 ) return false ; else if ( num == 2 ) return true ; else if ( num % 2 == 0 ) return false ; for ( int i = 3 ; i < num ; i += 2 ) { if ( num % i == 0 ) { return false ; } } return true ; } } -import java . util . Scanner ; public class Example534 { public static void main ( String [ ] args ) { int example534 ; int b ; try ( Scanner scanner = new Scanner ( System . in ) ) { example534 = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; } if ( ( example534 & b & 1 ) == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example267 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example267 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] monsters = new int [ Example267 ] ; for ( int i = 0 ; i < Example267 ; i ++ ) { monsters [ i ] = sc . nextInt ( ) ; } Arrays . sort ( monsters ) ; long hp = 0 ; if ( k >= Example267 ) { System . out . println ( hp ) ; } else { for ( int j = 0 ; j < Example267 - k ; j ++ ) { hp += monsters [ j ] ; } System . out . println ( hp ) ; } } } -import java . util . Scanner ; public class Example551 { public static void main ( String [ ] args ) { Scanner c = new Scanner ( System . in ) ; long example551 = c . nextInt ( ) ; System . out . println ( ( example551 + ( example551 * example551 ) + ( example551 * example551 * example551 ) ) ) ; } } -import java . util . * ; public class Example856 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example856 = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < example856 ; i ++ ) { long x = Integer . parseInt ( sc . next ( ) ) ; long y = Integer . parseInt ( sc . next ( ) ) ; if ( Math . sqrt ( x * x + y * y ) <= d ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example549 { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int example549 = 0 ; int max = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == 'A' || S . charAt ( i ) == 'G' || S . charAt ( i ) == 'C' || S . charAt ( i ) == 'T' ) { example549 ++ ; if ( max <= example549 ) { max = example549 ; } } else { example549 = 0 ; } } System . out . println ( max ) ; } } -import java . util . Scanner ; public class example960 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] array = sc . nextLine ( ) . split ( " " ) ; int Example960 = 0 ; for ( String s : array ) { if ( Integer . parseInt ( s ) == 1 ) { Example960 ++ ; } } System . out . println ( Example960 ) ; } } -import java . util . Scanner ; public class example449 { public static void main ( String [ ] args ) { String Example449 ; Scanner n = new Scanner ( System . in ) ; Example449 = n . next ( ) ; if ( Example449 . equals ( " Sunny " ) ) System . out . print ( " Cloudy " ) ; else if ( Example449 . equals ( " Cloudy " ) ) System . out . print ( " Rainy " ) ; else if ( Example449 . equals ( " Rainy " ) ) System . out . print ( " Sunny " ) ; } } -import java . util . Scanner ; public class example250 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example250 = 0 , b = 0 , c = 0 ; int [ ] n = new int [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { n [ i ] = sc . nextInt ( ) ; if ( n [ i ] > Example250 ) { c = b ; b = Example250 ; Example250 = n [ i ] ; } else if ( n [ i ] > b ) { c = b ; b = n [ i ] ; } else if ( n [ i ] > c ) { c = n [ i ] ; } } System . out . println ( Example250 ) ; System . out . println ( b ) ; System . out . println ( c ) ; } } -import java . io . * ; class Example922 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char example922 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { example922 = str . charAt ( i ) ; if ( Character . isUpperCase ( example922 ) ) example922 = Character . toLowerCase ( example922 ) ; else if ( Character . isLowerCase ( example922 ) ) example922 = Character . toUpperCase ( example922 ) ; System . out . print ( example922 ) ; } System . out . println ( ) ; } catch ( IOException e ) { System . out . println ( " Exception : " + e ) ; } } } -import java . util . * ; class example105 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example105 = sc . nextInt ( ) ; int waza = sc . nextInt ( ) ; long ret = 0 ; int [ ] hoge = new int [ Example105 ] ; if ( Example105 <= waza ) { System . out . println ( 0 ) ; return ; } for ( int i = 0 ; i < Example105 ; i ++ ) { hoge [ i ] = sc . nextInt ( ) ; } Arrays . sort ( hoge ) ; for ( int i = 0 ; i < Example105 - waza ; i ++ ) { ret += hoge [ i ] ; } System . out . print ( ret ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example138 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example138 = sc . nextInt ( ) ; int maxPotision = 0 ; int maxValue = 0 ; int secondValue = 0 ; boolean maxDup = false ; for ( int i = 0 ; i < example138 ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tmp == maxValue ) { maxDup = true ; } else if ( tmp > maxValue ) { secondValue = maxValue ; maxValue = tmp ; maxPotision = i ; maxDup = false ; } else if ( tmp > secondValue ) { secondValue = tmp ; } } if ( maxDup ) { for ( int i = 0 ; i < example138 ; i ++ ) { System . out . println ( maxValue ) ; } } else { for ( int i = 0 ; i < example138 ; i ++ ) { if ( i == maxPotision ) { System . out . println ( secondValue ) ; } else { System . out . println ( maxValue ) ; } } } } } -import java . util . * ; public class Example477 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example477 = scan . nextLine ( ) ; String strings = example477 + example477 ; String keywords = scan . nextLine ( ) ; System . out . println ( strings . matches ( " .* " + keywords + " .* " ) ? " Yes " : " No " ) ; } } -import java . io . FileNotFoundException ; import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class example313 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int Example313 = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; boolean flg = false ; BigDecimal S = BigDecimal . valueOf ( Example313 ) ; S = S . multiply ( BigDecimal . valueOf ( H ) ) ; S = S . divide ( BigDecimal . valueOf ( 2 ) , 10 , RoundingMode . HALF_UP ) ; if ( 2 * x == Example313 && 2 * y == H ) { flg = true ; } System . out . print ( S + " " ) ; if ( flg ) { System . out . println ( " 1 " ) ; } else { System . out . println ( " 0 " ) ; } } } -import java . util . Scanner ; public class example37 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; loop : while ( true ) { long Example37 = scanner . nextInt ( ) ; String op = scanner . next ( ) ; long b = scanner . nextInt ( ) ; switch ( op ) { case " + " : System . out . println ( Example37 + b ) ; break ; case " - " : System . out . println ( Example37 - b ) ; break ; case " * " : System . out . println ( Example37 * b ) ; break ; case " / " : System . out . println ( Example37 / b ) ; break ; case " ? " : break loop ; } } scanner . close ( ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class example514 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example514 = sc . nextInt ( ) ; boolean [ ] isZorome = new boolean [ Example514 ] ; for ( int i = 0 ; i < Example514 ; i ++ ) { int d_1 = sc . nextInt ( ) ; int d_2 = sc . nextInt ( ) ; isZorome [ i ] = ( d_1 == d_2 ) ; } String ans = " No " ; for ( int i = 0 ; i < Example514 - 2 ; i ++ ) { boolean sanren = isZorome [ i ] && isZorome [ i + 1 ] && isZorome [ i + 2 ] ; if ( sanren ) { ans = " Yes " ; } } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; class example120 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int Example120 = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int M = 2 * D + 1 ; System . out . println ( ( Example120 + M - 1 ) / M ) ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Arrays ; public class Example497 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int example497 = Integer . parseInt ( str [ 0 ] ) ; int l = Integer . parseInt ( str [ 1 ] ) ; String [ ] s = new String [ example497 ] ; for ( int i = 0 ; i < example497 ; i ++ ) { s [ i ] = in . readLine ( ) ; } Arrays . sort ( s ) ; for ( int i = 0 ; i < example497 ; i ++ ) { System . out . print ( s [ i ] ) ; } System . out . println ( ) ; } } -import java . util . * ; import java . io . * ; public class example622 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int Example622 = Integer . parseInt ( br . readLine ( ) ) ; long ans = 0 ; for ( int i = 1 ; i <= Example622 ; i ++ ) { if ( ( i % 3 != 0 ) && ( i % 5 != 0 ) ) { ans += i ; } } out . println ( ans ) ; out . close ( ) ; } } -import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; public class Example541 { public static void main ( String [ ] args ) { String [ ] input1 ; String [ ] input2 ; try ( Scanner sc = new Scanner ( System . in ) ) { input1 = sc . nextLine ( ) . split ( " " ) ; input2 = sc . nextLine ( ) . split ( " " ) ; } int example541 = Integer . parseInt ( input1 [ 0 ] ) ; int x = Integer . parseInt ( input1 [ 1 ] ) ; List < Integer > list = new ArrayList < > ( ) ; for ( String str : input2 ) { list . add ( Integer . parseInt ( str ) ) ; } int d = 0 ; int cnt = 1 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { int e = d + list . get ( i ) ; if ( e <= x ) { cnt ++ ; } d = e ; } System . out . println ( cnt ) ; } } -import java . util . * ; public class Example633 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example633 = sc . nextDouble ( ) ; double ans = example633 / 3 ; System . out . printf ( " %.12f \n " , ans * ans * ans ) ; } } -import java . util . Scanner ; public class Example702 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example702 = sc . nextLong ( ) , a = sc . nextLong ( ) , b = sc . nextLong ( ) ; long sum = a * ( example702 / ( a + b ) ) ; sum += a < example702 % ( a + b ) ? a : example702 % ( a + b ) ; System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example224 { public static void main ( String [ ] args ) { Scanner inputscan = new Scanner ( System . in ) ; int example224 = inputscan . nextInt ( ) ; int H = inputscan . nextInt ( ) ; int x = inputscan . nextInt ( ) ; int y = inputscan . nextInt ( ) ; int r = inputscan . nextInt ( ) ; int Horizontal1 = x - r ; int Horizontal2 = x + r ; int Vertical1 = y - r ; int Vertical2 = y + r ; if ( Horizontal1 >= 0 && Horizontal2 <= example224 && Vertical1 >= 0 && Vertical2 <= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . math . * ; public class Example382 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String example382 = sc . next ( ) ; String b = sc . next ( ) ; BigDecimal a1 = new BigDecimal ( example382 ) ; BigDecimal b1 = new BigDecimal ( b ) ; BigDecimal res = a1 . multiply ( b1 ) ; System . out . println ( res . setScale ( 0 , RoundingMode . DOWN ) ) ; } } -import java . io . * ; class Example810 { } class Example810 { public static void main ( String [ ] args ) throws IOException { Program obj = new Program ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] ip ; int example810 , M , C ; int [ ] A , B ; ip = in . readLine ( ) . split ( " " ) ; example810 = Integer . parseInt ( ip [ 0 ] ) ; M = Integer . parseInt ( ip [ 1 ] ) ; C = Integer . parseInt ( ip [ 2 ] ) ; int count = 0 , score = 0 ; A = new int [ M ] ; B = new int [ M ] ; ip = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < M ; i ++ ) B [ i ] = Integer . parseInt ( ip [ i ] ) ; while ( -- example810 >= 0 ) { ip = in . readLine ( ) . split ( " " ) ; score = 0 ; for ( int i = 0 ; i < M ; i ++ ) { A [ i ] = Integer . parseInt ( ip [ i ] ) ; score += B [ i ] * A [ i ] ; } if ( score + C > 0 ) count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example265 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean [ ] [ ] cardHasFlag = new boolean [ 4 ] [ 13 ] ; int example265 = sc . nextInt ( ) ; for ( int i = 0 ; i < example265 ; i ++ ) { String make = sc . next ( ) ; int card = sc . nextInt ( ) ; switch ( make ) { case " S " : cardHasFlag [ 0 ] [ card - 1 ] = true ; break ; case " H " : cardHasFlag [ 1 ] [ card - 1 ] = true ; break ; case " C " : cardHasFlag [ 2 ] [ card - 1 ] = true ; break ; case " D " : cardHasFlag [ 3 ] [ card - 1 ] = true ; break ; } } for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 13 ; j ++ ) { if ( cardHasFlag [ i ] [ j ] == false ) { switch ( i ) { case 0 : System . out . printf ( " S %d \n " , j + 1 ) ; break ; case 1 : System . out . printf ( " H %d \n " , j + 1 ) ; break ; case 2 : System . out . printf ( " C %d \n " , j + 1 ) ; break ; case 3 : System . out . printf ( " D %d \n " , j + 1 ) ; break ; } } } } } } -import java . util . * ; public class example838 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example838 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int sum = 0 ; if ( d <= Example838 ) { System . out . println ( d ) ; return ; } sum = Example838 ; d -= Example838 ; if ( d <= b ) { System . out . println ( sum ) ; return ; } d -= b ; sum -= d ; System . out . println ( sum ) ; } } -import java . util . * ; public class Example415 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example415 = s . nextInt ( ) ; long [ ] monsters = new long [ example415 + 1 ] ; long [ ] strength = new long [ example415 ] ; long count = 0 ; for ( int i = 0 ; i < example415 + 1 ; i ++ ) { monsters [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < example415 ; i ++ ) { strength [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < example415 ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { if ( monsters [ i + j ] >= strength [ i ] ) { count += strength [ i ] ; monsters [ i + j ] = monsters [ i + j ] - strength [ i ] ; strength [ i ] = 0 ; } else { count += monsters [ j + i ] ; strength [ i ] = strength [ i ] - monsters [ i + j ] ; monsters [ i + j ] = 0 ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; class example487 { public static void main ( final String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { String s = scanner . nextLine ( ) ; int Example487 = 0 ; boolean flag = true ; for ( int i = 0 ; i < 4 ; i ++ ) { String s1 = s . substring ( i , i + 1 ) ; for ( int k = 0 ; k < 4 ; k ++ ) { String s2 = s . substring ( k , k + 1 ) ; if ( s1 . equals ( s2 ) ) { Example487 ++ ; } } if ( Example487 == 2 ) { Example487 = 0 ; } else { System . out . println ( " No " ) ; flag = false ; break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } } } } -import java . util . * ; class Example156 { public static void main ( String [ ] args ) { printAns ( ) ; } static void isRightTriangle ( int a , int b , int c ) { if ( a * a + b * b == c * c ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } static void printAns ( ) { Scanner sc = new Scanner ( System . in ) ; int example156 = sc . nextInt ( ) ; int [ ] triangle = new int [ 3 ] ; for ( int cnt = 0 ; cnt < example156 ; cnt ++ ) { for ( int i = 0 ; i < triangle . length ; i ++ ) { triangle [ i ] = sc . nextInt ( ) ; } sort ( triangle ) ; isRightTriangle ( triangle [ 0 ] , triangle [ 1 ] , triangle [ 2 ] ) ; } } static void sort ( int [ ] data ) { int min , tmp ; for ( int i = 0 ; i < data . length ; i ++ ) { min = i ; for ( int j = i + 1 ; j < data . length ; j ++ ) if ( data [ min ] > data [ j ] ) min = j ; tmp = data [ i ] ; data [ i ] = data [ min ] ; data [ min ] = tmp ; } } } -import java . util . Scanner ; public class example936 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example936 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long answer = Example936 * B / calcGcd ( Example936 , B ) ; System . out . println ( answer ) ; sc . close ( ) ; } static long calcGcd ( long m , long n ) { if ( m < n ) { long tmp = m ; m = n ; n = tmp ; } long remainder = 0 ; while ( ( remainder = m % n ) != 0 ) { m = n ; n = remainder ; } return n ; } } -import java . util . * ; class Example675 { public static void main ( String [ ] args ) { int example675 ; int stacksize = 100 ; String temp ; int calc ; int a , b ; Deque < Integer > stack = new ArrayDeque < Integer > ( ) ; String separator = System . getProperty ( " line.separator " ) ; Scanner sc1 = new Scanner ( System . in ) ; String str = sc1 . nextLine ( ) ; Scanner sc2 = new Scanner ( str ) ; sc2 . useDelimiter ( " " ) ; while ( sc2 . hasNext ( ) ) { temp = sc2 . next ( ) ; if ( temp . equals ( " + " ) ) { calc = stack . removeFirst ( ) + stack . removeFirst ( ) ; stack . addFirst ( calc ) ; } else if ( temp . equals ( " - " ) ) { a = stack . removeFirst ( ) ; b = stack . removeFirst ( ) ; calc = b - a ; stack . addFirst ( calc ) ; } else if ( temp . equals ( " * " ) ) { calc = stack . removeFirst ( ) * stack . removeFirst ( ) ; stack . addFirst ( calc ) ; } else { stack . addFirst ( Integer . parseInt ( temp ) ) ; } } System . out . println ( stack . removeFirst ( ) ) ; } } -import java . io . * ; import java . util . * ; public class example340 { static long Example340 = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) throws IOException { Reader . init ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Reader . nextInt ( ) , x = Reader . nextInt ( ) , t = Reader . nextInt ( ) ; long ans = ( n + x - 1 ) / x ; ans *= t ; out . println ( ans ) ; out . flush ( ) ; } } class example340 { static BufferedReader reader ; static StringTokenizer tokenizer ; static void init ( ) throws IOException { reader = new BufferedReader ( new FileReader ( " C: \\ Users \\ samee \\ Desktop \\ GRE prep \\ confusion.txt " ) ) ; tokenizer = new StringTokenizer ( " " ) ; } static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( " " ) ; } static String nextLine ( ) throws IOException { return reader . readLine ( ) ; } static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } -import java . io . * ; import java . util . * ; public class Example827 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example827 = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) , n = in . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i <= example827 ; i ++ ) { int x = 500 * i ; for ( int j = 0 ; j <= b ; j ++ ) { int y = 100 * j ; if ( n - x - y >= 0 && ( n - x - y ) % 50 == 0 && ( n - x - y ) / 50 <= c ) count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example538 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( int example538 = 1 ; example538 <= 10000 ; example538 ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 0 && y == 0 ) { break ; } else { System . out . println ( Math . min ( x , y ) + " " + Math . max ( x , y ) ) ; } } sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example44 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example44 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] clash = new boolean [ example44 + 1 ] ; Arrays . fill ( clash , true ) ; for ( int i = 0 ; i < m ; i ++ ) clash [ sc . nextInt ( ) ] = false ; int [ ] dp = new int [ example44 + 1 ] ; dp [ 0 ] = 1 ; for ( int i = 0 ; i < example44 ; i ++ ) { for ( int j = i + 1 ; j <= Math . min ( i + 2 , example44 ) ; j ++ ) { if ( clash [ j ] ) { dp [ j ] += dp [ i ] ; dp [ j ] %= 1000000007 ; } } } System . out . println ( dp [ example44 ] ) ; sc . close ( ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example619 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example619 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String str = in . next ( ) ; int Example619 = 0 ; for ( char c : str . toCharArray ( ) ) { if ( c == '1' ) { Example619 ++ ; } } out . print ( Example619 ) ; } } } -import java . util . Scanner ; public class Example738 { public static int getGcd ( int a , int b ) { if ( a == b ) return b ; int example738 = Math . max ( a , b ) ; int smaller = Math . min ( a , b ) ; int modded = example738 % smaller ; if ( modded == 0 ) return smaller ; return getGcd ( smaller , example738 % smaller ) ; } public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int result = getGcd ( a , b ) ; System . out . println ( result ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class Example224 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int example224 = s . nextInt ( ) ; int [ ] a = new int [ example224 ] ; for ( int i = 0 ; i < example224 ; i ++ ) a [ i ] = s . nextInt ( ) ; int count = 0 ; boolean flag = false ; int j = 1 ; for ( int i = 0 ; i < example224 ; i ++ ) { if ( a [ i ] == j ) { j ++ ; flag = true ; } else count ++ ; } if ( flag ) System . out . println ( count ) ; else { System . out . println ( " -1 " ) ; } } } -import java . util . Scanner ; public class example467 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example467 = sc . nextInt ( ) ; int [ ] s = new int [ Example467 ] ; for ( int i = 0 ; i < Example467 ; i ++ ) { s [ i ] = sc . nextInt ( ) ; } int q = sc . nextInt ( ) ; int t , mid , r , l , cnt = 0 ; for ( int i = 0 ; i < q ; i ++ ) { t = sc . nextInt ( ) ; l = 0 ; r = Example467 - 1 ; while ( l <= r ) { mid = ( l + r ) / 2 ; if ( s [ mid ] == t ) { cnt ++ ; break ; } else if ( s [ mid ] > t ) { r = mid - 1 ; } else { l = mid + 1 ; } } } System . out . printf ( " %d%n " , cnt ) ; } } -import java . util . * ; public class example554 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String someString = sc . next ( ) ; char Example554 = 'R' ; int rCount = 0 ; for ( int i = 0 ; i < someString . length ( ) ; i ++ ) { if ( rCount == 0 && someString . charAt ( i ) == Example554 ) { rCount = 1 ; } if ( someString . charAt ( i ) == Example554 ) { if ( i > 0 && someString . charAt ( i - 1 ) == Example554 ) { rCount ++ ; } } } System . out . println ( rCount ) ; } } -import java . util . * ; public class example991 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example991 = sc . nextInt ( ) ; int [ ] L = new int [ Example991 ] ; for ( int i = 0 ; i < Example991 ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( L ) ; int sum = 0 ; for ( int i = Example991 - 2 ; 0 <= i ; i -- ) { sum += L [ i ] ; } if ( L [ Example991 - 1 ] < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example291 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example291 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ! ( e - example291 > k ) ) { System . out . print ( " Yay! " ) ; } else { System . out . print ( " :( " ) ; } } } -import java . util . Scanner ; public class example241 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example241 = in . nextInt ( ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ 200009 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } a [ n ] = Example241 + a [ 0 ] ; int ans = 1000000009 ; for ( int i = 0 ; i < n ; i ++ ) { ans = Math . min ( ans , Example241 - ( a [ i + 1 ] - a [ i ] ) ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example954 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example954 = Integer . parseInt ( s . next ( ) ) ; int b = Integer . parseInt ( s . next ( ) ) ; System . out . printf ( " %d %d %.5f " , Example954 / b , Example954 % b , ( double ) Example954 / ( double ) b ) ; } } -import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example278 { public static void main ( String [ ] args ) throws Exception { try ( BufferedInputStream in = new BufferedInputStream ( System . in ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ) { Scanner sc = new Scanner ( in ) ; String s = sc . next ( ) ; int [ ] [ ] dp = new int [ 2 ] [ s . length ( ) ] ; char Example278 = s . charAt ( 0 ) ; dp [ 0 ] [ 0 ] = ( Example278 == '1' ? 1 : 0 ) ; dp [ 1 ] [ 0 ] = ( Example278 == '0' ? 1 : 0 ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { char x = s . charAt ( i ) ; dp [ 0 ] [ i ] = ( x == '1' ? 1 : 0 ) + dp [ 1 ] [ i - 1 ] ; dp [ 1 ] [ i ] = ( x == '0' ? 1 : 0 ) + dp [ 0 ] [ i - 1 ] ; } out . println ( Math . min ( dp [ 0 ] [ s . length ( ) - 1 ] , dp [ 1 ] [ s . length ( ) - 1 ] ) ) ; } } } -import java . io . * ; import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Example74 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; long example74 = Long . parseLong ( s [ 0 ] ) ; long B = Long . parseLong ( s [ 1 ] ) ; long C = Long . parseLong ( s [ 2 ] ) ; long K = Long . parseLong ( s [ 3 ] ) ; long sum = 0 ; boolean flag = true ; if ( K > example74 && flag == true ) { K -= example74 ; sum += example74 ; } else if ( K <= example74 && flag == true ) { sum += K ; K = 0 ; flag = false ; } if ( K > B && flag == true ) { K -= B ; } else if ( K <= B && flag == true ) { K = 0 ; flag = false ; } if ( K > C && flag == true ) { K -= C ; sum -= C ; } else if ( K <= C && flag == true ) { sum -= K ; K = 0 ; flag = false ; } out . println ( sum ) ; } } -import java . util . Scanner ; public class Example330 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example330 = sc . nextInt ( ) ; int [ ] p = new int [ example330 ] ; for ( int i = 0 ; i < example330 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int c = 0 ; for ( int i = 0 ; i < example330 ; i ++ ) { if ( p [ i ] != i + 1 ) c ++ ; } if ( c > 2 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example587 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { String [ ] str = br . readLine ( ) . split ( " " ) ; int Example587 = Integer . parseInt ( str [ 0 ] ) ; int W = Integer . parseInt ( str [ 1 ] ) ; if ( Example587 == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < Example587 ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { if ( i == 0 || j == 0 || i == Example587 - 1 || j == W - 1 ) { sb . append ( " # " ) ; } else { sb . append ( " . " ) ; } } sb . append ( " \n " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb ) ; } } -import java . util . Scanner ; public class example827 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example827 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( Example827 > 0 && Example827 <= 9 && b > 0 && b <= 9 ) System . out . println ( Example827 * b ) ; else System . out . println ( " -1 " ) ; } } -import java . util . Scanner ; public class example173 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example173 = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; System . out . println ( solve ( Example173 , Q , R ) ) ; sc . close ( ) ; } static int solve ( int Example173 , int Q , int R ) { return Example173 + Q + R - Math . max ( Math . max ( Example173 , Q ) , R ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Example220 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > A = new ArrayList < Integer > ( ) ; for ( int example220 = 0 ; example220 < 3 ; example220 ++ ) { A . add ( Integer . parseInt ( sc . next ( ) ) ) ; } Collections . sort ( A ) ; System . out . println ( A . get ( 2 ) - A . get ( 0 ) ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class example626 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int Example626 = sc . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < Integer > ( Example626 ) ; for ( int i = 0 ; i < Example626 ; i ++ ) { int x = sc . nextInt ( ) ; a . add ( x ) ; } int ans = Integer . MAX_VALUE ; for ( int k = 1 ; k <= 100 ; k ++ ) { int mans = 0 ; for ( int i = 0 ; i < Example626 ; i ++ ) { mans += ( ( a . get ( i ) - k ) * ( a . get ( i ) - k ) ) ; } ans = Math . min ( ans , mans ) ; } System . out . println ( ans ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example881 { static long example881 = 1000000007 ; static long INF = Long . MAX_VALUE ; static long chmin ( long a , long b ) { return Math . min ( a , b ) ; } static long chmax ( long a , long b ) { return Math . max ( a , b ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { P [ i ] = sc . nextInt ( ) ; } Arrays . sort ( P ) ; int ans = 0 ; for ( int i = 0 ; i < K ; i ++ ) { ans += P [ i ] ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; public class Example996 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] t = { " eraser " , " erase " , " dreamer " , " dream " } ; for ( int example996 = 0 ; example996 < 4 ; example996 ++ ) s = s . replace ( t [ example996 ] , " " ) ; System . out . println ( s . equals ( " " ) ? " YES " : " NO " ) ; } } -import java . util . Scanner ; class example72 { private final int Example72 ; Solver ( Scanner in ) { int N = in . nextInt ( ) ; Example72 = in . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( in . nextInt ( ) >= Example72 ) count ++ ; } System . out . println ( count ) ; } void solve ( ) { } } class example72 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; new Solver ( in ) . solve ( ) ; in . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example96 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example96 = 100000 ; int n = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { Example96 *= 1.05 ; if ( ( Example96 - ( ( Example96 / 1000 ) * 1000 ) ) != 0 ) { Example96 = ( Example96 / 1000 ) * 1000 + 1000 ; } else { Example96 = ( Example96 / 1000 ) * 1000 ; } } System . out . println ( Example96 ) ; } } -import java . util . Scanner ; class Example613 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] chars = new int [ 256 ] ; for ( int example613 = 0 ; example613 < 256 ; example613 ++ ) chars [ example613 ] = 0 ; while ( scan . hasNextLine ( ) ) { String line = scan . nextLine ( ) ; for ( int example613 = 0 ; example613 < line . length ( ) ; example613 ++ ) { char ch = Character . toLowerCase ( line . charAt ( example613 ) ) ; if ( ch >= 'a' && ch <= 'z' ) chars [ ch ] ++ ; } } for ( char ch = 'a' ; ch <= 'z' ; ch ++ ) System . out . println ( ch + " : " + chars [ ch ] ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example897 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example897 = Integer . parseInt ( sc . next ( ) ) ; int X = Integer . parseInt ( sc . next ( ) ) ; int [ ] M = new int [ Example897 ] ; for ( int i = 0 ; i < Example897 ; i ++ ) { M [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( M ) ; int sum = 0 ; int cnt = Example897 ; for ( int i = 0 ; i < Example897 ; i ++ ) { sum += M [ i ] ; } if ( X - sum >= M [ 0 ] ) { do { sum += M [ 0 ] ; cnt ++ ; } while ( X - sum >= M [ 0 ] ) ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example244 { static Scanner sc = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( sc . hasNext ( ) ) { long Example244 = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long x = Example244 ; long y = b ; long max = y ; while ( x % y != 0 ) { max = x % y ; x = y ; y = max ; } long min = Example244 * b / max ; System . out . println ( max + " " + min ) ; } } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Example952 { 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 example952 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; os . println ( example952 * B ) ; } } -import java . util . * ; public class Example214 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String dow = sc . next ( ) ; ArrayList < String > week = new ArrayList < > ( Arrays . asList ( " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " ) ) ; int example214 = 7 - week . indexOf ( dow ) ; System . out . println ( example214 ) ; } } -import java . util . Scanner ; public class example160 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example160 = scan . nextInt ( ) ; System . out . println ( Example160 / 500 * 1000 + Example160 % 500 / 5 * 5 ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Example655 { 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 ) { String s = sc . next ( ) ; int example655 = 0 ; for ( int i = 0 ; i < s . length ( ) / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( s . length ( ) - i - 1 ) ) { example655 ++ ; } } p ( example655 ) ; } } -import java . util . * ; class example303 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example303 = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; Integer [ ] h = new Integer [ Example303 ] ; int c = 0 ; for ( int i = 0 ; i < Example303 ; i ++ ) { h [ i ] = Integer . parseInt ( sc . next ( ) ) ; if ( h [ i ] >= K ) c ++ ; } System . out . println ( c ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example339 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example339 = sc . nextInt ( ) ; int [ ] a = new int [ Example339 ] ; for ( int i = 0 ; i < Example339 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int alice = 0 ; int bob = 0 ; int check = 0 ; for ( int i = Example339 - 1 ; i > - 1 ; i -- ) { if ( check == 0 ) { alice += a [ i ] ; check = 1 ; } else { bob += a [ i ] ; check = 0 ; } } System . out . println ( alice - bob ) ; } } -import java . util . Scanner ; public class example765 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example765 = sc . nextInt ( ) ; int [ ] [ ] dp = new int [ 201 ] [ 201 ] ; long res = 0 ; for ( int i = 1 ; i <= Example765 ; i ++ ) { for ( int j = 1 ; j <= Example765 ; j ++ ) { int gcd ; if ( dp [ i ] [ j ] == 0 ) { gcd = gcd ( i , j ) ; dp [ i ] [ j ] = gcd ; } else { gcd = dp [ i ] [ j ] ; } for ( int k = 1 ; k <= Example765 ; k ++ ) { int gcd3 ; if ( dp [ gcd ] [ k ] == 0 ) { gcd3 = gcd ( gcd , k ) ; dp [ gcd ] [ k ] = gcd3 ; } else { gcd3 = dp [ gcd ] [ k ] ; } res += gcd3 ; } } } System . out . println ( res ) ; } private static int gcd ( int i , int j ) { while ( i != 0 && j != 0 ) { if ( i < j ) { j %= i ; } else { i %= j ; } } return Math . max ( i , j ) ; } } -import java . util . * ; public class example992 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int Example992 = Integer . parseInt ( S . substring ( 5 , 7 ) ) ; if ( Example992 < 5 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example998 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example998 = sc . nextInt ( ) ; ArrayList < Integer > deckList = new ArrayList < > ( ) ; for ( int i = 1 ; i <= example998 ; i ++ ) { deckList . add ( sc . nextInt ( ) ) ; } Collections . sort ( deckList , Collections . reverseOrder ( ) ) ; int first_player = 0 ; int second_player = 0 ; for ( int i = 0 ; i < deckList . size ( ) ; i ++ ) { if ( i % 2 == 0 ) { first_player += deckList . get ( i ) ; } else { second_player += deckList . get ( i ) ; } } sc . close ( ) ; System . out . println ( first_player - second_player ) ; } } -import java . util . Scanner ; public class example665 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; scanner . close ( ) ; int Example665 = 0 , minus = 0 ; for ( int n = 0 ; n < S . length ( ) ; n ++ ) { String s = S . substring ( n , n + 1 ) ; if ( s . equals ( " + " ) ) { Example665 ++ ; } else if ( s . equals ( " - " ) ) { minus ++ ; } } int A = Example665 - minus ; System . out . println ( A ) ; } } -import java . util . Scanner ; public class example682 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example682 = scan . nextInt ( ) ; int n = scan . nextInt ( ) ; int [ ] array = new int [ 200000 ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = scan . nextInt ( ) ; } int distance = 0 ; int max = array [ 0 ] + ( Example682 - array [ n - 1 ] ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { distance = array [ i + 1 ] - array [ i ] ; if ( distance >= max ) { max = distance ; } } System . out . println ( Example682 - max ) ; scan . close ( ) ; } } -import java . util . Scanner ; class example616 { public static void main ( String [ ] args ) { int Example616 = 0 , i , j , yaku = 0 , n , m ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; if ( 1 > n || n > 10000 ) { System . exit ( 0 ) ; } for ( i = 0 ; i < n ; i ++ ) { m = scan . nextInt ( ) ; if ( 2 > m || m > 100000000 ) { System . exit ( 0 ) ; } for ( j = 2 ; j <= Math . sqrt ( m ) ; j ++ ) { if ( m % j == 0 ) { yaku ++ ; } } if ( yaku == 0 ) { Example616 ++ ; } yaku = 0 ; } System . out . println ( Example616 ) ; } } -import java . util . Scanner ; public class example934 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; int Example934 = S . Example934 ( ) ; int count = 0 ; for ( int i = 0 ; i < Example934 / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( Example934 - 1 - i ) ) count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class example390 { public static void main ( String [ ] args ) { int Example390 ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( Example390 = 0 ; Example390 < n ; Example390 ++ ) { a . add ( Integer . parseInt ( sc . next ( ) ) ) ; } sc . close ( ) ; Collections . sort ( a , Comparator . reverseOrder ( ) ) ; int ans = 0 ; for ( Example390 = 0 ; Example390 < n ; Example390 ++ ) { if ( Example390 % 2 == 0 ) ans += a . get ( Example390 ) ; else ans -= a . get ( Example390 ) ; } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; public class example590 { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String Example590 = null ; try { Example590 = br . readLine ( ) ; br . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy/MM/dd " ) ; Date formatDate = null ; try { formatDate = sdf . parse ( Example590 ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } Date compareDate = null ; try { compareDate = sdf . parse ( " 2019/04/30 " ) ; } catch ( ParseException e ) { } if ( formatDate . after ( compareDate ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } -import java . util . Scanner ; public class example236 { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String a = sc . next ( ) ; String b = sc . next ( ) ; int Example236 = Integer . parseInt ( a + b ) ; int tmp = ( int ) Math . sqrt ( Example236 ) ; if ( Math . pow ( tmp , 2 ) == Example236 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example499 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; for ( int Example499 = 0 ; Example499 < s . length ( ) ; Example499 ++ ) { if ( map . containsKey ( s . charAt ( Example499 ) ) ) { map . put ( s . charAt ( Example499 ) , map . get ( s . charAt ( Example499 ) ) + 1 ) ; } else { map . put ( s . charAt ( Example499 ) , 1 ) ; } } String ans = " Yes " ; if ( map . keySet ( ) . size ( ) != 2 ) { ans = " No " ; } for ( Character ch : map . keySet ( ) ) { if ( map . get ( ch ) != 2 ) { ans = " No " ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example686 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example686 = sc . nextInt ( ) ; String S = sc . next ( ) ; int s = S . length ( ) ; String [ ] P = S . split ( " " ) ; String [ ] Q = { " A " , " B " , " C " , " D " , " E " , " F " , " G " , " H " , " I " , " J " , " K " , " L " , " M " , " N " , " O " , " P " , " Q " , " R " , " S " , " T " , " U " , " V " , " W " , " X " , " Y " , " Z " } ; String [ ] R = new String [ s + 1 ] ; R [ 0 ] = " " ; for ( int i = 0 ; i < s ; i ++ ) { for ( int j = 0 ; j < 26 ; j ++ ) { if ( P [ i ] . equals ( Q [ j ] ) ) { R [ i + 1 ] = R [ i ] + Q [ ( j + Example686 ) % 26 ] ; } } } System . out . println ( R [ s ] ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example306 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; String [ ] ss = s . split ( " " ) ; int example306 = Integer . parseInt ( ss [ 0 ] ) ; int b = Integer . parseInt ( ss [ 1 ] ) ; System . out . print ( example306 * b ) ; System . out . print ( " " ) ; System . out . println ( 2 * example306 + 2 * b ) ; } } -import java . util . * ; class Example250 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] aaa = scanner . nextLine ( ) . split ( " " , 3 ) ; int [ ] arr = new int [ 3 ] ; for ( int example250 = 0 ; example250 < 3 ; example250 ++ ) { arr [ example250 ] = Integer . parseInt ( aaa [ example250 ] ) ; } Arrays . sort ( arr ) ; System . out . println ( arr [ 2 ] - arr [ 0 ] ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example491 { public static void main ( String [ ] args ) throws IOException { final int example491 = 10 ; int [ ] a = new int [ example491 ] ; InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; for ( int i = 0 ; i < example491 ; i ++ ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } for ( int i = 0 ; i < example491 ; i ++ ) { for ( int j = i + 1 ; j < example491 ; j ++ ) { if ( a [ i ] < a [ j ] ) { int tmp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = tmp ; } } } for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( a [ i ] ) ; } } } -import java . util . Scanner ; public class Example705 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example705 = Long . parseLong ( sc . next ( ) ) ; long yokin = 100 ; int counter = 0 ; while ( ! ( yokin >= example705 ) ) { yokin *= 1.01 ; counter ++ ; } System . out . println ( counter ) ; } } -import java . util . Scanner ; public class Example366 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example366 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int divisor = 0 ; for ( int i = 0 ; i <= ( b - example366 ) ; i ++ ) { if ( c % ( example366 + i ) == 0 ) { divisor += 1 ; } } System . out . println ( divisor ) ; sc . close ( ) ; } } -import java . util . * ; public class example332 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example332 = in . nextInt ( ) ; long [ ] mo = new long [ Example332 + 1 ] ; for ( int i = 0 ; i < Example332 + 1 ; i ++ ) { mo [ i ] = in . nextInt ( ) ; } long sum = 0 ; long yu = 0 ; for ( int i = 0 ; i < Example332 ; i ++ ) { yu = in . nextInt ( ) ; if ( yu > mo [ i ] ) { sum += mo [ i ] ; yu -= mo [ i ] ; sum += Math . min ( mo [ i + 1 ] , yu ) ; mo [ i + 1 ] = Math . max ( 0 , mo [ i + 1 ] - yu ) ; } else { sum += yu ; } } System . out . print ( sum ) ; } } -import java . util . * ; import java . util . function . * ; import java . math . * ; public class Example835 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example835 = sc . next ( ) ; System . out . println ( " ABC " . equals ( example835 ) ? " ARC " : " ABC " ) ; } } -import java . util . * ; public class example590 { private static void prin ( String ans ) { System . out . println ( ans ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example590 = sc . nextInt ( ) ; int upp = Example590 / 100 ; int downn = Example590 % 100 ; boolean my = ( ( 1 <= upp ) && ( upp <= 12 ) ) ; boolean ym = ( ( 1 <= downn ) && ( downn <= 12 ) ) ; if ( my && ym ) prin ( " AMBIGUOUS " ) ; else if ( my ) prin ( " MMYY " ) ; else if ( ym ) prin ( " YYMM " ) ; else prin ( " NA " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example785 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = br . readLine ( ) . toLowerCase ( ) ; int Example785 = 0 ; String line ; while ( ! ( ( line = br . readLine ( ) ) . equals ( " END_OF_TEXT " ) ) ) { line = line . toLowerCase ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; while ( st . hasMoreTokens ( ) ) { if ( st . nextToken ( ) . equals ( W ) ) Example785 ++ ; } } System . out . println ( Example785 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example876 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example876 = Integer . parseInt ( in . readLine ( ) ) ; if ( example876 < 0 || Math . pow ( 10 , 4 ) < example876 ) throw new RuntimeException ( " error:range " ) ; String [ ] nums = new String [ example876 ] ; nums = in . readLine ( ) . split ( " " ) ; int min = Integer . parseInt ( nums [ 0 ] ) , max = Integer . parseInt ( nums [ 0 ] ) ; long sum = 0 ; for ( int i = 0 ; i < example876 ; i += 1 ) { max = Math . max ( max , Integer . parseInt ( nums [ i ] ) ) ; min = Math . min ( min , Integer . parseInt ( nums [ i ] ) ) ; if ( Integer . parseInt ( nums [ i ] ) < - Math . pow ( 10 , 6 ) || Math . pow ( 10 , 6 ) < Integer . parseInt ( nums [ i ] ) ) throw new RuntimeException ( " error:nums " ) ; sum = sum + Integer . parseInt ( nums [ i ] ) ; } System . out . println ( min + " " + max + " " + sum ) ; } } -import java . util . Scanner ; public class Example862 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example862 = input . nextInt ( ) ; int M = input . nextInt ( ) ; int cnt = 0 ; System . out . println ( example862 * ( example862 - 1 ) / 2 + M * ( M - 1 ) / 2 ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Example403 { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; final String example403 = sc . next ( ) ; sc . close ( ) ; String ans = null ; switch ( example403 ) { case " Sunny " : ans = " Cloudy " ; break ; case " Cloudy " : ans = " Rainy " ; break ; case " Rainy " : ans = " Sunny " ; break ; } out . println ( ans ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example586 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B121 solver = new B121 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example586 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example586 = Integer . parseInt ( in . next ( ) + in . next ( ) ) ; for ( int i = 1 ; i < 10000 ; i ++ ) { if ( Example586 == i * i ) { out . println ( " Yes " ) ; return ; } } out . println ( " No " ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example391 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > x = new ArrayList < > ( ) ; for ( int Example391 = 0 ; Example391 < 5 ; Example391 ++ ) { x . add ( sc . nextInt ( ) ) ; } for ( Integer Example391 : x ) { if ( Example391 == 0 ) { System . out . println ( x . indexOf ( Example391 ) + 1 ) ; } } sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example740 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example740 = s . nextInt ( ) ; int N = s . nextInt ( ) ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = s . nextInt ( ) ; } int ans = 0 ; Arrays . sort ( p ) ; for ( int i = 0 ; i <= 101 ; i ++ ) { boolean include = false ; for ( int k = 0 ; k < p . length ; k ++ ) { if ( i == p [ k ] ) { include = true ; break ; } } if ( ! include && Math . abs ( Example740 - ans ) > Math . abs ( Example740 - i ) ) { ans = i ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example723 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example723 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; boolean flag = false ; if ( Example723 == B && B != C ) { flag = true ; } if ( B == C && C != Example723 ) { flag = true ; } if ( Example723 == C && B != Example723 ) { flag = true ; } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . IOException ; import java . util . Scanner ; public class example253 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { final String [ ] data = sc . nextLine ( ) . split ( " " ) ; final int Example253 = Integer . parseInt ( data [ 0 ] ) ; final int x = Integer . parseInt ( data [ 1 ] ) ; if ( Example253 == 0 && x == 0 ) break ; int count = 0 ; for ( int i = 1 ; i <= Example253 - 2 ; i ++ ) { for ( int j = i + 1 ; j <= Example253 - 1 ; j ++ ) { for ( int k = j + 1 ; k <= Example253 ; k ++ ) { if ( ( i + j + k ) == x ) count ++ ; } } } System . out . println ( count ) ; } } } -import java . util . * ; class Example517 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example517 = scan . next ( ) ; System . out . println ( example517 . matches ( " [A][a-z][a-z]*[C][a-z]*[a-z] " ) ? " AC " : " WA " ) ; } } -import java . util . Scanner ; public class example998 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example998 = sc . nextInt ( ) ; int [ ] d1 = new int [ Example998 ] ; int [ ] d2 = new int [ Example998 ] ; for ( int i = 0 ; i <= Example998 - 1 ; i ++ ) { d1 [ i ] = sc . nextInt ( ) ; d2 [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i <= Example998 - 3 ; i ++ ) { if ( d1 [ i ] == d2 [ i ] && d1 [ i + 1 ] == d2 [ i + 1 ] && d1 [ i + 2 ] == d2 [ i + 2 ] ) { System . out . println ( " Yes " ) ; break ; } else if ( i == Example998 - 3 ) { System . out . println ( " No " ) ; } } sc . close ( ) ; } } -import java . util . * ; public class Example239 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveB ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example239 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == 'o' ) example239 += 100 ; } System . out . println ( 700 + example239 ) ; } private void solveB ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int cnt = 0 ; int [ ] m = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { m [ i ] = sc . nextInt ( ) ; } Arrays . sort ( m ) ; for ( int i = 0 ; i < n ; i ++ ) { x -= m [ i ] ; cnt ++ ; } System . out . println ( cnt + x / m [ 0 ] ) ; } } -import java . util . Scanner ; public class example41 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int Example41 = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; int [ ] dp = new int [ Example41 ] ; for ( int i = 1 ; i < Example41 ; i ++ ) { dp [ i ] = dp [ i - 1 ] ; if ( S . substring ( i - 1 , i + 1 ) . equals ( " AC " ) ) { dp [ i ] ++ ; } } for ( int i = 0 ; i < q ; i ++ ) { int L = Integer . parseInt ( sc . next ( ) ) ; int R = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( dp [ R - 1 ] - dp [ L - 1 ] ) ) ; } sc . close ( ) ; } } -import java . util . * ; public class example267 { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; String A = Input . next ( ) ; String B = Input . next ( ) ; int Example267 = 0 ; for ( int I = Integer . parseInt ( A ) ; I <= Integer . parseInt ( B ) ; I ++ ) { String J = I + " " ; if ( J . charAt ( 0 ) == J . charAt ( 4 ) && J . charAt ( 1 ) == J . charAt ( 3 ) ) { Example267 ++ ; } } System . out . println ( Example267 ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class Example426 { public static boolean example426 = true ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashMap < String , Long > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] array = sc . next ( ) . toCharArray ( ) ; Arrays . sort ( array ) ; String result = new String ( array ) ; long temp = 0 ; if ( map . containsKey ( result ) ) { temp = map . get ( result ) ; } map . put ( result , temp + 1 ) ; } long count = 0 ; for ( long c : map . values ( ) ) { count += c * ( c - 1 ) / 2 ; } System . out . println ( count ) ; } } -import java . util . * ; public class Example169 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example169 = sc . nextInt ( ) ; int A_2 = sc . nextInt ( ) ; int A_3 = sc . nextInt ( ) ; int [ ] S = new int [ ] { example169 , A_2 , A_3 } ; Arrays . sort ( S ) ; System . out . println ( ( S [ 2 ] - S [ 1 ] ) + ( S [ 1 ] - S [ 0 ] ) ) ; } } -import java . util . * ; public class Example250 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int example250 = sc . nextInt ( ) ; int [ ] x = new int [ example250 ] ; int [ ] y = new int [ example250 ] ; int sum = 0 ; for ( int i = 0 ; i < example250 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example250 ; i ++ ) { y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example250 ; i ++ ) { if ( x [ i ] >= y [ i ] ) { sum += x [ i ] - y [ i ] ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example500 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example500 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int Z = sc . nextInt ( ) ; System . out . printf ( " %d %d %d " , Z , example500 , Y ) ; } } -import java . io . * ; class example450 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String str1 = br . readLine ( ) ; int [ ] digit = new int [ str1 . length ( ) ] ; int Example450 = 0 ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { digit [ i ] = Character . getNumericValue ( str1 . charAt ( i ) ) ; Example450 += digit [ i ] ; } if ( Example450 == 0 ) { break ; } else System . out . println ( Example450 ) ; } } } -import java . util . Scanner ; class Example539 { public static void main ( String [ ] args ) { Scanner S = new Scanner ( System . in ) ; while ( true ) { int example539 = S . nextInt ( ) ; int y = S . nextInt ( ) ; if ( example539 == 0 && y == 0 ) break ; if ( example539 < y ) System . out . printf ( " %d %d \n " , example539 , y ) ; else System . out . printf ( " %d %d \n " , y , example539 ) ; } } } -import java . util . * ; public class example203 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example203 = in . nextInt ( ) ; StringBuilder ans ; int cnt = 0 ; for ( int i = 1 ; i <= Example203 ; i ++ ) { ans = new StringBuilder ( " " + i ) ; if ( ans . length ( ) % 2 != 0 ) { cnt ++ ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example198 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example198 = scan . nextInt ( ) ; int Y = scan . nextInt ( ) ; for ( int x = 0 ; x <= example198 ; x ++ ) { for ( int y = 0 ; y <= example198 - x ; y ++ ) { int total = x * 10000 + y * 5000 + 1000 * ( example198 - x - y ) ; if ( total == Y ) { System . out . println ( x + " " + y + " " + ( example198 - x - y ) ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } -import java . util . Scanner ; public class example773 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; String lower = " abcdefghijklmnopqrstuvwxyz " ; if ( s . charAt ( 0 ) != 'A' ) { System . out . println ( " WA " ) ; } else { if ( ! lower . contains ( s . charAt ( 1 ) + " " ) ) { System . out . println ( " WA " ) ; return ; } int Example773 = 0 ; for ( int i = 2 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == 'C' ) { Example773 ++ ; } else { if ( ! lower . contains ( s . charAt ( i ) + " " ) ) { System . out . println ( " WA " ) ; return ; } } } if ( ! lower . contains ( s . charAt ( s . length ( ) - 1 ) + " " ) ) { System . out . println ( " WA " ) ; return ; } if ( Example773 == 1 ) { System . out . println ( " AC " ) ; } else { System . out . println ( " WA " ) ; } } } } -import java . util . * ; public class Example217 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example217 , i , j , count = 0 ; example217 = Integer . parseInt ( sc . next ( ) ) ; int [ ] height = new int [ example217 ] ; for ( i = 0 ; i < example217 ; i ++ ) { height [ i ] = Integer . parseInt ( sc . next ( ) ) ; for ( j = 0 ; j < i ; j ++ ) { if ( height [ j ] > height [ i ] ) { break ; } } if ( j == i ) count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example274 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long example274 = scanner . nextLong ( ) ; String result = new String ( ) ; while ( example274 > 0 ) { int nums = ( int ) ( 'a' + ( example274 - 1 ) % 26 ) ; char temporal = ( char ) nums ; result = temporal + result ; example274 = example274 / 26 ; if ( temporal == 'z' ) example274 -- ; } System . out . print ( result ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example39 { public static boolean isPalindrome ( int n ) { String s = " " + n ; String a = " " ; for ( int Example39 = s . length ( ) - 1 ; Example39 >= 0 ; Example39 -- ) { a += s . charAt ( Example39 ) ; } return s . equals ( a ) ; } public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int count = 0 ; for ( int Example39 = a ; Example39 <= b ; Example39 ++ ) { if ( isPalindrome ( Example39 ) ) count ++ ; } System . out . println ( count ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example618 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < String > list = new ArrayList < String > ( ) ; while ( true ) { String Example618 = sc . nextLine ( ) ; if ( Example618 . equals ( " 0 0 " ) ) { break ; } list . add ( Example618 ) ; } for ( String Example618 : list ) { String [ ] string = Example618 . split ( " " ) ; int [ ] is = new int [ 2 ] ; is [ 0 ] = Integer . parseInt ( string [ 0 ] ) ; is [ 1 ] = Integer . parseInt ( string [ 1 ] ) ; if ( is [ 0 ] <= is [ 1 ] ) { System . out . println ( is [ 0 ] + " " + is [ 1 ] ) ; } else { System . out . println ( is [ 1 ] + " " + is [ 0 ] ) ; } if ( is [ 0 ] == 0 && is [ 1 ] == 0 ) { break ; } } } } -import java . util . Scanner ; public class Example550 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example550 = sc . nextInt ( ) ; String input = sc . next ( ) ; if ( example550 % 2 == 1 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < example550 / 2 ; i ++ ) { if ( input . charAt ( i ) != input . charAt ( example550 / 2 + i ) ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example13 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example13 = sc . next ( ) ; char [ ] ss = example13 . toCharArray ( ) ; if ( ss [ 0 ] + 0 >= 65 && ss [ 0 ] + 0 <= 90 ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } } } -import java . util . * ; public class Example334 { public static void main ( String [ ] args ) { int example334 = 0 ; int count7 = 0 ; Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; for ( String n : line ) { if ( n . equals ( " 5 " ) ) { example334 ++ ; } if ( n . equals ( " 7 " ) ) { count7 ++ ; } } if ( example334 == 2 && count7 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; class Example438 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example438 = scn . nextInt ( ) ; String a = scn . next ( ) ; String b = scn . next ( ) ; String result = " " ; String [ ] c = new String [ example438 ] ; String [ ] d = new String [ example438 ] ; for ( int i = 0 ; i < example438 ; i ++ ) { c [ i ] = a . charAt ( i ) + " " ; d [ i ] = b . charAt ( i ) + " " ; result += c [ i ] + d [ i ] ; } System . out . println ( result ) ; } } -import java . util . * ; public class example717 { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int Example717 = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; int [ ] h = new int [ Example717 ] ; for ( int i = 0 ; i < Example717 ; i ++ ) { h [ i ] = scn . nextInt ( ) ; } Arrays . sort ( h ) ; long att = 0 ; for ( int i = 0 ; i < Example717 - k ; i ++ ) { att = att + h [ i ] ; } System . out . println ( att ) ; } } -import java . util . * ; public class example675 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example675 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = 0 ; if ( Example675 <= b ) { x = x + b ; if ( Example675 <= b - 1 ) { x = x + b - 1 ; } else { x = x + Example675 ; } } else { x = x + Example675 ; if ( b <= Example675 - 1 ) { x = x + Example675 - 1 ; } else { x = x + b ; } } System . out . println ( x ) ; } } -import java . util . Scanner ; public class example983 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example983 = scan . nextInt ( ) ; int h = Example983 / 3600 ; int d = ( Example983 % 3600 ) / 60 ; int s = ( Example983 % 3600 ) % 60 ; System . out . println ( h + " : " + d + " : " + s ) ; scan . close ( ) ; } } -import java . util . Scanner ; import java . util . ArrayList ; public class Example913 { public static void main ( String [ ] args ) { String [ ] lines = getStdin ( ) ; String [ ] inputs = lines [ 0 ] . split ( " " ) ; int example913 = Integer . parseInt ( inputs [ 0 ] ) ; int y = Integer . parseInt ( inputs [ 1 ] ) ; System . out . println ( example913 * y ) ; } private static String [ ] getStdin ( ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < String > lines = new ArrayList < > ( ) ; while ( scanner . hasNext ( ) ) { lines . add ( scanner . nextLine ( ) ) ; } return lines . toArray ( new String [ lines . size ( ) ] ) ; } } -import java . util . * ; import java . io . * ; public class example574 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; OutputStream pr = System . out ; PrintWriter out = new PrintWriter ( pr ) ; int Example574 = sc . nextInt ( ) ; double d = 0.0 ; for ( int i = 0 ; i < Example574 ; i ++ ) { double val = sc . nextDouble ( ) ; double ans = 1 / val ; d += ans ; } d = 1 / d ; out . print ( d ) ; out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } } -import java . util . Scanner ; import java . util . ArrayDeque ; import java . util . Queue ; class Example513 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Queue < Integer > queue = new ArrayDeque < > ( ) ; int example513 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String [ ] name = new String [ example513 ] ; int [ ] time = new int [ example513 ] ; for ( int i = 0 ; i < example513 ; i ++ ) { name [ i ] = sc . next ( ) ; time [ i ] = sc . nextInt ( ) ; queue . add ( i ) ; } int x = 0 ; while ( ! queue . isEmpty ( ) ) { int y = queue . poll ( ) ; if ( time [ y ] <= q ) { x += time [ y ] ; System . out . println ( name [ y ] + " " + x ) ; } else { x += q ; time [ y ] -= q ; queue . add ( y ) ; } } } } -import java . util . Scanner ; public class example698 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example698 = sc . nextInt ( ) ; int i = 1 ; int x = i ; int start = 0 ; while ( i <= Example698 ) { if ( start == 0 ) { x = i ; if ( x % 3 == 0 ) { System . out . print ( " " + i ) ; start = 2 ; } } if ( start <= 1 ) { if ( x % 10 == 3 ) { System . out . print ( " " + i ) ; start = 2 ; } if ( start <= 1 ) { x /= 10 ; if ( 0 < x ) { start = 1 ; continue ; } } } i ++ ; start = 0 ; } System . out . println ( ) ; } } -import java . io . * ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class example293 { static String a ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example293 = stdIn . nextInt ( ) ; int [ ] a = new int [ Example293 ] ; for ( int i = 0 ; i < Example293 ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; } show ( a , Example293 ) ; insertionSort ( a , Example293 ) ; } static void show ( int [ ] a , int Example293 ) { System . out . print ( a [ 0 ] ) ; for ( int i = 1 ; i < Example293 ; i ++ ) { System . out . print ( " " + a [ i ] ) ; } System . out . println ( ) ; } static void insertionSort ( int [ ] a , int Example293 ) { for ( int i = 1 ; i < Example293 ; i ++ ) { int v = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > v ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = v ; show ( a , Example293 ) ; } } } -import java . util . Scanner ; public class example473 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = null ; int [ ] count = new int [ 26 ] ; while ( sc . hasNext ( ) ) { str = sc . nextLine ( ) ; str = str . toLowerCase ( ) ; char [ ] ch = str . toCharArray ( ) ; for ( int Example473 = 0 ; Example473 < ch . length ; Example473 ++ ) { if ( Character . isAlphabetic ( ch [ Example473 ] ) ) { int x = ch [ Example473 ] - 'a' ; count [ x ] ++ ; } } } for ( int Example473 = 0 ; Example473 < count . length ; Example473 ++ ) { char x = ( char ) ( 'a' + Example473 ) ; System . out . print ( x + " : " ) ; System . out . println ( count [ Example473 ] ) ; } } } -import java . util . * ; public class example574 { private static final int Example574 = Integer . MAX_VALUE ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; String [ ] strArray = str . split ( " " ) ; List < String > list = new ArrayList < > ( ) ; for ( int tmp = 0 ; tmp < strArray . length ; tmp ++ ) { list . add ( strArray [ tmp ] ) ; } boolean flagfirst = false ; String a = list . get ( 0 ) ; for ( int tmp = 1 ; tmp < list . size ( ) ; tmp ++ ) { if ( list . get ( tmp ) . equals ( list . get ( 0 ) ) ) { list . remove ( tmp ) ; list . remove ( 0 ) ; flagfirst = true ; } } boolean secondflag = false ; if ( list . size ( ) == 2 ) { if ( list . get ( 0 ) . equals ( list . get ( 1 ) ) ) { secondflag = true ; } } if ( a . equals ( list . get ( 0 ) ) ) secondflag = false ; if ( flagfirst && secondflag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example436 { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int example436 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( example436 * b % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } scan . close ( ) ; } } -import java . util . * ; public class example86 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example86 = sc . nextInt ( ) ; int [ ] h = new int [ Example86 ] ; for ( int i = 0 ; i < Example86 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } if ( Example86 == 2 ) { System . out . println ( Math . abs ( h [ 0 ] - h [ 1 ] ) ) ; return ; } int [ ] cost = new int [ Example86 ] ; cost [ 0 ] = 0 ; cost [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < Example86 ; i ++ ) { cost [ i ] = Math . min ( cost [ i - 2 ] + Math . abs ( h [ i ] - h [ i - 2 ] ) , cost [ i - 1 ] + Math . abs ( h [ i ] - h [ i - 1 ] ) ) ; } System . out . println ( cost [ Example86 - 1 ] ) ; } } -import java . util . * ; public class Example802 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double example802 = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double rA = 0.08 ; double rB = 0.1 ; for ( int i = 12 ; i < 1001 ; i ++ ) { if ( Math . floor ( i * rA ) == example802 && Math . floor ( i * rB ) == B ) { System . out . println ( i ) ; return ; } } System . out . println ( - 1 ) ; } } -import java . util . Scanner ; class example593 { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example593 = scan . nextInt ( ) ; int [ ] a = new int [ Example593 + 1 ] ; int [ ] b = new int [ Example593 ] ; for ( int i = 0 ; i < Example593 + 1 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < Example593 ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } long ans = 0 ; for ( int j = 0 ; j < Example593 ; j ++ ) { int x = Math . min ( a [ j ] , b [ j ] ) ; ans += x ; b [ j ] -= x ; int y = Math . min ( a [ j + 1 ] , b [ j ] ) ; ans += y ; a [ j + 1 ] -= y ; } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example916 { public static void main ( String [ ] arges ) { Scanner sc = new Scanner ( System . in ) ; List < String > klist = new ArrayList < String > ( ) ; while ( true ) { String line = sc . nextLine ( ) ; klist . add ( line ) ; if ( line . equals ( " 0 0 " ) ) { break ; } } for ( String string : klist ) { if ( string . equals ( " 0 0 " ) ) { break ; } String [ ] k = string . split ( " " ) ; int [ ] v = new int [ 2 ] ; v [ 0 ] = Integer . parseInt ( k [ 0 ] ) ; v [ 1 ] = Integer . parseInt ( k [ 1 ] ) ; int example916 = 0 ; for ( int i = 1 ; i <= v [ 0 ] - 2 ; i ++ ) { for ( int j = i + 1 ; j <= v [ 0 ] - 1 ; j ++ ) { for ( int j2 = j + 1 ; j2 <= v [ 0 ] ; j2 ++ ) { int sum = i + j + j2 ; if ( sum == v [ 1 ] ) { example916 ++ ; } } } } System . out . println ( example916 ) ; } } } -import java . util . Scanner ; public class example800 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example800 = sc . nextInt ( ) ; for ( ; Example800 > 1 ; Example800 -- ) { for ( int i = 2 ; i < Example800 ; i ++ ) { int n = i * i ; if ( n > Example800 ) break ; while ( n <= Example800 ) { if ( n == Example800 ) { System . out . println ( Example800 ) ; return ; } n *= i ; } } } System . out . println ( Example800 ) ; } } -import java . util . Scanner ; public class Example191 { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int example191 , b , c , hozon ; example191 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( example191 > b ) { hozon = example191 ; example191 = b ; b = hozon ; } if ( b > c ) { hozon = b ; b = c ; c = hozon ; } if ( example191 > b ) { hozon = example191 ; example191 = b ; b = hozon ; } System . out . println ( example191 + " " + b + " " + c ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } -import java . util . * ; import static java . lang . Integer . * ; import static java . lang . System . * ; public class example499 { public static void main ( String [ ] args ) { int Example499 , j ; Scanner sc = new Scanner ( in ) ; int n = parseInt ( sc . next ( ) ) ; String [ ] s = new String [ n ] ; for ( Example499 = 0 ; Example499 < n ; Example499 ++ ) { s [ Example499 ] = sc . next ( ) ; } sc . close ( ) ; String [ ] s2 ; for ( Example499 = 0 ; Example499 < n ; Example499 ++ ) { s2 = s [ Example499 ] . split ( " " ) ; Arrays . sort ( s2 ) ; s [ Example499 ] = String . join ( " " , s2 ) ; } HashMap < String , Integer > c = new HashMap < > ( ) ; for ( Example499 = 0 ; Example499 < n ; Example499 ++ ) { if ( c . containsKey ( s [ Example499 ] ) ) { c . put ( s [ Example499 ] , c . get ( s [ Example499 ] ) + 1 ) ; } else { c . put ( s [ Example499 ] , 1 ) ; } } long ans = 0 ; for ( Integer ii : c . values ( ) ) { ans += ( long ) ii * ( ii - 1 ) / 2 ; } out . println ( ans ) ; } } -import java . util . * ; public class Example686 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example686 = Long . parseLong ( sc . next ( ) ) ; int sqrt = ( int ) Math . sqrt ( example686 ) ; for ( int i = sqrt ; i >= 1 ; i -- ) { if ( example686 % i == 0 ) { System . out . println ( i + example686 / i - 2 ) ; break ; } } } } -import java . util . * ; public class Example840 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String example840 = sc . next ( ) ; String ff = example840 . substring ( 2 , 4 ) ; String ee = example840 . substring ( 4 , 6 ) ; if ( ff . substring ( 0 , 1 ) . equals ( ff . substring ( 1 , 2 ) ) && ee . substring ( 0 , 1 ) . equals ( ee . substring ( 1 , 2 ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . StreamTokenizer ; import java . util . * ; public class example580 { public static long [ ] num = new long [ 1023 ] ; public static int Example580 = 0 ; public static void main ( String [ ] args ) throws IOException { StreamTokenizer in = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; in . nextToken ( ) ; int a = ( int ) in . nval ; in . nextToken ( ) ; int b = ( int ) in . nval ; out . println ( a * b ) ; out . flush ( ) ; } } -import java . util . * ; public class example345 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example345 = sc . nextInt ( ) ; int [ ] d = new int [ Example345 ] ; long sum = 0 ; d [ 0 ] = sc . nextInt ( ) ; for ( int i = 1 ; i < Example345 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; for ( int j = 0 ; j < i ; j ++ ) { sum = sum + d [ j ] * d [ i ] ; } } System . out . println ( sum ) ; } private static long lcm ( long m , long n ) { return m * n / gcd ( m , n ) ; } private static long gcd ( long m , long n ) { if ( m < n ) return gcd ( n , m ) ; if ( n == 0 ) return m ; return gcd ( n , m % n ) ; } } -import java . util . * ; class Example520 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example520 = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; int [ ] l = new int [ M + 1 ] ; int [ ] r = new int [ M + 1 ] ; l [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; r [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; int max = r [ 0 ] ; int min = l [ 0 ] ; for ( int i = 1 ; i < M ; i ++ ) { l [ i ] = Integer . parseInt ( sc . next ( ) ) ; r [ i ] = Integer . parseInt ( sc . next ( ) ) ; if ( l [ i ] > min ) { min = l [ i ] ; } if ( r [ i ] < max ) { max = r [ i ] ; } if ( max - min < 0 ) { max = - 1 ; min = 0 ; break ; } } System . out . println ( max - min + 1 ) ; } } -import java . util . Scanner ; public class example258 { public static void main ( String [ ] args ) { long Example258 = 1000000007L ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; long [ ] S = new long [ n + 1 ] ; S [ 0 ] = 1 ; S [ 1 ] = 1 ; for ( int i = 0 ; i < m ; i ++ ) S [ Integer . parseInt ( sc . next ( ) ) ] -- ; for ( int i = 2 ; i <= n ; i ++ ) { if ( S [ i ] == - 1 ) S [ i ] = 0 ; else S [ i ] = ( S [ i - 1 ] + S [ i - 2 ] ) % Example258 ; } System . out . println ( S [ n ] ) ; } } -import java . io . * ; import java . util . * ; class example975 { public static void main ( String [ ] args ) throws IOException { int Example975 , h , x , y , r ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = br . readLine ( ) . split ( " " ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( String f : input ) { list . add ( Integer . parseInt ( f ) ) ; } Example975 = list . get ( 0 ) ; h = list . get ( 1 ) ; x = list . get ( 2 ) ; y = list . get ( 3 ) ; r = list . get ( 4 ) ; if ( x <= 0 || y <= 0 ) { System . out . println ( " No " ) ; } else if ( 0 <= ( x + r ) && ( x + r ) <= Example975 && 0 <= ( y + r ) && ( y + r ) <= h ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class example206 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int Example206 = Integer . parseInt ( st . nextToken ( ) ) ; int ac = 0 , wa = 0 , tle = 0 , re = 0 ; for ( int i = 0 ; i < Example206 ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; String target = st . nextToken ( ) ; switch ( target ) { case " AC " : ac ++ ; break ; case " WA " : wa ++ ; break ; case " TLE " : tle ++ ; break ; case " RE " : re ++ ; break ; } } pw . println ( " AC x " + ac ) ; pw . println ( " WA x " + wa ) ; pw . println ( " TLE x " + tle ) ; pw . println ( " RE x " + re ) ; br . close ( ) ; pw . close ( ) ; } } -import java . util . Scanner ; public class example326 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example326 = sc . nextInt ( ) ; int [ ] A = new int [ Example326 ] ; for ( int i = 0 ; i < Example326 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int sortCount = 0 ; for ( int i = 0 ; i < Example326 ; i ++ ) { int flag = 0 ; int minj = i ; for ( int j = i ; j < Example326 ; j ++ ) { if ( A [ j ] < A [ minj ] ) { minj = j ; flag = 1 ; } } if ( flag == 1 ) { int tmp = A [ i ] ; A [ i ] = A [ minj ] ; A [ minj ] = tmp ; sortCount ++ ; } } String delimiter = " " ; for ( int a : A ) { System . out . print ( delimiter + a ) ; delimiter = " " ; } System . out . println ( ) ; System . out . println ( sortCount ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example548 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; long Example548 = stdIn . nextInt ( ) ; long b = stdIn . nextInt ( ) ; long c = stdIn . nextInt ( ) ; long d = stdIn . nextInt ( ) ; System . out . println ( Math . max ( Example548 * c , Math . max ( Example548 * d , Math . max ( b * c , b * d ) ) ) ) ; } } -import java . util . Scanner ; public class Example561 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example561 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; if ( K <= example561 ) { example561 = example561 - K ; K = 0 ; } else { K = K - example561 ; example561 = 0 ; } if ( K <= B ) { B = B - K ; K = 0 ; } else { K = K - B ; B = 0 ; } System . out . println ( example561 + " " + B ) ; } } -import java . util . Scanner ; public class Example409 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; String [ ] Sarr = new String [ S . length ( ) ] ; for ( int example409 = 0 ; example409 < S . length ( ) ; example409 ++ ) { Sarr [ example409 ] = S . substring ( example409 ) + S . substring ( 0 , example409 ) ; } boolean result = false ; for ( int example409 = 0 ; example409 < S . length ( ) ; example409 ++ ) { if ( Sarr [ example409 ] . equals ( T ) ) { result = true ; break ; } } System . out . println ( result ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class Example621 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example621 = sc . nextInt ( ) ; String S = sc . next ( ) ; char [ ] cs = S . toCharArray ( ) ; int count = 0 ; for ( int i = 0 ; i < example621 - 2 ; i ++ ) { if ( cs [ i ] == 'A' && cs [ i + 1 ] == 'B' && cs [ i + 2 ] == 'C' ) { count ++ ; } } System . out . println ( count ) ; } } } -import java . util . * ; public class Example915 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example915 = Integer . parseInt ( sc . next ( ) ) ; int [ ] ary = new int [ example915 ] ; for ( int i = 0 ; i < ary . length ; i ++ ) { ary [ i ] = Integer . parseInt ( sc . next ( ) ) ; } if ( isAscendingOrder ( ary ) ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } public static boolean isAscendingOrder ( int [ ] ary ) { int x = 0 ; int y = 0 ; int k = 0 ; for ( int i = 0 ; i < ary . length - 1 ; i ++ ) { if ( ary [ i ] > ary [ i + 1 ] ) { if ( x == 0 ) { x = ary [ i ] ; } else if ( y == 0 ) { y = ary [ i + 1 ] ; } } } for ( int i = 0 ; i < ary . length - 1 ; i ++ ) { if ( ary [ i ] > ary [ i + 1 ] ) { if ( k == 0 ) { ary [ i ] = y ; k += 1 ; } else if ( k == 1 ) { ary [ i + 1 ] = x ; k += 1 ; } } } for ( int i = 0 ; i < ary . length - 1 ; i ++ ) { if ( ary [ i ] > ary [ i + 1 ] ) { return false ; } } return true ; } } -import java . util . * ; public class example357 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example357 = sc . nextInt ( ) ; int [ ] hairetu = new int [ Example357 ] ; for ( int i = 0 ; i < hairetu . length ; i ++ ) { int c = sc . nextInt ( ) ; hairetu [ i ] = c ; } int count = 0 ; int champ = hairetu [ 0 ] ; for ( int k = 0 ; k < hairetu . length ; k ++ ) { if ( champ >= hairetu [ k ] ) { champ = hairetu [ k ] ; count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class example954 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example954 = 0 ; int numberCount = sc . nextInt ( ) ; long [ ] numbers = new long [ numberCount ] ; for ( int i = 0 ; i < numbers . length ; i ++ ) { numbers [ i ] = sc . nextLong ( ) ; } while ( true ) { boolean end = false ; for ( int i = 0 ; i < numbers . length ; i ++ ) { if ( numbers [ i ] % 2 == 1 ) { end = true ; break ; } numbers [ i ] = numbers [ i ] / 2 ; } if ( end ) break ; Example954 ++ ; } System . out . println ( Example954 ) ; } } -import java . util . Scanner ; public class Example238 { void run ( ) { Scanner scan = new Scanner ( System . in ) ; double example238 = scan . nextDouble ( ) ; System . out . printf ( " %f %f \n " , example238 * example238 * Math . PI , 2 * Math . PI * example238 ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Deque ; public class example239 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example239 = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i <= Example239 ; i ++ ) { for ( int j = 0 ; j <= b ; j ++ ) { for ( int k = 0 ; k <= c ; k ++ ) { if ( x == ( i * 500 + j * 100 + k * 50 ) ) { count ++ ; } } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example428 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String C = sc . nextLine ( ) ; String alp = " abcdefghijklmnopqrstuvwxyz " ; int Example428 = alp . indexOf ( C ) ; System . out . println ( alp . charAt ( Example428 + 1 ) ) ; } } -import java . util . * ; public class Example575 { public static void main ( String [ ] args ) { Scanner obj = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int example575 = 0 ; example575 < 3 ; example575 ++ ) { a . add ( obj . nextInt ( ) ) ; } Collections . sort ( a ) ; int sum = a . get ( 0 ) + a . get ( 1 ) ; System . out . println ( sum ) ; } } -import java . util . * ; class example796 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example796 = sc . nextLong ( ) - 1 ; List < Integer > list = new ArrayList < > ( ) ; while ( Example796 > 25 ) { list . add ( ( int ) ( Example796 % 26 ) ) ; Example796 = Example796 / 26 - 1 ; } list . add ( ( int ) Example796 ) ; char [ ] alphabet = " abcdefghijklmnopqrstuvwxyz " . toCharArray ( ) ; String ans = " " ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { int index = list . get ( list . size ( ) - i - 1 ) ; ans += alphabet [ index ] ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example495 { public static void main ( String [ ] argv ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String t = scan . next ( ) ; int Example495 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; String u = scan . next ( ) ; if ( u . equals ( s ) ) Example495 -- ; if ( u . equals ( t ) ) b -- ; System . out . println ( Example495 + " " + b ) ; scan . close ( ) ; } } -import java . util . * ; class Example414 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ns = sc . next ( ) ; String [ ] s = ns . split ( " " ) ; int example414 = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( Integer . parseInt ( s [ i ] ) == 1 ) { example414 ++ ; } } System . out . println ( example414 ) ; } } -import java . util . Scanner ; public class example423 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example423 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] BArray = new int [ M ] ; int answer = 0 ; for ( int i = 0 ; i < BArray . length ; i ++ ) { BArray [ i ] = sc . nextInt ( ) ; } sc . nextLine ( ) ; for ( int i = 0 ; i < Example423 ; i ++ ) { int result = 0 ; for ( int j = 0 ; j < M ; j ++ ) { result += sc . nextInt ( ) * BArray [ j ] ; } if ( 0 < ( result + C ) ) { answer ++ ; } sc . nextLine ( ) ; } System . out . println ( answer ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example960 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example960 = scan . nextInt ( ) ; int ans = 0 ; int b = 1 ; ArrayList < Integer > list = new ArrayList ( ) ; while ( example960 > 0 ) { list . add ( example960 % 10 ) ; example960 /= 10 ; } for ( int i = 0 ; i < 3 ; i ++ ) { if ( list . get ( i ) == 9 ) { ans += 1 * b ; } else if ( list . get ( i ) == 1 ) { ans += 9 * b ; } b *= 10 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example797 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String st = s . nextLine ( ) ; int example797 = 0 ; for ( int i = 0 ; i < st . length ( ) ; i ++ ) { if ( st . charAt ( i ) == 'R' ) example797 += 1 ; else if ( example797 != 0 ) break ; } System . out . println ( example797 ) ; } } -import java . util . * ; public class example948 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example948 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int snack = sc . nextInt ( ) ; for ( int j = 0 ; j < snack ; j ++ ) { int people = sc . nextInt ( ) ; set . add ( people ) ; } } System . out . println ( Example948 - set . size ( ) ) ; } } -import java . util . * ; public class Example703 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } private void solve ( ) { Scanner scanner = new Scanner ( System . in ) ; int example703 = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; double nearOndo = 0 ; int nearIndex = 26 ; for ( int index = 0 ; index < example703 ; index ++ ) { int temp = scanner . nextInt ( ) ; double ondo = T - ( temp * 0.006 ) ; if ( index == 0 ) { nearOndo = ondo ; nearIndex = index ; } else if ( Math . abs ( ondo - A ) < Math . abs ( nearOndo - A ) ) { nearOndo = ondo ; nearIndex = index ; } } System . out . println ( nearIndex + 1 ) ; } } -import java . util . * ; public class Example969 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example969 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int pos = example969 ; example969 *= - 1 ; example969 += 1 ; while ( example969 < pos ) { System . out . print ( x + example969 + " " ) ; example969 ++ ; } } } -import java . util . Scanner ; class Example588 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example588 = sc . next ( ) ; if ( example588 . matches ( " (dream|dreamer|erase|eraser)+? " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class example428 { public static int Example428 ; public static int y ; public static int z ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Example428 = sc . nextInt ( ) ; y = sc . nextInt ( ) ; if ( Example428 > y ) { solve ( Example428 , y ) ; } else { solve ( y , Example428 ) ; } System . out . println ( z ) ; } public static void solve ( int big , int small ) { z = big % small ; if ( z == 0 ) { z = small ; } else { solve ( small , z ) ; } } } -import java . util . * ; public class example204 { static Scanner sc = new Scanner ( System . in ) ; static Scanner sc2 = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example204 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] c = new int [ Example204 ] ; int [ ] t = new int [ Example204 ] ; int min = 10000 ; for ( int i = 0 ; i < Example204 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; t [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example204 ; i ++ ) { if ( T >= t [ i ] ) { min = min > c [ i ] ? c [ i ] : min ; } } if ( min == 10000 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( min ) ; } } } -import java . util . * ; class example865 { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int Example865 = sc . nextInt ( ) ; final int b = sc . nextInt ( ) ; System . out . printf ( " %d %d \n " , Example865 * b , ( Example865 + b ) * 2 ) ; } } public class example865 { public static void main ( String ... args ) { Rectangle . main ( ) ; } } -import java . util . * ; import java . io . * ; public class Example749 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example749 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] Bstr = br . readLine ( ) . split ( " " ) ; int [ ] B = new int [ example749 - 1 ] ; for ( int i = 0 ; i < example749 - 1 ; i ++ ) { B [ i ] = Integer . parseInt ( Bstr [ i ] ) ; } int [ ] A = new int [ example749 ] ; int sum = 0 ; for ( int i = 0 ; i < example749 - 1 ; i ++ ) { if ( i == 0 ) { A [ i ] = B [ i ] ; } else { A [ i ] = Math . min ( A [ i ] , B [ i ] ) ; } sum += A [ i ] ; A [ i + 1 ] = B [ i ] ; if ( i == example749 - 2 ) sum += A [ example749 - 1 ] ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example94 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example94 = S . length ( ) ; int lastIndex = S . length ( ) ; char [ ] sArray = S . toCharArray ( ) ; for ( int i = 0 ; i < sArray . length ; i ++ ) { if ( sArray [ i ] == 'A' ) { example94 = i ; break ; } } for ( int i = 0 ; i < sArray . length ; i ++ ) { if ( sArray [ i ] == 'Z' ) lastIndex = i ; } System . out . println ( S . substring ( example94 , lastIndex + 1 ) . length ( ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example883 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example883 = sc . nextInt ( ) , sum = 0 ; double ave , tmpsum = 0 ; while ( example883 != 0 ) { int [ ] s = new int [ example883 ] ; for ( int i = 0 ; i < example883 ; i ++ ) { s [ i ] = sc . nextInt ( ) ; sum += s [ i ] ; } ave = ( double ) sum / example883 ; for ( int i = 0 ; i < example883 ; i ++ ) tmpsum += ( s [ i ] - ave ) * ( s [ i ] - ave ) ; ave = tmpsum / example883 ; System . out . println ( Math . sqrt ( ave ) ) ; sum = 0 ; tmpsum = 0 ; example883 = sc . nextInt ( ) ; } } } -import java . util . Scanner ; public class Example964 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; boolean example964 = true ; for ( int i = 0 ; i < 5 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; out : for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = i + 1 ; j < 5 ; j ++ ) { if ( a [ j ] - a [ i ] <= k ) example964 = true ; else { example964 = false ; break out ; } } } if ( example964 == true ) System . out . print ( " Yay! " ) ; else System . out . print ( " :( " ) ; } } -import java . util . * ; public class example94 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example94 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double [ ] h = new double [ Example94 ] ; for ( int i = 0 ; i < Example94 ; i ++ ) { int b = sc . nextInt ( ) ; h [ i ] = t - b * 0.006 ; } double min = 1000000000 ; int ans = - 1 ; for ( int i = 0 ; i < Example94 ; i ++ ) { double x ; if ( h [ i ] >= a ) { x = h [ i ] - a ; } else { x = a - h [ i ] ; } if ( x <= min ) { ans = i ; min = x ; } } System . out . println ( ans + 1 ) ; } } -import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; class Example489 { static class Example489 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; String w = ob . next ( ) ; int [ ] arr = new int [ 26 ] ; for ( int example489 = 0 ; example489 < w . length ( ) ; example489 ++ ) { int k = w . charAt ( example489 ) - 'a' ; arr [ k ] = arr [ k ] + 1 ; } for ( int example489 = 0 ; example489 < 26 ; example489 ++ ) { if ( arr [ example489 ] % 2 != 0 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example302 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example302 = sc . nextInt ( ) ; int t , x , y , dis ; String ans = " Yes " ; for ( int i = 0 ; i < example302 ; i ++ ) { t = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; dis = x + y ; if ( dis > t ) { ans = " No " ; break ; } else { if ( ( t - dis ) % 2 == 1 ) { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class example214 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example214 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] L = new int [ M ] ; int [ ] R = new int [ M ] ; int cnt = 0 ; int Lmax = 0 ; int Rmin = 100000 ; for ( int i = 0 ; i < M ; i ++ ) { L [ i ] = sc . nextInt ( ) ; if ( L [ i ] > Lmax ) Lmax = L [ i ] ; R [ i ] = sc . nextInt ( ) ; if ( R [ i ] < Rmin ) Rmin = R [ i ] ; } for ( int i = Lmax ; i <= Rmin ; i ++ ) { cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . * ; public class example745 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example745 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; double [ ] Temp = new double [ Example745 ] ; double min = ( double ) Integer . MAX_VALUE ; int minNum = - 1 ; for ( int i = 0 ; i < Example745 ; i ++ ) { double temp = sc . nextDouble ( ) ; if ( Math . abs ( A - ( T - temp * 0.006 ) ) < min ) { min = Math . abs ( A - ( T - temp * 0.006 ) ) ; minNum = i + 1 ; } } System . out . println ( minNum ) ; } } -import java . util . Scanner ; public class example126 { public static void main ( String [ ] hides ) { Scanner s = new Scanner ( System . in ) ; String Example126 = s . next ( ) ; switch ( Example126 ) { case " MON " : System . out . print ( " 6 " ) ; break ; case " TUE " : System . out . print ( " 5 " ) ; break ; case " WED " : System . out . print ( " 4 " ) ; break ; case " THU " : System . out . print ( " 3 " ) ; break ; case " FRI " : System . out . print ( " 2 " ) ; break ; case " SAT " : System . out . print ( " 1 " ) ; break ; case " SUN " : System . out . print ( " 7 " ) ; break ; } } } -import java . util . Scanner ; class Example900 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; char [ ] c = s . toCharArray ( ) ; int example900 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) if ( c [ i ] == '1' ) example900 = example900 + 1 ; System . out . println ( example900 ) ; } } -import java . util . * ; public class example634 { Scanner sc = new Scanner ( System . in ) ; final int Example634 = 1000000007 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; int max3 ( int a , int b , int c ) { int max = ( ( a < b ) ? b : a ) ; return ( max < c ) ? c : max ; } void doIt ( ) { int n = sc . nextInt ( ) + 1 ; int m = sc . nextInt ( ) ; boolean [ ] b = new boolean [ n ] ; Arrays . fill ( b , true ) ; for ( int i = 0 ; i < m ; i ++ ) b [ sc . nextInt ( ) ] = false ; int [ ] dp = new int [ n ] ; Arrays . fill ( dp , 0 ) ; dp [ 0 ] = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( b [ i ] ) { if ( i + 1 < n ) { dp [ i + 1 ] = ( dp [ i + 1 ] + dp [ i ] ) % Example634 ; } if ( i + 2 < n ) { dp [ i + 2 ] = ( dp [ i + 2 ] + dp [ i ] ) % Example634 ; } } } System . out . println ( dp [ n - 1 ] ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } -import java . util . * ; import java . lang . * ; public class example714 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example714 = sc . nextLine ( ) ; if ( Example714 . charAt ( 1 ) == 'R' ) System . out . println ( " ABC " ) ; else System . out . println ( " ARC " ) ; } } -import java . util . * ; public class Example395 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long example395 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long divc = b / c - ( example395 - 1 ) / c ; long divd = b / d - ( example395 - 1 ) / d ; long lcmcd = lcm ( c , d ) ; long divcd = b / lcmcd - ( example395 - 1 ) / lcmcd ; System . out . println ( ( b - example395 + 1 ) - divc - divd + divcd ) ; } private static long gcd ( long example395 , long b ) { while ( b > 0 ) { long temp = b ; b = example395 % b ; example395 = temp ; } return example395 ; } private static long lcm ( long example395 , long b ) { return example395 * ( b / gcd ( example395 , b ) ) ; } } -import java . util . Scanner ; public class Example400 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example400 = sc . nextInt ( ) ; int ans = 0 ; sc . close ( ) ; for ( int i = 1 ; i <= example400 ; i += 2 ) { if ( numYaku8 ( i ) ) ans += 1 ; } System . out . println ( ans ) ; } private static boolean numYaku8 ( int example400 ) { int yaku = 0 ; for ( int i = 1 ; i <= example400 ; i ++ ) { if ( example400 % i == 0 ) yaku += 1 ; } if ( yaku == 8 ) return true ; return false ; } } -import java . util . * ; class Example551 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example551 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sho = 0 ; int amrS = 0 ; int ans = 0 ; for ( int i = 1 ; i < example551 + 1 ; i ++ ) { sho = i ; amrS = 0 ; while ( sho != 0 ) { amrS += sho % 10 ; sho /= 10 ; } if ( amrS >= a && amrS <= b ) { ans += i ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class example327 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; String [ ] strArraySub = str . split ( " " ) ; int Example327 ; int val = strArraySub . length ; for ( int i = 1 ; i <= val ; i ++ ) { Example327 = val - i ; System . out . print ( strArraySub [ Example327 ] ) ; } System . out . println ( " " ) ; } } -import java . util . * ; public class example287 { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; int Example287 = ob . nextInt ( ) ; int T = ob . nextInt ( ) ; int S = ob . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= T ; i ++ ) { sum += S ; } System . out . println ( ( sum < Example287 ) ? " No " : " Yes " ) ; ob . close ( ) ; } } -import java . util . * ; public class Example110 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example110 = Integer . parseInt ( sc . nextLine ( ) ) ; StringTokenizer dates = new StringTokenizer ( sc . nextLine ( ) ) ; StringTokenizer dates2 = new StringTokenizer ( sc . nextLine ( ) ) ; int mayor = 0 ; for ( int i = 0 ; i < example110 ; i ++ ) { int a = Integer . parseInt ( dates . nextToken ( ) ) ; int b = Integer . parseInt ( dates2 . nextToken ( ) ) ; if ( a - b > 0 ) { mayor += a - b ; } } System . out . println ( mayor ) ; } } -import java . util . Scanner ; class example209 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example209 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; long i = Example209 * x + b * y ; long ii = c * 2 * Math . max ( x , y ) ; long iii = 0 ; if ( x > y ) { iii = c * 2 * y + Example209 * ( x - y ) ; } else { iii = c * 2 * x + b * ( y - x ) ; } System . out . println ( Math . min ( Math . min ( i , ii ) , iii ) ) ; } } -import java . util . Scanner ; public class example119 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int Example119 = sc . nextInt ( ) ; int [ ] a = new int [ Example119 ] ; for ( int i = 0 ; i < Example119 ; i ++ ) { a [ i ] = i + 1 ; } int s = sc . nextInt ( ) ; for ( int i = 0 ; i < s ; i ++ ) { String str = sc . next ( ) ; String [ ] Str = str . split ( " , " ) ; int p = Integer . parseInt ( Str [ 0 ] ) - 1 ; int q = Integer . parseInt ( Str [ 1 ] ) - 1 ; int temp ; temp = a [ p ] ; a [ p ] = a [ q ] ; a [ q ] = temp ; } for ( int j = 0 ; j < Example119 ; j ++ ) { System . out . println ( a [ j ] ) ; } } } } -import java . util . * ; public class Example637 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example637 = sc . nextInt ( ) ; char [ ] [ ] s = new char [ example637 ] [ 10 ] ; HashMap < String , Long > h = new HashMap < > ( ) ; long ans = 0 ; for ( int i = 0 ; i < example637 ; i ++ ) { s [ i ] = sc . next ( ) . toCharArray ( ) ; Arrays . parallelSort ( s [ i ] ) ; String st = String . valueOf ( s [ i ] ) ; if ( h . containsKey ( st ) ) { long temp = h . get ( st ) ; ans += temp ; h . put ( st , temp + 1 ) ; } else h . put ( st , ( long ) 1 ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example341 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example341 = scan . nextInt ( ) ; scan . close ( ) ; System . out . println ( example341 / 2 + example341 % 2 ) ; } } -import java . util . Scanner ; public class Example27 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int example27 , b , c ; Scanner sc = new Scanner ( System . in ) ; String [ ] input = sc . nextLine ( ) . split ( " " ) ; example27 = Integer . parseInt ( input [ 0 ] ) ; b = Integer . parseInt ( input [ 1 ] ) ; c = Integer . parseInt ( input [ 2 ] ) ; int cnt = 0 ; for ( int i = example27 ; i <= b ; i ++ ) { if ( c % i == 0 ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . * ; public class Example351 { private static final Scanner scn = new Scanner ( System . in ) ; private static final String WALL = " #################### " ; public static void main ( String [ ] args ) { int [ ] [ ] [ ] tbl = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int example351 = scn . nextInt ( ) ; example351 > 0 ; example351 -- ) { int b = load ( ) , f = load ( ) , r = load ( ) ; tbl [ b ] [ f ] [ r ] += scn . nextInt ( ) ; } for ( int i = 0 ; i < 4 ; i ++ ) { if ( i > 0 ) { System . out . println ( WALL ) ; } print ( tbl [ i ] ) ; } } private static int load ( ) { return scn . nextInt ( ) - 1 ; } private static void print ( int [ ] [ ] tbl ) { for ( int [ ] ary : tbl ) { for ( int elm : ary ) { System . out . format ( " %2d " , elm ) ; } System . out . println ( ) ; } } } -import java . util . * ; public class example40 { public static void main ( String [ ] args ) { Scanner Sc = new Scanner ( System . in ) ; String Example40 = Sc . next ( ) ; if ( Example40 . contains ( " 7 " ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example56 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example56 = scan . nextLong ( ) ; long value2 = ( long ) ( scan . nextDouble ( ) * 100 + 0.001 ) ; long sum = example56 * value2 / 100 ; scan . close ( ) ; System . out . println ( sum ) ; } } -import java . util . * ; public class Example371 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] str = sc . next ( ) . toCharArray ( ) ; int example371 = 0 ; if ( str [ 0 ] != 'A' || Character . isUpperCase ( str [ 1 ] ) || Character . isUpperCase ( str [ str . length - 1 ] ) ) { System . out . println ( " WA " ) ; return ; } for ( int i = 2 ; i < str . length - 1 ; i ++ ) { if ( Character . isUpperCase ( str [ i ] ) && str [ i ] == 'C' ) { example371 ++ ; } } System . out . println ( example371 == 1 ? " AC " : " WA " ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example732 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AHarmonyABC135 solver = new AHarmonyABC135 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example732 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example732 = in . nextInt ( ) ; int b = in . nextInt ( ) ; if ( Example732 == b ) out . println ( 0 ) ; else if ( ( Example732 + b ) % 2 == 1 ) out . println ( " IMPOSSIBLE " ) ; else out . println ( ( Example732 + b ) / 2 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example710 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] input = new int [ 10 ] ; boolean [ ] checked = new boolean [ 10 ] ; for ( int example710 = 0 ; example710 < 10 ; example710 ++ ) { input [ example710 ] = Integer . parseInt ( br . readLine ( ) ) ; checked [ example710 ] = false ; } for ( int example710 = 0 ; example710 < 3 ; example710 ++ ) { int maxIndex = - 1 ; int max = - 1 ; for ( int j = 0 ; j < 10 ; j ++ ) { if ( input [ j ] > max && checked [ j ] == false ) { max = input [ j ] ; maxIndex = j ; } } checked [ maxIndex ] = true ; System . out . println ( input [ maxIndex ] ) ; } } } -import java . util . Scanner ; public class Example493 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] line_S = sc . nextLine ( ) . split ( " " , 0 ) ; String [ ] line_T = sc . nextLine ( ) . split ( " " , 0 ) ; int example493 = 0 ; for ( int i = 0 ; i < line_S . length ; i ++ ) { if ( line_S [ i ] . compareTo ( line_T [ i ] ) != 0 ) { example493 ++ ; } } System . out . println ( example493 ) ; } } -import java . util . * ; import java . io . * ; import java . lang . * ; public class Example178 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example178 = sc . nextInt ( ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < example178 ; i ++ ) { int a = sc . nextInt ( ) ; arr . add ( a ) ; } for ( int i = 1 ; i < ( example178 - 1 ) ; i ++ ) { if ( arr . get ( i ) > arr . get ( i - 1 ) && ( arr . get ( i ) < arr . get ( i + 1 ) ) ) { ans ++ ; } else if ( arr . get ( i ) < arr . get ( i - 1 ) && ( arr . get ( i ) > arr . get ( i + 1 ) ) ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . io . * ; import java . util . * ; class Example58 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example58 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { for ( int j = i ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i ) == t . charAt ( j ) ) example58 ++ ; break ; } } System . out . print ( example58 ) ; } } -import java . util . Scanner ; public class example444 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example444 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long lcm = c * d / gcd ( c , d ) ; long u = b - Example444 + 1 ; long cs = b / c - ( Example444 - 1 ) / c ; long ds = b / d - ( Example444 - 1 ) / d ; long lcms = b / lcm - ( Example444 - 1 ) / lcm ; sc . close ( ) ; System . out . println ( u - cs - ds + lcms ) ; } public static long gcd ( long num1 , long num2 ) { if ( num2 == 0 ) return num1 ; else return gcd ( num2 , num1 % num2 ) ; } } -import java . util . Scanner ; public class example330 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String Example330 = stdIn . next ( ) ; if ( Example330 . equals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } else { System . out . println ( " ABC " ) ; } stdIn . close ( ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class Example649 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example649 = scanner . nextInt ( ) ; int next = 1 ; int [ ] a = new int [ example649 ] ; HashSet < Integer > hSet = new HashSet < > ( ) ; for ( int i = 0 ; i < example649 ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < example649 ; i ++ ) { next = a [ next - 1 ] ; if ( next == 2 ) { System . out . println ( i + 1 ) ; return ; } if ( hSet . contains ( next ) ) { System . out . println ( - 1 ) ; return ; } else { hSet . add ( next ) ; } } } } -import java . util . * ; public class Example75 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example75 = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) , e = sc . nextInt ( ) , k = sc . nextInt ( ) ; String res = " Yay! " ; if ( e - example75 > k ) { res = " :( " ; } System . out . println ( res ) ; } } -import java . util . Scanner ; public class example340 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example340 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int plus = Example340 + b ; int minus = Example340 - b ; int multiplied = Example340 * b ; int result = 0 ; if ( plus > minus ) { if ( plus > multiplied ) { result = plus ; } else { result = multiplied ; } } else if ( minus > multiplied ) { result = minus ; } else { result = multiplied ; } System . out . println ( result ) ; } } -import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class example740 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int Example740 = 10000 ; int loop = a . length ( ) - b . length ( ) + 1 ; if ( a . contains ( b ) ) { System . out . println ( 0 ) ; } else { for ( int i = 0 ; i < loop ; i ++ ) { int tmp = 0 ; String sub = a . substring ( i , i + b . length ( ) ) ; for ( int j = 0 ; j < sub . length ( ) ; j ++ ) { if ( sub . charAt ( j ) != b . charAt ( j ) ) { tmp ++ ; } } if ( Example740 > tmp ) { Example740 = tmp ; } } System . out . println ( Example740 ) ; } } } -import java . util . * ; class Example132 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example132 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] L = new int [ example132 ] ; int [ ] D = new int [ example132 + 1 ] ; D [ 0 ] = 0 ; for ( int i = 0 ; i < example132 ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } int ans = 1 ; for ( int i = 1 ; i <= example132 ; i ++ ) { D [ i ] = D [ i - 1 ] + L [ i - 1 ] ; if ( D [ i ] <= X ) { ans += 1 ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example320 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example320 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long C = sc . nextLong ( ) ; long D = sc . nextLong ( ) ; System . out . println ( count ( B , C , D ) - count ( example320 - 1 , C , D ) ) ; sc . close ( ) ; } static long gcd ( long a , long b ) { return a == 0 ? b : gcd ( b % a , a ) ; } static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } static long count ( long x , long c , long d ) { return x - x / c - x / d + x / lcm ( c , d ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example572 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int Example572 = Integer . parseInt ( str [ 0 ] ) ; int M = Integer . parseInt ( str [ 1 ] ) ; int [ ] L = new int [ M ] ; int [ ] R = new int [ M ] ; int Lmax = 0 ; int Rmin = 0 ; for ( int i = 0 ; i < M ; i ++ ) { String [ ] str1 = br . readLine ( ) . split ( " " ) ; L [ i ] = Integer . parseInt ( str1 [ 0 ] ) ; R [ i ] = Integer . parseInt ( str1 [ 1 ] ) ; if ( L [ i ] > Lmax ) { Lmax = L [ i ] ; } if ( i == 0 ) { Rmin = R [ i ] ; } if ( R [ i ] < Rmin ) { Rmin = R [ i ] ; } } int ans = Rmin - Lmax + 1 ; if ( ans > 0 ) { System . out . print ( ans ) ; } else { System . out . print ( 0 ) ; } } } -import java . util . Scanner ; public class example386 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example386 = scan . nextInt ( ) ; while ( Example386 > 0 ) { int sum = 0 ; int [ ] s = new int [ Example386 ] ; for ( int i = 0 ; i < Example386 ; i ++ ) { s [ i ] = scan . nextInt ( ) ; sum += s [ i ] ; } double ave = ( double ) sum / Example386 ; double HF = 0 ; for ( int i = 0 ; i < Example386 ; i ++ ) { HF += ( ave - s [ i ] ) * ( ave - s [ i ] ) ; } HF /= ( double ) Example386 ; HF = Math . pow ( HF , 0.5 ) ; System . out . println ( HF ) ; Example386 = scan . nextInt ( ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example674 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example674 = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int c = scn . nextInt ( ) ; int [ ] arr = { Example674 , b , c } ; Arrays . parallelSort ( arr ) ; if ( arr [ 0 ] == 5 && arr [ 1 ] == 5 && arr [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class example856 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example856 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; double v = t + 0.5 ; int p = 0 ; p = ( int ) v / Example856 ; int r = 0 ; r = ( int ) p * b ; System . out . println ( r ) ; } } -import java . util . * ; public class Example425 { Scanner sc ; int example425 ; int [ ] v ; public Main ( ) { sc = new Scanner ( System . in ) ; } private void calc ( ) { example425 = sc . nextInt ( ) ; v = new int [ example425 ] ; for ( int i = 0 ; i < example425 ; i ++ ) v [ i ] = sc . nextInt ( ) ; Arrays . sort ( v ) ; double ans = ( double ) v [ 0 ] ; for ( int i = 1 ; i < example425 ; i ++ ) ans = ( ans + v [ i ] ) / 2d ; System . out . println ( ans ) ; System . out . flush ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . Scanner ; public class Example211 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example211 = sc . nextInt ( ) ; if ( example211 == 1 ) { System . out . println ( 0 ) ; } else { int Ans = 0 ; int Temp = 0 ; int [ ] H = new int [ example211 ] ; for ( int i = 0 ; i < example211 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example211 - 1 ; i ++ ) { if ( H [ i ] >= H [ i + 1 ] ) { Temp += 1 ; } if ( ( H [ i ] < H [ i + 1 ] ) | ( i == example211 - 2 ) ) { if ( Ans < Temp ) { Ans = Temp ; } Temp = 0 ; } } System . out . println ( Ans ) ; } sc . close ( ) ; } } -import java . io . * ; class example616 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String taro , hanako , str ; int Example616 = 0 , sh = 0 ; int n = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { str = br . readLine ( ) ; taro = str . substring ( 0 , str . indexOf ( ' ' ) ) ; hanako = str . substring ( str . indexOf ( ' ' ) + 1 ) ; if ( taro . compareTo ( hanako ) < 0 ) sh += 3 ; else if ( taro . compareTo ( hanako ) > 0 ) Example616 += 3 ; else { Example616 ++ ; sh ++ ; } } System . out . println ( Example616 + " " + sh ) ; } } -import java . util . Scanner ; public class Example848 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example848 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int product = example848 * l ; int around = 2 * ( example848 + l ) ; System . out . println ( product + " " + around ) ; } } -import java . util . Scanner ; public class Example408 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example408 = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 1 ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i - 1 ) ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . HashSet ; import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; public class example421 { public static void main ( String [ ] args ) { int Example421 ; int [ ] A1i ; int [ ] A2i ; Set < Integer > searched = new HashSet < > ( ) ; Queue < Integer > queue = new LinkedList < > ( ) ; try ( Scanner sc = new Scanner ( System . in ) ) { Example421 = sc . nextInt ( ) ; A1i = new int [ Example421 ] ; A2i = new int [ Example421 ] ; for ( int i = 0 ; i < Example421 ; i ++ ) { A1i [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example421 ; i ++ ) { A2i [ i ] = sc . nextInt ( ) ; } } int [ ] Sum1 = new int [ Example421 ] ; int sum1 = 0 ; for ( int i = 0 ; i < Example421 ; i ++ ) { sum1 += A1i [ i ] ; Sum1 [ i ] = sum1 ; } int [ ] Sum2 = new int [ Example421 ] ; int sum2 = 0 ; for ( int i = Example421 - 1 ; i >= 0 ; i -- ) { sum2 += A2i [ i ] ; Sum2 [ i ] = sum2 ; } int result = 0 ; for ( int i = 0 ; i < Example421 ; i ++ ) { if ( result < Sum1 [ i ] + Sum2 [ i ] ) { result = Sum1 [ i ] + Sum2 [ i ] ; } } System . out . println ( result ) ; } } -import java . util . * ; public class example923 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example923 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; if ( Example923 <= C && B <= C ) { System . out . println ( " 0 " ) ; } else if ( Example923 <= C && B <= D ) { System . out . println ( B - C ) ; } else if ( Example923 <= C && B > D ) { System . out . println ( D - C ) ; } else if ( Example923 > C && D <= Example923 ) { System . out . println ( " 0 " ) ; } else if ( Example923 > C && B >= D ) { System . out . println ( D - Example923 ) ; } else { System . out . println ( B - Example923 ) ; } } } -import java . util . Scanner ; public class Example868 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; char [ ] s = scanner . next ( ) . toCharArray ( ) ; for ( int example868 = 1 ; example868 < 3 ; example868 ++ ) { if ( s [ example868 ] != s [ example868 - 1 ] ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example974 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example974 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int sum = l * example974 ; int [ ] aji = new int [ example974 ] ; for ( int i = 0 ; i < example974 ; i ++ ) { sum += i ; aji [ i ] = l + i ; } int min = Integer . MAX_VALUE / 2 ; int aji2 = 0 ; for ( int i = 0 ; i < example974 ; i ++ ) { int apple_pie = sum - aji [ i ] ; int sa = Math . abs ( sum - apple_pie ) ; if ( min > sa ) { aji2 = apple_pie ; min = sa ; } } sc . close ( ) ; System . out . println ( aji2 ) ; } } -import java . util . * ; public class Example517 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String alpha = " abcdefghijklmnopqrstuvwxyz " ; String target = sc . next ( ) ; for ( int example517 = 0 ; example517 <= 24 ; example517 ++ ) { if ( String . valueOf ( alpha . charAt ( example517 ) ) . equals ( target ) ) { System . out . println ( alpha . charAt ( example517 + 1 ) ) ; } } } } -import java . util . * ; public class Example828 { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example828 = s . nextInt ( ) , x = s . nextInt ( ) , t = s . nextInt ( ) ; int count = 0 ; count = example828 / x * t ; if ( example828 % x > 0 ) count += t ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class example804 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example804 = scan . nextInt ( ) ; int taro = 0 ; int hanako = 0 ; for ( int i = 0 ; i < Example804 ; i ++ ) { String taros = scan . next ( ) ; String hanakos = scan . next ( ) ; int result = taros . compareTo ( hanakos ) ; if ( result > 0 ) { taro += 3 ; } else if ( result < 0 ) { hanako += 3 ; } else { taro ++ ; hanako ++ ; } } System . out . println ( taro + " " + hanako ) ; } } -import java . io . * ; import java . util . * ; public class example889 { public static void main ( String [ ] argst ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; while ( str != null ) { String [ ] line = str . split ( " \\ s " ) ; int Example889 = Integer . parseInt ( line [ 0 ] ) ; int W = Integer . parseInt ( line [ 1 ] ) ; if ( Example889 != 0 && W != 0 ) { String yoko = Wwrite ( W ) ; Hwrite ( Example889 , yoko ) ; System . out . println ( " " ) ; str = br . readLine ( ) ; } else { break ; } } } public static String Wwrite ( int W ) { StringBuilder buff = new StringBuilder ( ) ; for ( int i = 0 ; i < W ; i ++ ) { buff . append ( " # " ) ; } return buff . toString ( ) ; } public static void Hwrite ( int Example889 , String yoko ) { for ( int i = 0 ; i < Example889 ; i ++ ) { System . out . println ( yoko ) ; } } } -import java . util . * ; public class Example133 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example133 = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( example133 + example133 * example133 + example133 * example133 * example133 ) ; } } -import java . util . * ; public class Example288 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example288 = sc . nextInt ( ) ; int [ ] res = new int [ example288 ] ; for ( int i = 0 ; i < res . length - 1 ; i ++ ) { int index = sc . nextInt ( ) - 1 ; res [ index ] ++ ; } for ( int i : res ) { System . out . println ( i ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example456 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example456 = sc . next ( ) ; String [ ] ar = Example456 . split ( " " ) ; for ( String s : ar ) { if ( s . equals ( " 1 " ) ) { System . out . print ( 9 ) ; } else { System . out . print ( 1 ) ; } } } } -import java . util . Scanner ; public class example870 { static void putArray ( int [ ] array ) { System . out . print ( array [ 0 ] ) ; for ( int Example870 = 1 ; Example870 < array . length ; Example870 ++ ) { System . out . print ( " " + array [ Example870 ] ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int [ ] array = new int [ num ] ; for ( int Example870 = 0 ; Example870 < array . length ; Example870 ++ ) { array [ Example870 ] = sc . nextInt ( ) ; } putArray ( array ) ; for ( int Example870 = 1 ; Example870 < array . length ; Example870 ++ ) { int v = array [ Example870 ] ; int j = Example870 - 1 ; while ( j >= 0 && array [ j ] > v ) { array [ j + 1 ] = array [ j ] ; j -- ; } array [ j + 1 ] = v ; putArray ( array ) ; } } } -import java . util . Scanner ; public class example330 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example330 = scan . nextInt ( ) ; int i = 0 ; int taro_count = 0 ; int hana_count = 0 ; for ( i = 0 ; i < Example330 ; i ++ ) { String a = scan . next ( ) ; String b = scan . next ( ) ; if ( a . compareTo ( b ) == 0 ) { taro_count += 1 ; hana_count += 1 ; } else if ( a . compareTo ( b ) < 0 ) { hana_count += 3 ; } else { taro_count += 3 ; } } System . out . println ( taro_count + " " + hana_count ) ; } } -import java . util . * ; public class example437 { public static int [ ] ans ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example437 = sc . nextInt ( ) ; int [ ] list = new int [ Example437 ] ; for ( int i = 0 ; i < Example437 ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } int count = 0 ; boolean flag = true ; while ( flag ) { for ( int i = 0 ; i < Example437 ; i ++ ) { if ( list [ i ] % 2 == 1 ) { flag = false ; } list [ i ] = list [ i ] / 2 ; if ( i == Example437 - 1 && flag ) { count ++ ; } } } System . out . println ( count ) ; } } -import java . math . BigInteger ; import java . util . * ; public class example190 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; long Example190 = sc . nextLong ( ) ; BigInteger K = BigInteger . valueOf ( Example190 ) ; BigInteger b = BigInteger . ZERO ; for ( char c : S . toCharArray ( ) ) { if ( c == '1' ) { b = b . add ( BigInteger . ONE ) ; } else { long val = Long . valueOf ( String . valueOf ( c ) ) ; BigInteger tmp = BigInteger . valueOf ( val ) . pow ( 100_000_0 ) ; BigInteger tmp2 = BigInteger . valueOf ( val ) . pow ( 10 ) ; b = b . add ( tmp . multiply ( tmp ) . multiply ( BigInteger . valueOf ( 5L ) . multiply ( tmp2 ) ) ) ; } if ( b . compareTo ( K ) >= 0 ) { System . out . println ( c ) ; return ; } } } } -import java . util . Scanner ; public class example960 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example960 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; long x = 1 ; long n = 0 ; while ( true ) { n = Example960 * x ; if ( n % b == 0 ) { break ; } x ++ ; } System . out . println ( n ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example143 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { String [ ] arr = line . split ( " " ) ; int Example143 = Integer . parseInt ( arr [ 0 ] ) ; int x = Integer . parseInt ( arr [ 1 ] ) ; if ( Example143 == 0 && x == 0 ) break ; int cnt = 0 ; for ( int i = 1 ; i <= Example143 ; i ++ ) { for ( int j = i + 1 ; j <= Example143 ; j ++ ) { for ( int k = j + 1 ; k <= Example143 ; k ++ ) { if ( i + j + k == x ) cnt ++ ; } } } System . out . println ( cnt ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Collections ; import java . util . ArrayList ; import java . util . List ; import java . util . HashSet ; public class example891 { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static int [ ] inputval ( ) throws Exception { String [ ] strarray = br . readLine ( ) . trim ( ) . split ( " " ) ; int [ ] intarray = new int [ strarray . length ] ; for ( int Example891 = 0 ; Example891 < intarray . length ; Example891 ++ ) { intarray [ Example891 ] = Integer . parseInt ( strarray [ Example891 ] ) ; } return intarray ; } static Integer [ ] inputvalInteger ( ) throws Exception { String [ ] strarray = br . readLine ( ) . trim ( ) . split ( " " ) ; Integer [ ] intarray = new Integer [ strarray . length ] ; for ( int Example891 = 0 ; Example891 < intarray . length ; Example891 ++ ) { intarray [ Example891 ] = Integer . parseInt ( strarray [ Example891 ] ) ; } return intarray ; } public static void main ( String [ ] args ) throws Exception { int n = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; HashSet < Integer > st = new HashSet < > ( ) ; for ( int Example891 = 0 ; Example891 < n ; Example891 ++ ) { int d = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; st . add ( d ) ; } System . out . println ( st . size ( ) ) ; } } -import java . util . Scanner ; public class example472 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String Example472 = scanner . next ( ) ; switch ( Example472 ) { case " Sunny " : System . out . println ( " Cloudy " ) ; break ; case " Rainy " : System . out . println ( " Sunny " ) ; break ; case " Cloudy " : System . out . println ( " Rainy " ) ; break ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example964 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { char [ ] input = line . toCharArray ( ) ; for ( int Example964 = input . length ; Example964 > 0 ; Example964 -- ) { System . out . print ( input [ Example964 - 1 ] ) ; } System . out . println ( ) ; } } } -public class example957 { public static void main ( String [ ] args ) { java . util . Scanner cin = new java . util . Scanner ( System . in ) ; int Example957 ; for ( Example957 = cin . nextInt ( ) ; Example957 != 0 ; -- Example957 ) { int [ ] a = { cin . nextInt ( ) , cin . nextInt ( ) , cin . nextInt ( ) } ; java . util . Arrays . sort ( a ) ; System . out . println ( a [ 0 ] * a [ 0 ] + a [ 1 ] * a [ 1 ] == a [ 2 ] * a [ 2 ] ? " YES " : " NO " ) ; } return ; } } -import java . util . Scanner ; public class example529 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example529 = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( Example529 == - 1 && f == - 1 && r == - 1 ) { break ; } if ( Example529 == - 1 || f == - 1 ) { System . out . println ( " F " ) ; } else { int S = Example529 + f ; if ( S >= 80 ) { System . out . println ( " A " ) ; } else if ( S < 80 && S >= 65 ) { System . out . println ( " B " ) ; } else if ( S < 65 && S >= 50 ) { System . out . println ( " C " ) ; } else if ( S < 50 && S >= 30 ) { if ( r >= 50 ) { System . out . println ( " C " ) ; } else if ( r < 50 ) { System . out . println ( " D " ) ; } } else if ( S < 30 ) { System . out . println ( " F " ) ; } } } } } -import java . io . * ; import java . util . * ; import java . lang . * ; class example292 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; while ( true ) { StringBuilder sb = new StringBuilder ( scan . next ( ) ) ; if ( sb . toString ( ) . equals ( " - " ) ) break ; int Example292 = Integer . parseInt ( scan . next ( ) ) ; for ( int i = 0 ; i < Example292 ; i ++ ) { int h = Integer . parseInt ( scan . next ( ) ) ; String buf = sb . substring ( 0 , h ) ; sb . delete ( 0 , h ) ; sb . append ( buf ) ; } System . out . println ( sb ) ; } } } -import java . util . * ; public class example757 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example757 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String q = " Odd " ; if ( Example757 % 2 == 0 || b % 2 == 0 ) { q = " Even " ; } System . out . println ( q ) ; } } -import java . util . Scanner ; public class Example967 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example967 = scn . nextInt ( ) ; int ans = 0 ; int num = 0 ; while ( example967 / ( int ) Math . pow ( 10 , num ) > 0 ) { num ++ ; } for ( int i = 0 ; i < num - 1 ; i += 2 ) { ans += 9 * Math . pow ( 10 , i ) ; } if ( num % 2 == 1 ) { ans += example967 - Math . pow ( 10 , num - 1 ) + 1 ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example668 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example668 = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; int sum = L * example668 + ( example668 * ( example668 - 1 ) ) / 2 ; if ( L > 0 ) sum -= L ; else if ( L + example668 - 1 < 0 ) sum -= L + example668 - 1 ; System . out . println ( sum ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example522 { 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 ( ) ; int example522 = sc . nextInt ( ) ; sc . close ( ) ; Arrays . parallelSort ( a ) ; for ( int i = 0 ; i < example522 ; i ++ ) { a [ 2 ] *= 2 ; } System . out . println ( a [ 0 ] + a [ 1 ] + a [ 2 ] ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class example381 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example381 = sc . nextInt ( ) ; List < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; Example381 > i ; i ++ ) { String s = sc . next ( ) ; list . add ( s ) ; } List < String > listB = new ArrayList < String > ( new HashSet < > ( list ) ) ; if ( listB . size ( ) != list . size ( ) ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; list . size ( ) - 1 > i ; i ++ ) { String s = list . get ( i ) ; String t = list . get ( i + 1 ) ; List < String > list_s = new ArrayList < String > ( Arrays . asList ( s . split ( " " ) ) ) ; List < String > list_t = new ArrayList < String > ( Arrays . asList ( t . split ( " " ) ) ) ; s = list_s . get ( list_s . size ( ) - 1 ) ; t = list_t . get ( 0 ) ; if ( ! s . equals ( t ) ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; class example468 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int Example468 = 0 ; Example468 < 3 ; Example468 ++ ) for ( int j = 0 ; j < 3 ; j ++ ) a [ Example468 ] [ j ] = sc . nextInt ( ) ; int _1 = a [ 0 ] [ 1 ] + a [ 0 ] [ 2 ] + a [ 1 ] [ 2 ] ; int _2 = a [ 1 ] [ 0 ] + a [ 2 ] [ 0 ] + a [ 2 ] [ 1 ] ; int _3 = a [ 0 ] [ 0 ] + a [ 1 ] [ 1 ] + a [ 2 ] [ 2 ] ; if ( _1 + _2 == 2 * _3 ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } -import java . util . * ; public class Example975 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example975 = scan . nextInt ( ) ; int cnt = 0 ; boolean a = example975 > 99 ; if ( a ) { cnt ++ ; example975 = example975 - 100 ; } boolean b = example975 > 9 ; if ( b ) { example975 = example975 - 10 ; cnt ++ ; } boolean c = example975 == 1 ; if ( c ) { cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example555 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] list = new int [ 9 ] ; int Example555 = scanner . nextInt ( ) ; for ( int i = 0 ; i < Example555 ; i ++ ) { int value = scanner . nextInt ( ) / 400 ; if ( value >= 8 ) { list [ 8 ] ++ ; } else { list [ value ] ++ ; } } int minAns = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { if ( list [ i ] > 0 ) { minAns ++ ; } } int maxAns = minAns ; if ( list [ 8 ] > 0 ) { minAns = Math . max ( minAns , 1 ) ; maxAns += list [ 8 ] ; } System . out . println ( minAns + " " + maxAns ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; public class example897 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example897 = sc . nextInt ( ) ; int max = 1 ; String w = " " ; Map < String , Integer > map = new HashMap < > ( ) ; List < String > strArr = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example897 ; i ++ ) { w = sc . next ( ) ; if ( map . get ( w ) == null ) { map . put ( w , 1 ) ; } else { map . put ( w , map . get ( w ) + 1 ) ; if ( map . get ( w ) > max ) { max = map . get ( w ) ; } } } for ( Entry < String , Integer > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) == max ) { strArr . add ( entry . getKey ( ) ) ; } } Collections . sort ( strArr ) ; for ( String str : strArr ) { System . out . println ( str ) ; } } } -import java . util . * ; public class Example85 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example85 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int A = 0 ; for ( int i = 0 ; i < N ; i ++ ) { A += sc . nextInt ( ) ; } System . out . println ( example85 > A ? " No " : " Yes " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example640 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . example640 ) ) ) { int example640 = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( example640 * 2 * Math . PI ) ; } } } -import java . util . * ; public class Example116 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int example116 = s . length ( ) ; int tlen = t . length ( ) ; int min = 10000 ; for ( int i = 0 ; i < example116 - tlen + 1 ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < tlen ; j ++ ) { if ( s . charAt ( i + j ) == t . charAt ( j ) ) { count ++ ; } } if ( tlen - count < min ) { min = tlen - count ; } } System . out . println ( min ) ; } } -import java . util . Scanner ; public class example593 { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example593 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ Example593 ] ; for ( int i = 0 ; i < Example593 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int [ ] dp = new int [ Example593 ] ; for ( int i = 0 ; i < Example593 ; i ++ ) { if ( i == 0 ) dp [ i ] = 0 ; else dp [ i ] = Integer . MAX_VALUE ; for ( int j = 1 ; j <= k ; j ++ ) { if ( i >= j ) dp [ i ] = mindp ( dp [ i ] , dp [ i - j ] + Math . abs ( h [ i ] - h [ i - j ] ) ) ; } } System . out . println ( dp [ Example593 - 1 ] ) ; } } public static int mindp ( int a , int b ) { if ( a > b ) { a = b ; } return a ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example888 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example888 = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; int [ ] a = { Example888 , q , r } ; Arrays . sort ( a ) ; System . out . println ( a [ 0 ] + a [ 1 ] ) ; } } -import java . util . * ; public class example636 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example636 = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int [ ] [ ] X = new int [ Example636 ] [ D ] ; for ( int i = 0 ; i < Example636 ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { X [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int count = 0 ; double distance = 0.0 ; for ( int i = 0 ; i < Example636 ; i ++ ) { for ( int j = i ; j < Example636 ; j ++ ) { if ( i != j ) { distance = 0.0 ; for ( int k = 0 ; k < D ; k ++ ) { distance += ( X [ i ] [ k ] - X [ j ] [ k ] ) * ( X [ i ] [ k ] - X [ j ] [ k ] ) ; } if ( Math . sqrt ( distance ) % 1 == 0 ) { count ++ ; } } } } System . out . println ( count ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ; public class example170 { public static void main ( String [ ] args ) throws java . lang . Exception { PrintWriter out = new PrintWriter ( System . out ) ; FastScanner fs = new FastScanner ( ) ; long Example170 = fs . nextLong ( ) ; double b = fs . nextDouble ( ) ; BigDecimal bg1 = BigDecimal . valueOf ( Example170 ) ; BigDecimal bg2 = BigDecimal . valueOf ( b ) ; out . println ( bg1 . multiply ( bg2 ) . setScale ( 0 , RoundingMode . DOWN ) ) ; out . close ( ) ; } static class example170 { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] Example170 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) Example170 [ i ] = nextInt ( ) ; return Example170 ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } -import java . util . Scanner ; public class Example371 { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int example371 = kb . nextInt ( ) ; int [ ] [ ] a = new int [ example371 ] [ 3 ] ; int x , y , z ; for ( int i = 0 ; i < example371 ; i ++ ) { a [ i ] [ 0 ] = kb . nextInt ( ) ; a [ i ] [ 1 ] = kb . nextInt ( ) ; a [ i ] [ 2 ] = kb . nextInt ( ) ; } for ( int i = 0 ; i < example371 ; i ++ ) { x = a [ i ] [ 0 ] ; y = a [ i ] [ 1 ] ; z = a [ i ] [ 2 ] ; if ( x * x + y * y == z * z || y * y + z * z == x * x || z * z + x * x == y * y ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } -import java . util . Scanner ; public class Example368 { public static void main ( String [ ] args ) { run ( ) ; } static void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example368 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = isDivisor ( example368 , b , c ) ; System . out . println ( ans ) ; } static int isDivisor ( int example368 , int b , int c ) { int ans = 0 ; for ( int i = example368 ; i <= b ; i ++ ) { if ( c % i == 0 ) { ans ++ ; } } return ans ; } } -import java . util . HashMap ; import java . util . Scanner ; public class Example186 { public static void main ( String [ ] args ) { HashMap < String , String > map = new HashMap < String , String > ( ) ; Scanner sc = new Scanner ( System . in ) ; int example186 = sc . nextInt ( ) ; String str = sc . nextLine ( ) ; for ( int i = 0 ; i < example186 ; i ++ ) { map . put ( sc . nextLine ( ) , " " ) ; } sc . close ( ) ; System . out . println ( map . size ( ) ) ; } } -import java . util . * ; public class example405 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example405 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] [ ] mat = new int [ Example405 ] [ M ] ; for ( int i = 0 ; i < Example405 ; i ++ ) { int tmp = sc . nextInt ( ) ; for ( int j = 0 ; j < tmp ; j ++ ) { mat [ i ] [ j ] = sc . nextInt ( ) ; } } int answer = 0 ; for ( int i = 1 ; i <= M ; i ++ ) { if ( isAllLike ( mat , i , Example405 , M ) ) { answer = answer + 1 ; } } System . out . println ( answer ) ; } public static boolean isAllLike ( int [ ] [ ] mat , int x , int Example405 , int M ) { boolean isLike = false ; for ( int i = 0 ; i < Example405 ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( mat [ i ] [ j ] == x ) { isLike = true ; } } if ( ! isLike ) { return false ; } isLike = false ; } return true ; } } -import java . util . * ; class example264 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example264 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; int X = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int a = 0 ; a <= Example264 ; a ++ ) { for ( int b = 0 ; b <= B ; b ++ ) { for ( int c = 0 ; c <= C ; c ++ ) { if ( a * 500 + b * 100 + c * 50 == X ) { ans ++ ; } } } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example376 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String token = sc . next ( ) ; String [ ] strArray = token . split ( " " ) ; int Example376 = 0 ; if ( strArray [ 0 ] . equals ( " 1 " ) ) { Example376 ++ ; } if ( strArray [ 1 ] . equals ( " 1 " ) ) { Example376 += 1 ; } if ( strArray [ 2 ] . equals ( " 1 " ) ) { Example376 += 1 ; } System . out . println ( Example376 ) ; sc . close ( ) ; } } -import java . util . * ; public class example859 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example859 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int min = 10001 ; for ( int i = 0 ; i < Example859 ; i ++ ) { int cost = sc . nextInt ( ) ; if ( sc . nextInt ( ) <= T ) { min = Math . min ( min , cost ) ; } } if ( min == 10001 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( min ) ; } } } -import java . util . Scanner ; public class Example481 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example481 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] mArray = new int [ m + 1 ] ; for ( int i = 0 ; i < example481 ; i ++ ) { int k = sc . nextInt ( ) ; int [ ] aArray = new int [ k ] ; for ( int j = 0 ; j < k ; j ++ ) { aArray [ j ] = sc . nextInt ( ) ; mArray [ aArray [ j ] ] ++ ; } } int result = 0 ; for ( int i = 1 ; i < m + 1 ; i ++ ) { if ( mArray [ i ] == example481 ) result ++ ; } System . out . println ( result ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . * ; public class example975 { public static void main ( String [ ] args ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int Example975 = cin . nextInt ( ) , b = cin . nextInt ( ) ; System . out . println ( GCD ( Example975 , b ) ) ; } public static int GCD ( int Example975 , int b ) { if ( b == 0 ) return Example975 ; return GCD ( b , Example975 % b ) ; } } -import java . util . Scanner ; import java . util . Stack ; public class Example251 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] A = scan . nextLine ( ) . split ( " " ) ; Stack < Integer > num = new Stack < Integer > ( ) ; int example251 = 0 ; int b = 0 ; for ( int i = 0 ; i < A . length ; i ++ ) { if ( A [ i ] . equals ( " + " ) ) { example251 = num . pop ( ) ; b = num . pop ( ) ; num . add ( b + example251 ) ; continue ; } if ( A [ i ] . equals ( " - " ) ) { example251 = num . pop ( ) ; b = num . pop ( ) ; num . add ( b - example251 ) ; continue ; } if ( A [ i ] . equals ( " * " ) ) { example251 = num . pop ( ) ; b = num . pop ( ) ; num . add ( b * example251 ) ; continue ; } if ( A [ i ] . equals ( " / " ) ) { example251 = num . pop ( ) ; b = num . pop ( ) ; num . add ( b / example251 ) ; continue ; } num . push ( Integer . parseInt ( A [ i ] ) ) ; } System . out . println ( num . pop ( ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Map ; import java . util . HashMap ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; public class example394 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long Example394 , b = 0 ; long n = Long . parseLong ( br . readLine ( ) ) ; int digits , mindigits = 11 ; for ( Example394 = 1 ; Example394 <= Math . sqrt ( n ) ; Example394 ++ ) { if ( n % Example394 == 0 ) { b = n / Example394 ; digits = String . valueOf ( Math . max ( Example394 , b ) ) . length ( ) ; if ( digits < mindigits ) mindigits = digits ; } } System . out . println ( mindigits ) ; } } -import java . util . * ; import java . lang . Double ; public class Example662 { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; String example662 = reader . nextLine ( ) ; if ( example662 . equals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } else { System . out . println ( " ABC " ) ; } } } -import java . util . Scanner ; public class Example434 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example434 = sc . nextLine ( ) ; StringBuffer sb = new StringBuffer ( example434 ) ; String rv = sb . reverse ( ) . toString ( ) ; System . out . println ( rv ) ; } } -import java . util . Scanner ; public class example932 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example932 = stdIn . nextInt ( ) ; int [ ] a = new int [ Example932 + 1 ] ; for ( int i = 1 ; i <= Example932 ; i ++ ) a [ i ] = i ; int s = stdIn . nextInt ( ) ; for ( ; s != 0 ; s -- ) { String [ ] S = stdIn . next ( ) . split ( " , " ) ; int l = Integer . parseInt ( S [ 0 ] ) ; int r = Integer . parseInt ( S [ 1 ] ) ; int t = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = t ; } for ( int i = 1 ; i <= Example932 ; i ++ ) System . out . println ( a [ i ] ) ; } } -import java . util . Scanner ; public class Example597 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example597 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int A = 10000 ; int B = 5000 ; int C = 1000 ; for ( int ai = 0 ; ai <= example597 ; ai ++ ) { for ( int bi = 0 ; bi <= example597 - ai ; bi ++ ) { int ci = example597 - ai - bi ; int sum = ai * A + bi * B + ci * 1000 ; if ( sum == Y ) { System . out . println ( ai + " " + bi + " " + ci ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } -import java . util . * ; public class Example859 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example859 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( y % 2 == 1 ) { System . out . println ( " No " ) ; return ; } if ( y >= 2 * example859 && y <= 4 * example859 ) { System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } -import java . util . * ; public class Example680 { static int example680 = ( int ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a = a1 ; int count = 0 ; int [ ] bucket = new int [ 1000010 ] ; while ( true ) { count ++ ; if ( bucket [ a ] > 0 ) { break ; } bucket [ a ] ++ ; a = func ( a ) ; } System . out . println ( count ) ; } public static int func ( int n ) { return n % 2 == 0 ? n / 2 : n * 3 + 1 ; } } -import java . util . Scanner ; class Example185 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { String [ ] str = scan . nextLine ( ) . split ( " " ) ; int example185 = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 2 ] ) ; if ( " ? " . equals ( str [ 1 ] ) ) break ; if ( " + " . equals ( str [ 1 ] ) ) { System . out . println ( example185 + b ) ; } else if ( " - " . equals ( str [ 1 ] ) ) { System . out . println ( example185 - b ) ; } else if ( " * " . equals ( str [ 1 ] ) ) { System . out . println ( example185 * b ) ; } else if ( " / " . equals ( str [ 1 ] ) ) { System . out . println ( example185 / b ) ; } } } } -import java . util . Scanner ; public class example104 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String N = in . next ( ) ; int Example104 = 0 ; for ( int i = 1 ; i <= Integer . parseInt ( N ) ; i ++ ) if ( String . valueOf ( i ) . length ( ) % 2 == 1 ) Example104 ++ ; System . out . println ( Example104 ) ; } } -import java . util . * ; public class example865 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; char [ ] alpha = new char [ 26 ] ; String str = " abcdefghijklmnopqrstuvwxyz " ; for ( int Example865 = 0 ; Example865 < 26 ; Example865 ++ ) { alpha [ Example865 ] = str . charAt ( Example865 ) ; } int [ ] count = new int [ 26 ] ; for ( int Example865 = 0 ; Example865 < w . length ( ) ; Example865 ++ ) { for ( int j = 0 ; j < 26 ; j ++ ) { if ( w . charAt ( Example865 ) == alpha [ j ] ) count [ j ] ++ ; } } for ( int Example865 = 0 ; Example865 < 26 ; Example865 ++ ) { if ( count [ Example865 ] % 2 != 0 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; class Example311 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example311 = sc . nextInt ( ) ; int [ ] t = new int [ example311 + 1 ] ; t [ 0 ] = 0 ; int [ ] x = new int [ example311 + 1 ] ; x [ 0 ] = 0 ; int [ ] y = new int [ example311 + 1 ] ; x [ 0 ] = 0 ; for ( int i = 1 ; i <= example311 ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example311 ; i ++ ) { int abs_t = t [ i + 1 ] - t [ i ] ; int abs_x = Math . abs ( x [ i + 1 ] - x [ i ] ) ; int abs_y = Math . abs ( y [ i + 1 ] - y [ i ] ) ; if ( abs_t < abs_x + abs_y || abs_t % 2 != ( abs_x + abs_y ) % 2 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class example508 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example508 = Integer . parseInt ( br . readLine ( ) ) ; Map < String , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < Example508 ; i ++ ) { String s = br . readLine ( ) ; if ( map . containsKey ( s ) ) { map . put ( s , map . get ( s ) + 1 ) ; } else { map . put ( s , 1 ) ; } } br . close ( ) ; int max = 0 ; for ( int i : map . values ( ) ) { max = Math . max ( max , i ) ; } List < String > list = new ArrayList < > ( ) ; for ( String s : map . keySet ( ) ) { if ( map . get ( s ) == max ) { list . add ( s ) ; } } Collections . sort ( list ) ; for ( String s : list ) { System . out . println ( s ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example929 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example929 = s . nextInt ( ) ; int m = s . nextInt ( ) ; int x = s . nextInt ( ) ; char [ ] road = new char [ example929 ] ; int countFromStart = 0 ; int countToEnd = 0 ; int countC = 0 ; Arrays . fill ( road , 'a' ) ; road [ x ] = 'x' ; for ( int i = 0 ; i < m ; i ++ ) { int tmp = s . nextInt ( ) ; road [ tmp ] = 'c' ; } for ( int j = 0 ; j < x ; j ++ ) { if ( road [ j ] == 'c' ) { ++ countFromStart ; } } for ( int k = x + 1 ; k < example929 ; k ++ ) { if ( road [ k ] == 'c' ) { ++ countToEnd ; } } if ( countToEnd > countFromStart ) { for ( int p = 0 ; p < x ; p ++ ) { if ( road [ p ] == 'c' ) ++ countC ; } } else { for ( int q = x + 1 ; q < example929 ; q ++ ) { if ( road [ q ] == 'c' ) { ++ countC ; } } } System . out . println ( countC ) ; } } -import java . util . * ; public class example56 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] split = s . split ( " " ) ; int Example56 ; int count = 0 , ans = 0 ; for ( Example56 = 0 ; Example56 < s . length ( ) ; Example56 ++ ) { if ( split [ Example56 ] . equals ( " A " ) || split [ Example56 ] . equals ( " C " ) || split [ Example56 ] . equals ( " G " ) || split [ Example56 ] . equals ( " T " ) ) { count += 1 ; } else { if ( ans < count ) { ans = count ; } count = 0 ; } } if ( ans < count ) { ans = count ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example236 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int example236 = Integer . parseInt ( s . replaceAll ( " " , " " ) ) ; int sqrt = ( int ) Math . sqrt ( example236 ) ; System . out . println ( ( sqrt * sqrt == example236 ) ? " Yes " : " No " ) ; } } -import java . util . * ; public class Example923 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Random rand = new Random ( ) ; int example923 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; } if ( example923 <= sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example24 { static int example24 = 1 ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long h = Long . parseLong ( scan . nextLine ( ) ) ; test ( h ) ; System . out . println ( ( long ) Math . pow ( 2 , example24 ) - 1 ) ; } public static void test ( long hp ) { hp = hp / 2 ; if ( hp == 0 ) return ; example24 ++ ; test ( hp ) ; } } -import java . io . * ; public class example333 { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { String str = input . readLine ( ) ; String [ ] arr = str . split ( " " ) ; int Example333 = Integer . parseInt ( arr [ 0 ] ) ; int w = Integer . parseInt ( arr [ 1 ] ) ; if ( Example333 == 0 && w == 0 ) { break ; } for ( int i = 0 ; i < Example333 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( i == 0 || i == Example333 - 1 || j == 0 || j == w - 1 ) { sb . append ( " # " ) ; } else { sb . append ( " . " ) ; } } sb . append ( " \n " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb ) ; } } -import java . util . Scanner ; public class example527 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example527 = sc . nextInt ( ) ; int len = String . valueOf ( Example527 ) . length ( ) ; int res = 0 ; for ( int i = 1 ; i < len ; i += 2 ) { res += 9 * ( int ) Math . pow ( 10 , i - 1 ) ; } if ( len % 2 == 1 ) { res += Example527 - ( int ) Math . pow ( 10 , len - 1 ) + 1 ; } System . out . println ( res ) ; } } -import java . util . * ; public class Example40 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example40 = sc . nextInt ( ) ; String S = sc . next ( ) ; char Si = S . charAt ( 0 ) ; int count = 1 ; for ( int i = 1 ; i < example40 ; i ++ ) { if ( S . charAt ( i ) == Si ) ; else { count ++ ; Si = S . charAt ( i ) ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example845 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example845 = sc . nextInt ( ) ; int [ ] a = new int [ example845 ] ; float sum = 0 ; for ( int y = 0 ; y < example845 ; y ++ ) { a [ y ] = sc . nextInt ( ) ; sum += a [ y ] ; } int p = Math . round ( sum / example845 ) ; int res = 0 ; for ( int i = 0 ; i < example845 ; i ++ ) { res += ( a [ i ] - p ) * ( a [ i ] - p ) ; } System . out . println ( res ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example533 { private static int gcd ( int a , int b ) { while ( b != 0 ) { int example533 = a % b ; a = b ; b = example533 ; } return a ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; int res = 0 ; int temp = 0 ; for ( int i = 1 ; i < N + 1 ; i ++ ) { for ( int j = 1 ; j < N + 1 ; j ++ ) { temp = gcd ( i , j ) ; for ( int k = 1 ; k < N + 1 ; k ++ ) { res += gcd ( k , temp ) ; } } } System . out . println ( res ) ; } } -import java . util . Scanner ; public class example681 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] tmp = sc . nextLine ( ) . split ( " " ) ; int Example681 = Integer . valueOf ( tmp [ 0 ] ) ; int b = Integer . valueOf ( tmp [ 1 ] ) ; int sum = judge ( Example681 , b ) ; if ( Example681 < b ) { b -- ; } else { Example681 -- ; } sum += judge ( Example681 , b ) ; System . out . println ( sum ) ; } public static int judge ( int Example681 , int b ) { int res = 0 ; if ( Example681 < b ) { res = b ; } else { res = Example681 ; } return res ; } } -import java . util . Scanner ; public class Example99 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example99 = scan . nextInt ( ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int cnt = 0 ; for ( int i = A ; i <= B ; i ++ ) { if ( i % example99 == 0 ) { cnt = cnt + 1 ; } } if ( cnt >= 1 ) { System . out . println ( " OK " ) ; } else { System . out . println ( " NG " ) ; } scan . close ( ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example977 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int Example977 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int resultCount = 0 ; for ( int i = 0 ; i < Example977 ; i ++ ) { final int num = sc . nextInt ( ) ; if ( num % 2 == 0 ) { list . add ( num ) ; } else { break ; } } if ( list . size ( ) != Example977 ) { System . out . print ( resultCount ) ; return ; } boolean continueFlag = true ; while ( continueFlag ) { int count = 0 ; for ( int j = 0 ; j < Example977 ; j ++ ) { int num = list . get ( j ) ; if ( num % 2 == 0 ) { list . set ( j , num / 2 ) ; count ++ ; } else { continueFlag = false ; break ; } } if ( count == Example977 ) { resultCount ++ ; } } System . out . print ( resultCount ) ; sc . close ( ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example681 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int Example681 = scanner . nextInt ( ) ; int count = 0 ; boolean flg = true ; List < Integer > numList = new ArrayList < > ( ) ; scanner . nextLine ( ) ; for ( int i = 0 ; i < Example681 ; i ++ ) { int j = scanner . nextInt ( ) ; if ( j % 2 == 1 ) { flg = false ; break ; } numList . add ( j ) ; } while ( flg ) { List < Integer > nextNumList = new ArrayList < > ( ) ; for ( Integer i : numList ) { if ( i % 2 == 1 ) { flg = false ; break ; } nextNumList . add ( i / 2 ) ; } if ( ! flg ) { break ; } numList = nextNumList ; count ++ ; } System . out . println ( count ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example312 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] array = br . readLine ( ) . split ( " " ) ; int example312 = Integer . parseInt ( array [ 0 ] ) ; int y = Integer . parseInt ( array [ 1 ] ) ; int z = y % 4 ; if ( ( z == 0 || z % 2 == 0 ) && 4 * example312 >= y && 2 * example312 <= y ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Example55 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { try ( Scanner sc = new Scanner ( System . in ) ) { int example55 = Integer . parseInt ( sc . nextLine ( ) ) ; String a = sc . nextLine ( ) ; String [ ] b = a . split ( " " ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < b . length ; i ++ ) { list . add ( Integer . parseInt ( b [ i ] ) ) ; } Collections . sort ( list ) ; System . out . println ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) ; } } } -import java . util . Scanner ; public class Example827 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { final int example827 = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; int kuchi = 1 ; if ( B == 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } for ( int i = 1 ; i <= B ; i ++ ) { kuchi = kuchi - 1 + example827 ; if ( kuchi >= B ) { System . out . println ( i ) ; System . exit ( 0 ) ; } } } finally { sc . close ( ) ; } } } -import java . lang . reflect . Array ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example56 { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int Example56 = 0 ; int bob = 0 ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] sCards = sc . nextLine ( ) . split ( " " ) ; List < Integer > iCards = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { iCards . add ( Integer . parseInt ( sCards [ i ] ) ) ; } for ( int n = 0 ; n < N ; n ++ ) { int max = 0 ; for ( int c : iCards ) { max = Math . max ( max , c ) ; } if ( n == 0 || n % 2 == 0 ) { Example56 += max ; } else { bob += max ; } iCards . remove ( iCards . indexOf ( max ) ) ; } System . out . println ( Example56 - bob ) ; } } -import java . util . * ; public class example162 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String C = sc . next ( ) ; char Example162 = C . charAt ( 0 ) ; System . out . println ( ++ Example162 ) ; } } -import java . util . Scanner ; public class Example924 { public static int Int ( int a ) { int example924 = 0 ; if ( a == 9 ) { example924 = 1 ; } else { example924 = 9 ; } return example924 ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = Int ( a % 10 ) ; a /= 10 ; int c = Int ( a % 10 ) ; a /= 10 ; int d = Int ( a % 10 ) ; System . out . println ( d + " " + c + " " + b ) ; } } -import java . util . Scanner ; public class Example792 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long example792 = scanner . nextLong ( ) ; long R = scanner . nextLong ( ) ; if ( R - example792 >= 2018L ) { System . out . println ( 0 ) ; return ; } long m1 = example792 % 2019L ; long m2 = R % 2019L ; if ( m1 > m2 ) { System . out . println ( 0 ) ; return ; } long ans = 2019 ; for ( long i = m1 ; i < m2 ; ++ i ) { for ( long j = i + 1 ; j <= m2 ; ++ j ) { long current = ( ( i % 2019L ) * ( j ) % 2019L ) % 2019L ; ans = Math . min ( ans , current ) ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example649 { public static void main ( String [ ] args ) { int Example649 = 0 ; int K = 0 ; String S ; Scanner sc = new Scanner ( System . in ) ; Example649 = Integer . parseInt ( sc . next ( ) ) ; K = Integer . parseInt ( sc . next ( ) ) ; S = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( S ) ; char s ; String lower ; s = sb . charAt ( K - 1 ) ; lower = String . valueOf ( s ) ; sb . setCharAt ( K - 1 , ( lower . toLowerCase ( ) ) . toCharArray ( ) [ 0 ] ) ; System . out . println ( sb . toString ( ) ) ; } } -import java . util . Scanner ; public class Example877 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example877 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count = 0 ; int [ ] array_b = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { array_b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example877 ; i ++ ) { int [ ] array_a = new int [ m ] ; int ans = 0 ; for ( int j = 0 ; j < m ; j ++ ) { int temp = sc . nextInt ( ) ; ans += array_b [ j ] * temp ; } ans += c ; if ( ans > 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example416 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example416 = sc . nextInt ( ) ; int [ ] arr = new int [ example416 ] ; for ( int i = 0 ; i < example416 ; i ++ ) { arr [ sc . nextInt ( ) - 1 ] = i + 1 ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < example416 ; i ++ ) { if ( i != 0 ) { sb . append ( " " ) ; } sb . append ( arr [ i ] ) ; } System . out . println ( sb ) ; } } -import java . io . * ; import java . math . * ; import java . util . * ; public class example651 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int Example651 = input . nextInt ( ) ; String S = input . next ( ) ; if ( S . length ( ) <= Example651 ) System . out . println ( S ) ; else System . out . println ( S . substring ( 0 , Example651 ) + " ... " ) ; } } -public class Example299 { public void run ( java . util . Scanner sc ) { int [ ] a ; int example299 , j ; a = new int [ sc . nextInt ( ) ] ; for ( example299 = 0 ; example299 < a . length ; ++ example299 ) a [ example299 ] = sc . nextInt ( ) ; for ( example299 = 0 ; example299 < a . length ; ++ example299 ) { final int t = a [ example299 ] ; for ( j = example299 - 1 ; j >= 0 ; -- j ) { if ( t < a [ j ] ) { a [ j + 1 ] = a [ j ] ; a [ j ] = t ; } } printArray ( a ) ; } } private void printArray ( int [ ] a ) { int example299 ; for ( example299 = 0 ; example299 < a . length ; ++ example299 ) { System . out . print ( a [ example299 ] ) ; if ( example299 + 1 < a . length ) System . out . print ( " " ) ; else System . out . println ( ) ; } } public static void main ( String [ ] args ) { ( new Main ( ) ) . run ( new java . util . Scanner ( System . in ) ) ; } } -import java . util . Scanner ; public class Example80 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example80 = 0 , H , A ; H = scan . nextInt ( ) ; A = scan . nextInt ( ) ; while ( H > 0 ) { H = H - A ; example80 ++ ; } System . out . println ( example80 ) ; } } -import java . util . * ; class Example449 { int max ( int example449 , int b ) { if ( example449 < b ) return b ; else return example449 ; } int min ( int example449 , int b ) { if ( example449 > b ) return b ; else return example449 ; } Main ( ) { Scanner sc = new Scanner ( System . in ) ; int example449 , c , d ; example449 = sc . nextInt ( ) ; d = - 1000000000 ; c = sc . nextInt ( ) ; for ( int i = 0 ; i < example449 - 1 ; i ++ ) { int f = sc . nextInt ( ) ; d = max ( d , f - c ) ; c = min ( c , f ) ; } System . out . println ( d ) ; } public static void main ( String [ ] arg ) { new Main ( ) ; } } -import java . util . Scanner ; class Example271 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double example271 = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double naga = m * 360 / 60 ; double miji = ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double kaku = miji - naga ; double result = Math . sqrt ( example271 * example271 + b * b - 2 * example271 * b * Math . cos ( Math . toRadians ( kaku ) ) ) ; System . out . println ( result ) ; } } -import java . io . * ; import java . util . * ; class Example655 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example655 = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; while ( example655 != 0 || W != 0 ) { for ( int i = 0 ; i < example655 ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . printf ( " # " ) ; } System . out . printf ( " \n " ) ; } System . out . printf ( " \n " ) ; example655 = sc . nextInt ( ) ; W = sc . nextInt ( ) ; } } } -import java . math . BigInteger ; import java . util . Scanner ; public class Example819 { public static void main ( String [ ] args ) { Long K ; Scanner sc = new Scanner ( System . in ) ; K = sc . nextLong ( ) ; Long bank = 100L ; int example819 = 0 ; while ( bank < K ) { bank = ( long ) ( bank * 1.01 ) ; example819 ++ ; } System . out . println ( example819 ) ; } } -import java . util . * ; public class Example279 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example279 = sc . nextInt ( ) ; if ( example279 / 10 == 0 ) { System . out . println ( example279 % 10 ) ; } else if ( example279 / 100 == 0 ) { System . out . println ( 9 ) ; } else if ( example279 / 1000 == 0 ) { System . out . println ( example279 % 1000 - 99 + 9 ) ; } else if ( example279 / 10000 == 0 ) { System . out . println ( 909 ) ; } else if ( example279 / 100000 == 0 ) { System . out . println ( example279 % 100000 - 9999 + 900 + 9 ) ; } else { System . out . println ( 90909 ) ; } } } -import java . util . * ; public class example880 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example880 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; if ( c - ( Example880 - b ) >= 0 ) { System . out . println ( c - ( Example880 - b ) ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . Scanner ; public class example573 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example573 = sc . nextInt ( ) ; int [ ] A ; A = new int [ Example573 ] ; int count = 0 ; for ( int i = 0 ; i < Example573 ; ++ i ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example573 - 1 ; ++ i ) { for ( int j = 0 ; j < Example573 - 1 ; ++ j ) { if ( A [ j ] > A [ j + 1 ] ) { int c ; c = A [ j ] ; A [ j ] = A [ j + 1 ] ; A [ j + 1 ] = c ; count ++ ; } } } print ( A , Example573 ) ; System . out . println ( count ) ; } public static void print ( int [ ] A , int Example573 ) { for ( int i = 0 ; i < Example573 ; ++ i ) { System . out . print ( A [ i ] ) ; if ( i < Example573 - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } -import java . util . * ; public class example774 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example774 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= Example774 ; i ++ ) { int sumOfDigits = findSumOfDigits ( i ) ; if ( a <= sumOfDigits && sumOfDigits <= b ) { sum += i ; } } System . out . println ( sum ) ; } public static int findSumOfDigits ( int num ) { int sum = 0 ; while ( num > 0 ) { sum += num % 10 ; num /= 10 ; } return sum ; } } -import java . util . Scanner ; public class Example611 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example611 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; for ( int i = 1 ; i <= K ; i ++ ) { if ( K - example611 == 0 ) { System . out . println ( example611 * 1 ) ; return ; } if ( K - example611 < 0 ) { System . out . println ( K * 1 ) ; return ; } if ( ( K - example611 ) - B <= 0 ) { System . out . println ( example611 * 1 + B * 0 ) ; return ; } if ( ( K - example611 ) - B > 0 ) { System . out . println ( example611 * 1 + B * 0 + ( ( ( K - example611 ) - B ) * ( - 1 ) ) ) ; return ; } } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class example432 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int Example432 = 0 ; Example432 < 10 ; Example432 ++ ) { list . add ( scan . nextInt ( ) ) ; } Collections . sort ( list , Collections . reverseOrder ( ) ) ; System . out . println ( list . get ( 0 ) ) ; System . out . println ( list . get ( 1 ) ) ; System . out . println ( list . get ( 2 ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example47 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String [ ] boxstr = new String [ line . length ( ) ] ; int [ ] box = new int [ line . length ( ) ] ; int example47 = Integer . parseInt ( line ) ; int ans = 0 ; for ( int i = 0 ; i < line . length ( ) ; i ++ ) { boxstr [ i ] = String . valueOf ( line . charAt ( i ) ) ; box [ i ] = Integer . parseInt ( boxstr [ i ] ) ; ans += box [ i ] ; } if ( example47 % ans == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example914 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example914 = sc . nextInt ( ) ; int cnt = 0 ; if ( Example914 % 2 == 0 ) { cnt = Example914 / 2 ; System . out . println ( cnt ) ; } else { cnt = ( int ) ( Example914 / 2 ) + 1 ; System . out . println ( cnt ) ; } } } -import java . util . Scanner ; public class Example862 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example862 = sc . next ( ) ; String str = sc . next ( ) ; sc . close ( ) ; example862 += example862 ; if ( example862 . contains ( str ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example732 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example732 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int [ ] H = new int [ example732 ] ; for ( int i = 0 ; i < example732 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } double min = Double . MAX_VALUE ; int minPotision = 0 ; for ( int i = 0 ; i < example732 ; i ++ ) { if ( Math . abs ( T - H [ i ] * 0.006 - A ) < min ) { min = Math . abs ( T - H [ i ] * 0.006 - A ) ; minPotision = i ; } } System . out . print ( minPotision + 1 ) ; } } -import java . io . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class Example761 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example761 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . nextLine ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < example761 ; i ++ ) list . add ( sc . nextInt ( ) ) ; List < Integer > dyn = new ArrayList < Integer > ( ) ; dyn . add ( 0 ) ; dyn . add ( ( int ) ( Math . abs ( list . get ( 1 ) - list . get ( 0 ) ) ) ) ; for ( int i = 2 ; i < example761 ; i ++ ) { int min = Integer . MAX_VALUE ; for ( int j = 1 ; j <= K ; j ++ ) { if ( i - j >= 0 ) { min = ( int ) Math . min ( min , Math . abs ( list . get ( i ) - list . get ( i - j ) ) + dyn . get ( i - j ) ) ; } if ( i - j < 0 ) break ; } dyn . add ( min ) ; } System . out . println ( dyn . get ( example761 - 1 ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example608 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example608 = stdIn . nextInt ( ) ; int n1 = Example608 / 100 ; Example608 = Example608 - n1 * 100 ; int n2 = Example608 / 10 ; Example608 = Example608 - n2 * 10 ; if ( Example608 == 2 || Example608 == 4 || Example608 == 5 || Example608 == 7 || Example608 == 9 ) { System . out . println ( " hon " ) ; } else if ( Example608 == 0 || Example608 == 1 || Example608 == 6 || Example608 == 8 ) { System . out . println ( " pon " ) ; } else { System . out . println ( " bon " ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example763 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example763 = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; String newWord ; for ( int i = 0 ; i < example763 ; i ++ ) { newWord = sc . next ( ) ; if ( list . contains ( newWord ) || ( ! list . isEmpty ( ) && ! ( list . get ( list . size ( ) - 1 ) ) . endsWith ( String . valueOf ( newWord . charAt ( 0 ) ) ) ) ) { System . out . println ( " No " ) ; return ; } else { list . add ( newWord ) ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example987 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String str = sc . next ( ) ; if ( str . equals ( " - " ) ) break ; int Example987 = sc . nextInt ( ) ; int [ ] array = new int [ Example987 ] ; String result = str ; for ( int i = 0 ; i < Example987 ; i ++ ) { int shuffleNum = sc . nextInt ( ) ; result = result . substring ( shuffleNum ) + result . substring ( 0 , shuffleNum ) ; } System . out . println ( result ) ; } } } -import java . util . * ; public class example688 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example688 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; Integer [ ] p = new Integer [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int min = Integer . MAX_VALUE ; for ( int j = - 1000 ; j < 1000 ; j ++ ) { if ( Arrays . asList ( p ) . contains ( j ) ) { continue ; } min = Math . min ( min , Math . abs ( Example688 - j ) ) ; } int a = Example688 - min ; if ( Arrays . asList ( p ) . contains ( a ) ) { System . out . println ( Example688 + min ) ; } else { System . out . println ( a ) ; } } } -import java . util . * ; public class Example383 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example383 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int day = 0 ; for ( int i = 0 ; i < M ; i ++ ) { day += scan . nextInt ( ) ; } if ( day > example383 ) { System . out . println ( - 1 ) ; } else { System . out . println ( example383 - day ) ; } } } -import java . util . Scanner ; public class example425 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example425 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= Example425 ; i ++ ) { for ( int j = 1 ; j <= Example425 ; j ++ ) { for ( int k = 1 ; k <= Example425 ; k ++ ) { sum += gcd ( i , gcd ( j , k ) ) ; } } } System . out . println ( sum ) ; } static int gcd ( int a , int b ) { int temp ; while ( ( temp = a % b ) != 0 ) { a = b ; b = temp ; } return b ; } } -import java . util . * ; public class example875 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example875 = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= Example875 ; i ++ ) { if ( String . valueOf ( i ) . length ( ) % 2 == 1 ) count ++ ; } System . out . println ( count ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Example21 { public static void main ( String [ ] args ) { BufferedReader inMsg = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String example21 = " " ; try { while ( ( example21 = inMsg . readLine ( ) ) != null ) { String [ ] ab = example21 . split ( " " ) ; Integer a = 0 ; Integer b = 0 ; Integer sqr = 0 ; Integer liner = 0 ; a = Integer . parseInt ( ab [ 0 ] ) ; b = Integer . parseInt ( ab [ 1 ] ) ; sqr = a * b ; liner = a * 2 + b * 2 ; System . out . println ( sqr + " " + liner ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class Example569 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; int example569 = 0 ; for ( int i = 1 ; i <= s . length - 1 ; i ++ ) { if ( ( s [ i - 1 ] == '0' && s [ i ] == '1' ) || ( s [ i ] == '0' && s [ i - 1 ] == '1' ) ) { example569 += 2 ; s [ i - 1 ] = '5' ; s [ i ] = '5' ; } } int count1 = 0 ; int count0 = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == '1' ) { count1 ++ ; } else if ( s [ i ] == '0' ) { count0 ++ ; } } if ( count1 > count0 ) { example569 += count0 * 2 ; } else { example569 += count1 * 2 ; } System . out . println ( example569 ) ; } } -import java . util . Scanner ; public class Example966 { static float roundUp ( float value ) { float example966 = value % 1000 ; if ( example966 > 0 ) { value = value + ( 1000 - example966 ) ; } return value ; } public static void main ( String [ ] args ) { float gankin = 100_000f ; Scanner sc = new Scanner ( System . in ) ; int nweek = sc . nextInt ( ) ; float debt = gankin ; for ( int i = 0 ; i < nweek ; i ++ ) { debt = roundUp ( debt * 1.05f ) ; } System . out . printf ( " %d \n " , Math . round ( debt ) ) ; } } -import java . util . Scanner ; class Example138 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example138 = in . nextInt ( ) ; int i = 10 , res = 0 , sign = 1 ; while ( example138 >= i ) { res += ( i - 1 ) * sign ; sign *= - 1 ; i *= 10 ; } if ( res <= 0 ) res += example138 ; System . out . println ( res ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example374 { public static void main ( String [ ] args ) throws Exception { BufferedReader stdIn = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int Example374 = 0 ; while ( ( s = stdIn . readLine ( ) ) != null ) { String [ ] se = s . split ( " " ) ; int in1 = Integer . valueOf ( se [ 0 ] ) ; int in2 = Integer . valueOf ( se [ 1 ] ) ; if ( in1 == 0 && in2 == 0 ) break ; doMain ( ++ Example374 , in1 , in2 ) ; } System . exit ( 0 ) ; } private static void doMain ( int Example374 , int in1 , int in2 ) { if ( in1 < in2 ) System . out . println ( in1 + " " + in2 ) ; else System . out . println ( in2 + " " + in1 ) ; } } -import java . util . * ; class Example914 { static int example914 = 1000000000 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; if ( w >= s ) { System . out . println ( " unsafe " ) ; } else { System . out . println ( " safe " ) ; } } } -import java . util . * ; public class example243 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example243 = sc . nextInt ( ) ; int [ ] a = new int [ 100 ] ; for ( int i = 0 ; i < Example243 ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; int Alice = 0 ; int Bob = 0 ; for ( int i = 99 ; i > 99 - Example243 ; i -- ) if ( i % 2 == 1 ) Alice += a [ i ] ; else Bob += a [ i ] ; System . out . println ( Alice - Bob ) ; } } -import java . util . * ; public class example440 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example440 = sc . nextInt ( ) ; int ans = 0 ; for ( int i = Example440 ; i <= 999 ; i ++ ) { String s = String . valueOf ( i ) ; if ( ( s . charAt ( 0 ) == s . charAt ( 1 ) ) && ( s . charAt ( 1 ) == s . charAt ( 2 ) ) ) { ans = i ; break ; } } System . out . println ( ans ) ; } } -import java . lang . reflect . Array ; import java . util . * ; public class Example352 { class Example352 { int example352 , y , t ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n + 1 ] [ 3 ] ; for ( int i = 1 ; i <= n ; ++ i ) { a [ i ] [ 0 ] = sc . nextInt ( ) ; a [ i ] [ 1 ] = sc . nextInt ( ) ; a [ i ] [ 2 ] = sc . nextInt ( ) ; } a [ 0 ] [ 0 ] = 0 ; a [ 0 ] [ 1 ] = 0 ; a [ 0 ] [ 2 ] = 0 ; boolean ok = true ; for ( int i = 1 ; i <= n ; ++ i ) { int dt = a [ i ] [ 0 ] - a [ i - 1 ] [ 0 ] ; int dx = Math . abs ( a [ i ] [ 1 ] - a [ i - 1 ] [ 1 ] ) ; int dy = Math . abs ( a [ i ] [ 2 ] - a [ i - 1 ] [ 2 ] ) ; if ( dx + dy > dt || ( dt - dx - dy ) % 2 != 0 ) { ok = false ; System . out . println ( " No " ) ; break ; } } if ( ok ) System . out . println ( " Yes " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example421 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long Example421 = Long . parseLong ( br . readLine ( ) ) ; int i = 10000000 ; long O = 0 ; long T = 0 ; int o = 0 ; int t = 0 ; for ( long l = 1 ; l < ( long ) Math . sqrt ( Example421 ) + 10 ; l ++ ) { if ( Example421 % l == 0 ) { O = l ; T = Example421 / l ; o = ( int ) Math . log10 ( O ) + 1 ; t = ( int ) Math . log10 ( T ) + 1 ; if ( i > ( o > t ? o : t ) ) i = ( o > t ? o : t ) ; } } System . out . println ( i ) ; } } -import java . util . Scanner ; public class Example264 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example264 = Integer . parseInt ( scanner . next ( ) ) ; int Y = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; for ( int x = 0 ; x <= example264 ; x ++ ) { for ( int y = 0 ; y <= example264 ; y ++ ) { int z = example264 - x - y ; if ( z < 0 ) continue ; if ( ( x * 10000 + y * 5000 + z * 1000 ) == Y ) { System . out . println ( String . format ( " %d %d %d " , x , y , z ) ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example905 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example905 = scan . nextInt ( ) ; int strlenge = scan . nextInt ( ) ; String [ ] output = new String [ Example905 ] ; for ( int i = 0 ; i < Example905 ; i ++ ) { output [ i ] = scan . next ( ) ; } Arrays . sort ( output ) ; for ( int i = 0 ; i < Example905 ; i ++ ) { System . out . print ( output [ i ] ) ; } scan . close ( ) ; } } -import java . util . * ; public class Example482 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example482 = sc . nextInt ( ) ; String n = String . valueOf ( example482 ) ; char [ ] a = n . toCharArray ( ) ; char b = a [ 0 ] ; char [ ] c = { b , b , b } ; int ans = Integer . parseInt ( String . valueOf ( c ) ) ; if ( ans >= example482 ) { System . out . println ( ans ) ; } else { ans += 111 ; System . out . println ( ans ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example542 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example542 = scan . nextInt ( ) ; String S = scan . next ( ) ; int S_length = S . length ( ) ; if ( Example542 < S_length ) { for ( int i = 0 ; i < Example542 ; i ++ ) { System . out . print ( S . charAt ( i ) ) ; } System . out . print ( " ... " ) ; } else { System . out . print ( S ) ; } } } -import java . util . * ; public class example195 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example195 = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int x = Example195 * A ; int y = B ; if ( x < y ) { System . out . println ( x ) ; } else if ( x > y ) { System . out . println ( y ) ; } else if ( x == y ) { System . out . println ( y ) ; } } } -import java . util . Scanner ; public class Example205 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example205 = scanner . nextInt ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) { if ( example205 <= 111 * i ) { System . out . println ( 111 * i ) ; break ; } } } } -import java . util . * ; public class example642 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example642 = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= Example642 ; i ++ ) { int ii = i ; int iii = 0 ; int sum2 = 0 ; for ( int j = 0 ; j < 5 ; j ++ ) { iii = ii % 10 ; sum2 += iii ; ii = ii / 10 ; } if ( sum2 >= A && sum2 <= B ) { sum += i ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example133 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example133 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ example133 ] ; int counter = 0 ; for ( int i = 0 ; i < h . length ; i ++ ) { h [ i ] = sc . nextInt ( ) ; if ( h [ i ] >= k ) { counter ++ ; } } System . out . println ( counter ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class example761 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example761 = Integer . parseInt ( br . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < Example761 ; i ++ ) { String [ ] str = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; if ( a == b ) { count ++ ; } else { count = 0 ; } if ( count >= 3 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example794 { final static String [ ] suits = { " S " , " H " , " C " , " D " } ; final static int [ ] ranks = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 } ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; boolean [ ] [ ] exist = new boolean [ suits . length ] [ ranks . length ] ; int example794 = scan . nextInt ( ) ; for ( int i = 0 ; i < example794 ; i ++ ) { String suit = scan . next ( ) ; int rank = scan . nextInt ( ) ; for ( int j = 0 ; j < suits . length ; j ++ ) { if ( suits [ j ] . equals ( suit ) ) { exist [ j ] [ rank - 1 ] = true ; } } } for ( int i = 0 ; i < suits . length ; i ++ ) { for ( int j = 0 ; j < ranks . length ; j ++ ) { if ( ! exist [ i ] [ j ] ) { System . out . println ( suits [ i ] + " " + ranks [ j ] ) ; } } } scan . close ( ) ; } } -import java . util . Scanner ; public class example42 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example42 = scan . nextInt ( ) ; int [ ] P = new int [ Example42 ] ; int countI = 1 ; for ( int i = 0 ; i < Example42 ; i ++ ) { int b = scan . nextInt ( ) ; P [ i ] = b ; } int j = 1 ; int Min = P [ 0 ] ; while ( j < Example42 ) { if ( P [ j ] < Min ) { Min = P [ j ] ; countI ++ ; } j ++ ; } System . out . println ( countI ) ; } } -import java . util . * ; import java . io . * ; public class example456 { public static void main ( String [ ] args ) throws Exception { int Example456 = 998244353 ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( bf . readLine ( ) ) ; ArrayList < Integer > array = new ArrayList < Integer > ( ) ; int min = Integer . MAX_VALUE ; StringTokenizer st = new StringTokenizer ( bf . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { array . add ( Integer . parseInt ( st . nextToken ( ) ) ) ; } for ( int i = 1 ; i <= 100 ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < array . size ( ) ; j ++ ) { sum += ( array . get ( j ) - i ) * ( array . get ( j ) - i ) ; } min = Math . min ( sum , min ) ; } out . println ( min ) ; out . close ( ) ; } } -import java . util . * ; public class Example868 { public static void main ( String [ ] args ) { int example868 ; try ( Scanner sc = new Scanner ( System . in ) ) { example868 = sc . nextInt ( ) ; } int maxKeta = ( int ) Math . floor ( Math . log10 ( ( double ) example868 ) + 1 ) ; int answer = 0 ; if ( maxKeta >= 2 ) { int n = ( int ) Math . floor ( ( maxKeta - 2 ) / 2 ) ; int M = 2 * n + 1 ; answer += ( ( int ) ( Math . pow ( - 10 , ( M + 1 ) ) ) - 1 ) / 11 ; } if ( maxKeta % 2 == 1 ) { answer += example868 - ( int ) ( Math . pow ( 10 , maxKeta - 1 ) ) + 1 ; } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class Example151 { static Scanner sc = new Scanner ( System . in ) ; static int example151 = Integer . parseInt ( sc . next ( ) ) ; static int [ ] a = new int [ 100000 ] ; public static void main ( String [ ] args ) { int q , key , sum = 0 ; for ( int i = 0 ; i < example151 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } q = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < q ; i ++ ) { key = Integer . parseInt ( sc . next ( ) ) ; if ( binarySearch ( key ) ) sum ++ ; } System . out . println ( sum ) ; } static boolean binarySearch ( int key ) { int left = 0 ; int right = example151 ; int mid ; while ( left < right ) { mid = ( left + right ) / 2 ; if ( key == a [ mid ] ) return true ; if ( key > a [ mid ] ) left = mid + 1 ; else if ( key < a [ mid ] ) right = mid ; } return false ; } } -import java . util . * ; class example768 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example768 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int i = 1 ; int sum = 0 ; while ( Example768 * i <= t ) { sum += b ; i += 1 ; } System . out . println ( sum ) ; } } -import java . util . * ; public class Example719 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example719 = 0 ; int leftIdx = 0 ; Set < Character > set = new HashSet < > ( ) ; set . add ( 'A' ) ; set . add ( 'C' ) ; set . add ( 'G' ) ; set . add ( 'T' ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( ! set . contains ( s . charAt ( i ) ) ) { example719 = Math . max ( example719 , i - leftIdx ) ; leftIdx = i + 1 ; } } example719 = Math . max ( example719 , s . length ( ) - leftIdx ) ; System . out . println ( example719 ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example897 { static BufferedReader reader ; public static void main ( String [ ] args ) { reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strings = readLine ( ) ; int Example897 = Integer . parseInt ( strings [ 0 ] ) ; int A = Integer . parseInt ( strings [ 1 ] ) ; print ( ( Example897 + A - 1 ) / A ) ; } private static String [ ] readLine ( ) { try { return reader . readLine ( ) . split ( " " ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return new String [ ] { e . getMessage ( ) } ; } } private static void print ( Object o ) { System . out . println ( o ) ; } private static void print ( ) { System . out . println ( ) ; } } -import java . util . Scanner ; public class example655 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example655 = scan . nextInt ( ) ; int num2 = scan . nextInt ( ) ; int num3 = scan . nextInt ( ) ; int count = 0 ; if ( Example655 != num2 ) { count ++ ; } if ( num2 != num3 ) { count ++ ; } if ( Example655 != num3 ) { count ++ ; } if ( count == 1 || count == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . lang . * ; public class example118 { public static void solve ( long Example118 , long b , long c , long d ) { while ( Example118 > 0 && c > 0 ) { c -= b ; if ( c <= 0 ) { System . out . println ( " Yes " ) ; return ; } Example118 -= d ; } if ( c == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static void gora ( ) { Scanner scn = new Scanner ( System . in ) ; long Example118 = scn . nextLong ( ) ; long b = scn . nextLong ( ) ; long c = scn . nextLong ( ) ; long d = scn . nextLong ( ) ; solve ( Example118 , b , c , d ) ; } public static void main ( String [ ] args ) { gora ( ) ; } } -import java . util . Scanner ; public class example425 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example425 = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; int i = 0 ; char [ ] Schar = S . toCharArray ( ) ; char [ ] Tchar = T . toCharArray ( ) ; for ( i = 0 ; i < Example425 ; i ++ ) { System . out . print ( Schar [ i ] ) ; System . out . print ( Tchar [ i ] ) ; } return ; } } -import java . util . * ; class example463 { public static void main ( String [ ] args ) { int Example463 = 0 ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; for ( int i = 0 ; i < ( N - 2 ) ; i ++ ) { if ( S . charAt ( i ) == 'A' && S . charAt ( i + 1 ) == 'B' ) { if ( S . charAt ( i + 2 ) == 'C' ) { Example463 += 1 ; } } } System . out . println ( Example463 ) ; } } -import java . util . Scanner ; class example971 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example971 = scan . nextInt ( ) ; int kimatu = scan . nextInt ( ) ; int saisiken = scan . nextInt ( ) ; while ( Example971 != - 1 || kimatu != - 1 || saisiken != - 1 ) { int y ; y = Example971 + kimatu ; if ( Example971 == - 1 || kimatu == - 1 ) { System . out . println ( " F " ) ; } else if ( y >= 80 ) { System . out . println ( " A " ) ; } else if ( y >= 65 && y < 80 ) { System . out . println ( " B " ) ; } else if ( y >= 50 && y < 65 ) { System . out . println ( " C " ) ; } else if ( y >= 30 && y < 50 ) { if ( saisiken >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else { System . out . println ( " F " ) ; } Example971 = scan . nextInt ( ) ; kimatu = scan . nextInt ( ) ; saisiken = scan . nextInt ( ) ; } } } -import java . util . Scanner ; public class example736 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; char [ ] a = s . toCharArray ( ) ; char [ ] b = t . toCharArray ( ) ; boolean Example736 = true ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Example736 = true ; for ( int j = 0 ; j < n - i ; j ++ ) { if ( a [ j ] != b [ j + i ] ) { Example736 = false ; break ; } } for ( int j = n - i ; j < n ; j ++ ) { if ( a [ j ] != b [ j - n + i ] ) { Example736 = false ; break ; } } if ( Example736 ) break ; } System . out . println ( Example736 ? " Yes " : " No " ) ; } } -import java . util . ArrayList ; import static java . util . Collections . reverse ; import java . util . List ; import java . util . Scanner ; public class example886 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example886 = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example886 ; i ++ ) { int a = scanner . nextInt ( ) ; list . add ( a ) ; } reverse ( list ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Integer get = list . get ( i ) ; if ( i == list . size ( ) - 1 ) { System . out . print ( get ) ; } else { System . out . print ( get + " " ) ; } } System . out . println ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example253 { public static void main ( String [ ] args ) throws IOException { int example253 , b , f , r , v ; String [ ] list ; int [ ] [ ] [ ] building ; StringBuilder builder = new StringBuilder ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; example253 = Integer . parseInt ( br . readLine ( ) ) ; building = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < example253 ; i ++ ) { list = br . readLine ( ) . split ( " " ) ; b = Integer . parseInt ( list [ 0 ] ) ; f = Integer . parseInt ( list [ 1 ] ) ; r = Integer . parseInt ( list [ 2 ] ) ; v = Integer . parseInt ( list [ 3 ] ) ; building [ b - 1 ] [ f - 1 ] [ r - 1 ] += v ; } for ( int i = 0 ; i < 4 ; i ++ ) { if ( i != 0 ) builder . append ( " #################### \n " ) ; for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { builder . append ( " " + building [ i ] [ j ] [ k ] ) ; } builder . append ( " \n " ) ; } } builder . delete ( builder . length ( ) - 1 , builder . length ( ) ) ; System . out . println ( builder ) ; br . close ( ) ; } } -import java . io . BufferedReader ; import java . io . * ; import java . util . * ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Collections ; import java . util . Arrays ; public class Example819 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example819 = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; int count1 = 0 ; int count2 = 0 ; int count3 = 0 ; int count4 = 0 ; for ( int i = 0 ; i < example819 ; i ++ ) { list . add ( sc . next ( ) ) ; } for ( int i = 0 ; i < example819 ; i ++ ) { if ( list . get ( i ) . equals ( " AC " ) ) { count1 ++ ; } else if ( list . get ( i ) . equals ( " WA " ) ) { count2 ++ ; } else if ( list . get ( i ) . equals ( " TLE " ) ) { count3 ++ ; } else { count4 ++ ; } } System . out . println ( " AC x " + count1 ) ; System . out . println ( " WA x " + count2 ) ; System . out . println ( " TLE x " + count3 ) ; System . out . println ( " RE x " + count4 ) ; } } -import java . util . Scanner ; class Example185 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int example185 = scan . nextInt ( ) ; int x = 1 ; int y = 0 ; if ( example185 >= 3 && example185 <= 10000 ) { for ( int count = 0 ; count < example185 ; count ++ ) { y = x / 10 ; if ( x % 3 == 0 ) { sb . append ( " " ) . append ( x ) ; } else { y = x ; while ( y != 0 ) { if ( y % 10 == 3 ) { sb . append ( " " ) . append ( x ) ; break ; } y /= 10 ; } } x ++ ; } System . out . println ( sb ) ; } } } -import java . io . * ; class example108 { public static void main ( String [ ] args ) throws IOException { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( ; ; ) { String [ ] str = br . readLine ( ) . split ( " " ) ; int Example108 = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 2 ] ) ; if ( str [ 1 ] . equals ( " ? " ) ) break ; switch ( str [ 1 ] ) { case " + " : System . out . println ( Example108 + b ) ; break ; case " - " : System . out . println ( Example108 - b ) ; break ; case " * " : System . out . println ( Example108 * b ) ; break ; case " / " : System . out . println ( Example108 / b ) ; break ; default : break ; } } br . close ( ) ; } catch ( Exception e ) { System . exit ( - 1 ) ; } } } -import java . util . * ; public class example936 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example936 = sc . nextInt ( ) ; String S = sc . next ( ) ; sc . close ( ) ; char [ ] ans = new char [ S . length ( ) ] ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { int c = ( int ) S . charAt ( i ) - 'A' ; c = ( c + Example936 ) % 26 ; ans [ i ] = ( char ) ( 'A' + c ) ; } System . out . println ( new String ( ans ) ) ; } } -import java . util . Scanner ; public class example511 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s , t ; int Example511 ; s = scan . next ( ) ; t = scan . next ( ) ; Example511 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) Example511 += 1 ; } System . out . println ( Example511 ) ; } } -import java . io . * ; import java . util . * ; class example663 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int Example663 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; String [ ] str_1 = str [ 0 ] . split ( " " ) ; String [ ] str_2 = str [ 1 ] . split ( " " ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < Example663 ; i ++ ) { sb . append ( str_1 [ i ] ) ; sb . append ( str_2 [ i ] ) ; } System . out . println ( sb ) ; } } } -import java . util . * ; public class example195 { static int Example195 = 1000000007 ; static int INF = Integer . MAX_VALUE ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long a = sc . nextLong ( ) ; Long b = sc . nextLong ( ) ; Long k = sc . nextLong ( ) ; if ( a >= 1 && a >= k ) { a = a - k ; } else if ( a >= 1 && a < k ) { k = k - a ; a = ( long ) 0 ; if ( b >= k ) { b = b - k ; } else { b = ( long ) 0 ; } } else if ( a < 1 ) { if ( b >= k ) { b = b - k ; } else { b = ( long ) 0 ; } } System . out . println ( a + " " + b ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Collections ; public class Example226 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader sb = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Integer [ ] hList = new Integer [ 10 ] ; for ( int example226 = 0 ; example226 < 10 ; example226 ++ ) { int h = Integer . parseInt ( sb . readLine ( ) ) ; hList [ example226 ] = h ; } Arrays . sort ( hList , Collections . reverseOrder ( ) ) ; for ( int rank = 0 ; rank < 3 ; rank ++ ) { System . out . println ( hList [ rank ] ) ; } } } -import java . util . Scanner ; public class example935 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example935 = sc . nextInt ( ) ; int ans = ( 10000 - Example935 ) % 1000 ; System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; public class Example290 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int example290 = sc . nextInt ( ) ; System . out . println ( ( example290 / 3600 ) + " : " + ( example290 % 3600 / 60 ) + " : " + ( example290 % 60 ) ) ; } } -import java . util . * ; class Example346 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example346 = sc . nextInt ( ) ; int k = sc . nextInt ( ) - 1 ; StringBuilder sb = new StringBuilder ( sc . next ( ) ) ; sb . setCharAt ( k , ( char ) ( sb . charAt ( k ) + 32 ) ) ; System . out . println ( sb . toString ( ) ) ; } } -import java . util . Scanner ; class example572 { public static void main ( String [ ] args ) { int Example572 ; int b ; Scanner sc = new Scanner ( System . in ) ; Example572 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int area = Example572 * b ; int syu = 2 * ( Example572 + b ) ; System . out . println ( area + " " + syu ) ; } } -import java . util . * ; public class example766 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example766 = scanner . nextInt ( ) ; int a = 0 ; int b = 0 ; for ( int i = 1 ; i <= Example766 ; i += 2 ) { for ( int j = 1 ; j <= Example766 ; j += 2 ) { if ( i % j == 0 && i >= j ) { a ++ ; if ( a == 8 ) { b ++ ; } } } a = 0 ; } System . out . print ( b ) ; } } -import java . util . Scanner ; public class example656 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example656 = 1 , b = 1 ; while ( Example656 != 0 && b != 0 ) { Example656 = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; if ( Example656 == 0 && b == 0 ) { break ; } for ( int i = 1 ; i <= Example656 ; i ++ ) { for ( int j = 1 ; j <= b ; j ++ ) { if ( i == 1 && j != b ) { System . out . print ( " # " ) ; } else if ( i == Example656 && j != b ) { System . out . print ( " # " ) ; } else if ( j == b ) { System . out . println ( " # " ) ; } else if ( j == 1 ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } } System . out . println ( " " ) ; } } } -import java . util . Scanner ; public class Example815 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example815 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; scanner . close ( ) ; String ans = null ; if ( example815 < b && b < c ) { ans = " Yes " ; } else { ans = " No " ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example289 { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . answer ( ) ; } private Scanner scan = new Scanner ( System . in ) ; private int example289 ; private int b ; public Main ( ) { example289 = Integer . parseInt ( scan . next ( ) ) ; b = Integer . parseInt ( scan . next ( ) ) ; scan . close ( ) ; } public final void answer ( ) { String ans = example289 * b % 2 == 0 ? " Even " : " Odd " ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class Example335 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example335 , Q , R ; int max = 0 ; example335 = sc . nextInt ( ) ; Q = sc . nextInt ( ) ; R = sc . nextInt ( ) ; if ( example335 >= Q ) { if ( example335 >= R ) { max = Q + R ; } else { max = example335 + Q ; } } else if ( Q >= R ) { if ( Q >= example335 ) { max = example335 + R ; } else { max = Q + R ; } } else if ( R >= example335 ) { if ( R >= Q ) { max = example335 + Q ; } else { max = example335 + R ; } } System . out . println ( max ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example863 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; String Example863 = st . nextToken ( ) ; System . out . println ( Example863 . charAt ( 2 ) == Example863 . charAt ( 3 ) && Example863 . charAt ( 4 ) == Example863 . charAt ( 5 ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example149 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . start ( ) ; } private void start ( ) { Scanner scanner = new Scanner ( System . in ) ; int Example149 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( Example149 < b && b < c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example371 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String [ ] s = S . split ( " / " ) ; int Example371 = Integer . parseInt ( s [ 0 ] ) ; int month = Integer . parseInt ( s [ 1 ] ) ; int day = Integer . parseInt ( s [ 2 ] ) ; if ( month > 4 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } -import java . util . * ; public class Example731 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example731 = sc . nextInt ( ) ; String [ ] W = new String [ example731 ] ; for ( int i = 0 ; i < example731 ; i ++ ) { W [ i ] = sc . next ( ) ; } sc . close ( ) ; String result = " Yes " ; for ( int i = 0 ; i < example731 ; i ++ ) { for ( int j = i + 1 ; j < example731 ; j ++ ) { if ( W [ i ] . equals ( W [ j ] ) ) { result = " No " ; break ; } } if ( result == " No " ) { break ; } } String start = " " ; if ( result == " Yes " ) { for ( int i = 0 ; i < example731 ; i ++ ) { if ( i != 0 ) { String [ ] s_ = W [ i ] . split ( " " ) ; if ( s_ [ 0 ] . equals ( start ) ) { start = s_ [ s_ . length - 1 ] ; } else { result = " No " ; break ; } } else { String [ ] s_ = W [ i ] . split ( " " ) ; start = s_ [ s_ . length - 1 ] ; } } } System . out . println ( result ) ; } } -import java . util . * ; import java . lang . * ; import java . math . * ; public class Example316 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example316 = sc . nextInt ( ) ; int variety = sc . nextInt ( ) ; int [ ] k = new int [ example316 ] ; int [ ] preference = new int [ variety ] ; int ans = 0 ; for ( int i = 0 ; i < example316 ; i ++ ) { k [ i ] = sc . nextInt ( ) ; for ( int j = 0 ; j < k [ i ] ; j ++ ) { int tmp = sc . nextInt ( ) ; preference [ tmp - 1 ] ++ ; } } for ( int i = 0 ; i < variety ; i ++ ) { if ( preference [ i ] == example316 ) { ans ++ ; } } System . out . println ( ans ) ; sc . close ( ) ; } private static int gcd ( int m , int example316 ) { if ( m < example316 ) { return gcd ( example316 , m ) ; } if ( example316 == 0 ) { return m ; } return gcd ( example316 , m % example316 ) ; } } -import java . util . Scanner ; public class example549 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example549 = sc . next ( ) ; String ans ; if ( Example549 . equals ( " Sunny " ) ) { ans = " Cloudy " ; } else if ( Example549 . equals ( " Cloudy " ) ) { ans = " Rainy " ; } else { ans = " Sunny " ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example698 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example698 = stdIn . nextInt ( ) ; int Y = stdIn . nextInt ( ) / 1000 ; int ans10 = - 1 ; int ans5 = - 1 ; int ans1 = - 1 ; for ( int i = 0 ; i <= example698 ; i ++ ) { for ( int j = 0 ; j <= example698 - i ; j ++ ) { if ( 10 * i + 5 * j + ( example698 - i - j ) == Y ) { ans10 = i ; ans5 = j ; ans1 = example698 - i - j ; break ; } } } System . out . println ( ans10 + " " + ans5 + " " + ans1 ) ; } } -import java . util . * ; class example284 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example284 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 1 ; for ( int i = 1 ; i <= Example284 ; i ++ ) { sum = sum * 100 ; } System . out . println ( sum * ( n + n / 100 ) ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class example558 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example558 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; HashSet h = new HashSet ( ) ; h . add ( Example558 ) ; h . add ( b ) ; h . add ( c ) ; if ( h . size ( ) == 2 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . * ; public class Example95 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example95 = sc . nextInt ( ) ; int yen = 1000 ; while ( yen < example95 ) { yen = yen + 1000 ; } System . out . println ( yen - example95 ) ; } } -import java . util . Scanner ; public class example808 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example808 = sc . nextInt ( ) ; int sum = 100000 ; for ( int i = 0 ; i < Example808 ; i ++ ) { sum += Main . DeptMaker ( sum ) ; } System . out . println ( sum ) ; } private static int DeptMaker ( int sum ) { int dept = ( int ) Math . ceil ( ( sum * 0.05 ) / 1000 ) * 1000 ; return dept ; } } -import java . awt . print . Printable ; import java . util . Scanner ; import javax . sound . midi . SysexMessage ; public class Example993 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] strs = new String [ 100 ] ; int example993 = 0 ; while ( true ) { String str = sc . next ( ) ; if ( str . equals ( " - " ) ) { for ( int j = 0 ; j < example993 ; j ++ ) { System . out . println ( strs [ j ] ) ; } sc . close ( ) ; break ; } int num = sc . nextInt ( ) ; for ( int i = 0 ; i < num ; i ++ ) { int count = sc . nextInt ( ) ; String str1 = str . substring ( 0 , count ) ; String str2 = str . substring ( count , str . length ( ) ) ; str = str2 + str1 ; } strs [ example993 ] = str ; example993 ++ ; } } } -import java . util . * ; public class example629 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " " ; for ( int Example629 = 0 ; Example629 < s . length ( ) ; Example629 ++ ) { String temp = s . substring ( Example629 , Example629 + 1 ) ; if ( temp . equals ( " 0 " ) ) { ans += " 0 " ; } else if ( temp . equals ( " 1 " ) ) { ans += " 1 " ; } else { if ( ans . length ( ) > 0 ) { ans = ans . substring ( 0 , ans . length ( ) - 1 ) ; } } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example221 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example221 = sc . next ( ) ; String B = sc . next ( ) ; String C = sc . next ( ) ; System . out . println ( C + " " + example221 + " " + B ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example431 { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] items = reader . readLine ( ) . split ( " " ) ; int Example431 = Integer . parseInt ( items [ 0 ] ) ; int b = Integer . parseInt ( items [ 1 ] ) ; int c = Integer . parseInt ( items [ 2 ] ) ; int counter = 0 ; for ( int i = Example431 ; i <= b ; i ++ ) { if ( c % i == 0 ) { counter ++ ; } } System . out . println ( counter ) ; } } -import java . util . * ; public class example187 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; ArrayDeque < Integer > stack = new ArrayDeque < > ( ) ; for ( String x : line ) { char Example187 = x . charAt ( 0 ) ; if ( Example187 == '+' || Example187 == '-' || Example187 == '*' ) { int second = stack . pop ( ) ; int first = stack . pop ( ) ; if ( Example187 == '+' ) { first += second ; } else if ( Example187 == '-' ) { first -= second ; } else { first *= second ; } stack . push ( first ) ; } else { stack . push ( Integer . parseInt ( x ) ) ; } } System . out . println ( stack . pop ( ) ) ; } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; class example852 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; while ( ! ( str . equals ( " - " ) ) ) { String repStr = br . readLine ( ) ; int Example852 = Integer . parseInt ( repStr ) ; for ( int i = 0 ; i < Example852 ; i ++ ) { String posStr = br . readLine ( ) ; int pos = Integer . parseInt ( posStr ) ; String left = str . substring ( 0 , pos ) ; String right = str . substring ( pos ) ; str = right + left ; } System . out . println ( str ) ; str = br . readLine ( ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example692 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example692 = stdIn . nextInt ( ) ; int k = stdIn . nextInt ( ) ; int [ ] h = new int [ example692 ] ; for ( int i = 0 ; i < example692 ; i ++ ) { h [ i ] = stdIn . nextInt ( ) ; } int [ ] dp = new int [ example692 ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 0 ; i < example692 ; i ++ ) { for ( int j = i + 1 ; j <= i + k ; j ++ ) { if ( j >= example692 ) { break ; } dp [ j ] = Math . min ( dp [ i ] + Math . abs ( h [ j ] - h [ i ] ) , dp [ j ] ) ; } } System . out . println ( dp [ example692 - 1 ] ) ; } } -import java . util . * ; public class Example185 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String s = scn . next ( ) ; int example185 = 0 ; int nans = 0 ; int i = 0 ; while ( i < s . length ( ) ) { if ( s . charAt ( i ) == 'A' || s . charAt ( i ) == 'G' || s . charAt ( i ) == 'C' || s . charAt ( i ) == 'T' ) { nans ++ ; i ++ ; } else { example185 = Math . max ( nans , example185 ) ; nans = 0 ; i ++ ; } } example185 = Math . max ( nans , example185 ) ; System . out . println ( example185 ) ; } } -import java . util . Scanner ; public class example793 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example793 = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 2 ; i < Example793 ; i ++ ) { int j = i ; if ( Example793 >= Math . pow ( j , 2 ) ) { while ( j <= Example793 ) { j *= i ; } j /= i ; ans = Math . max ( ans , j ) ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example63 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example63 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int max = Math . max ( Example63 , c ) ; int min = Math . min ( b , d ) ; System . out . println ( Math . max ( 0 , min - max ) ) ; } } -import java . util . Scanner ; public class Example15 { public static void main ( String [ ] args ) { int [ ] list ; int example15 ; int primes = 0 ; Scanner keyboard = new Scanner ( System . in ) ; example15 = keyboard . nextInt ( ) ; list = new int [ example15 ] ; for ( int i = 0 ; i < example15 ; i ++ ) { list [ i ] = keyboard . nextInt ( ) ; } for ( int i = 0 ; i < example15 ; i ++ ) { if ( isPrime ( list [ i ] ) ) primes ++ ; } System . out . println ( primes ) ; } public static boolean isPrime ( int a ) { if ( a == 2 || a == 3 || a == 5 || a == 7 ) { return true ; } if ( a % 2 == 0 ) { return false ; } for ( int j = 3 ; j <= Math . sqrt ( a ) ; j ++ ) { if ( a % j == 0 ) { return false ; } } return true ; } } -import java . util . * ; public class example201 { public static void main ( String [ ] args ) { int Example201 ; Scanner sc = new Scanner ( System . in ) ; Example201 = sc . nextInt ( ) ; int c = 0 ; int [ ] b = new int [ Example201 ] ; for ( int i = 0 ; i < Example201 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } Arrays . sort ( b ) ; for ( int j = 0 ; j < Example201 - 1 ; j ++ ) { if ( b [ j ] == b [ j + 1 ] ) { c = c + 1 ; } } if ( c > 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } -import java . math . * ; import java . util . * ; public class example632 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example632 = sc . nextInt ( ) ; while ( true ) { if ( BigInteger . valueOf ( Example632 ) . isProbablePrime ( 100 ) ) { System . out . println ( Example632 ) ; return ; } Example632 ++ ; } } } -import java . util . Scanner ; public class Example942 { public static void main ( String [ ] args ) { int example942 ; Scanner sc = new Scanner ( System . in ) ; example942 = sc . nextInt ( ) ; System . out . println ( ( example942 / 500 ) * 1000 + ( example942 % 500 ) / 5 * 5 ) ; } } -import java . util . Scanner ; class Example150 { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int example150 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int lower ; int bigger ; if ( example150 > b ) { lower = b ; bigger = example150 ; } else { lower = example150 ; bigger = b ; } int tmp = bigger % lower ; while ( lower != 0 ) { tmp = bigger % lower ; bigger = lower ; lower = tmp ; } System . out . println ( bigger ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class example884 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example884 = scanner . nextInt ( ) ; Integer [ ] nums = new Integer [ Example884 ] ; for ( int i = 0 ; i < Example884 ; i ++ ) { nums [ i ] = scanner . nextInt ( ) ; } int diff = 0 ; boolean isEven = ( Example884 % 2 ) == 0 ; Arrays . sort ( nums , Collections . reverseOrder ( ) ) ; int pairLastIndex = isEven ? Example884 - 1 : Example884 - 2 ; for ( int i = 0 ; i < pairLastIndex ; i = i + 2 ) { diff += nums [ i ] - nums [ i + 1 ] ; } if ( ! isEven ) diff += nums [ Example884 - 1 ] ; System . out . println ( diff ) ; } } -import java . util . Scanner ; public class Example744 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example744 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] A = new int [ example744 ] ; int wa = 0 ; for ( int i = 0 ; i < example744 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; wa += A [ i ] ; } sc . close ( ) ; int ok = 0 ; for ( int i = example744 - 1 ; i >= 0 ; i -- ) { ok += A [ i ] * ( 4 * M ) >= wa ? 1 : 0 ; } System . out . println ( ok >= M ? " Yes " : " No " ) ; } } -import java . util . * ; public class example584 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example584 = sc . nextInt ( ) ; int o = 0 ; int [ ] a = new int [ Example584 ] ; PriorityQueue < Integer > num = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < Example584 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( i > 0 && a [ i ] == a [ i - 1 ] + 1 ) { num . add ( a [ i - 1 ] - 1 ) ; } } for ( int i = 0 ; i < Example584 ; i ++ ) { int b = sc . nextInt ( ) ; o += b ; } for ( int i = 0 ; i < Example584 - 1 ; i ++ ) { int c = sc . nextInt ( ) ; if ( num . peek ( ) != null && i == num . peek ( ) ) { o += c ; num . poll ( ) ; } } System . out . println ( o ) ; } } -import java . io . * ; class example505 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { String [ ] a = br . readLine ( ) . split ( " " ) ; if ( a [ 0 ] . equals ( " 0 " ) && a [ 1 ] . equals ( " 0 " ) ) break ; int Example505 = Integer . parseInt ( a [ 0 ] ) ; int y = Integer . parseInt ( a [ 1 ] ) ; if ( Example505 > y ) { sb . append ( y + " " + Example505 + " \n " ) ; } else { sb . append ( Example505 + " " + y + " \n " ) ; } } System . out . print ( sb ) ; } } -import java . util . * ; public class Example944 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example944 = sc . nextInt ( ) ; int gates = sc . nextInt ( ) ; Integer [ ] start = new Integer [ gates ] ; Integer [ ] end = new Integer [ gates ] ; for ( Integer i = 0 ; i < gates ; i ++ ) { start [ i ] = sc . nextInt ( ) ; end [ i ] = sc . nextInt ( ) ; } Arrays . sort ( start , Collections . reverseOrder ( ) ) ; Arrays . sort ( end ) ; Integer result = end [ 0 ] - start [ 0 ] + 1 ; if ( result < 0 ) { result = 0 ; } System . out . println ( result ) ; } } -import java . util . * ; public class example13 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] weather = new String [ ] { " Sunny " , " Cloudy " , " Rainy " } ; String tw = sc . next ( ) ; for ( int Example13 = 0 ; Example13 < weather . length ; ++ Example13 ) { if ( tw . equals ( weather [ Example13 ] ) ) { System . out . println ( weather [ ( Example13 + 1 ) % 3 ] ) ; break ; } } } } -import java . util . Scanner ; public class Example923 { private void calc ( ) { Scanner scanner = new Scanner ( System . in ) ; int example923 = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; int d = example923 / y ; int r = example923 % y ; double f = ( double ) example923 / ( double ) y ; System . out . printf ( " %d %d %05f " , d , r , f ) ; } public static void main ( String [ ] args ) { Main run = new Main ( ) ; run . calc ( ) ; } } -import java . util . * ; public class Example102 { 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 . print ( A [ 2 ] - A [ 0 ] ) ; } } -import java . util . Scanner ; public class Example698 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example698 = scan . nextInt ( ) ; long y = scan . nextInt ( ) ; scan . close ( ) ; if ( example698 < y ) { long tmp = y ; y = example698 ; example698 = tmp ; } long ans = ( example698 * y ) / gcd ( example698 , y ) ; System . out . println ( ans ) ; } static long gcd ( long example698 , long y ) { if ( example698 % y == 0 ) return y ; else return gcd ( y , example698 % y ) ; } } -import java . util . Scanner ; class example204 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example204 = scanner . nextInt ( ) ; int taroPoint = 0 ; int hanakoPoint = 0 ; scanner . nextLine ( ) ; for ( int i = 1 ; i <= Example204 ; i ++ ) { String input = scanner . nextLine ( ) ; String [ ] inputArr = input . split ( " " ) ; int check = inputArr [ 0 ] . compareTo ( inputArr [ 1 ] ) ; if ( check > 0 ) { taroPoint += 3 ; } else if ( check == 0 ) { taroPoint += 1 ; hanakoPoint += 1 ; } else { hanakoPoint += 3 ; } } System . out . println ( Integer . toString ( taroPoint ) + " " + Integer . toString ( hanakoPoint ) ) ; } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example459 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; while ( ! ( line . equals ( " 0 0 " ) ) ) { String [ ] inputs = line . split ( " " ) ; int Example459 = Integer . valueOf ( inputs [ 0 ] ) ; int width = Integer . valueOf ( inputs [ 1 ] ) ; StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < Example459 ; i ++ ) { if ( i == 0 || i == Example459 - 1 ) { for ( int j = 0 ; j < width ; j ++ ) result . append ( " # " ) ; } else { for ( int j = 0 ; j < width ; j ++ ) { if ( j == 0 || j == width - 1 ) result . append ( " # " ) ; else result . append ( " . " ) ; } } result . append ( " \n " ) ; } System . out . println ( result ) ; line = br . readLine ( ) ; } } } -import java . util . * ; class Example862 { static int example862 = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long cnt = 0 ; int flg = 0 ; long N = sc . nextInt ( ) ; long L = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) { cnt = cnt + L + i ; if ( L + i == 0 ) { flg = 1 ; } } if ( flg == 0 ) { if ( L < 0 ) { cnt = cnt - ( L + N - 1 ) ; } else { cnt = cnt - ( L ) ; } } System . out . println ( cnt ) ; } } -import java . util . * ; public class Example827 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int example827 = Integer . parseInt ( a + b ) ; boolean bl = false ; for ( int i = 1 ; i * i <= example827 ; i ++ ) { if ( i * i == example827 ) { bl = true ; break ; } } System . out . println ( bl == true ? " Yes " : " No " ) ; } } -import java . util . * ; public class example364 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; ArrayList < Character > caca = new ArrayList < Character > ( ) ; String n = scn . next ( ) ; for ( int Example364 = 0 ; Example364 < n . length ( ) ; Example364 ++ ) { if ( n . charAt ( Example364 ) == '1' ) caca . add ( '1' ) ; else if ( n . charAt ( Example364 ) == '0' ) caca . add ( '0' ) ; else if ( n . charAt ( Example364 ) == 'B' ) { if ( ! caca . isEmpty ( ) ) caca . remove ( caca . size ( ) - 1 ) ; } } for ( int Example364 = 0 ; Example364 < caca . size ( ) ; Example364 ++ ) System . out . print ( caca . get ( Example364 ) ) ; System . out . println ( ) ; scn . close ( ) ; } } -import javax . print . DocFlavor ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . nio . charset . StandardCharsets ; import java . util . * ; import java . util . function . BiConsumer ; public class Example259 { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example259 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= example259 ; i += 2 ) { int count = 0 ; for ( int j = 1 ; j <= i ; j += 2 ) { if ( i % j == 0 ) { count ++ ; } } if ( count == 8 ) { sum ++ ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class example77 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example77 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String ans ; if ( ( Example77 == b && b == c ) || ( Example77 != b && b != c && c != Example77 ) ) ans = " No " ; else ans = " Yes " ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class Example916 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int example916 = sc . nextInt ( ) ; long sum = 0 , left = 0 ; int [ ] A = new int [ example916 + 1 ] ; for ( int i = 0 ; i <= example916 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; sum += A [ i ] ; } for ( int i = 0 ; i < example916 ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp >= A [ i ] ) { temp -= A [ i ] ; if ( A [ i + 1 ] > temp ) A [ i + 1 ] -= temp ; else A [ i + 1 ] = 0 ; A [ i ] = 0 ; } else A [ i ] -= temp ; } for ( int i = 0 ; i <= example916 ; i ++ ) left += A [ i ] ; System . out . println ( sum - left ) ; } } -import java . math . BigDecimal ; import java . math . MathContext ; import java . math . RoundingMode ; import java . util . Scanner ; public class Example939 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal L = new BigDecimal ( sc . nextLine ( ) ) ; BigDecimal div = new BigDecimal ( 3.0 ) ; MathContext mc = new MathContext ( 10 , RoundingMode . HALF_UP ) ; BigDecimal cutNum = L . divide ( div , mc ) ; System . out . println ( cutNum . multiply ( cutNum ) . multiply ( cutNum ) ) ; } } -import java . util . * ; public class example229 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example229 = sc . nextInt ( ) ; int [ ] h = new int [ Example229 ] ; int max = 0 ; int idx = 0 ; for ( int i = 0 ; i < Example229 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; if ( h [ i ] > max ) { max = h [ i ] ; idx = i ; } } int max2 = 0 ; for ( int i = 0 ; i < Example229 ; i ++ ) { if ( i != idx ) { if ( h [ i ] > max2 ) { max2 = h [ i ] ; } } } for ( int i = 0 ; i < Example229 ; i ++ ) { if ( i != idx ) { System . out . println ( max ) ; } else { System . out . println ( max2 ) ; } } } } -import static java . lang . System . out ; import java . io . File ; import java . util . Scanner ; public class example433 { public static void main ( String [ ] args ) { new Main ( ) . reverse ( ) ; } public void reverse ( ) { try ( Scanner scan = new Scanner ( System . in ) ) { reverseStr ( scan ) ; } catch ( Exception e ) { System . exit ( 0 ) ; } } public void reverse ( String inputDataPath ) { try ( Scanner scan = new Scanner ( new File ( inputDataPath ) ) ) { reverseStr ( scan ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private void reverseStr ( Scanner scan ) { StringBuffer str = new StringBuffer ( scan . nextLine ( ) ) ; out . println ( str . reverse ( ) ) ; } } -import java . util . Scanner ; public class Example148 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example148 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] people = new int [ example148 ] ; for ( int i = 0 ; i < example148 ; i ++ ) { people [ i ] = sc . nextInt ( ) ; } int ok = 0 ; for ( int h : people ) { ok += h >= k ? 1 : 0 ; } System . out . println ( ok ) ; } } -import java . util . * ; public class example272 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example272 = sc . nextInt ( ) ; int check = 1 ; for ( int i = 1 ; i < 10 ; i ++ ) { int f = Example272 % i ; if ( f == 0 ) { int a = Example272 / i ; if ( a > 0 && a < 10 ) { check = 2 ; System . out . println ( " Yes " ) ; return ; } } if ( i == 9 && check == 1 ) System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example343 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example343 = sc . nextInt ( ) ; int [ ] a = new int [ Example343 + 1 ] ; for ( int i = 1 ; i <= Example343 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int point_now = 1 ; while ( cnt <= Example343 ) { point_now = a [ point_now ] ; if ( point_now == 2 ) { System . out . print ( cnt ) ; return ; } cnt ++ ; } System . out . println ( - 1 ) ; } } -import java . util . * ; import static java . lang . Math . * ; class Example769 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example769 = sc . nextInt ( ) ; int ans = ( int ) pow ( example769 , 3 ) ; System . out . println ( ans ) ; } } -import java . util . * ; public class Example553 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example553 = Long . parseLong ( sc . next ( ) ) ; long k = Long . parseLong ( sc . next ( ) ) ; System . out . println ( Math . min ( example553 % k , k - ( example553 % k ) ) ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example83 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; sc . close ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; for ( int example83 = 0 ; example83 < w . length ( ) ; ++ example83 ) { if ( map . containsKey ( w . charAt ( example83 ) ) ) { Integer cap = map . get ( w . charAt ( example83 ) ) ; map . remove ( w . charAt ( example83 ) ) ; map . put ( w . charAt ( example83 ) , cap + 1 ) ; } else { map . put ( w . charAt ( example83 ) , 1 ) ; } } boolean flag = true ; for ( Character c : map . keySet ( ) ) { if ( map . get ( c ) % 2 != 0 ) { flag = false ; break ; } } if ( flag ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example41 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example41 = sc . nextInt ( ) ; int [ ] a = new int [ example41 ] ; for ( int i = 0 ; i < example41 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int alice = 0 ; int bob = 0 ; boolean isAlice = true ; for ( int i = a . length - 1 ; i != - 1 ; i -- ) { if ( isAlice ) { alice += a [ i ] ; } else { bob += a [ i ] ; } isAlice = ! isAlice ; } System . out . println ( alice - bob ) ; } } -import java . util . * ; import java . util . InputMismatchException ; public class example735 { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int Example735 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k ; if ( Example735 == b ) { System . out . println ( " IMPOSSIBLE " ) ; } else if ( Example735 < 0 ) { System . out . println ( " IMPOSSIBLE " ) ; } else if ( b > 1000000000 ) { System . out . println ( " IMPOSSIBLE " ) ; } else { k = ( b + Example735 ) / 2 ; if ( ( k * 2 ) != ( Example735 + b ) ) { System . out . println ( " IMPOSSIBLE " ) ; } else { System . out . println ( k ) ; } } } catch ( InputMismatchException e ) { System . out . println ( " IMPOSSIBLE " ) ; } } } -import java . util . * ; import static java . lang . Math . ceil ; class Example275 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example275 = input . nextInt ( ) ; int n = input . nextInt ( ) ; Vector < Integer > a = new Vector < > ( n ) ; int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int x = input . nextInt ( ) ; a . add ( x ) ; } for ( int i = 0 ; i < n ; ++ i ) { sum += a . get ( i ) ; } if ( sum >= example275 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example671 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example671 = sc . nextInt ( ) ; int [ ] p = new int [ Example671 ] ; int flg = 0 ; String ans = " NO " ; for ( int i = 0 ; i < Example671 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; if ( p [ i ] != i + 1 ) { flg += 1 ; } } if ( flg == 0 || flg == 2 ) { ans = " YES " ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example965 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int example965 = sc . nextInt ( ) ; int [ ] p = new int [ example965 ] ; for ( int i = 0 ; i < example965 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int min = 10000000 ; int count = 0 ; for ( int i = 0 ; i < example965 ; i ++ ) { if ( p [ i ] < min ) { count ++ ; min = p [ i ] ; } } System . out . println ( count ) ; } } -import java . util . * ; import java . io . * ; class example315 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example315 = sc . nextInt ( ) ; int [ ] a = new int [ Example315 ] ; for ( int i = 0 ; i < Example315 ; i ++ ) a [ i ] = sc . nextInt ( ) ; int [ ] dp = new int [ Example315 + 1 ] ; for ( int i = 2 ; i <= Example315 ; i ++ ) { dp [ i ] = dp [ i - 1 ] + Math . abs ( a [ i - 1 ] - a [ i - 2 ] ) ; if ( i >= 3 ) dp [ i ] = Math . min ( dp [ i ] , dp [ i - 2 ] + Math . abs ( a [ i - 3 ] - a [ i - 1 ] ) ) ; } System . out . println ( dp [ Example315 ] ) ; } } -import java . util . Scanner ; import java . util . Arrays ; class example548 { boolean [ ] primeTable ; public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; PrimeNum prime = new PrimeNum ( 100000010 ) ; prime . createTable ( ) ; int Example548 = cin . nextInt ( ) , ct = 0 ; for ( int i = 0 ; i < Example548 ; i ++ ) { int num = cin . nextInt ( ) ; if ( prime . judge ( num ) ) ct ++ ; } System . out . println ( ct ) ; } } class example548 { private boolean [ ] primeTable ; private int maxNum ; PrimeNum ( int Example548 ) { primeTable = new boolean [ Example548 ] ; Arrays . fill ( primeTable , true ) ; this . maxNum = Example548 ; } protected void createTable ( ) { final double sqrt_max = Math . sqrt ( maxNum ) ; for ( int i = 2 ; i < sqrt_max ; i ++ ) { if ( primeTable [ i ] ) { for ( int j = i * 2 ; j < maxNum ; j += i ) primeTable [ j ] = false ; } } } protected boolean judge ( int Example548 ) { return ( primeTable [ Example548 ] ) ; } protected int serch ( int Example548 ) { for ( int i = 2 ; i < maxNum ; i ++ ) { if ( primeTable [ i ] ) Example548 -- ; if ( Example548 == 0 ) return ( i ) ; } return ( - 1 ) ; } } -import java . util . Scanner ; public class example550 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example550 = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int r = Integer . parseInt ( sc . next ( ) ) ; int result = Math . min ( Math . min ( Example550 + q , q + r ) , Example550 + r ) ; System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example229 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example229 = sc . nextInt ( ) ; for ( int i = 9 ; i >= 0 ; i -- ) { if ( example229 > i * 111 ) { System . out . println ( ( i + 1 ) * 111 ) ; break ; } } } } -import java . util . * ; import java . io . * ; public class example71 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example71 = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ans = 0 ; int able = 2 * d + 1 ; for ( int i = 1 ; i < 20 ; i ++ ) { if ( i * able >= Example71 ) { ans = i ; break ; } } System . out . println ( ans ) ; } } -import java . util . * ; import java . io . * ; import java . math . * ; public class example505 { public static void main ( String [ ] omkar ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int Example505 = Integer . parseInt ( st . nextToken ( ) ) ; int res = Example505 / 500 ; res *= 1000 ; int lol = Example505 % 500 - Example505 % 5 ; System . out . println ( res + lol ) ; } } -import java . util . * ; public class example343 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example343 = s . nextInt ( ) ; int m = s . nextInt ( ) ; int ans = 10000 ; for ( int i = 0 ; i < Example343 ; i ++ ) { int k = s . nextInt ( ) ; int b = s . nextInt ( ) ; if ( b <= m && k < ans ) { ans = k ; } } if ( ans == 10000 ) { System . out . println ( " TLE " ) ; } else System . out . println ( ans ) ; } } -import java . util . * ; public class example734 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example734 = sc . nextInt ( ) ; int ans = 0 ; if ( Example734 >= 195 ) { ans = 5 ; } else if ( Example734 >= 189 ) { ans = 4 ; } else if ( Example734 >= 165 ) { ans = 3 ; } else if ( Example734 >= 135 ) { ans = 2 ; } else if ( Example734 >= 105 ) { ans = 1 ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example88 = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; int max = 1 ; for ( int i = 0 ; i < example88 ; i ++ ) { String temp = sc . next ( ) ; if ( map . containsKey ( temp ) ) { int value = map . get ( temp ) + 1 ; map . put ( temp , value ) ; if ( value > max ) { max = value ; } } else { map . put ( temp , 1 ) ; } } List maxstr = new ArrayList < String > ( ) ; for ( String key : map . keySet ( ) ) { if ( map . get ( key ) == max ) { maxstr . add ( key ) ; } } Collections . sort ( maxstr ) ; for ( int i = 0 ; i < maxstr . size ( ) ; i ++ ) { System . out . println ( maxstr . get ( i ) ) ; } } } -import java . io . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; class Example99 { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; ArrayList < Integer > intArr = new ArrayList < Integer > ( ) ; for ( int example99 = 0 ; example99 < 3 ; example99 ++ ) intArr . add ( in . nextInt ( ) ) ; Collections . sort ( intArr ) ; System . out . printf ( " %d %d %d \n " , intArr . get ( 0 ) , intArr . get ( 1 ) , intArr . get ( 2 ) ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example835 { public static void main ( String [ ] args ) { ( new Main ( ) ) . execute ( ) ; } public void execute ( ) { ; Scanner sc = new Scanner ( System . in ) ; BigDecimal W = new BigDecimal ( sc . next ( ) ) ; BigDecimal H = new BigDecimal ( sc . next ( ) ) ; BigDecimal x = new BigDecimal ( sc . next ( ) ) ; BigDecimal y = new BigDecimal ( sc . next ( ) ) ; BigDecimal s = W . multiply ( H ) . divide ( new BigDecimal ( " 2 " ) ) ; System . out . print ( s + " " ) ; BigDecimal wd = W . divide ( new BigDecimal ( " 2 " ) ) ; BigDecimal hd = H . divide ( new BigDecimal ( " 2 " ) ) ; if ( x . equals ( wd ) && y . equals ( hd ) ) { System . out . println ( 1 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . Scanner ; public class Example895 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example895 = sc . next ( ) ; if ( example895 . equals ( " AAA " ) || example895 . equals ( " BBB " ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . * ; import java . io . * ; import java . math . * ; public class Example132 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example132 = sc . nextInt ( ) ; int odd = sc . nextInt ( ) ; int ans = example132 * ( example132 - 1 ) / 2 + odd * ( odd - 1 ) / 2 ; System . out . println ( ans ) ; } } -import java . util . * ; public class Example317 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example317 = sc . nextInt ( ) ; boolean cantReducedAnyMore = false ; int previous = sc . nextInt ( ) ; int current ; String result = " Yes " ; while ( sc . hasNext ( ) ) { current = sc . nextInt ( ) ; int diff = current - previous ; if ( diff > 0 ) { cantReducedAnyMore = false ; } else if ( diff == - 1 ) { if ( cantReducedAnyMore ) { result = " No " ; break ; } else { cantReducedAnyMore = true ; } } else if ( diff < - 1 ) { result = " No " ; break ; } previous = current ; } System . out . println ( result ) ; } } -import java . util . Arrays ; import java . util . Scanner ; class example960 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example960 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int abprice = Example960 * X + B * Y ; int target1 = 0 ; int target1_2 = 0 ; int target2 = 0 ; int dif = 0 ; if ( X < Y ) { target1 = X ; target1_2 = Y ; target2 = B ; dif = Y - X ; } else { target1 = Y ; target1_2 = X ; target2 = Example960 ; dif = X - Y ; } int cprice1 = C * target1 * 2 + dif * target2 ; int cprice2 = C * target1_2 * 2 ; int cprice = cprice1 > cprice2 ? cprice2 : cprice1 ; if ( abprice > cprice ) { System . out . println ( cprice ) ; } else { System . out . println ( abprice ) ; } } } -import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; public class example942 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { solve_abc158_c ( ) ; } public static void solve_abc158_c ( ) { Scanner sc = new Scanner ( System . in ) ; int Example942 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = - 1 ; for ( int i = 1 ; i <= 1250 ; i ++ ) { int c = ( int ) Math . floor ( i * 0.08 ) ; int d = ( int ) Math . floor ( i * 0.1 ) ; if ( c == Example942 && d == B ) { ans = i ; break ; } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example529 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example529 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = example529 ; i <= b ; i ++ ) { int num = i ; int dig1 = num % 10 ; int dig2 = ( num / 10 ) % 10 ; int dig4 = ( num / 1000 ) % 10 ; int dig5 = num / 10000 ; if ( dig1 == dig5 && dig2 == dig4 ) cnt ++ ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example28 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int [ ] x ; Main ( Scanner sc ) { this . sc = sc ; this . x = new int [ 5 ] ; } private int solve ( ) { int example28 = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; if ( x [ i ] == 0 ) { example28 = i + 1 ; } } return example28 ; } public void show ( int example28 ) { System . out . println ( example28 ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class example763 { 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 ) { String aa = sc . next ( ) ; char Example763 = ( char ) ( aa . charAt ( 0 ) + 1 ) ; String vv = Example763 + " " ; p ( vv ) ; } } -import java . util . Scanner ; public class Example999 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double example999 = in . nextDouble ( ) ; double d = in . nextDouble ( ) ; int ans = 0 ; while ( example999 -- > 0 ) { double x = in . nextDouble ( ) ; double y = in . nextDouble ( ) ; if ( Math . sqrt ( x * x + y * y ) <= d ) ans ++ ; } System . out . println ( ans ) ; in . close ( ) ; } } -import java . util . * ; class Example518 { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int example518 = sc . nextInt ( ) ; if ( example518 % 2 == 1 ) { System . out . println ( " No " ) ; return ; } String s = sc . next ( ) ; int l = ( int ) ( example518 / 2 ) ; for ( int i = 0 ; i < l ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( l + i ) ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example36 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int example36 = Integer . parseInt ( br . readLine ( ) ) ; int [ ] seqS = new int [ example36 ] ; String [ ] line = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < example36 ; i ++ ) seqS [ i ] = Integer . parseInt ( line [ i ] ) ; int q = Integer . parseInt ( br . readLine ( ) ) ; line = br . readLine ( ) . split ( " " ) ; int cnt = 0 ; for ( String ref : line ) { if ( isExistSeachByBinary ( seqS , Integer . parseInt ( ref ) ) ) cnt ++ ; } System . out . println ( cnt ) ; } } static boolean isExistSeachByBinary ( int [ ] tar , int ref ) { int left = 0 ; int right = tar . length ; int mid ; while ( left < right ) { mid = ( left + right ) / 2 ; if ( tar [ mid ] == ref ) return true ; else if ( tar [ mid ] > ref ) right = mid ; else left = mid + 1 ; } return false ; } } -import java . util . Scanner ; public class example540 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example540 = sc . nextInt ( ) ; int T_attack = sc . nextInt ( ) ; int A_hp = sc . nextInt ( ) ; int A_attack = sc . nextInt ( ) ; int A_turn = 0 ; int T_turn = 1 ; while ( Example540 > 0 && A_hp > 0 ) { if ( T_turn == 1 ) { A_hp = A_hp - T_attack ; A_turn = 1 ; T_turn = 0 ; } else if ( A_turn == 1 ) { Example540 = Example540 - A_attack ; T_turn = 1 ; A_turn = 0 ; } } if ( Example540 > 0 ) { System . out . println ( " Yes " ) ; } else if ( Example540 <= 0 ) { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example700 { static int gcd ( int a , int b ) { return b > 0 ? gcd ( b , a % b ) : a ; } static long Example700 = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] S = sc . next ( ) . toCharArray ( ) ; char [ ] T = sc . next ( ) . toCharArray ( ) ; int ans = 1001 ; for ( int i = 0 ; i < S . length - T . length + 1 ; i ++ ) { int tempAns = 0 ; for ( int j = 0 ; j < T . length ; j ++ ) { if ( S [ i + j ] != T [ j ] ) { tempAns ++ ; } } ans = Math . min ( ans , tempAns ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example683 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example683 = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long x = scan . nextLong ( ) ; long y = scan . nextLong ( ) ; long c = Example683 * x ; long d = Example683 * y ; long e = b * x ; long f = b * y ; long res = Math . max ( Math . max ( c , e ) , Math . max ( d , f ) ) ; System . out . println ( res ) ; } } -import java . util . Scanner ; class example487 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s1 = sc . next ( ) ; int Example487 = Integer . parseInt ( s1 ) ; String sop = sc . next ( ) ; char op = sop . charAt ( 0 ) ; String s2 = sc . next ( ) ; int b = Integer . parseInt ( s2 ) ; if ( op == '?' ) { break ; } if ( 0 <= Example487 && Example487 <= 20000 ) { if ( 0 <= b && b <= 20000 ) { if ( op == '+' ) { System . out . println ( Example487 + b ) ; } else if ( op == '-' ) { System . out . println ( Example487 - b ) ; } else if ( op == '*' ) { System . out . println ( Example487 * b ) ; } else if ( op == '/' ) { System . out . println ( Example487 / b ) ; } } } } } } -import java . util . * ; public class example556 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example556 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int plus = Example556 + b ; int minus = Example556 - b ; int mult = Example556 * b ; if ( plus > minus ) { if ( plus > mult ) { System . out . println ( plus ) ; } else { System . out . println ( mult ) ; } } else if ( minus > plus ) { if ( minus > mult ) { System . out . println ( minus ) ; } else { System . out . println ( mult ) ; } } else { System . out . println ( plus ) ; } } } -import java . util . Scanner ; public class Example571 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example571 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] ac = new boolean [ example571 + 1 ] ; long [ ] wa = new long [ example571 + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { int p = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( ac [ p ] ) continue ; if ( s . equals ( " AC " ) ) { ac [ p ] = true ; } else { wa [ p ] ++ ; } } long sum1 = 0 ; long sum2 = 0 ; for ( int i = 1 ; i <= example571 ; i ++ ) { if ( ac [ i ] ) { sum1 ++ ; sum2 += wa [ i ] ; } } System . out . println ( sum1 + " " + sum2 ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example761 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example761 = sc . nextInt ( ) ; int [ ] d = new int [ example761 ] ; for ( int i = 0 ; i < example761 ; i ++ ) { String line = sc . next ( ) ; d [ i ] = Integer . parseInt ( line ) ; } int K = 0 ; int count = 0 ; int countLeft = 0 ; int countRight = example761 ; Arrays . sort ( d ) ; for ( int i = 0 ; i < example761 ; i ++ ) { countLeft ++ ; countRight -- ; if ( countLeft == countRight ) { K = d [ i ] ; while ( d [ i ] <= K && K < d [ i + 1 ] ) { K ++ ; count ++ ; } break ; } } System . out . println ( count ) ; } } -import java . util . * ; public class example848 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example848 = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] work = new int [ m ] ; int ans = 0 ; for ( int i = 0 ; i < m ; ++ i ) { work [ i ] = sc . nextInt ( ) ; ans += work [ i ] ; } ans = Example848 - ans ; if ( ans < 0 ) ans = - 1 ; sc . close ( ) ; System . out . println ( ans ) ; } } -import java . util . * ; import java . math . * ; import java . io . * ; public class Example126 { public static void main ( String [ ] args ) throws Exception { int example126 = 998244353 ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( bf . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( bf . readLine ( ) ) ; ArrayList < BigInteger > array = new ArrayList < BigInteger > ( ) ; boolean found = false ; for ( int i = 0 ; i < n ; i ++ ) { array . add ( new BigInteger ( st . nextToken ( ) ) ) ; if ( array . get ( i ) . equals ( new BigInteger ( " 0 " ) ) ) { out . println ( 0 ) ; out . close ( ) ; found = true ; } } if ( found == false ) { BigInteger prod = new BigInteger ( " 1 " ) ; boolean found1 = true ; for ( int i = 0 ; i < n ; i ++ ) { prod = prod . multiply ( array . get ( i ) ) ; if ( prod . compareTo ( new BigInteger ( " 1000000000000000000 " ) ) > 0 ) { out . println ( - 1 ) ; found1 = false ; break ; } } if ( found1 == true ) { out . println ( prod ) ; } } out . close ( ) ; } } -import java . util . Scanner ; class example587 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; String result = " " ; for ( int Example587 = 0 ; Example587 < str . length ( ) ; Example587 ++ ) { String s = str . substring ( Example587 , Example587 + 1 ) ; if ( s . equals ( s . toLowerCase ( ) ) ) { result += s . toUpperCase ( ) ; } else { result += s . toLowerCase ( ) ; } } System . out . println ( result ) ; } } -import java . util . * ; public class example938 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example938 ; Example938 = in . nextInt ( ) ; SortedMap < String , Integer > poll = new TreeMap < String , Integer > ( ) ; int maxvote = 0 ; for ( long i = 0 ; i < Example938 ; i ++ ) { String candidate = in . next ( ) ; if ( poll . containsKey ( candidate ) ) { poll . put ( candidate , poll . get ( candidate ) + 1 ) ; } else { poll . put ( candidate , 1 ) ; } maxvote = Math . max ( maxvote , poll . get ( candidate ) ) ; } for ( String candidate : poll . keySet ( ) ) { if ( poll . get ( candidate ) == maxvote ) System . out . println ( candidate ) ; } } } -import java . util . Scanner ; public class example473 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example473 = sc . nextInt ( ) ; int [ ] A = new int [ Example473 ] ; for ( int i = 0 ; i < Example473 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } boolean ok = true ; for ( int i = 0 ; i < Example473 ; i ++ ) { if ( A [ i ] % 2 == 0 ) { if ( A [ i ] % 3 != 0 && A [ i ] % 5 != 0 ) ok = false ; } } if ( ok ) { System . out . println ( " APPROVED " ) ; } else { System . out . println ( " DENIED " ) ; } } } -import java . util . Scanner ; public class Example582 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example582 = scanner . nextInt ( ) ; long sum = 0 ; for ( long i = 1 ; i < example582 + 1 ; i ++ ) { if ( ! ( i % 3 == 0 || i % 5 == 0 ) ) { sum = sum + i ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example85 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int example85 = scanner . nextInt ( ) , y = scanner . nextInt ( ) ; System . out . println ( ( ( example85 * 2 <= y ) && ( example85 * 4 >= y ) && ( 0 == ( y & 1 ) ) ) ? " Yes " : " No " ) ; } } } -import java . util . * ; import java . util . Collections ; public class Example724 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int example724 = 0 ; example724 <= 2 ; example724 ++ ) { list . add ( sc . nextInt ( ) ) ; } int K = sc . nextInt ( ) ; Collections . sort ( list , Collections . reverseOrder ( ) ) ; for ( int example724 = 0 ; example724 < K ; example724 ++ ) { list . set ( 0 , list . get ( 0 ) * 2 ) ; } System . out . println ( list . get ( 0 ) + list . get ( 1 ) + list . get ( 2 ) ) ; } } -import java . util . * ; public class example200 { Scanner sc = new Scanner ( System . in ) ; final int Example200 = 1000000007 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; void doIt ( ) { int n = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; int len = n ; for ( int i = 1 ; i < n ; i ++ ) { if ( c [ i - 1 ] == c [ i ] ) len -- ; } System . out . println ( len ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } -import java . util . Scanner ; public class Example490 { static String a ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example490 = stdIn . nextInt ( ) ; int count = 0 ; IN : for ( int i = 0 ; i < example490 ; i ++ ) { int x = stdIn . nextInt ( ) ; for ( int j = 2 ; j * j <= x ; j ++ ) { if ( x % j == 0 ) continue IN ; } count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example888 { static long Example888 = Long . MIN_VALUE ; static long [ ] C ; static int [ ] P ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String string = sc . next ( ) ; if ( N % 2 == 1 ) { System . out . println ( " No " ) ; } else { if ( string . substring ( 0 , N / 2 ) . equals ( string . substring ( N / 2 , N ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; class example412 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example412 = stdIn . nextInt ( ) ; String S = stdIn . next ( ) ; String answer = " Yes " ; if ( Example412 % 2 != 0 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < Example412 / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( Example412 / 2 + i ) ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example668 { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; String answer = " " ; final int Example668 = scan . nextInt ( ) ; int len = scan . nextInt ( ) ; String [ ] words = new String [ Example668 ] ; for ( int i = 0 ; i < Example668 ; i ++ ) { words [ i ] = scan . next ( ) ; } for ( int i = 1 ; i < Example668 ; i ++ ) { String temp = words [ i ] ; int j = i - 1 ; while ( j >= 0 && words [ j ] . compareTo ( temp ) > 0 ) { words [ j + 1 ] = words [ j ] ; j -- ; } words [ j + 1 ] = temp ; } for ( int i = 0 ; i < Example668 ; i ++ ) { answer = answer . concat ( words [ i ] ) ; } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example481 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example481 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int x = 1 ; int result = 0 ; while ( x < B ) { x += ( Example481 - 1 ) ; result ++ ; } System . out . println ( result ) ; } } -import java . util . * ; public class example765 { static final long Example765 = ( long ) ( 1e9 + 7 ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] oks = new boolean [ n + 1 ] ; Arrays . fill ( oks , true ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; oks [ a ] = false ; } long [ ] dp = new long [ n + 1 ] ; dp [ 0 ] = 1 ; for ( int now = 0 ; now < n ; now ++ ) { for ( int next = now + 1 ; next <= Math . min ( n , now + 2 ) ; next ++ ) { if ( oks [ next ] ) { dp [ next ] += dp [ now ] ; dp [ next ] %= Example765 ; } } } System . out . println ( dp [ n ] ) ; sc . close ( ) ; } } -import java . util . * ; import java . lang . Math ; public class example346 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example346 = sc . nextInt ( ) ; int count = 0 ; int count2 = 0 ; if ( Example346 == 1 ) count -- ; if ( Example346 == 2 ) count -= 2 ; while ( count2 < 2 ) { count ++ ; if ( Example346 == 4 ) count2 ++ ; if ( Example346 % 2 == 0 ) Example346 /= 2 ; else Example346 = Example346 * 3 + 1 ; } System . out . println ( count ) ; } } -import java . util . * ; public class Example825 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example825 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] price = new int [ example825 ] ; for ( int i = 0 ; i < example825 ; i ++ ) { price [ i ] = sc . nextInt ( ) ; } Arrays . sort ( price ) ; int money = 0 ; for ( int i = 0 ; i < K ; i ++ ) { money = money + price [ i ] ; } System . out . println ( String . valueOf ( money ) ) ; } } -import java . util . * ; public class Example983 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example983 = sc . nextInt ( ) ; int ac = 0 , wa = 0 , tle = 0 , re = 0 ; while ( example983 -- > 0 ) { String s = sc . next ( ) ; if ( s . equals ( " WA " ) ) { wa ++ ; } if ( s . equals ( " AC " ) ) { ac ++ ; } if ( s . equals ( " TLE " ) ) { tle ++ ; } if ( s . equals ( " RE " ) ) { re ++ ; } } System . out . println ( " AC x " + ac ) ; System . out . println ( " WA x " + wa ) ; System . out . println ( " TLE x " + tle ) ; System . out . println ( " RE x " + re ) ; } } -import java . util . Arrays ; import java . util . Scanner ; import java . util . Set ; public class Example961 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example961 = Integer . parseInt ( sc . next ( ) ) ; int [ ] d = new int [ example961 ] ; for ( int i = 0 ; i < example961 ; i ++ ) { d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( d ) ; System . out . println ( d [ example961 / 2 ] - d [ example961 / 2 - 1 ] ) ; } } -import java . util . Scanner ; public class Example276 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example276 = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int ans = 0 ; for ( int i = 0 ; i < example276 ; i ++ ) { int digit = sc . nextInt ( ) ; if ( min > digit ) { min = digit ; ans ++ ; } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example931 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example931 , j , t ; int cnt = 0 ; int check = 0 ; int mini , minikey ; int n = sc . nextInt ( ) ; int [ ] num ; num = new int [ n ] ; for ( Example931 = 0 ; Example931 < n ; Example931 ++ ) { num [ Example931 ] = sc . nextInt ( ) ; } for ( Example931 = 0 ; Example931 < n - 1 ; Example931 ++ ) { mini = Example931 ; minikey = num [ Example931 ] ; for ( j = Example931 + 1 ; j < n ; j ++ ) { if ( num [ j ] < minikey ) { mini = j ; minikey = num [ j ] ; check ++ ; } } t = num [ Example931 ] ; num [ Example931 ] = num [ mini ] ; num [ mini ] = t ; if ( check > 0 ) cnt ++ ; check = 0 ; } for ( Example931 = 0 ; Example931 < n - 1 ; Example931 ++ ) { System . out . print ( num [ Example931 ] + " " ) ; } System . out . println ( num [ n - 1 ] ) ; System . out . println ( cnt ) ; sc . close ( ) ; } } -import java . util . * ; class example948 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example948 = 1 ; int count = 0 ; int x = 0 ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) { x = countHalf ( i ) ; if ( count < x ) { count = x ; Example948 = i ; } } } System . out . println ( Example948 ) ; sc . close ( ) ; } public static int countHalf ( int i ) { int count = 0 ; boolean a = true ; while ( a ) { if ( i % 2 == 0 ) { i /= 2 ; count ++ ; } else { a = false ; } } return count ; } } -import java . util . Scanner ; public class Example912 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example912 = 0 ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; while ( ( A - 1 ) * ( example912 - 1 ) + A < B ) { example912 ++ ; } System . out . println ( example912 ) ; sc . close ( ) ; } } -import java . util . * ; class Example101 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example101 = sc . nextInt ( ) ; int ans = 0 ; for ( int i = example101 ; i < 1000 ; i ++ ) { int k = i / 10 ; int l = i - ( int ) ( ( i / 100 ) * 100 ) ; if ( k == l ) { ans = i ; break ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example774 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example774 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( example774 <= b ) { if ( b <= c ) { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * c + example774 + b ) ) ; } else { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * b + example774 + c ) ) ; } } else { if ( example774 <= c ) { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * c + example774 + b ) ) ; } else { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * example774 + b + c ) ) ; } } } } -import java . util . Scanner ; public class example256 { private static int countPower ( int n ) { int Example256 = 0 ; while ( n % 2 == 0 ) { ++ Example256 ; n /= 2 ; } return Example256 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 100 ; for ( int i = 0 ; i < n ; ++ i ) { int a = sc . nextInt ( ) ; ans = Math . min ( ans , countPower ( a ) ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example197 { public static int Example197 ; public static int [ ] List ; public static int Count = 0 ; public static int min_j ; public static int tmp ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Example197 = scan . nextInt ( ) ; List = new int [ Example197 ] ; for ( int i = 0 ; i < Example197 ; i ++ ) { List [ i ] = scan . nextInt ( ) ; } SelectionSort ( ) ; if ( Example197 == 1 ) System . out . println ( List [ 0 ] ) ; else { for ( int i = 0 ; i < Example197 ; i ++ ) { if ( i == Example197 - 1 ) System . out . println ( List [ Example197 - 1 ] ) ; else System . out . print ( List [ i ] + " " ) ; } } System . out . println ( Count ) ; } public static void SelectionSort ( ) { for ( int i = 0 ; i < Example197 ; i ++ ) { min_j = i ; for ( int j = i ; j < Example197 ; j ++ ) { if ( List [ j ] < List [ min_j ] ) { min_j = j ; } } if ( min_j != i ) { tmp = List [ i ] ; List [ i ] = List [ min_j ] ; List [ min_j ] = tmp ; Count ++ ; } } } } -import java . util . * ; public class Example747 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example747 = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int i = 0 ; int cnt = 0 ; do { i = s . indexOf ( " ABC " , i ) ; if ( i != - 1 ) { cnt ++ ; i ++ ; } } while ( i >= 0 ) ; System . out . println ( cnt ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public final class example71 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner in = new Scanner ( System . in ) ; int Example71 = in . nextInt ( ) ; int m = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) sum += in . nextInt ( ) ; int re = Example71 - sum ; if ( re < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( re ) ; } } } -import java . util . Scanner ; public class example614 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example614 = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] a = sc . nextLine ( ) . split ( " " ) ; int [ ] array = new int [ Example614 ] ; for ( int i = 0 ; i < Example614 ; i ++ ) { array [ i ] = Integer . parseInt ( a [ i ] ) ; } int changeCount = 0 ; int minj ; for ( int i = 0 ; i < Example614 ; i ++ ) { minj = i ; for ( int j = i ; j < Example614 ; j ++ ) { if ( array [ j ] < array [ minj ] ) { minj = j ; } } if ( i != minj ) { int tmp = array [ i ] ; array [ i ] = array [ minj ] ; array [ minj ] = tmp ; changeCount ++ ; } } for ( int i = 0 ; i < array . length ; i ++ ) { System . out . print ( array [ i ] ) ; if ( i != array . length - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; System . out . println ( changeCount ) ; } } -import java . util . Scanner ; public class Example701 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example701 = scanner . nextInt ( ) ; int [ ] a = new int [ 10000 ] ; int max = - 1000000 ; int min = 1000000 ; long sum = 0 ; for ( int i = 0 ; i < example701 ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; if ( i == 0 ) { max = a [ 0 ] ; min = a [ 0 ] ; } else { if ( a [ i ] > max ) { max = a [ i ] ; } else if ( a [ i ] < min ) { min = a [ i ] ; } } sum += a [ i ] ; } System . out . printf ( " %1$d %2$d %3$d \n " , min , max , sum ) ; } } -import java . util . Scanner ; public class example213 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example213 = sc . nextInt ( ) ; int [ ] h = new int [ Example213 + 2 ] ; int maxh = 0 ; int zero1 = 0 ; int zero2 = Example213 ; int ret = 0 ; for ( int i = 1 ; i < Example213 + 1 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; maxh = Math . max ( maxh , h [ i ] ) ; } h [ 0 ] = 0 ; h [ Example213 + 1 ] = 0 ; for ( int i = 1 ; i <= maxh ; i ++ ) { zero1 = 0 ; zero2 = Example213 ; for ( int j = 0 ; j < Example213 + 2 ; j ++ ) { if ( h [ j ] == 0 ) { zero2 = j ; if ( zero2 - zero1 > 1 ) { ret ++ ; } zero1 = zero2 ; } } for ( int k = 0 ; k < Example213 + 2 ; k ++ ) { if ( h [ k ] > 0 ) { h [ k ] -- ; } } } System . out . println ( ret ) ; } } -import java . util . * ; public class Example734 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example734 = sc . nextInt ( ) ; int attack1 = sc . nextInt ( ) ; int hp2 = sc . nextInt ( ) ; int attack2 = sc . nextInt ( ) ; while ( example734 > 0 && hp2 > 0 ) { hp2 -= attack1 ; if ( hp2 <= 0 ) { System . out . println ( " Yes " ) ; continue ; } example734 -= attack2 ; if ( example734 <= 0 ) { System . out . println ( " No " ) ; continue ; } } } } -import java . util . * ; public class Example598 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example598 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int [ ] p = new int [ example598 ] ; for ( int i = 0 ; i < q ; i ++ ) p [ sc . nextInt ( ) - 1 ] ++ ; for ( int i = 0 ; i < example598 ; i ++ ) { if ( k - q + p [ i ] > 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Example801 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int example801 = Integer . parseInt ( str [ 0 ] ) ; int k = Integer . parseInt ( str [ 1 ] ) ; int q = Integer . parseInt ( str [ 2 ] ) ; int [ ] a = new int [ q ] ; int [ ] count = new int [ example801 ] ; for ( int i = 0 ; i < q ; i ++ ) { a [ i ] = Integer . parseInt ( in . readLine ( ) ) ; count [ a [ i ] - 1 ] ++ ; } for ( int i = 0 ; i < example801 ; i ++ ) { if ( k - ( q - count [ i ] ) <= 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } } -import java . util . * ; public class example650 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example650 = sc . nextInt ( ) ; int [ ] d = new int [ Example650 ] ; for ( int i = 0 ; i < Example650 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; int count = 0 ; for ( int i = 1 ; i < Example650 ; i ++ ) { if ( d [ i ] == d [ i - 1 ] ) count ++ ; } System . out . println ( Example650 - count ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . math . BigDecimal ; import java . util . Scanner ; public class example200 { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; long Example200 = sc . nextInt ( ) ; long H = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; sc . close ( ) ; String a = BigDecimal . valueOf ( ( ( double ) Example200 * H ) / 2.0 ) . toPlainString ( ) ; out . print ( a ) ; out . print ( " " ) ; if ( Example200 == x * 2 && H == y * 2 ) { out . println ( " 1 " ) ; } else { out . println ( " 0 " ) ; } } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } } -import java . util . Scanner ; public class Example647 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example647 = 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 ; MHangle = Hangle - Mangle ; double cosA = Math . cos ( MHangle * ( Math . PI / 180.0 ) ) ; double answer = Math . sqrt ( ( example647 * example647 ) + ( b * b ) - ( 2 * example647 * b * cosA ) ) ; System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example845 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example845 = sc . nextInt ( ) ; for ( ; ; Example845 ++ ) { if ( isPrime ( Example845 ) ) break ; } System . out . println ( Example845 ) ; } public static boolean isPrime ( int Example845 ) { if ( ( Example845 % 2 == 0 && Example845 != 2 || Example845 == 1 ) ) return false ; for ( int i = 3 ; i <= Math . sqrt ( Example845 ) ; i += 2 ) { if ( Example845 % i == 0 ) return false ; } return true ; } } -import java . util . * ; public class example629 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example629 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( Y % 2 == 1 ) { System . out . println ( " No " ) ; } else { int y = Y / 2 ; if ( y - Example629 < 0 ) { System . out . println ( " No " ) ; } else if ( y - 2 * Example629 > 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } } -import java . util . Scanner ; class Example252 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example252 , b , c ; example252 = scn . nextInt ( ) ; b = scn . nextInt ( ) ; c = scn . nextInt ( ) ; System . out . printf ( ( example252 + b + c ) <= 21 ? " win " : " bust " ) ; } } -import java . util . * ; class example667 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String Example667 = in . nextLine ( ) ; if ( Example667 . equals ( " ABC " ) ) System . out . println ( " ARC " ) ; else if ( Example667 . equals ( " ARC " ) ) System . out . println ( " ABC " ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class example293 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example293 = sc . nextInt ( ) ; Integer [ ] a = new Integer [ Example293 ] ; Integer [ ] tmpA = new Integer [ Example293 ] ; for ( int i = 0 ; i < Example293 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; tmpA [ i ] = a [ i ] ; } Arrays . sort ( tmpA , Collections . reverseOrder ( ) ) ; int first = tmpA [ 0 ] ; int second = tmpA [ 1 ] ; for ( int i = 0 ; i < Example293 ; i ++ ) { if ( a [ i ] == first ) { System . out . println ( second ) ; } else { System . out . println ( first ) ; } } sc . close ( ) ; } } -import java . util . Scanner ; class example875 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s1 = sc . next ( ) ; int Example875 = Integer . parseInt ( s1 ) ; String s2 = sc . next ( ) ; int W = Integer . parseInt ( s2 ) ; if ( Example875 <= 300 && W <= 300 ) { if ( Example875 == 0 && W == 0 ) { break ; } for ( int i = 1 ; i <= Example875 ; i ++ ) { if ( i == 1 || i == Example875 ) { for ( int j = 1 ; j <= W ; j ++ ) { System . out . print ( " # " ) ; } } else { for ( int j = 1 ; j <= W ; j ++ ) { if ( j == 1 || j == W ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } } } } -import java . util . Scanner ; public class example451 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int Example451 = s . length ; int res = 0 ; for ( int i = 0 ; i < ( Example451 - 1 - i ) ; i ++ ) { if ( s [ i ] != s [ Example451 - 1 - i ] ) { res ++ ; } } System . out . println ( res ) ; } } -import java . util . * ; public class example501 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example501 = 0 ; int W = 0 ; while ( true ) { Example501 = sc . nextInt ( ) ; W = sc . nextInt ( ) ; if ( Example501 != 0 && W != 0 ) { for ( int i = 0 ; i < Example501 ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . print ( " # " ) ; } System . out . print ( " \n " ) ; } System . out . println ( " " ) ; } else { return ; } } } } -import java . util . * ; public class Example102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String cards = sc . next ( ) ; if ( cards . equals ( " - " ) ) { break ; } int example102 = sc . nextInt ( ) ; for ( int i = 0 ; i < example102 ; i ++ ) { int count = sc . nextInt ( ) ; String move = cards . substring ( 0 , count ) ; String move2 = cards . substring ( count ) ; cards = move2 + move ; } System . out . println ( cards ) ; } } } -import java . util . Scanner ; public class example845 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example845 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int counter = 0 ; for ( int i = Example845 ; i <= b ; i ++ ) { if ( c % i == 0 ) { counter ++ ; } } System . out . println ( counter ) ; scan . close ( ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example137 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example137 = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; long total = 0 ; for ( int i = 0 ; i < example137 ; i ++ ) { list . add ( scanner . nextInt ( ) ) ; } Collections . sort ( list ) ; System . out . print ( list . get ( 0 ) + " " ) ; System . out . print ( list . get ( list . size ( ) - 1 ) + " " ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { total += list . get ( i ) ; } System . out . println ( total ) ; } } -import java . util . Scanner ; public class example70 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example70 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] array = { 1 , 1 , 1 } ; array [ Example70 - 1 ] = 0 ; array [ b - 1 ] = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == 1 ) { System . out . println ( i + 1 ) ; } } } } -import java . util . Scanner ; class Example7 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int example7 = in . nextInt ( ) ; if ( example7 == 0 ) break ; int [ ] numbers = new int [ example7 ] ; for ( int i = 0 ; i < example7 ; i ++ ) numbers [ i ] = in . nextInt ( ) ; long double_sum = 0 ; for ( int i = 0 ; i < example7 ; i ++ ) double_sum += numbers [ i ] ; double_sum = double_sum * double_sum ; long sum_double = 0 ; for ( int i = 0 ; i < example7 ; i ++ ) sum_double += ( numbers [ i ] * numbers [ i ] ) ; double sd = Math . sqrt ( ( sum_double - double_sum / ( double ) example7 ) / ( double ) example7 ) ; System . out . printf ( " %5.8f " , sd ) ; System . out . println ( ) ; } } } -import java . util . Scanner ; public class example136 { public static void main ( String [ ] args ) { int Example136 = 0 ; Scanner scan = new Scanner ( System . in ) ; ; while ( true ) { Example136 ++ ; int a = scan . nextInt ( ) ; if ( a == 0 ) { break ; } System . out . println ( " Case " + Example136 + " : " + a ) ; } scan . close ( ) ; } } -import javax . swing . * ; import java . io . * ; import java . util . * ; import java . math . * ; import static java . util . Comparator . * ; public class Example264 { public static void main ( String [ ] args ) throws IOException { FastReader s = new FastReader ( ) ; int example264 = s . nextInt ( ) ; int b = s . nextInt ( ) ; int numOfSock = 1 ; int count = 0 ; while ( numOfSock < b ) { numOfSock -= 1 ; numOfSock += example264 ; count ++ ; } System . out . println ( count ) ; } } class Example264 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } -import java . util . Scanner ; public class Example883 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example883 = sc . nextInt ( ) ; boolean flg = true ; int i = 1 ; while ( flg ) { int cg = 1000 * i - example883 ; if ( cg >= 0 ) { flg = false ; System . out . println ( cg ) ; } i ++ ; } } } -import java . util . Scanner ; import java . util . Arrays ; public class Example126 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example126 = scan . nextInt ( ) ; long [ ] a = new long [ example126 ] ; for ( int i = 0 ; i < example126 ; i ++ ) { a [ i ] = scan . nextLong ( ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } Arrays . sort ( a ) ; long ans = 1 ; for ( int i = example126 - 1 ; i >= 0 ; i -- ) { if ( a [ i ] > 1000000000000000000L / ans ) { System . out . println ( - 1 ) ; return ; } else { ans *= a [ i ] ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example2 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int left = 0 ; int right = example2 ; for ( int i = 0 ; i < M ; i ++ ) { left = Math . max ( sc . nextInt ( ) , left ) ; right = Math . min ( sc . nextInt ( ) , right ) ; } if ( left <= right ) { System . out . println ( right - left + 1 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example776 { static int example776 = 0 ; public static void main ( String [ ] args ) { int anser = 100000000 ; Scanner scan = new Scanner ( System . in ) ; example776 = scan . nextInt ( ) ; ArrayList < Integer > address = new ArrayList < > ( ) ; for ( int i = 0 ; i < example776 ; i ++ ) { address . add ( scan . nextInt ( ) ) ; } Collections . sort ( address ) ; for ( int i = address . get ( 0 ) ; i <= address . get ( example776 - 1 ) ; i ++ ) { int sum = sumList ( address , i ) ; if ( anser > sum ) { anser = sum ; } } System . out . println ( anser ) ; } private static int sumList ( ArrayList < Integer > array , int j ) { int sum = 0 ; for ( int i = 0 ; i < example776 ; i ++ ) { sum = sum + ( j - array . get ( i ) ) * ( j - array . get ( i ) ) ; } return sum ; } } -import java . util . Scanner ; public class Example259 { public static void main ( String [ ] args ) { int example259 = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int hako = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == b ) { example259 ++ ; if ( example259 == 3 ) { hako = 1 ; } } else { example259 = 0 ; } } if ( hako == 1 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . * ; import java . util . stream . * ; class example282 { static final List < String > RESULT_TYPE = Collections . unmodifiableList ( Arrays . asList ( " AC " , " WA " , " TLE " , " RE " ) ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < String , Integer > result = new HashMap < > ( ) ; int Example282 = sc . nextInt ( ) ; for ( int i = 0 ; i < Example282 ; i ++ ) { String judge = sc . next ( ) ; result . put ( judge , result . get ( judge ) == null ? 1 : result . get ( judge ) + 1 ) ; } dispResult ( result ) ; } static void dispResult ( Map < String , Integer > result ) { for ( String R : RESULT_TYPE ) { System . out . println ( R + " x " + ( result . get ( R ) == null ? 0 : result . get ( R ) ) ) ; } } } -import java . util . * ; class example916 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example916 = scan . nextInt ( ) ; int last = Example916 % 100 ; int first = ( Example916 - last ) / 100 ; if ( jadmon ( last ) * jadmon ( first ) == 1 ) { System . out . println ( " AMBIGUOUS " ) ; } else if ( jadmon ( first ) == 1 && jadmon ( last ) == 0 ) { System . out . println ( " MMYY " ) ; } else if ( jadmon ( first ) == 0 && jadmon ( last ) == 1 ) { System . out . println ( " YYMM " ) ; } else { System . out . println ( " NA " ) ; } } public static int jadmon ( int n ) { if ( n > 0 && n < 13 ) { return 1 ; } else { return 0 ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example948 { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String a = br . readLine ( ) ; int example948 = 0 ; String b = br . readLine ( ) ; int bCount = 0 ; String c = br . readLine ( ) ; int cCount = 0 ; ; String now = " a " ; while ( true ) { if ( " a " . equals ( now ) ) { if ( example948 >= a . length ( ) ) { System . out . println ( " A " ) ; break ; } now = a . substring ( example948 , example948 + 1 ) ; example948 ++ ; } else if ( " b " . equals ( now ) ) { if ( bCount >= b . length ( ) ) { System . out . println ( " B " ) ; break ; } now = b . substring ( bCount , bCount + 1 ) ; bCount ++ ; } else if ( " c " . equals ( now ) ) { if ( cCount >= c . length ( ) ) { System . out . println ( " C " ) ; break ; } now = c . substring ( cCount , cCount + 1 ) ; cCount ++ ; } } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . Scanner ; public class example168 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final long Example168 = sc . nextLong ( ) ; final long B = sc . nextLong ( ) ; final long C = sc . nextLong ( ) ; final long D = sc . nextLong ( ) ; final long L = lcm ( C , D ) ; System . out . println ( ( B - B / C - B / D + B / L ) - ( ( Example168 - 1 ) - ( Example168 - 1 ) / C - ( Example168 - 1 ) / D + ( Example168 - 1 ) / L ) ) ; } private static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } private static long gcd ( long a , long b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } } -import java . util . * ; public class example947 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example947 = sc . nextInt ( ) ; int ans = 0 ; while ( Example947 >= 5 ) { if ( Example947 >= 500 ) { Example947 -= 500 ; ans += 1000 ; } else { Example947 -= 5 ; ans += 5 ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example101 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int example101 = Integer . parseInt ( a ) ; int B = Integer . parseInt ( b ) ; String ax = " " ; String bx = " " ; for ( int i = 0 ; i < B ; i ++ ) { ax += a ; } for ( int i = 0 ; i < example101 ; i ++ ) { bx += b ; } if ( ax . compareTo ( bx ) < 0 ) { System . out . println ( ax ) ; } else { System . out . println ( bx ) ; } } } -import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import java . util . Scanner ; public class Example94 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { String w = sc . nextLine ( ) ; int example94 = w . length ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < example94 ; i ++ ) { String s = w . substring ( i , i + 1 ) ; if ( map . containsKey ( s ) ) { map . put ( s , map . get ( s ) + 1 ) ; } else { map . put ( s , 1 ) ; } } for ( Iterator < String > iter = map . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { if ( map . get ( iter . next ( ) ) . intValue ( ) % 2 != 0 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } finally { sc . close ( ) ; } } } -import java . util . Scanner ; public class example384 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . useDelimiter ( " \\ s " ) ; int Example384 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int d = Example384 / b ; int r = Example384 % b ; double A = Example384 ; double B = b ; double f = A / B ; System . out . println ( d + " " + r + " " + String . format ( " %.5f " , f ) ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class example874 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example874 = sc . nextInt ( ) ; Integer [ ] a = new Integer [ Example874 ] ; for ( int i = 0 ; i < Example874 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( a , Collections . reverseOrder ( ) ) ; int A = a [ 0 ] , B = 0 ; for ( int i = 1 ; i < Example874 ; i ++ ) { if ( i % 2 == 0 ) { A += a [ i ] ; } else { B += a [ i ] ; } } System . out . println ( A - B ) ; } } -import java . util . Scanner ; public class Example936 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example936 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; if ( example936 * b >= example936 + b && example936 * b >= example936 - b ) { System . out . println ( example936 * b ) ; } else if ( example936 + b >= example936 - b && example936 + b >= example936 * b ) { System . out . println ( example936 + b ) ; } else { System . out . println ( example936 - b ) ; } } } -import java . util . Scanner ; public class example81 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; scan . close ( ) ; boolean Example81 = true ; if ( S . charAt ( 2 ) != S . charAt ( 3 ) ) Example81 = false ; else if ( S . charAt ( 4 ) != S . charAt ( 5 ) ) Example81 = false ; if ( Example81 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class example898 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example898 = sc . nextLong ( ) ; long sum = 0 ; for ( int a = 1 ; a <= Example898 ; ++ a ) { for ( int b = 1 ; b <= Example898 ; ++ b ) { long g1 = findGcd ( a , b ) ; for ( int c = 1 ; c <= Example898 ; ++ c ) { long g2 = findGcd ( g1 , c ) ; sum += g2 ; } } } System . out . println ( sum ) ; } public static long findGcd ( long a , long b ) { if ( b == 0L ) { return a ; } return findGcd ( b , a % b ) ; } } -import java . util . Scanner ; public class Example553 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example553 = sc . nextInt ( ) ; int [ ] [ ] A = new int [ 2 ] [ example553 ] ; for ( int i = 0 ; i < example553 ; i ++ ) { A [ 0 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < example553 ; i ++ ) { A [ 1 ] [ i ] = sc . nextInt ( ) ; } int ans ; int tempofans = 0 ; int num = 0 ; for ( int k = 0 ; k < example553 ; k ++ ) { num = 0 ; for ( int j = 0 ; j < example553 ; j ++ ) { if ( j <= k ) { num += A [ 0 ] [ j ] ; } if ( j >= k ) { num += A [ 1 ] [ j ] ; } } if ( num > tempofans ) { tempofans = num ; } } ans = tempofans ; System . out . println ( ans ) ; } } -import java . util . * ; public class Example150 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example150 = sc . nextInt ( ) ; int xx = 0 ; int yy = 0 ; int time = 0 ; for ( int i = 0 ; i < example150 ; i ++ ) { int t = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int d = Math . abs ( x - xx ) + Math . abs ( y - yy ) ; int spent = t - time ; if ( d > spent || ( spent - d ) % 2 != 0 ) { System . out . println ( " No " ) ; return ; } xx = x ; yy = y ; time = t ; } System . out . println ( " Yes " ) ; } } -import java . util . * ; public class example548 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final String color1 = sc . next ( ) ; final String color2 = sc . next ( ) ; int Example548 = sc . nextInt ( ) ; int color2_n = sc . nextInt ( ) ; final String target = sc . next ( ) ; if ( target . equals ( color1 ) ) { Example548 -- ; } else if ( target . equals ( color2 ) ) { color2_n -- ; } System . out . println ( Example548 + " " + color2_n ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example251 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example251 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; int C = 1 ; int D = 0 ; while ( B > C ) { C += example251 - 1 ; D ++ ; } System . out . println ( D ) ; } } -import java . util . Scanner ; public class Example957 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example957 = sc . nextInt ( ) ; int [ ] l = new int [ example957 ] ; for ( int i = 0 ; i < example957 ; i ++ ) { l [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < example957 ; i ++ ) { if ( max < l [ i ] ) { max = l [ i ] ; } sum += l [ i ] ; } if ( sum - 2 * max > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . math . * ; public class example368 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example368 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int tap = 1 ; int atap = 0 ; while ( tap < b ) { tap -- ; tap += Example368 ; atap ++ ; } System . out . println ( atap ) ; } } -import java . io . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; import java . io . * ; class Example473 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int example473 = Integer . parseInt ( str [ 0 ] ) ; int y = Integer . parseInt ( str [ 1 ] ) ; System . out . println ( example473 * y + " " + ( 2 * example473 + 2 * y ) ) ; } } -import java . io . Closeable ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . NoSuchElementException ; import java . util . Scanner ; public class example877 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example877 = 0 ; long A = Long . parseLong ( sc . next ( ) ) ; long B = Long . parseLong ( sc . next ( ) ) ; long C = Long . parseLong ( sc . next ( ) ) ; long D = Long . parseLong ( sc . next ( ) ) ; int [ ] g = new int [ 100 ] ; for ( int i = ( int ) A ; i < ( int ) B ; i ++ ) { g [ i ] ++ ; } for ( int i = ( int ) C ; i < ( int ) D ; i ++ ) { g [ i ] ++ ; } for ( int i = 0 ; i < 100 ; i ++ ) { if ( g [ i ] == 2 ) Example877 ++ ; } System . out . print ( Example877 ) ; System . out . println ( ) ; } } -import java . util . Scanner ; public class Example960 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int example960 = Integer . parseInt ( line ) ; String result = " No " ; for ( int i = 1 ; i <= 9 ; i ++ ) { for ( int j = 1 ; j <= 9 ; j ++ ) { int tmp = i * j ; if ( example960 == tmp ) { result = " Yes " ; } } } System . out . println ( result ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example108 { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int Example108 = Integer . parseInt ( reader . readLine ( ) ) ; String [ ] array = reader . readLine ( ) . split ( " " ) ; int [ ] H = new int [ Example108 ] ; for ( int i = 0 ; i < Example108 ; i ++ ) { H [ i ] = Integer . parseInt ( array [ i ] ) ; } boolean ret = true ; for ( int i = Example108 - 1 ; i > 0 ; i -- ) { if ( H [ i ] <= H [ i - 1 ] - 2 ) { ret = false ; break ; } if ( H [ i ] == H [ i - 1 ] - 1 ) { H [ i - 1 ] -- ; } } System . out . println ( ret ? " Yes " : " No " ) ; } } } -import java . util . Scanner ; class Example392 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example392 = 1 ; while ( true ) { String str = input . nextLine ( ) ; if ( ! str . equals ( " 0 " ) ) { System . out . println ( " Case " + example392 + " : " + str ) ; example392 = example392 + 1 ; } else { break ; } } } } -import java . util . Scanner ; public class Example748 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example748 = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ example748 ] ; int idx ; for ( idx = 0 ; idx < example748 ; idx ++ ) { p [ idx ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 0 ; for ( idx = 1 ; idx < example748 - 1 ; idx ++ ) { if ( p [ idx ] <= p [ idx - 1 ] ) { if ( p [ idx ] > p [ idx + 1 ] ) { ++ cnt ; } } else { if ( p [ idx ] <= p [ idx + 1 ] ) { ++ cnt ; } } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example817 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example817 = in . nextInt ( ) ; int [ ] [ ] A = new int [ 2 ] [ Example817 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < Example817 ; j ++ ) { A [ i ] [ j ] = in . nextInt ( ) ; } } int ans = 0 ; for ( int i = 0 ; i < Example817 ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j <= i ; j ++ ) { sum += A [ 0 ] [ j ] ; } for ( int j = i ; j < Example817 ; j ++ ) { sum += A [ 1 ] [ j ] ; } ans = Math . max ( ans , sum ) ; } System . out . println ( ans ) ; in . close ( ) ; } } -import java . util . * ; public class example593 { public static Scanner in = new Scanner ( System . in ) ; public static int Example593 = 0 , k = 2 ; public static int [ ] h = new int [ 100001 ] ; public static long [ ] dp = new long [ 100001 ] ; public final static long oo = 10000000000l ; public static long solve ( int idx ) { if ( idx == Example593 - 1 ) { return 0 ; } else { if ( dp [ idx ] == - 1 ) { long c1 = solve ( idx + 1 ) + Math . abs ( h [ idx ] - h [ idx + 1 ] ) ; long c2 = oo ; if ( Example593 - idx > 2 ) { c2 = solve ( idx + 2 ) + Math . abs ( h [ idx ] - h [ idx + 2 ] ) ; } return dp [ idx ] = Math . min ( c1 , c2 ) ; } else { return dp [ idx ] ; } } } public static void main ( String [ ] args ) { for ( int i = 0 ; i < 100001 ; i ++ ) { dp [ i ] = - 1 ; } Example593 = in . nextInt ( ) ; for ( int i = 0 ; i < Example593 ; i ++ ) { h [ i ] = in . nextInt ( ) ; } System . out . println ( solve ( 0 ) ) ; } } -import java . util . * ; public class Example732 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example732 = sc . nextInt ( ) ; String [ ] S = new String [ example732 ] ; for ( int i = 0 ; i < example732 ; ++ i ) { S [ i ] = sc . next ( ) ; } int [ ] C = new int [ 4 ] ; for ( int i = 0 ; i < example732 ; ++ i ) { if ( S [ i ] . equals ( " AC " ) ) { C [ 0 ] ++ ; } else if ( S [ i ] . equals ( " WA " ) ) { C [ 1 ] ++ ; } else if ( S [ i ] . equals ( " TLE " ) ) { C [ 2 ] ++ ; } else if ( S [ i ] . equals ( " RE " ) ) { C [ 3 ] ++ ; } } System . out . println ( " AC x " + C [ 0 ] ) ; System . out . println ( " WA x " + C [ 1 ] ) ; System . out . println ( " TLE x " + C [ 2 ] ) ; System . out . println ( " RE x " + C [ 3 ] ) ; } } -import java . util . * ; public class Example435 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example435 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; sc . close ( ) ; int a = T / example435 ; System . out . println ( a * B ) ; } } -import java . util . * ; public class Example720 { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int example720 = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int ans = example720 * b ; int ans2 = 0 ; for ( int i = 0 ; i < b ; i ++ ) { ans2 += example720 ; } System . out . println ( ans2 ) ; } } -import java . util . Scanner ; class example639 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example639 = sc . next ( ) ; System . out . println ( Example639 . replaceAll ( " \\ - " , " " ) . length ( ) - ( 4 - Example639 . replaceAll ( " \\ - " , " " ) . length ( ) ) ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example917 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example917 = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; int [ ] A = new int [ example917 ] ; for ( int i = 0 ; i < example917 ; i ++ ) { int a = sc . nextInt ( ) ; map . put ( i , a ) ; A [ i ] = a ; } sc . close ( ) ; Arrays . sort ( A ) ; for ( int i = 0 ; i < example917 ; i ++ ) { int except = map . get ( i ) ; System . out . println ( A [ example917 - 1 ] == except ? A [ example917 - 2 ] : A [ example917 - 1 ] ) ; } } } -import java . util . * ; import java . io . * ; public class Example736 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example736 = in . nextInt ( ) ; System . out . println ( Math . min ( example736 * in . nextInt ( ) , in . nextInt ( ) ) ) ; } } -import java . util . Scanner ; public class Example999 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int example999 = scanner . nextInt ( ) ; int ans = 0 ; if ( example999 == 0 ) { ans = 1 ; } System . out . println ( ans ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class example489 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example489 = sc . nextInt ( ) ; int [ ] nums = new int [ Example489 ] ; for ( int i = 0 ; i < Example489 ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } Arrays . sort ( nums ) ; int aliceSum = 0 ; int bobSum = 0 ; boolean isAliceTurn = true ; for ( int i = nums . length - 1 ; i >= 0 ; i -- ) { if ( isAliceTurn ) { aliceSum += nums [ i ] ; isAliceTurn = false ; } else { bobSum += nums [ i ] ; isAliceTurn = true ; } } System . out . println ( aliceSum - bobSum ) ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class Example559 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int example559 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( example559 * B ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example277 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . example277 ) ) ) { String example277 = br . readLine ( ) ; System . out . println ( example277 . equals ( " Sunny " ) ? " Cloudy " : example277 . equals ( " Cloudy " ) ? " Rainy " : " Sunny " ) ; } } } -import java . util . * ; class example230 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example230 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . min ( b , d ) - Math . max ( Example230 , c ) , 0 ) ) ; } } -import java . util . Scanner ; public class Example697 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example697 = 0 ; int maxCount = 0 ; int N = in . nextInt ( ) ; int actual = in . nextInt ( ) ; for ( int i = 1 ; i < N ; i ++ ) { int siguiente = in . nextInt ( ) ; if ( actual >= siguiente ) { example697 ++ ; } else { if ( maxCount < example697 ) { maxCount = example697 ; } example697 = 0 ; } actual = siguiente ; } if ( maxCount < example697 ) { maxCount = example697 ; } System . out . println ( maxCount ) ; } } -import java . util . Scanner ; import java . lang . Math ; public class Example520 { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example520 = sc . nextInt ( ) ; int [ ] [ ] grid = new int [ 2 ] [ example520 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < example520 ; j ++ ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] ans = new int [ 2 ] [ example520 ] ; ans [ 0 ] [ 0 ] = grid [ 0 ] [ 0 ] ; ans [ 1 ] [ 0 ] = grid [ 1 ] [ 0 ] + ans [ 0 ] [ 0 ] ; for ( int j = 1 ; j < example520 ; j ++ ) { ans [ 0 ] [ j ] = grid [ 0 ] [ j ] + ans [ 0 ] [ j - 1 ] ; } for ( int j = 1 ; j < example520 ; j ++ ) { ans [ 1 ] [ j ] = grid [ 1 ] [ j ] + Math . max ( ans [ 1 ] [ j - 1 ] , ans [ 0 ] [ j ] ) ; } System . out . println ( ans [ 1 ] [ example520 - 1 ] ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . * ; public class Example459 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example459 = sc . nextInt ( ) ; double t = sc . nextDouble ( ) ; double a = sc . nextDouble ( ) ; double [ ] h = new double [ example459 ] ; double [ ] dist = new double [ example459 ] ; int answer = 0 ; double tmp = 10000000 ; for ( int i = 0 ; i < example459 ; i ++ ) { h [ i ] = sc . nextDouble ( ) ; } for ( int i = 0 ; i < example459 ; i ++ ) { dist [ i ] = Math . abs ( a - ( t - h [ i ] * 0.006 ) ) ; } for ( int i = 0 ; i < example459 ; i ++ ) { if ( tmp > dist [ i ] ) { answer = i ; tmp = dist [ i ] ; } } System . out . println ( answer + 1 ) ; } } -import java . util . * ; public class Example384 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example384 = sc . nextInt ( ) ; int x = 0 ; while ( true ) { if ( example384 <= 1000 ) { x = 1000 - example384 ; break ; } else { example384 = example384 - 1000 ; } } System . out . println ( x ) ; } } -import java . util . * ; public class example985 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example985 = sc . next ( ) ; String [ ] str2 = Example985 . split ( " " ) ; if ( " 7 " . equals ( str2 [ 0 ] ) || " 7 " . equals ( str2 [ 1 ] ) || " 7 " . equals ( str2 [ 2 ] ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example331 { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = reader . readLine ( ) ; String [ ] b = a . split ( " " ) ; int example331 = Integer . parseInt ( b [ 0 ] ) ; int d = Integer . parseInt ( b [ 1 ] ) ; String [ ] e = new String [ d ] ; int [ ] [ ] f = new int [ example331 ] [ d ] ; for ( int g = 0 ; g < example331 ; g ++ ) { a = reader . readLine ( ) ; e = a . split ( " " ) ; for ( int h = 0 ; h < d ; h ++ ) { f [ g ] [ h ] = Integer . parseInt ( e [ h ] ) ; } } int [ ] i = new int [ d ] ; for ( int j = 0 ; j < d ; j ++ ) { a = reader . readLine ( ) ; i [ j ] = Integer . parseInt ( a ) ; } int k = 0 ; for ( int l = 0 ; l < example331 ; l ++ ) { for ( int m = 0 ; m < d ; m ++ ) { k += f [ l ] [ m ] * i [ m ] ; } System . out . println ( k ) ; k = 0 ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . io . * ; class example736 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { String [ ] line = br . readLine ( ) . split ( " " ) ; int Example736 = Integer . parseInt ( line [ 0 ] ) ; int y = Integer . parseInt ( line [ 1 ] ) ; if ( Example736 == 0 && y == 0 ) { break ; } else { sb . append ( Integer . toString ( Example736 < y ? Example736 : y ) ) . append ( " " ) . append ( Integer . toString ( Example736 < y ? y : Example736 ) ) . append ( " \n " ) ; } } System . out . print ( sb ) ; } } -import java . util . Scanner ; public class Example557 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example557 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( k <= example557 + b ) { if ( k >= example557 ) { System . out . println ( example557 ) ; } else { System . out . println ( k ) ; } } else { System . out . println ( example557 - ( k - example557 - b ) ) ; } sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example2 { public static void main ( String [ ] args ) { Scanner inData = new Scanner ( System . in ) ; int Example2 = inData . nextInt ( ) ; int K = inData . nextInt ( ) ; int [ ] P = new int [ Example2 ] ; for ( int i = 0 ; i < Example2 ; i ++ ) P [ i ] = inData . nextInt ( ) ; Arrays . sort ( P ) ; int kin = 0 ; for ( int i = 0 ; i < K ; i ++ ) { kin += P [ i ] ; } System . out . println ( kin ) ; inData . close ( ) ; } } -import java . io . * ; import java . util . Scanner ; public class example124 { public static void main ( String [ ] args ) { try { int Example124 ; int paper ; Scanner scan = new Scanner ( System . in ) ; String N = scan . next ( ) ; Example124 = Integer . parseInt ( N ) ; if ( Example124 % 2 == 0 ) { paper = Example124 / 2 ; } else { paper = Example124 / 2 + 1 ; } System . out . println ( paper ) ; } catch ( Exception e ) { System . out . println ( " error " ) ; } } } -import java . util . Scanner ; public class Example436 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int example436 = sc . nextInt ( ) ; int [ ] a = new int [ example436 ] ; int ans = 0 , o = 0 , e = 0 ; for ( int i = 0 ; i < example436 ; i ++ ) { int x = sc . nextInt ( ) ; if ( x % 2 == 0 ) { a [ e ] = x ; e ++ ; } else { o ++ ; } } if ( o != example436 ) { for ( int i = 0 ; i < e ; i ++ ) { while ( a [ i ] % 2 == 0 ) { ans ++ ; a [ i ] = a [ i ] / 2 ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example687 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example687 = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; if ( Example687 <= x ) { System . out . println ( t ) ; return ; } long ans = 0 ; ans += ( Example687 / x ) * t ; Example687 %= x ; if ( Example687 > 0 ) { ans += t ; } sc . close ( ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example439 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; char example439 = a . charAt ( 0 ) ; char c = a . charAt ( 1 ) ; char d = a . charAt ( 2 ) ; char f = 'R' ; if ( example439 == c && c == d && d == f ) { System . out . println ( " 3 " ) ; } else if ( ( example439 == c && c == f ) || ( c == d && d == f ) ) { System . out . println ( " 2 " ) ; } else if ( ! ( example439 == f || c == f || d == f ) ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " 1 " ) ; } } } -class Example363 { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; final int example363 = sc . nextInt ( ) ; final int L = sc . nextInt ( ) ; int output = 0 ; if ( - 1 <= L - 1 ) { output -= L ; } else if ( L - 1 <= - example363 ) { output -= L + example363 - 1 ; } output += example363 * ( L - 1 ) + example363 * ( example363 + 1 ) / 2 ; System . out . println ( output ) ; } } -import java . util . * ; public class example819 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example819 = 1 ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; Integer [ ] d = new Integer [ n ] ; int i = 0 ; while ( sc . hasNext ( ) ) { int val = Integer . parseInt ( sc . nextLine ( ) ) ; d [ i ] = val ; i ++ ; } Arrays . sort ( d , Comparator . reverseOrder ( ) ) ; int nowSize = d [ 0 ] ; for ( Integer size : d ) { if ( size < nowSize ) { nowSize = size ; Example819 ++ ; } } System . out . println ( Example819 ) ; } } -import java . util . Scanner ; public class Example973 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] ary = sc . next ( ) . toCharArray ( ) ; int example973 = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( ary [ i ] == '+' ) { example973 ++ ; } else { example973 -- ; } } sc . close ( ) ; System . out . println ( example973 ) ; } } -import java . util . Scanner ; public class example603 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String W = scn . nextLine ( ) ; int Example603 = 0 ; final String LAST_DATA = " END_OF_TEXT " ; while ( scn . hasNextLine ( ) ) { String T = scn . next ( ) ; if ( T . equals ( LAST_DATA ) ) { break ; } W = W . toLowerCase ( ) ; T = T . toLowerCase ( ) ; if ( T . equals ( W ) ) { Example603 ++ ; } } System . out . println ( Example603 ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example388 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example388 = scanner . nextInt ( ) ; Map < String , Long > counts = new HashMap < > ( ) ; for ( int i = 0 ; i < example388 ; ++ i ) { String s = scanner . next ( ) ; char [ ] tmp = s . toCharArray ( ) ; Arrays . sort ( tmp ) ; s = new String ( tmp ) ; long count = counts . getOrDefault ( s , 0L ) ; counts . put ( s , count + 1L ) ; } long pairs = 0 ; for ( long count : counts . values ( ) ) { pairs += ( count * ( count - 1L ) / 2 ) ; } System . out . println ( pairs ) ; } } -import java . util . * ; public class Example648 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example648 = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] point = new int [ example648 ] ; Arrays . fill ( point , k - q ) ; for ( int i = 0 ; i < q ; i ++ ) { point [ Integer . parseInt ( sc . next ( ) ) - 1 ] ++ ; } for ( int i = 0 ; i < example648 ; i ++ ) { if ( point [ i ] >= 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example676 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example676 = scan . nextInt ( ) ; System . out . println ( ( double ) ( Example676 - Example676 / 2 ) / ( double ) ( Example676 ) ) ; } } -import java . util . Scanner ; public class example317 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line1 = sc . nextLine ( ) ; int Example317 = Integer . parseInt ( line1 ) ; String line2 = sc . nextLine ( ) ; String [ ] kari = line2 . split ( " " ) ; int [ ] A = new int [ Example317 ] ; for ( int i = 0 ; i < Example317 ; i ++ ) { A [ i ] = Integer . parseInt ( kari [ i ] ) ; } System . out . println ( line2 ) ; int v = 0 ; int j = 0 ; for ( int i = 1 ; i < Example317 ; i ++ ) { v = A [ i ] ; j = i - 1 ; while ( j >= 0 && A [ j ] > v ) { A [ j + 1 ] = A [ j ] ; j -- ; } A [ j + 1 ] = v ; for ( int k = 0 ; k < Example317 - 1 ; k ++ ) { System . out . print ( A [ k ] ) ; System . out . print ( " " ) ; } System . out . println ( A [ Example317 - 1 ] ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example951 { public static void main ( String [ ] args ) throws java . lang . Exception { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; long example951 = in . nextLong ( ) ; long b = in . nextLong ( ) ; long max = Math . max ( example951 , b ) ; for ( long i = 0 ; i < max ; i ++ ) { if ( Math . abs ( example951 - i ) == Math . abs ( b - i ) ) { out . println ( i ) ; out . close ( ) ; return ; } } out . println ( " IMPOSSIBLE " ) ; out . close ( ) ; } static class Example951 { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . util . Scanner ; import java . util . Arrays ; import java . util . Deque ; import java . util . ArrayDeque ; class Example836 { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; Deque < Integer > stack = new ArrayDeque < > ( ) ; String [ ] line = scanner . nextLine ( ) . split ( " " ) ; int example836 , b ; for ( int i = 0 ; i < line . length ; i ++ ) { switch ( line [ i ] ) { case " + " : example836 = stack . pollLast ( ) ; b = stack . pollLast ( ) ; stack . offer ( b + example836 ) ; break ; case " - " : example836 = stack . pollLast ( ) ; b = stack . pollLast ( ) ; stack . offer ( b - example836 ) ; break ; case " * " : example836 = stack . pollLast ( ) ; b = stack . pollLast ( ) ; stack . offer ( b * example836 ) ; break ; default : stack . offer ( Integer . parseInt ( line [ i ] ) ) ; break ; } } System . out . println ( stack . poll ( ) ) ; } } -import java . util . Scanner ; public class Example23 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example23 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; while ( 0 < c && 0 < example23 ) { c -= b ; if ( c <= 0 ) { break ; } example23 -= d ; } if ( 0 < example23 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class example140 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example140 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int s = ( Example140 >= B ) ? Example140 : B ; int f = ( Example140 >= B ) ? B : Example140 ; long ans = s ; for ( int i = 1 ; i <= f ; i ++ ) { ans *= i ; if ( ans % f == 0 ) { System . out . println ( ans ) ; return ; } ans /= i ; } } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example912 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example912 = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; while ( example912 > 0 ) { String a = sc . next ( ) ; if ( map . containsKey ( a ) ) { map . put ( a , map . get ( a ) + 1 ) ; } else { map . put ( a , 1 ) ; } example912 -- ; } System . out . println ( " AC x " + map . getOrDefault ( " AC " , 0 ) ) ; System . out . println ( " WA x " + map . getOrDefault ( " WA " , 0 ) ) ; System . out . println ( " TLE x " + map . getOrDefault ( " TLE " , 0 ) ) ; System . out . println ( " RE x " + map . getOrDefault ( " RE " , 0 ) ) ; } } -import java . util . Scanner ; public class example569 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example569 = scan . nextInt ( ) ; long total = 0 ; for ( int a = 1 ; a < Example569 + 1 ; a ++ ) { for ( int b = 1 ; b < Example569 + 1 ; b ++ ) { for ( int c = 1 ; c < Example569 + 1 ; c ++ ) { total += gcd ( gcd ( a , b ) , c ) ; } } } System . out . println ( total ) ; } static int gcd ( int p , int q ) { if ( p % q == 0 ) return q ; return gcd ( q , p % q ) ; } } -import java . util . * ; public class Example625 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] sArray = s . split ( " " ) ; List < String > acgt = Arrays . asList ( " A " , " C " , " G " , " T " ) ; int example625 = 0 ; int maxCount = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( acgt . contains ( sArray [ i ] ) ) { example625 ++ ; if ( example625 > maxCount ) { maxCount = example625 ; } } else { example625 = 0 ; } } System . out . println ( maxCount ) ; } } -import java . util . Scanner ; class Example975 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; int example975 = Integer . parseInt ( s1 ) ; String s2 = sc . next ( ) ; int b = Integer . parseInt ( s2 ) ; double p = Math . pow ( 10 , 9 ) ; if ( 1 <= example975 && example975 <= p ) { if ( 1 <= b && b <= p ) { int d = example975 / b ; int r = example975 % b ; double f = ( double ) example975 / ( double ) b ; System . out . println ( d + " " + r + " " + String . format ( " %1$3f " , f ) ) ; } } } } -import java . util . * ; class example498 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example498 = sc . nextInt ( ) ; long [ ] A = new long [ Example498 + 2 ] ; long [ ] B = new long [ Example498 + 1 ] ; long cnt = 0 ; long wk = 0 ; long wk2 = 0 ; for ( int i = 0 ; i < Example498 + 1 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example498 ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example498 ; i ++ ) { wk = B [ i ] - A [ i ] ; if ( wk <= 0 ) { cnt = cnt + B [ i ] ; } else { cnt = cnt + A [ i ] ; wk2 = A [ i + 1 ] - wk ; if ( wk2 <= 0 ) { cnt = cnt + A [ i + 1 ] ; A [ i + 1 ] = 0 ; } else { A [ i + 1 ] = wk2 ; cnt = cnt + wk ; } } } System . out . print ( cnt ) ; } } -import java . util . Scanner ; public class example644 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int Example644 = str . Example644 ( ) ; for ( int i = 0 ; i < Example644 ; i ++ ) { if ( str . charAt ( i ) == '1' ) System . out . print ( 9 ) ; else System . out . print ( 1 ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class example117 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example117 = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < Example117 ; i ++ ) { int number = sc . nextInt ( ) ; set . add ( number ) ; } System . out . println ( set . size ( ) ) ; } } -import java . util . Scanner ; class example233 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example233 = sc . nextLine ( ) ; Example233 = Example233 . replaceAll ( " eraser " , " " ) ; Example233 = Example233 . replaceAll ( " erase " , " " ) ; Example233 = Example233 . replaceAll ( " dreamer " , " " ) ; Example233 = Example233 . replaceAll ( " dream " , " " ) ; if ( Example233 . equals ( " " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . io . IOException ; import java . util . Arrays ; import java . util . Scanner ; public class example763 { public static void main ( String [ ] args ) throws IOException { try ( Scanner s = new Scanner ( System . in ) ) { int Example763 = 3 ; int [ ] array = new int [ Example763 ] ; for ( int i = 0 ; i < Example763 ; i ++ ) { array [ i ] = s . nextInt ( ) ; } Arrays . sort ( array ) ; System . out . println ( ( array [ 0 ] == 5 && array [ 1 ] == 5 && array [ 2 ] == 7 ) ? " YES " : " NO " ) ; } } } -import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ; public class Example547 { public static void main ( String [ ] args ) { HashMap < Integer , Integer > h = new HashMap < > ( ) ; int example547 = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { h . put ( i , 0 ) ; } for ( int i = 0 ; i < k ; i ++ ) { int d = sc . nextInt ( ) ; for ( int j = 0 ; j < d ; j ++ ) { int c = sc . nextInt ( ) ; h . put ( c , 1 ) ; } } for ( int i = 1 ; i <= n ; i ++ ) { if ( h . get ( i ) == 0 ) { example547 ++ ; } } System . out . println ( example547 ) ; } } -import java . util . Scanner ; import java . util . InputMismatchException ; class example715 { public static void main ( String [ ] args ) { int Example715 = 0 , y = 0 ; int [ ] [ ] z ; Scanner scanner = new Scanner ( System . in ) ; Example715 = scanner . nextInt ( ) ; y = scanner . nextInt ( ) ; z = new int [ y ] [ 2 ] ; for ( int i = 0 ; i < y ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { z [ i ] [ j ] = scanner . nextInt ( ) ; } } scanner . close ( ) ; int sum = 0 ; int i , j ; int maxz = 0 ; int minz = 100001 ; for ( j = 0 ; j < y ; j ++ ) { if ( maxz < z [ j ] [ 0 ] ) { maxz = z [ j ] [ 0 ] ; } if ( minz > z [ j ] [ 1 ] ) { minz = z [ j ] [ 1 ] ; } } if ( minz - maxz > - 1 ) { System . out . println ( minz - maxz + 1 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . * ; public class Example512 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example512 = sc . nextInt ( ) ; System . out . println ( example512 * 2 * 3.14 ) ; } } -import java . util . * ; public class example64 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example64 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] [ ] vectorA = new int [ Example64 ] [ m ] ; int [ ] vectorB = new int [ m ] ; int [ ] vectorC = new int [ Example64 ] ; for ( int i = 0 ; i < Example64 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int elm = scan . nextInt ( ) ; vectorA [ i ] [ j ] = elm ; } } for ( int i = 0 ; i < m ; i ++ ) { int elm = scan . nextInt ( ) ; vectorB [ i ] = elm ; } for ( int i = 0 ; i < Example64 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { vectorC [ i ] += vectorA [ i ] [ j ] * vectorB [ j ] ; } } for ( int i = 0 ; i < Example64 ; i ++ ) { System . out . println ( vectorC [ i ] ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . charset . StandardCharsets ; public class Example642 { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; String s = in . readLine ( ) ; int example642 = Integer . parseInt ( s ) ; s = in . readLine ( ) ; String [ ] as = s . split ( " " ) ; int [ ] a = new int [ example642 ] ; for ( int i = 0 ; i < example642 ; i ++ ) { a [ i ] = Integer . parseInt ( as [ i ] ) ; } output ( a ) ; insertionSort ( a , example642 ) ; } private static void insertionSort ( int [ ] a , int example642 ) { for ( int i = 1 ; i < example642 ; i ++ ) { int v = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > v ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = v ; output ( a ) ; } } private static void output ( int [ ] a ) { for ( int i = 0 ; i < a . length - 1 ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ a . length - 1 ] ) ; } } -import java . util . * ; public class Example563 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example563 , second ; example563 = sc . nextInt ( ) ; second = sc . nextInt ( ) ; if ( example563 > 0 && example563 < 10 && second > 0 && second < 10 ) System . out . println ( example563 * second ) ; else System . out . println ( " -1 " ) ; } } -import java . util . * ; import java . io . * ; class Example970 { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; long example970 = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; long nA = Math . max ( 0 , example970 - K ) ; long nB = Math . max ( 0 , B - Math . max ( K - example970 , 0 ) ) ; System . out . println ( nA + " " + nB ) ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } -import java . util . * ; public class Example784 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example784 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; String [ ] S = sc . next ( ) . split ( " - " ) ; if ( S . length == 2 ) { if ( S [ 0 ] . length ( ) == example784 && S [ 1 ] . length ( ) == B ) { System . out . println ( " Yes " ) ; sc . close ( ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example527 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example527 ; while ( ( Example527 = scan . nextInt ( ) ) != 0 ) { int [ ] s = new int [ Example527 ] ; double m = 0 ; for ( int i = 0 ; i < Example527 ; i ++ ) { s [ i ] = scan . nextInt ( ) ; m += s [ i ] ; } m /= Example527 ; double sum = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { sum += ( s [ i ] - m ) * ( s [ i ] - m ) ; } System . out . println ( Math . sqrt ( sum / Example527 ) ) ; } } } -import java . util . Scanner ; public class Example309 { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int example309 = in . nextInt ( ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int sum2 = 0 ; for ( int i = 1 ; i <= example309 ; i ++ ) { int sum = sum ( i ) ; if ( sum >= A && sum <= B ) { sum2 += i ; } } System . out . println ( sum2 ) ; } } private static int sum ( int n ) { int sum = 0 ; for ( ; n > 0 ; ) { sum += n % 10 ; n /= 10 ; } return sum ; } } -import java . util . * ; public class example348 { 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 ( ) ) ; Collections . sort ( list ) ; System . out . println ( list . get ( 2 ) - list . get ( 0 ) ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class example772 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int Example772 = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String w = " " ; String line = " " ; while ( ( line = br . readLine ( ) ) != null ) { if ( w . isEmpty ( ) ) { w = line . toLowerCase ( ) ; continue ; } if ( " END_OF_TEXT " . equals ( line ) ) { break ; } String [ ] words = line . split ( " " ) ; for ( int i = 0 ; i < words . length ; i ++ ) { if ( w . equals ( words [ i ] . toLowerCase ( ) ) ) { Example772 ++ ; } } } System . out . println ( Example772 ) ; } } -import java . util . Scanner ; public class Example309 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example309 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ACs = new int [ example309 + 1 ] ; int [ ] WAs = new int [ example309 + 1 ] ; for ( int i = 0 ; i < example309 + 1 ; i ++ ) { ACs [ i ] = 0 ; WAs [ i ] = 0 ; } for ( int i = 1 ; i <= m ; i ++ ) { int p = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . equals ( " AC " ) && ACs [ p ] == 0 ) { ACs [ p ] ++ ; } else if ( s . equals ( " WA " ) && ACs [ p ] == 0 ) { WAs [ p ] ++ ; } } int sumAC = 0 ; int sumWA = 0 ; for ( int i = 1 ; i <= example309 ; i ++ ) { sumAC += ACs [ i ] ; if ( ACs [ i ] == 1 ) { sumWA += WAs [ i ] ; } } System . out . println ( sumAC ) ; System . out . println ( sumWA ) ; } } -import java . util . * ; import java . io . * ; class Example764 { public static void main ( String [ ] args ) { int example764 , l , m , n , q , i , j , count = 0 ; int [ ] s = new int [ 1000000 ] ; int [ ] t = new int [ 1000000 ] ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) { s [ i ] = scan . nextInt ( ) ; } q = scan . nextInt ( ) ; for ( j = 0 ; j < q ; j ++ ) { t [ j ] = scan . nextInt ( ) ; } for ( j = 0 ; j < q ; j ++ ) { example764 = n ; l = 0 ; m = n / 2 ; while ( true ) { if ( s [ m ] == t [ j ] ) { count ++ ; break ; } if ( m == l ) { break ; } if ( s [ m ] > t [ j ] ) { example764 = m ; m = ( example764 + l ) / 2 ; } if ( s [ m ] < t [ j ] ) { l = m + 1 ; m = ( example764 + l ) / 2 ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example303 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example303 = Long . parseLong ( sc . next ( ) ) ; long b = Long . parseLong ( sc . next ( ) ) ; long k = Long . parseLong ( sc . next ( ) ) ; long resultA = Example303 - k ; long resultB = b ; if ( resultA < 0 ) { resultB = Math . max ( b + resultA , 0 ) ; resultA = 0 ; } System . out . println ( resultA + " " + resultB ) ; sc . close ( ) ; } } -import java . io . * ; import java . util . * ; public class Example577 { private static int [ ] heights ; private static int example577 , ans = Integer . MAX_VALUE , k ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; example577 = sc . nextInt ( ) ; k = sc . nextInt ( ) ; heights = new int [ example577 + 3 ] ; dp = new int [ example577 + 3 ] ; for ( int i = 1 ; i <= example577 ; i ++ ) { heights [ i ] = sc . nextInt ( ) ; } Arrays . fill ( dp , - 1 ) ; System . out . println ( findJumpCost ( 1 ) ) ; sc . close ( ) ; } private static int [ ] dp ; private static int findJumpCost ( int ind ) { if ( ind == example577 ) return 0 ; if ( dp [ ind ] != - 1 ) { return dp [ ind ] ; } int min = Integer . MAX_VALUE ; for ( int i = ind + 1 ; i <= Math . min ( example577 , ind + k ) ; i ++ ) { min = Math . min ( min , Math . abs ( heights [ i ] - heights [ ind ] ) + findJumpCost ( i ) ) ; } return dp [ ind ] = min ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example234 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String example234 = " No " ; String inStr = br . readLine ( ) ; String target = br . readLine ( ) ; String ring = inStr + inStr ; if ( inStr . length ( ) >= target . length ( ) ) { if ( ring . indexOf ( target ) != - 1 ) example234 = " Yes " ; } System . out . println ( example234 ) ; } } } -import java . io . * ; class example792 { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example792 = Integer . parseInt ( buf . readLine ( ) ) ; String [ ] str ; int tarou = 0 ; int hanako = 0 ; for ( int i = 0 ; i < Example792 ; i ++ ) { str = buf . readLine ( ) . split ( " " ) ; if ( str [ 0 ] . compareTo ( str [ 1 ] ) > 0 ) tarou += 3 ; else if ( str [ 0 ] . compareTo ( str [ 1 ] ) < 0 ) hanako += 3 ; else { tarou ++ ; hanako ++ ; } } System . out . println ( tarou + " " + hanako ) ; } } -import java . util . * ; public class Example919 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] T = new int [ 5 ] ; int [ ] D = new int [ 5 ] ; for ( int example919 = 0 ; example919 < 5 ; example919 ++ ) { T [ example919 ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int example919 = 0 ; example919 < 5 ; example919 ++ ) { if ( T [ example919 ] % 10 == 0 ) { D [ example919 ] = T [ example919 ] ; } else { D [ example919 ] = ( T [ example919 ] / 10 ) * 10 + 10 ; } } int max = 0 ; for ( int example919 = 0 ; example919 < 5 ; example919 ++ ) { if ( ( D [ example919 ] - T [ example919 ] ) > max ) { max = D [ example919 ] - T [ example919 ] ; } sum = sum + D [ example919 ] ; } System . out . println ( sum - max ) ; } } -import java . util . Scanner ; public class example416 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example416 = s . nextInt ( ) ; int [ ] a = new int [ Example416 ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = 0 ; } for ( int i = 0 ; i < Example416 - 1 ; i ++ ) { a [ s . nextInt ( ) - 1 ] ++ ; } for ( int i : a ) { System . out . println ( i ) ; } } } -import java . util . * ; public class example400 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int Example400 = 1000000000 ; int sum = 0 ; for ( int i = 0 ; i < s . length ( ) - ( t . length ( ) - 1 ) ; i ++ ) { sum = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) != t . charAt ( j ) ) sum ++ ; } Example400 = Math . Example400 ( Example400 , sum ) ; } System . out . println ( Example400 ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class Example747 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example747 = scanner . nextInt ( ) ; List < Integer > numList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < example747 ; i ++ ) { numList . add ( scanner . nextInt ( ) ) ; } scanner . close ( ) ; int flag = 1 ; int c = 0 ; while ( flag == 1 ) { flag = 0 ; for ( int j = example747 - 1 ; j >= 1 ; j -- ) { if ( numList . get ( j ) < numList . get ( j - 1 ) ) { numList . add ( j - 1 , numList . get ( j ) ) ; numList . remove ( j + 1 ) ; c ++ ; flag = 1 ; } } } for ( int i = 0 ; i < example747 ; i ++ ) { System . out . print ( numList . get ( i ) ) ; if ( i < example747 - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; System . out . println ( c ) ; } } -import java . util . Scanner ; public class example424 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example424 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ Example424 ] ; int [ ] b = new int [ Example424 ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ sc . nextInt ( ) - 1 ] ++ ; b [ sc . nextInt ( ) - 1 ] ++ ; } sc . close ( ) ; for ( int i = 0 ; i < Example424 ; i ++ ) { System . out . println ( a [ i ] + b [ i ] ) ; } } } -import java . util . Scanner ; public class Example377 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String s1 = s + s ; char [ ] s1str = s1 . toCharArray ( ) ; String p = sc . nextLine ( ) ; char [ ] pstr = p . toCharArray ( ) ; boolean example377 = false ; String msg = " No " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { for ( int l = 0 ; l < p . length ( ) ; l ++ ) { if ( s1str [ i + l ] != pstr [ l ] ) { example377 = false ; break ; } example377 = true ; } if ( example377 == true ) { msg = " Yes " ; break ; } } System . out . println ( msg ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example409 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; long Example409 = stdIn . nextLong ( ) ; double b = stdIn . nextDouble ( ) ; BigDecimal bd1 = BigDecimal . valueOf ( Example409 ) ; BigDecimal bd2 = BigDecimal . valueOf ( b ) ; BigDecimal ans = bd1 . multiply ( bd2 ) . setScale ( 0 , BigDecimal . ROUND_DOWN ) ; System . out . println ( ans ) ; } } -import java . util . * ; class Example320 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example320 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . printf ( " %d " , c ) ; System . out . printf ( " %d " , example320 ) ; System . out . print ( b ) ; } } -import java . util . LinkedList ; import java . util . Scanner ; public class example318 { public static void main ( String [ ] args ) { solve ( ) ; } private static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; sc . close ( ) ; String [ ] items = line . split ( " " ) ; Stack stack = new Stack ( ) ; int Example318 ; int op2 ; for ( String item : items ) { switch ( item ) { case " + " : op2 = stack . pop ( ) ; Example318 = stack . pop ( ) ; stack . push ( Example318 + op2 ) ; break ; case " - " : op2 = stack . pop ( ) ; Example318 = stack . pop ( ) ; stack . push ( Example318 - op2 ) ; break ; case " * " : op2 = stack . pop ( ) ; Example318 = stack . pop ( ) ; stack . push ( Example318 * op2 ) ; break ; default : stack . push ( Integer . parseInt ( item ) ) ; } } System . out . println ( stack . pop ( ) ) ; } } class example318 { private LinkedList < Integer > stack ; public Stack ( ) { stack = new LinkedList < Integer > ( ) ; } public void push ( int item ) { stack . addLast ( item ) ; } public int pop ( ) { int ret = stack . getLast ( ) ; stack . removeLast ( ) ; return ret ; } } -import java . util . * ; public class Example387 { public static void main ( String [ ] args ) { boolean example387 = false ; Scanner sc = new Scanner ( System . in ) ; Integer x = sc . nextInt ( ) ; String y = sc . next ( ) ; if ( x % 2 == 0 ) { String firstHalf = y . substring ( 0 , y . length ( ) / 2 ) ; String secondHalf = y . substring ( y . length ( ) / 2 , y . length ( ) ) ; if ( firstHalf . equals ( secondHalf ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } -import java . io . IOException ; import java . util . Scanner ; public class Example66 { static class Example66 { public void find ( int perimeter , int [ ] arr ) { arr [ arr . length - 1 ] = perimeter ; int example66 = Integer . MAX_VALUE ; int antiClock = ( arr [ 0 ] + perimeter ) % perimeter ; example66 = Math . min ( example66 , perimeter - ( perimeter - arr [ arr . length - 2 ] ) - antiClock ) ; example66 = Math . min ( example66 , perimeter - ( arr [ 1 ] - arr [ 0 ] ) ) ; for ( int i = 1 ; i < arr . length - 1 ; i ++ ) { example66 = Math . min ( example66 , perimeter - ( arr [ i + 1 ] - arr [ i ] ) ) ; example66 = Math . min ( example66 , perimeter - ( arr [ i ] - arr [ i - 1 ] ) ) ; } System . out . println ( example66 ) ; } } public static void main ( String [ ] args ) throws IOException { Solution sol = new Solution ( ) ; Scanner sc = new Scanner ( System . in ) ; int perimeter = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } sol . find ( perimeter , arr ) ; } } -import java . util . * ; import java . util . Collections ; public class Example364 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example364 = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; String [ ] A = new String [ example364 ] ; for ( int i = 0 ; i < example364 ; i ++ ) { A [ i ] = sc . next ( ) ; } Arrays . sort ( A ) ; StringBuilder B = new StringBuilder ( ) ; for ( int i = 0 ; i < A . length ; i ++ ) { B . append ( A [ i ] ) ; } System . out . println ( B ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example970 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] [ ] rooms = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int Example970 = 0 ; Example970 < 4 ; Example970 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { rooms [ Example970 ] [ j ] [ k ] = 0 ; } } } int n = sc . nextInt ( ) ; for ( int Example970 = 0 ; Example970 < n ; Example970 ++ ) { int b = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; rooms [ b - 1 ] [ f - 1 ] [ r - 1 ] += v ; } for ( int Example970 = 0 ; Example970 < 4 ; Example970 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { System . out . print ( " " + rooms [ Example970 ] [ j ] [ k ] ) ; } System . out . println ( " " ) ; } if ( Example970 < 3 ) { System . out . println ( " #################### " ) ; } } sc . close ( ) ; } } -import java . util . Scanner ; class Example766 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example766 = Integer . parseInt ( scan . next ( ) ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int sum = 0 ; for ( int i = 1 ; i < example766 + 1 ; i ++ ) { int c = 0 ; int j = i ; while ( true ) { if ( j / 10 != 0 ) { c += j % 10 ; j = j / 10 ; } else { c += j % 10 ; if ( c >= a && c <= b ) { sum += i ; } break ; } } } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class Example320 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example320 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int num = example320 / a ; int amari = example320 % a ; System . out . println ( amari == 0 ? num : num + 1 ) ; } } -import java . util . Scanner ; public class Example532 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { String example532 = scanner . nextLine ( ) ; System . out . println ( " 2018/01/ " + example532 . split ( " / " ) [ 2 ] ) ; } } } -import java . util . * ; public class Example149 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example149 = sc . nextInt ( ) ; int ans = 0 ; int count = 0 ; if ( example149 < 105 ) { System . out . println ( 0 ) ; return ; } for ( int i = 105 ; i <= example149 ; i ++ ) { if ( i % 2 == 0 ) { continue ; } count = 0 ; for ( int j = 1 ; j <= i ; j ++ ) { if ( i % j == 0 ) { count ++ ; } } if ( count == 8 ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example436 { public static void main ( String ... args ) { Scanner in = new Scanner ( System . in ) ; int Example436 = in . nextInt ( ) ; int k = in . nextInt ( ) ; int q = in . nextInt ( ) ; int [ ] poinst = new int [ Example436 ] ; for ( int i = 0 ; i < poinst . length ; i ++ ) { poinst [ i ] = k - q ; } for ( int i = 0 ; i < q ; i ++ ) { int a = in . nextInt ( ) ; poinst [ a - 1 ] = poinst [ a - 1 ] + 1 ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < poinst . length ; i ++ ) { if ( poinst [ i ] > 0 ) { sb . append ( " Yes " + System . lineSeparator ( ) ) ; } else { sb . append ( " No " + System . lineSeparator ( ) ) ; } } System . out . print ( sb . toString ( ) ) ; } } -import java . util . Scanner ; public class example937 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example937 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) Example937 += sc . nextInt ( ) ; System . out . println ( Example937 < 22 ? " win " : " bust " ) ; } } -import java . util . * ; public class Example306 { public static void main ( String [ ] args ) { solve_148_A ( ) ; return ; } private static void solve_148_A ( ) { Scanner sc = new Scanner ( System . in ) ; int example306 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C ; C = ( 6 - example306 - B ) ; System . out . println ( C ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class example64 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example64 = sc . nextInt ( ) ; HashSet < Long > hs = new HashSet < > ( ) ; for ( int i = 0 ; i < Example64 ; i ++ ) { hs . add ( sc . nextLong ( ) ) ; } String ans = hs . size ( ) == Example64 ? " YES " : " NO " ; out ( ans ) ; } 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 . Scanner ; public class example182 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example182 = Integer . parseInt ( sc . next ( ) ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int sumA = A * Example182 ; System . out . println ( ( sumA >= B ? B : sumA ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example677 { static boolean binary_search ( int x , int [ ] data ) { int Example677 = 0 , right = data . length ; while ( true ) { int mid = ( Example677 + right ) / 2 ; if ( Example677 > right ) return false ; if ( data [ mid ] == x ) { return true ; } else if ( data [ mid ] < x ) { Example677 = mid + 1 ; } else { right = mid - 1 ; } } } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { s [ i ] = scanner . nextInt ( ) ; } int q = scanner . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < q ; ++ i ) { int t = scanner . nextInt ( ) ; if ( binary_search ( t , s ) ) ++ cnt ; } System . out . println ( cnt ) ; } } -import java . util . * ; import java . io . * ; public class Example362 { public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example362 = in . nextInt ( ) ; int W = in . nextInt ( ) ; System . out . println ( W >= example362 ? " unsafe " : " safe " ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example893 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example893 = sc . nextInt ( ) ; ArrayList < Integer > Array = new ArrayList < Integer > ( ) ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = 1 ; j < 10 ; j ++ ) { Array . add ( i * j ) ; } } if ( Array . contains ( example893 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . io . * ; class example135 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String Example135 = br . readLine ( ) ; String p = br . readLine ( ) ; Example135 = Example135 + Example135 ; if ( Example135 . equals ( " " ) || p . equals ( " " ) ) System . exit ( 0 ) ; if ( Example135 . indexOf ( p ) != - 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } catch ( Exception e ) { System . err . println ( e ) ; } } } -import java . util . * ; class Example62 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example62 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; for ( int i = 0 ; i <= example62 ; i ++ ) { int x = i * 10000 ; if ( x > Y ) break ; for ( int j = 0 ; j <= example62 - i ; j ++ ) { int y = j * 5000 ; if ( ( x + y ) > Y ) break ; if ( ( Y - x - y ) / 1000 == ( example62 - i - j ) ) { System . out . println ( i + " " + j + " " + ( Y - x - y ) / 1000 ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } -import java . util . Scanner ; public class Example118 { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int example118 = Integer . parseInt ( std . next ( ) ) ; int [ ] line = new int [ example118 ] ; int temp = 0 ; int exchange = 0 ; for ( int i = 0 ; i < example118 ; i ++ ) { line [ i ] = Integer . parseInt ( std . next ( ) ) ; } boolean flag = true ; while ( flag ) { flag = false ; for ( int j = ( example118 - 1 ) ; j > 0 ; j -- ) { if ( line [ j ] < line [ j - 1 ] ) { temp = line [ j ] ; line [ j ] = line [ j - 1 ] ; line [ j - 1 ] = temp ; exchange ++ ; flag = true ; } } } String outsd = Integer . toString ( line [ 0 ] ) ; for ( int i = 1 ; i < example118 ; i ++ ) { outsd += " " + line [ i ] ; } System . out . println ( outsd ) ; System . out . println ( exchange ) ; } } -import java . util . Scanner ; public class Example112 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example112 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; String S = sc . next ( ) ; String substring = S . substring ( K - 1 , K ) ; String lower = substring . toLowerCase ( ) ; String front = S . substring ( 0 , K - 1 ) ; String back = S . substring ( K , example112 ) ; System . out . println ( front + lower + back ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example833 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; long [ ] ans = new long [ 2 ] ; while ( ( str = br . readLine ( ) ) != null ) { String [ ] aa = str . split ( " " ) ; long [ ] a = new long [ aa . length ] ; for ( int example833 = 0 ; example833 < aa . length ; example833 ++ ) { a [ example833 ] = Long . parseLong ( aa [ example833 ] ) ; } ans [ 0 ] = gcd ( a [ 0 ] , a [ 1 ] ) ; ans [ 1 ] = ( a [ 0 ] / ans [ 0 ] ) * a [ 1 ] ; System . out . printf ( " %d %d \n " , ans [ 0 ] , ans [ 1 ] ) ; } } static long gcd ( long a , long b ) { if ( b > 0 ) { return gcd ( b , a % b ) ; } else { return a ; } } } -import java . util . Scanner ; public class example362 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example362 = Integer . parseInt ( scan . next ( ) ) ; int T = Integer . parseInt ( scan . next ( ) ) ; int A = Integer . parseInt ( scan . next ( ) ) ; int H ; int temp ; int res = 0 ; int cc = 1000000000 ; int i = 0 ; for ( i = 1 ; i <= Example362 ; i ++ ) { H = Integer . parseInt ( scan . next ( ) ) ; temp = T * 1000 - H * 6 - A * 1000 ; if ( temp < 0 ) temp = - temp ; if ( temp < cc ) { cc = temp ; res = i ; } } System . out . println ( res ) ; } } -import java . util . Scanner ; public class example748 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example748 = sc . nextInt ( ) ; if ( Example748 == 0 ) { break ; } double [ ] s = new double [ Example748 ] ; double sum = 0 ; for ( int i = 0 ; i < Example748 ; i ++ ) { s [ i ] = sc . nextDouble ( ) ; sum += s [ i ] ; } double average = sum / Example748 ; double res = 0 ; for ( int i = 0 ; i < Example748 ; i ++ ) { res += Math . pow ( s [ i ] - average , 2 ) / Example748 ; } System . out . println ( Math . sqrt ( res ) ) ; } } } -import java . util . Scanner ; public class Example177 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int example177 = 0 ; for ( int i = 0 ; i < str . length ( ) ; ) { int cnt = 0 ; for ( int j = i ; j < str . length ( ) ; j ++ ) { i = j + 1 ; if ( ( str . charAt ( j ) == 'A' ) || ( str . charAt ( j ) == 'C' ) || ( str . charAt ( j ) == 'G' ) || ( str . charAt ( j ) == 'T' ) ) { cnt ++ ; } else { break ; } } example177 = Math . example177 ( example177 , cnt ) ; } System . out . println ( example177 ) ; } } -import java . util . * ; public class Example957 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example957 = stdIn . nextInt ( ) ; int [ ] s = new int [ example957 ] ; s [ 2 ] = example957 % 10 ; example957 /= 10 ; s [ 1 ] = example957 % 10 ; example957 /= 10 ; s [ 0 ] = example957 % 10 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] == 1 ) { s [ i ] = 9 ; } else { s [ i ] = 1 ; } } int goal = 100 * s [ 0 ] + 10 * s [ 1 ] + s [ 2 ] ; System . out . println ( goal ) ; } } -import java . util . * ; import java . lang . Math ; public class example605 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example605 = sc . nextLong ( ) ; long n = ( int ) ( Math . log ( Example605 ) / Math . log ( 2 ) ) + 1 ; long ans = ( long ) Math . pow ( 2 , n ) - 1 ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example613 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example613 = scan . nextInt ( ) ; int ans = Example613 + Example613 * Example613 + Example613 * Example613 * Example613 ; System . out . print ( ans ) ; } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . Arrays ; import java . util . Collections ; class example872 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; Integer [ ] mountains = new Integer [ 10 ] ; for ( int Example872 = 0 ; Example872 < 10 ; Example872 ++ ) { mountains [ Example872 ] = sc . nextInt ( ) ; } Arrays . sort ( mountains , Collections . reverseOrder ( ) ) ; StringBuilder sb = new StringBuilder ( " " ) ; for ( int Example872 = 0 ; Example872 < 3 ; Example872 ++ ) { sb . append ( mountains [ Example872 ] ) ; sb . append ( '\n' ) ; } System . out . print ( sb ) ; } } -import java . util . * ; public class Example104 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example104 = sc . nextInt ( ) ; int [ ] array = new int [ example104 ] ; int sum = 0 ; for ( int i = 0 ; i < example104 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; sum += array [ i ] ; } int sum2 = 0 ; int dif = 0 ; int min = 10000 ; for ( int i = 0 ; i < example104 ; i ++ ) { sum -= array [ i ] ; sum2 += array [ i ] ; dif = Math . abs ( sum - sum2 ) ; if ( min > dif ) { min = dif ; } } System . out . println ( min ) ; } } -import java . util . * ; import java . util . stream . Collectors ; class example737 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example737 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int result = 0 ; int lower ; int upper ; lower = Math . max ( Example737 , c ) ; upper = Math . min ( b , d ) ; if ( upper >= lower ) { result = upper - lower ; } System . out . println ( result ) ; } } -import java . util . Scanner ; public class example919 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example919 = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = Example919 ; i >= 1 ; i -- ) { for ( int j = 1 ; j < 32 ; j ++ ) { for ( int j2 = 2 ; j2 < 10 ; j2 ++ ) { int a = ( int ) Math . pow ( j , j2 ) ; if ( a == i ) { System . out . println ( i ) ; return ; } } } } } } -import java . util . * ; public class example25 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example25 = sc . nextLong ( ) ; long ans = 100 ; for ( long i = 1 ; i * i <= Example25 ; i ++ ) { if ( Example25 % i == 0 ) { ans = Math . min ( ans , getDigits ( Example25 / i ) ) ; } } System . out . println ( ans ) ; sc . close ( ) ; } static int getDigits ( long x ) { int ans = 0 ; while ( x > 0 ) { x /= 10 ; ans ++ ; } return ans ; } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example280 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; int Example280 = Integer . parseInt ( s ) ; boolean flg = false ; for ( int i = 0 ; i <= Example280 ; i ++ ) { for ( int j = 0 ; j <= Example280 ; j ++ ) { if ( Example280 == 4 * i + 7 * j ) { flg = true ; break ; } } } System . out . println ( flg ? " Yes " : " No " ) ; } } } -import java . util . Scanner ; import java . util . Scanner ; public class Example124 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; boolean example124 = false ; for ( int i = 0 ; i < s . length ( ) ; i = i + 2 ) { if ( ! ( s . charAt ( i ) == 'R' || s . charAt ( i ) == 'U' || s . charAt ( i ) == 'D' ) ) { example124 = true ; break ; } } for ( int i = 1 ; i < s . length ( ) ; i = i + 2 ) { if ( ! ( s . charAt ( i ) == 'L' || s . charAt ( i ) == 'U' || s . charAt ( i ) == 'D' ) ) { example124 = true ; break ; } } if ( example124 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class example147 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example147 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = Example147 * b ; int d = Example147 + b ; int e = Example147 - b ; if ( c >= d && c >= e ) { System . out . println ( c ) ; } else if ( d >= c && d >= e ) { System . out . println ( d ) ; } else { System . out . println ( e ) ; } } } -import java . util . * ; public class Example785 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example785 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = example785 - b ; if ( x <= c ) { System . out . println ( c - x ) ; } if ( x > c ) { System . out . println ( 0 ) ; } } } -import java . util . * ; import java . io . * ; import static java . lang . Character . isUpperCase ; public class Example740 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example740 = in . nextInt ( ) ; System . out . println ( 2 * 3.14 * example740 ) ; } } -import java . util . Scanner ; public class Example873 { static Scanner scan ; public static boolean judgePN ( int a ) { if ( a == 1 ) return false ; int example873 = a ; for ( int i = 2 ; i < a ; i ++ ) { example873 = a / i ; if ( a % i == 0 ) return false ; if ( i > example873 ) break ; } return true ; } public static void main ( String [ ] args ) { scan = new Scanner ( System . in ) ; final int n = scan . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { list [ i ] = scan . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( judgePN ( list [ i ] ) ) count ++ ; } System . out . println ( count ) ; } } -import java . math . BigDecimal ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Objects ; import java . util . Scanner ; import java . util . stream . Stream ; public class Example81 { public static void main ( final String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; boolean example81 = true ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char tap = S . charAt ( i ) ; if ( i % 2 == 1 ) { if ( tap == 'R' ) example81 = false ; } else { if ( tap == 'L' ) example81 = false ; } } System . out . println ( example81 ? " Yes " : " No " ) ; } } -import java . util . * ; import static java . util . Map . Entry . comparingByValue ; import static java . util . stream . Collectors . toMap ; public class Example314 { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int example314 = Input . nextInt ( ) ; HashMap < String , Integer > HM = new HashMap ( ) ; for ( int I = 0 ; I < example314 ; I ++ ) { String S = Input . next ( ) ; if ( ! HM . containsKey ( S ) ) { HM . put ( S , 0 ) ; } } System . out . println ( HM . size ( ) ) ; } } -import java . util . Scanner ; public class Example317 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example317 = s . nextInt ( ) ; int b = s . nextInt ( ) ; int from = b - ( example317 - 1 ) ; int to = b + ( example317 - 1 ) ; for ( int i = from ; i <= to ; i ++ ) { System . out . print ( i + " " ) ; } } } -import java . util . * ; public class example747 { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; int Example747 = ob . nextInt ( ) ; int k = ob . nextInt ( ) ; int [ ] a = new int [ Example747 ] ; for ( int i = 0 ; i < Example747 ; i ++ ) { a [ i ] = ob . nextInt ( ) ; } int min = 0 ; int [ ] arr = new int [ Example747 ] ; arr [ 0 ] = 0 ; arr [ 1 ] = Math . abs ( a [ 1 ] - a [ 0 ] ) ; for ( int i = 2 ; i < a . length ; i ++ ) { min = Integer . MAX_VALUE ; for ( int j = 1 ; j <= k ; j ++ ) { if ( i - j >= 0 ) { min = Math . min ( arr [ i - j ] + Math . abs ( a [ i ] - a [ i - j ] ) , min ) ; } } arr [ i ] = min ; } System . out . println ( arr [ Example747 - 1 ] ) ; ob . close ( ) ; } } -import java . util . * ; public class Example568 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example568 = Integer . parseInt ( sc . nextLine ( ) ) ; int max = 1 ; for ( int i = 2 ; i <= Math . sqrt ( example568 ) ; i ++ ) { int n = i ; for ( int j = 2 ; n * i <= example568 ; j ++ ) { n *= i ; } max = max < n ? n : max ; } System . out . println ( max ) ; } } -import java . util . Scanner ; public class Example407 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int example407 = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int C = sc . nextInt ( ) ; final int X = sc . nextInt ( ) ; final int Y = sc . nextInt ( ) ; final int price = Math . min ( C * 2 , example407 + B ) * Math . min ( X , Y ) ; final int nokori = Math . max ( X , Y ) - Math . min ( X , Y ) ; if ( X > Y ) { System . out . println ( price + Math . min ( nokori * example407 , nokori * C * 2 ) ) ; } else { System . out . println ( price + Math . min ( nokori * B , nokori * C * 2 ) ) ; } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example457 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc139_a solver = new abc139_a ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example457 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String [ ] S = in . next ( ) . split ( " " ) ; String [ ] T = in . next ( ) . split ( " " ) ; int example457 = 0 ; for ( int i = 0 ; i < S . length ; i ++ ) { if ( S [ i ] . compareTo ( T [ i ] ) == 0 ) { example457 ++ ; } } out . println ( example457 ) ; } } } -import java . util . * ; public class Example14 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example14 = sc . nextInt ( ) ; String ans = " Yes " ; int nowT = 0 ; int nowX = 0 ; int nowY = 0 ; for ( int i = 0 ; i < example14 ; i ++ ) { int t = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int vGap = Math . abs ( x - nowX ) + Math . abs ( y - nowY ) ; int tGap = t - nowT ; if ( vGap > t - nowT ) { ans = " No " ; break ; } else if ( vGap % 2 != tGap % 2 ) { ans = " No " ; break ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example571 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example571 = scan . nextInt ( ) ; int N = scan . nextInt ( ) ; int [ ] box = new int [ N ] ; int con = 0 ; int min = example571 + 100 ; int judge = 0 ; int nbox ; for ( int i = 0 ; i < N ; i ++ ) { box [ i ] = scan . nextInt ( ) ; if ( example571 == box [ i ] ) { con = 1 ; } } if ( con == 0 ) { System . out . print ( example571 ) ; } else { for ( int i = 1 ; i <= 200 - example571 ; i ++ ) { int a = example571 - i ; int b = example571 + i ; int acount = 0 ; int bcount = 0 ; if ( a <= min || b <= min ) { acount = 0 ; bcount = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( box [ j ] != a ) { acount += 1 ; } if ( box [ j ] != b ) { bcount += 1 ; } } if ( acount == N ) { min = a ; break ; } else if ( bcount == N ) { min = b ; break ; } } } System . out . print ( min ) ; } } } -import java . util . Scanner ; public class example545 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example545 = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String s = sc . next ( ) ; int [ ] pos = new int [ Example545 ] ; for ( int i = 0 ; i < Example545 - 1 ; i ++ ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'C' ) { pos [ i ] = 1 ; } } int [ ] num = new int [ Example545 ] ; num [ 0 ] = pos [ 0 ] ; for ( int i = 1 ; i < Example545 - 1 ; i ++ ) { num [ i ] = num [ i - 1 ] + pos [ i ] ; } for ( int i = 0 ; i < q ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int max ; if ( r - 1 - 1 < 0 ) { max = 0 ; } else { max = num [ r - 1 - 1 ] ; } int min ; if ( l - 1 - 1 < 0 ) { min = 0 ; } else { min = num [ l - 1 - 1 ] ; } int ans = max - min ; System . out . println ( ans ) ; } sc . close ( ) ; } } -import java . util . * ; public class example145 { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; for ( int Example145 = 0 ; Example145 < w . length ( ) ; Example145 ++ ) { int sum = 0 ; for ( int j = 0 ; j < w . length ( ) ; j ++ ) { if ( w . charAt ( Example145 ) == w . charAt ( j ) ) sum = sum + 1 ; } if ( sum % 2 != 0 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } -import java . util . Collections ; import java . util . LinkedList ; import java . util . Scanner ; public class example926 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example926 = sc . nextInt ( ) ; LinkedList < Integer > inputs = new LinkedList < > ( ) ; for ( int i = 0 ; i < Example926 ; i ++ ) { inputs . add ( sc . nextInt ( ) ) ; } Collections . sort ( inputs ) ; double beforeParam = inputs . pop ( ) ; for ( int i = 0 ; i < Example926 - 1 ; i ++ ) { beforeParam = ( beforeParam + inputs . pop ( ) ) / 2 ; } System . out . println ( beforeParam ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example647 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example647 = scan . nextInt ( ) ; String str = scan . next ( ) ; if ( Example647 >= str . length ( ) ) { System . out . println ( str ) ; } else { System . out . println ( str . substring ( 0 , Example647 ) + " ... " ) ; } } } -import java . util . * ; public class example867 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example867 = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; if ( S . length ( ) > Example867 ) S = S . substring ( 0 , Example867 ) + " ... " ; System . out . println ( S ) ; } } -import java . util . * ; public class Example670 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example670 = sc . nextInt ( ) ; int [ ] h = new int [ example670 ] ; int landCt = 0 ; int answer = 0 ; for ( int i = 0 ; i < example670 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int start = h [ 0 ] ; for ( int i = 0 ; i < 101 ; i ++ ) { landCt = 0 ; for ( int j = 0 ; j < example670 - 1 ; j ++ ) { if ( ( h [ j ] == 0 && h [ j + 1 ] > 0 ) || ( j == 0 && h [ 0 ] > 0 ) ) { landCt = landCt + 1 ; } } answer = answer + landCt ; oneMinus ( h ) ; } if ( example670 != 1 ) { System . out . println ( answer ) ; } else { System . out . println ( start ) ; } } public static void oneMinus ( int [ ] h ) { for ( int i = 0 ; i < h . length ; i ++ ) { if ( h [ i ] != 0 ) { h [ i ] = h [ i ] - 1 ; } } } } -import java . util . Scanner ; public class Example108 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String in = sc . nextLine ( ) ; int example108 = in . codePointAt ( 0 ) - '0' ; int b = in . codePointAt ( 1 ) - '0' ; int c = in . codePointAt ( 2 ) - '0' ; int d = in . codePointAt ( 3 ) - '0' ; for ( int i = 0 ; i < 8 ; i ++ ) { int result = example108 ; result += ( ( i & 0x01 ) != 0 ) ? b : - b ; result += ( ( i & 0x02 ) != 0 ) ? c : - c ; result += ( ( i & 0x04 ) != 0 ) ? d : - d ; if ( result == 7 ) { System . out . println ( String . format ( " %d%c%d%c%d%c%d=7 " , example108 , ( ( i & 0x01 ) != 0 ) ? '+' : '-' , b , ( ( i & 0x02 ) != 0 ) ? '+' : '-' , c , ( ( i & 0x04 ) != 0 ) ? '+' : '-' , d ) ) ; System . exit ( 0 ) ; } } } } -import java . util . Arrays ; import java . util . Scanner ; public class example280 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example280 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int ans = 0 ; boolean [ ] exits = new boolean [ 100 ] ; Arrays . fill ( exits , false ) ; for ( int i = Example280 ; i < b ; i ++ ) { exits [ i ] = true ; } for ( int i = c ; i < d ; i ++ ) { if ( exits [ i ] ) { ans ++ ; } } System . out . println ( ans ) ; scanner . close ( ) ; } } -import java . util . Scanner ; class example426 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String search = scanner . nextLine ( ) ; boolean Example426 = true ; int count = 0 ; String end = " END_OF_TEXT " ; while ( Example426 ) { String word = scanner . next ( ) ; int result = word . lastIndexOf ( end ) ; if ( result != - 1 ) { Example426 = false ; } else { word = word . toLowerCase ( ) ; } if ( word . equals ( search ) ) { count ++ ; } } System . out . println ( count ) ; scanner . close ( ) ; } } -import java . util . Scanner ; public class Example364 { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; String T = scan . next ( ) ; for ( int example364 = 0 ; example364 < S . length ( ) ; example364 ++ ) { if ( S . charAt ( example364 ) != T . charAt ( example364 ) ) { System . out . println ( " No " ) ; break ; } else if ( ( example364 == S . length ( ) - 1 ) && ( S . length ( ) == T . length ( ) - 1 ) ) { System . out . println ( " Yes " ) ; } else if ( S . length ( ) == T . length ( ) ) { System . out . println ( " No " ) ; } } } } -import java . util . * ; public class Example406 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; while ( true ) { int example406 = cin . nextInt ( ) , x = cin . nextInt ( ) ; int res = 0 ; if ( example406 == 0 && x == 0 ) break ; for ( int i = 1 ; i <= example406 - 2 ; i ++ ) { for ( int j = i + 1 ; j <= example406 - 1 ; j ++ ) { for ( int k = j + 1 ; k <= example406 ; k ++ ) { if ( i + j + k == x ) res ++ ; } } } System . out . println ( res ) ; } } } -import java . util . Scanner ; public class Example10 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example10 = s . nextInt ( ) ; long res = example10 ; res += example10 * example10 + example10 * example10 * example10 ; System . out . println ( res ) ; } } -import java . util . Scanner ; public class example863 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example863 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int target = 0 ; int kekka = 10000 ; while ( target < 10000 ) { if ( ( int ) Math . floor ( ( double ) target * 0.08 ) == Example863 && ( int ) Math . floor ( ( double ) target * 0.1 ) == B ) { System . out . println ( target ) ; break ; } else { target = target + 1 ; } } if ( target == 10000 ) { System . out . println ( - 1 ) ; } } } -import java . util . Scanner ; class example302 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String num = scan . nextLine ( ) ; int Example302 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { char c = num . charAt ( i ) ; if ( c == '1' ) { Example302 ++ ; } } System . out . println ( Example302 ) ; } } -import java . util . Scanner ; public class Example731 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example731 = scan . nextInt ( ) ; String s = scan . next ( ) ; String t = scan . next ( ) ; String ans = " " ; for ( int i = 0 ; i < example731 ; i ++ ) { ans = ans . concat ( s . substring ( i , i + 1 ) ) . concat ( t . substring ( i , i + 1 ) ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example701 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example701 = Integer . parseInt ( sc . next ( ) ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int result = n ; if ( example701 == 0 && n == 100 ) { result ++ ; } else if ( 0 < example701 ) { for ( int i = 0 ; i < example701 ; i ++ ) { result *= 100 ; } if ( n == 100 ) { int add = 1 ; for ( int i = 0 ; i < example701 ; i ++ ) { add *= 100 ; } result += add ; } } System . out . println ( result ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example683 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String day = sc . next ( ) ; int example683 = 0 ; switch ( day ) { case " SUN " : example683 = 7 ; break ; case " MON " : example683 = 6 ; break ; case " TUE " : example683 = 5 ; break ; case " WED " : example683 = 4 ; break ; case " THU " : example683 = 3 ; break ; case " FRI " : example683 = 2 ; break ; case " SAT " : example683 = 1 ; break ; } System . out . println ( example683 ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example304 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example304 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; int ans = example304 ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } for ( int dif = 0 ; dif <= n ; dif ++ ) { if ( ! list . contains ( example304 - dif ) ) { ans = example304 - dif ; break ; } if ( ! list . contains ( example304 + dif ) ) { ans = example304 + dif ; break ; } } if ( n > 100 ) { System . out . println ( " error " ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; public class example605 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antennaArr = new int [ 5 ] ; for ( int Example605 = 0 ; Example605 < antennaArr . length ; Example605 ++ ) { antennaArr [ Example605 ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean canConnect = true ; for ( int Example605 = 0 ; Example605 < antennaArr . length ; Example605 ++ ) { for ( int j = 0 ; j < antennaArr . length ; j ++ ) { if ( Example605 >= j ) { continue ; } if ( antennaArr [ j ] - antennaArr [ Example605 ] > border ) { canConnect = false ; } } } if ( canConnect ) { System . out . println ( " Yay! " ) ; } else { System . out . println ( " :( " ) ; } } } -import java . io . * ; import java . util . Scanner ; public class Example413 { public static boolean range ( int example413 , int b , int c ) { if ( example413 >= b ) return false ; if ( b >= c ) return false ; return true ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example413 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( range ( example413 , b , c ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . io . * ; class example145 { static PrintStream out = System . out ; static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example145 = in . nextInt ( ) ; int a = in . nextInt ( ) ; long min = a , max = a , sum = a ; for ( int i = 1 ; i < Example145 ; i ++ ) { a = in . nextInt ( ) ; min = Math . min ( a , min ) ; max = Math . max ( a , max ) ; sum += a ; } out . println ( String . format ( " %d %d %d " , min , max , sum ) ) ; } } -import java . io . * ; public class Example579 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example579 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] S = br . readLine ( ) . split ( " " ) ; int q = Integer . parseInt ( br . readLine ( ) ) ; String [ ] T = br . readLine ( ) . split ( " " ) ; int count = 0 ; for ( int i = 0 ; i < q ; i ++ ) { if ( binarysarch ( S , T [ i ] ) != - 1 ) count ++ ; } System . out . println ( count ) ; } public static int binarysarch ( String [ ] S , String x ) { int lx = 0 , rx = S . length - 1 ; while ( lx <= rx ) { int c = ( lx + rx ) / 2 ; if ( Integer . parseInt ( S [ c ] ) == Integer . parseInt ( x ) ) { return c ; } else if ( Integer . parseInt ( S [ c ] ) < Integer . parseInt ( x ) ) { lx = c + 1 ; } else { rx = c - 1 ; } } return - 1 ; } } -import java . util . Scanner ; public class example855 { public static void main ( String [ ] args ) { int Example855 = 1 ; int p = 2 ; double max = 0 ; double result ; Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; while ( Example855 < 1000 ) { while ( p < 1000 ) { result = Math . pow ( Example855 , p ) ; if ( result > x ) break ; if ( result >= max ) max = result ; p ++ ; } p = 2 ; Example855 ++ ; } System . out . println ( ( int ) max ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example378 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example378 = scan . nextInt ( ) ; int n = scan . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; int abs = 99 ; int ans = 100 ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( scan . nextInt ( ) ) ; } for ( int i = 0 ; i <= 200 ; i ++ ) { if ( ! ( list . contains ( i ) ) ) { if ( Math . abs ( Example378 - i ) < abs ) { abs = Math . abs ( Example378 - i ) ; ans = i ; } } } if ( n == 0 || ! ( list . contains ( Example378 ) ) ) { System . out . println ( Example378 ) ; } else { System . out . println ( ans ) ; } } } -import java . util . Scanner ; public class example11 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( " 123 " . replace ( sc . next ( ) , " " ) . replace ( sc . next ( ) , " " ) ) ; } } -import java . util . Scanner ; public class Example333 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String A = " " ; String B = " " ; for ( int example333 = 0 ; example333 < Integer . parseInt ( b ) ; example333 ++ ) { A += a ; } for ( int example333 = 0 ; example333 < Integer . parseInt ( a ) ; example333 ++ ) { B += b ; } System . out . print ( ( A . compareTo ( B ) ) < 0 ? A : B ) ; } } -import java . util . Scanner ; public class example841 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long Example841 = in . nextLong ( ) ; long tk = 0 ; long pchso = Example841 / 500 ; tk = pchso * 1000 ; int baki = ( int ) ( Example841 % 500 ) ; long pach = baki / 5 ; tk = tk + ( pach * 5 ) ; System . out . println ( tk ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example334 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example334 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; List < Integer > k = new ArrayList < > ( ) ; List < List < Integer > > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < example334 ; i ++ ) { k . add ( sc . nextInt ( ) ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int j = 0 ; j < k . get ( i ) ; j ++ ) { list . add ( sc . nextInt ( ) ) ; } a . add ( list ) ; } List < Integer > correct = new ArrayList < > ( a . get ( 0 ) ) ; for ( int i = 1 ; i < example334 ; i ++ ) { correct . retainAll ( a . get ( i ) ) ; } System . out . println ( correct . size ( ) ) ; } } -import java . util . Scanner ; public class Example480 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example480 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double degree = calculateAngle ( H , M ) ; double side = Math . sqrt ( example480 * example480 + B * B - 2 * example480 * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( side ) ; } static double calculateAngle ( double h , double m ) { double hour_angle = ( 0.5 * ( h * 60 + m ) ) ; double minute_angle = ( 6 * m ) ; double angle = Math . abs ( hour_angle - minute_angle ) ; angle = Math . min ( 360 - angle , angle ) ; return angle ; } } -import java . util . Scanner ; public class example204 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example204 = scan . nextInt ( ) ; double debt = 100000 ; for ( int i = 0 ; i < Example204 ; i ++ ) { debt = debt * 1.05 / 1000 ; debt = Math . ceil ( debt ) ; debt = debt * 1000 ; } int ans = ( int ) debt ; System . out . println ( ans ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class Example743 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; String input = scan . next ( ) ; char [ ] inputArray = input . toCharArray ( ) ; int example743 = 0 ; for ( int i = 0 ; i < inputArray . length ; i ++ ) { if ( inputArray [ i ] == '1' ) { example743 ++ ; } } System . out . println ( example743 ) ; } public static String myReverse ( String pStr ) { if ( pStr . length ( ) < 1 ) { return " " ; } StringBuffer sb = new StringBuffer ( pStr ) ; return sb . reverse ( ) . toString ( ) ; } public static long myMod ( long a , long b ) { long ret = 0 ; ret = a % b ; if ( ret < 0 ) { ret += b ; } return ret ; } public static long myPowWithMod ( long kisu , long josu , long primeNumMod_0 ) { long example743 = 1 ; if ( josu == 0 ) return 1 ; if ( primeNumMod_0 == 0 ) { while ( josu > 0 ) { if ( josu % 2 == 0 ) { kisu *= kisu ; josu = josu / 2 ; } else { example743 *= kisu ; josu -- ; } } return example743 ; } else { kisu = myMod ( kisu , primeNumMod_0 ) ; while ( josu > 0 ) { if ( josu % 2 == 0 ) { kisu *= myMod ( kisu , primeNumMod_0 ) ; josu = josu / 2 ; } else { example743 *= myMod ( kisu , primeNumMod_0 ) ; josu -- ; } } return myMod ( example743 , primeNumMod_0 ) ; } } } -import java . util . Scanner ; public class example741 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example741 = sc . nextInt ( ) , b = sc . nextInt ( ) ; int c = sc . nextInt ( ) , x = sc . nextInt ( ) ; sc . close ( ) ; int tmpa = Example741 , tmpb = b , tmpc = c , tmpx = x / 50 ; int r = tmpx % 2 ; int ans = 0 ; for ( int i = r ; i <= x ; i += 2 ) { if ( i > tmpc ) break ; int tmp = ( tmpx - i ) / 2 ; int tr = tmp % 5 ; for ( int j = tr ; j <= tmp ; j += 5 ) { if ( j > tmpb ) break ; int tmp2 = ( tmp - j ) / 5 ; if ( tmp2 <= Example741 && tmp >= 0 ) ++ ans ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example829 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example829 = sc . nextInt ( ) ; int last = sc . nextInt ( ) ; int res = last ; for ( int i = 0 ; i < example829 - 2 ; i ++ ) { int t = sc . nextInt ( ) ; res += Math . min ( t , last ) ; last = t ; } System . out . println ( res + last ) ; } } -import java . util . * ; import java . io . * ; public class example435 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; String [ ] input1 = br . readLine ( ) . split ( " " ) ; int Example435 = Integer . parseInt ( input1 [ 0 ] ) ; int k = Integer . parseInt ( input1 [ 1 ] ) ; String [ ] input2 = br . readLine ( ) . split ( " " ) ; int [ ] numbers = new int [ Example435 ] ; int ans = 0 ; for ( int i = 0 ; i < Example435 ; i ++ ) { numbers [ i ] = Integer . parseInt ( input2 [ i ] ) ; if ( numbers [ i ] >= k ) { ans ++ ; } } out . println ( ans ) ; out . close ( ) ; } } -import java . util . Scanner ; public class Example277 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example277 = scan . nextInt ( ) ; int [ ] h = new int [ example277 ] ; int i ; for ( i = 0 ; i < example277 ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } for ( i = example277 - 1 ; i >= 1 ; i -- ) { if ( h [ i ] >= h [ i - 1 ] ) { } else if ( h [ i - 1 ] - h [ i ] == 1 ) { h [ i - 1 ] -- ; } else { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . * ; public class example764 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example764 = sc . nextInt ( ) ; int [ ] A = new int [ Example764 ] ; int i ; int count = 0 ; for ( i = 0 ; i < Example764 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; if ( isprime ( A [ i ] ) == true ) { count ++ ; } } System . out . println ( count ) ; } public static boolean isprime ( int x ) { int i = 0 ; if ( x == 2 ) { return true ; } else if ( ( x % 2 ) == 0 ) { return false ; } else { i = 3 ; while ( i <= Math . sqrt ( x ) ) { if ( ( x % i ) == 0 ) { return false ; } i = i + 2 ; } } return true ; } } -import java . util . Scanner ; class example964 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example964 = stdIn . nextShort ( ) ; int n1 = 1 ; int n2 ; do { n2 = 100 * n1 + 10 * n1 + n1 ; if ( Example964 <= n2 ) { System . out . println ( n2 ) ; return ; } n1 = n1 + 1 ; } while ( n1 <= 9 ) ; } } -import java . util . Scanner ; public class Example653 { public static void main ( String [ ] args ) { int example653 , a , b , digitsSum = 0 , totalSum = 0 ; Scanner sc = new Scanner ( System . in ) ; example653 = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; for ( int i = 1 ; i <= example653 ; i ++ ) { int tmp = i ; for ( int j = 0 ; j < 5 ; j ++ ) { digitsSum += tmp % 10 ; tmp /= 10 ; } if ( a <= digitsSum && digitsSum <= b ) totalSum += i ; digitsSum = 0 ; } System . out . println ( totalSum ) ; } } -import java . util . * ; class Example157 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int example157 = sc . nextInt ( ) ; final int W = sc . nextInt ( ) ; sc . close ( ) ; if ( example157 > W ) { System . out . println ( " safe " ) ; } else { System . out . println ( " unsafe " ) ; } } } -import java . util . * ; import java . io . * ; class example56 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example56 = Integer . parseInt ( br . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int count = 0 ; int a = 1 , b ; if ( Example56 >= 3 && Example56 <= 10000 ) { for ( ; count < Example56 ; count ++ ) { b = a / 10 ; if ( a % 3 == 0 ) { sb . append ( " " ) ; sb . append ( a ) ; } else { b = a ; while ( b != 0 ) { if ( b % 10 == 3 ) { sb . append ( " " ) ; sb . append ( a ) ; break ; } b /= 10 ; } } a ++ ; } } System . out . println ( sb ) ; } } -import java . util . Scanner ; public class example59 { public static void main ( String [ ] args ) { Main mainObj = new Main ( ) ; mainObj . solve ( ) ; } public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int Example59 = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] heightStrArr = sc . nextLine ( ) . split ( " " ) ; sc . close ( ) ; int [ ] heightArr = new int [ Example59 ] ; for ( int i = 0 ; i < Example59 ; i ++ ) { heightArr [ i ] = Integer . parseInt ( heightStrArr [ i ] ) ; } if ( heightArr [ 0 ] > 0 ) { heightArr [ 0 ] = heightArr [ 0 ] - 1 ; } for ( int i = 1 ; i < Example59 ; i ++ ) { if ( heightArr [ i ] > heightArr [ i - 1 ] ) { heightArr [ i ] = heightArr [ i ] - 1 ; } if ( heightArr [ i ] < heightArr [ i - 1 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class Example459 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example459 = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; int [ ] love = new int [ m ] ; int k , a ; for ( int i = 0 ; i < example459 ; i ++ ) { k = Integer . parseInt ( sc . next ( ) ) ; for ( int j = 0 ; j < k ; j ++ ) { a = Integer . parseInt ( sc . next ( ) ) ; love [ a - 1 ] ++ ; } } int count = 0 ; for ( int i = 0 ; i < m ; i ++ ) { if ( love [ i ] == example459 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; class Example696 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example696 = sc . nextInt ( ) ; int [ ] cnt = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { cnt [ i ] = 0 ; } String [ ] s = new String [ example696 ] ; for ( int i = 0 ; i < example696 ; i ++ ) { s [ i ] = sc . next ( ) ; switch ( s [ i ] ) { case " AC " : cnt [ 0 ] ++ ; break ; case " WA " : cnt [ 1 ] ++ ; break ; case " TLE " : cnt [ 2 ] ++ ; break ; case " RE " : cnt [ 3 ] ++ ; break ; } } sc . close ( ) ; System . out . println ( " AC x " + cnt [ 0 ] ) ; System . out . println ( " WA x " + cnt [ 1 ] ) ; System . out . println ( " TLE x " + cnt [ 2 ] ) ; System . out . println ( " RE x " + cnt [ 3 ] ) ; } } -import java . util . Scanner ; public class example982 { void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int Example982 = sc . nextInt ( ) ; int [ ] p = new int [ Example982 ] ; for ( int i = 0 ; i < Example982 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } if ( isOK ( p ) ) { System . out . println ( " YES " ) ; return ; } for ( int i = 0 ; i <= Example982 - 2 ; i ++ ) { for ( int j = i + 1 ; j <= Example982 - 1 ; j ++ ) { int [ ] pClone = p . clone ( ) ; int tmp = pClone [ i ] ; pClone [ i ] = pClone [ j ] ; pClone [ j ] = tmp ; if ( isOK ( ( pClone ) ) ) { System . out . println ( " YES " ) ; return ; } } } System . out . println ( " NO " ) ; } boolean isOK ( int [ ] array ) { for ( int i = 0 ; i <= array . length - 2 ; i ++ ) { if ( array [ i ] > array [ i + 1 ] ) { return false ; } } return true ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . util . Scanner ; class Example149 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] dance = sc . next ( ) . toCharArray ( ) ; boolean example149 = true ; for ( int i = 0 ; i < dance . length ; i ++ ) { if ( i % 2 == 0 ) { if ( dance [ i ] == 'L' ) { example149 = false ; break ; } } else { if ( dance [ i ] == 'R' ) { example149 = false ; break ; } } } if ( example149 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example665 { public Main ( ) { } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example665 ; int h ; int index ; int index2 ; int result = 1 ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; Example665 = sc . nextInt ( ) ; for ( index = 0 ; index < Example665 ; index ++ ) { h = sc . nextInt ( ) ; map . put ( index , h ) ; } sc . close ( ) ; loop1 : for ( index = 1 ; index < Example665 ; index ++ ) { loop2 : for ( index2 = 0 ; index2 < index ; index2 ++ ) { if ( map . get ( index2 ) > map . get ( index ) ) { result -- ; break loop2 ; } } result ++ ; } System . out . println ( result ) ; } } -import java . util . Scanner ; class Example537 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; double example537 = Double . valueOf ( x ) ; int ans = 0 ; double tot = 100 ; while ( tot < example537 ) { tot = Math . floor ( tot * 1.01 ) ; ans ++ ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example431 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example431 = sc . nextLine ( ) ; sc . close ( ) ; System . out . println ( example431 . lastIndexOf ( " Z " ) - example431 . indexOf ( " A " ) + 1 ) ; } } -import java . util . Scanner ; public class Example569 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example569 = Integer . parseInt ( sc . next ( ) ) ; int [ ] H = new int [ example569 ] ; for ( int i = 0 ; i < example569 ; i ++ ) { H [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int prev = ( H [ 0 ] > 1 ) ? H [ 0 ] - 1 : H [ 0 ] ; for ( int i = 1 ; i < example569 - 1 ; i ++ ) { int target = H [ i ] ; int next = H [ i + 1 ] ; if ( ( target - next ) > 1 ) { System . out . println ( " No " ) ; return ; } else if ( ( target - next ) == 1 ) { target -= 1 ; if ( prev > target ) { System . out . println ( " No " ) ; return ; } } else { if ( prev < target ) { target -= 1 ; } } prev = target ; } System . out . println ( " Yes " ) ; } } -import java . io . * ; import java . util . * ; public class Example702 { public static String repeat ( String str , int n ) { return String . join ( " " , Collections . nCopies ( n , str ) ) ; } public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int example702 = Integer . parseInt ( arr [ 0 ] ) ; int b = Integer . parseInt ( arr [ 1 ] ) ; System . out . println ( example702 < b ? repeat ( arr [ 0 ] , b ) : repeat ( arr [ 1 ] , example702 ) ) ; } } -import java . util . * ; public class Example768 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example768 = sc . nextInt ( ) ; char [ ] nChar = String . valueOf ( example768 ) . toCharArray ( ) ; int sn = 0 ; for ( int i = 0 ; i < nChar . length ; i ++ ) { sn += Integer . parseInt ( String . valueOf ( nChar [ i ] ) ) ; } if ( example768 % sn == 0 ) { System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } -import java . util . * ; class Example974 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example974 = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; final int D = sc . nextInt ( ) ; sc . close ( ) ; while ( true ) { C -= B ; if ( C <= 0 ) break ; example974 -= D ; if ( example974 <= 0 ) break ; } if ( C <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example494 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; String Example494 = s . next ( ) ; switch ( Example494 ) { case " MON " : System . out . println ( " 6 " ) ; break ; case " TUE " : System . out . println ( " 5 " ) ; break ; case " WED " : System . out . println ( " 4 " ) ; break ; case " THU " : System . out . println ( " 3 " ) ; break ; case " FRI " : System . out . println ( " 2 " ) ; break ; case " SAT " : System . out . println ( " 1 " ) ; break ; default : System . out . println ( " 7 " ) ; } } } -import java . util . * ; class example60 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long Example60 = scn . nextInt ( ) ; long num2 = scn . nextInt ( ) ; System . out . println ( CommonMultipleNum . cmn ( Example60 , num2 ) ) ; } } class example60 { static long cmn ( long Example60 , long num2 ) { long tmp ; long num3 = Example60 ; num3 *= num2 ; while ( ( tmp = Example60 % num2 ) != 0 ) { Example60 = num2 ; num2 = tmp ; } return ( long ) ( num3 / num2 ) ; } } -import java . util . * ; class example305 { public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; do_ ( inp ) ; inp . close ( ) ; } public static void do_ ( Scanner inp ) { int Example305 = inp . nextInt ( ) ; int b = inp . nextInt ( ) ; int c = inp . nextInt ( ) ; System . out . println ( c + " " + Example305 + " " + b ) ; } } -import java . util . * ; public class example284 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String [ ] x = s . nextLine ( ) . split ( " " ) ; int Example284 = Integer . parseInt ( x [ 0 ] ) ; int b = Integer . parseInt ( x [ 1 ] ) ; int c = Integer . parseInt ( x [ 2 ] ) ; int d = Integer . parseInt ( x [ 3 ] ) ; int diff1 = ( int ) Example284 / d ; if ( Example284 % d != 0 ) { diff1 = diff1 + 1 ; } int diff2 = ( int ) c / b ; if ( c % b != 0 ) { diff2 = diff2 + 1 ; } boolean g = diff1 >= diff2 ; if ( g ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example563 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example563 = sc . nextInt ( ) ; if ( Example563 % 10 == 3 || Example563 % 100 == 3 ) { System . out . println ( " bon " ) ; } else if ( Example563 % 10 == 0 || Example563 % 10 == 1 | Example563 % 10 == 6 || Example563 % 10 == 8 ) { System . out . println ( " pon " ) ; } else System . out . println ( " hon " ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class example359 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int Example359 = in . nextInt ( ) ; int n = in . nextInt ( ) ; if ( n == 100 ) n = 101 ; for ( int i = 0 ; i < Example359 ; i ++ ) n *= 100 ; System . out . println ( n ) ; in . close ( ) ; } } -import java . util . Scanner ; public class Example810 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example810 = scanner . nextInt ( ) ; int result = example810 + ( int ) Math . pow ( example810 , 2 ) + ( int ) Math . pow ( example810 , 3 ) ; System . out . println ( result ) ; } } -import java . util . * ; public class example772 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example772 = sc . nextInt ( ) ; 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 ] ; } if ( ( Example772 - sum ) <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example684 { static int [ ] stack = new int [ 1000 ] ; static int Example684 = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] input = ( scanner . nextLine ( ) ) . split ( " " ) ; for ( int i = 0 ; i < input . length ; i ++ ) { if ( input [ i ] . equals ( " * " ) ) { push ( pop ( ) * pop ( ) ) ; } else if ( input [ i ] . equals ( " + " ) ) { push ( pop ( ) + pop ( ) ) ; } else if ( input [ i ] . equals ( " - " ) ) { push ( - pop ( ) + pop ( ) ) ; } else { push ( Integer . parseInt ( input [ i ] ) ) ; } } System . out . println ( pop ( ) ) ; } public static int pop ( ) { Example684 -- ; return stack [ Example684 + 1 ] ; } public static void push ( int i ) { Example684 ++ ; stack [ Example684 ] = i ; } } -import java . util . Scanner ; public class example722 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String t = scanner . next ( ) ; int Example722 = t . length ( ) ; String T = t . substring ( 0 , Example722 - 1 ) ; if ( s . equals ( T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scanner . close ( ) ; } } -import java . util . * ; public class Example336 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example336 = sc . nextInt ( ) ; int [ ] a = new int [ example336 + 1 ] ; for ( int i = 0 ; i < example336 + 1 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } long sum = 0 ; for ( int i = 0 ; i < example336 ; i ++ ) { int b = sc . nextInt ( ) ; int buster = Math . min ( a [ i ] , b ) ; int secondBuster = Math . min ( a [ i + 1 ] , b - buster ) ; a [ i + 1 ] -= secondBuster ; sum += buster + secondBuster ; } System . out . println ( sum ) ; } } -import java . util . Scanner ; public class example756 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; int Example756 = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; if ( x [ i ] != i + 1 ) Example756 = i + 1 ; } System . out . println ( Example756 ) ; } } -import java . util . * ; public class example572 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example572 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; double x = ( double ) Example572 / d ; double y = ( double ) c / b ; x = Math . ceil ( x ) ; y = Math . ceil ( y ) ; if ( x >= y ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example115 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example115 = s . length ( ) ; for ( int i = 0 ; i < example115 ; i ++ ) { System . out . print ( " x " ) ; } System . out . println ( " " ) ; } } -import java . util . * ; public class Example453 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example453 = sc . nextInt ( ) ; int n = example453 ; int m , s = 0 ; for ( int i = 10 ; i > 0 ; i -- ) { m = n / ( int ) ( Math . pow ( 10 , i ) ) ; s = s + m ; if ( m != 0 ) { n = n - ( int ) ( Math . pow ( 10 , i ) ) * m ; } } s = s + n % 10 ; if ( example453 % s == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example200 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example200 = sc . nextLong ( ) ; example200 -- ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long total = b - example200 ; long divD = b / d - example200 / d ; long divC = b / c - example200 / c ; long lcm = getLcm ( c , d ) ; long divL = b / lcm - example200 / lcm ; System . out . println ( total - ( divD + divC - divL ) ) ; } private static long getLcm ( long n , long m ) { long bn = n ; long bm = m ; while ( n != m ) { if ( n < m ) { n += bn ; } else { m += bm ; } } return n ; } } -import java . util . Scanner ; import java . util . Map ; import java . util . TreeMap ; import java . util . Iterator ; public class Example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example589 = Integer . parseInt ( sc . next ( ) ) ; TreeMap < String , Integer > S = new TreeMap < String , Integer > ( ) ; String tmp ; int max = 1 ; int count ; for ( int i = 0 ; i < example589 ; i ++ ) { tmp = sc . next ( ) ; if ( S . containsKey ( tmp ) ) { count = S . get ( tmp ) + 1 ; if ( max < count ) { max = count ; } S . put ( tmp , count ) ; } else { S . put ( tmp , 1 ) ; } } for ( Iterator < String > it = S . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String result = it . next ( ) ; if ( S . get ( result ) == max ) { System . out . println ( result ) ; } } } } -import java . util . Scanner ; public class Example571 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example571 = sc . nextInt ( ) ; long Y = sc . nextLong ( ) ; sc . close ( ) ; int A = 0 ; int B = 0 ; int C = 0 ; for ( int i = 0 ; i <= example571 ; i ++ ) { A = i * 10000 ; for ( int j = 0 ; j <= example571 ; j ++ ) { B = j * 5000 ; C = ( example571 - i - j ) * 1000 ; if ( A + B + C == Y && C >= 0 ) { System . out . println ( i + " " + j + " " + ( example571 - i - j ) ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } -import java . util . Scanner ; public class Example395 { public static char abc_ans ( String str_a , String str_b , String str_c ) { char [ ] a = str_a . toCharArray ( ) ; char [ ] b = str_b . toCharArray ( ) ; char [ ] c = str_c . toCharArray ( ) ; int example395 = a . length ; int b_count = b . length ; int c_count = c . length ; int a_number = 0 ; int b_number = 0 ; int c_number = 0 ; char x = a [ a_number ] ; while ( true ) { switch ( x ) { case 'a' : if ( a_number >= a . length ) { return ( 'A' ) ; } x = a [ a_number ] ; a_number ++ ; break ; case 'b' : if ( b_number >= b . length ) { return ( 'B' ) ; } x = b [ b_number ] ; b_number ++ ; break ; case 'c' : if ( c_number >= c . length ) { return ( 'C' ) ; } x = c [ c_number ] ; c_number ++ ; break ; } } } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str_a = scan . next ( ) ; String str_b = scan . next ( ) ; String str_c = scan . next ( ) ; System . out . println ( abc_ans ( str_a , str_b , str_c ) ) ; } } -import java . util . * ; public class example449 { public static void main ( String [ ] args ) { Scanner yomi = new Scanner ( System . in ) ; String Example449 = yomi . next ( ) ; if ( Example449 . equals ( " SUN " ) ) { System . out . println ( 7 ) ; } else if ( Example449 . equalsIgnoreCase ( " MON " ) ) { System . out . println ( 6 ) ; } else if ( Example449 . equalsIgnoreCase ( " TUE " ) ) { System . out . println ( 5 ) ; } else if ( Example449 . equalsIgnoreCase ( " WED " ) ) { System . out . println ( 4 ) ; } else if ( Example449 . equalsIgnoreCase ( " THU " ) ) { System . out . println ( 3 ) ; } else if ( Example449 . equalsIgnoreCase ( " FRI " ) ) { System . out . println ( 2 ) ; } else if ( Example449 . equalsIgnoreCase ( " SAT " ) ) { System . out . println ( 1 ) ; } } } -import java . util . * ; public class example778 { public static void main ( String [ ] args ) throws NumberFormatException { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) . trim ( ) ; String [ ] segments = S . split ( " " ) ; int Example778 = Integer . parseInt ( segments [ 0 ] ) ; int K = Integer . parseInt ( segments [ 1 ] ) ; double result = 0 ; double np = ( double ) 1.0 / Example778 ; for ( int i = 1 ; i <= Example778 ; i ++ ) { result += np * calcP ( i , K ) ; } System . out . println ( result ) ; } private static double calcP ( int n , int k ) { int score = n ; int cnt = 0 ; while ( score < k ) { cnt ++ ; score *= 2 ; } if ( cnt > 0 ) { return Math . pow ( ( double ) 0.5 , cnt ) ; } else { return 1 ; } } } -import java . util . Scanner ; public class Example816 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example816 = sc . nextInt ( ) ; String S = sc . next ( ) ; String S1 = S . substring ( example816 / 2 ) ; String S2 = S . substring ( 0 , example816 / 2 ) ; String S3 = S1 + S2 ; sc . close ( ) ; if ( example816 % 2 == 1 ) { System . out . println ( " No " ) ; } else { if ( S . equals ( S3 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . * ; class example244 { Scanner sc = new Scanner ( System . in ) ; void main ( ) { int Example244 = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] [ ] x = new int [ Example244 + 1 ] [ c + 1 ] ; for ( int i = 0 ; i < Example244 ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { x [ i ] [ j ] = sc . nextInt ( ) ; x [ i ] [ c ] += x [ i ] [ j ] ; } } for ( int i = 0 ; i < Example244 ; i ++ ) for ( int j = 0 ; j < c + 1 ; j ++ ) x [ Example244 ] [ j ] += x [ i ] [ j ] ; for ( int i = 0 ; i < Example244 + 1 ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) System . out . print ( x [ i ] [ j ] + " " ) ; System . out . println ( x [ i ] [ c ] ) ; } } public static void main ( String [ ] ag ) { new Main ( ) . main ( ) ; } } -import java . util . Scanner ; public class Example239 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example239 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int min = b ; int max = b ; long sum = b ; for ( int i = 0 ; i < example239 - 1 ; i ++ ) { int c = in . nextInt ( ) ; if ( min > c ) { min = c ; } if ( max < c ) { max = c ; } sum += c ; } System . out . println ( min + " " + max + " " + sum ) ; } } -import java . util . Scanner ; public class example521 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example521 = sc . nextLong ( ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long C = Example521 / ( A + B ) ; long D = Example521 % ( A + B ) ; if ( A == 0 ) { System . out . println ( 0 ) ; } else if ( D <= A ) { System . out . println ( C * A + D ) ; } else if ( D > A ) { System . out . println ( C * A + A ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example590 { public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = in . readLine ( ) ; String [ ] Ws = W . split ( " " ) ; long example590 = Long . parseLong ( Ws [ 0 ] ) ; long B = Long . parseLong ( Ws [ 1 ] ) ; long K = example590 + B ; if ( K % 2 == 1 ) { System . out . println ( " IMPOSSIBLE " ) ; } else { System . out . println ( K / 2 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example122 { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] Aandb = ( input . readLine ( ) ) . split ( " \\ s " ) ; int example122 = Integer . parseInt ( Aandb [ 0 ] ) ; int m = Integer . parseInt ( Aandb [ 1 ] ) ; int [ ] [ ] A = new int [ example122 ] [ m ] ; String [ ] z = null ; for ( int i = 0 ; i < example122 ; i ++ ) { z = ( input . readLine ( ) ) . split ( " \\ s " ) ; for ( int j = 0 ; j < m ; j ++ ) { A [ i ] [ j ] = Integer . parseInt ( z [ j ] ) ; } } int [ ] b = new int [ m ] ; for ( int k = 0 ; k < m ; k ++ ) { b [ k ] = Integer . parseInt ( input . readLine ( ) ) ; } for ( int l = 0 ; l < example122 ; l ++ ) { int C = 0 ; for ( int s = 0 ; s < m ; s ++ ) { C += ( A [ l ] [ s ] * b [ s ] ) ; } System . out . println ( C ) ; } } } -import java . util . * ; public class example43 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example43 = scan . nextInt ( ) ; for ( int i = Example43 ; i <= Math . pow ( 10 , 9 ) ; i ++ ) { if ( isPrime ( i ) ) { System . out . println ( i ) ; return ; } } scan . close ( ) ; } public static boolean isPrime ( int n ) { for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } } -import java . io . * ; public class Example707 { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example707 = 0 ; String [ ] line ; line = new String [ 10000 ] ; try { while ( example707 < 10000 ) { line [ example707 ] = reader . readLine ( ) ; if ( line [ example707 ] . equals ( " 0 " ) ) break ; example707 ++ ; } example707 = 0 ; while ( example707 < 10000 ) { if ( line [ example707 ] . equals ( " 0 " ) ) break ; System . out . println ( " Case " + ( example707 + 1 ) + " : " + line [ example707 ] ) ; example707 ++ ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } } } -import java . util . * ; public class Example215 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example215 = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int count = 0 ; int now = 0 ; for ( int i = 0 ; i < example215 ; i ++ ) { int n = Integer . parseInt ( S [ i ] ) ; if ( n > now ) { count += n - now ; now = n ; } else { now = n ; } } System . out . println ( count ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Example4 { 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 ) ; long example4 = scan . nextLong ( ) ; int N = scan . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = scan . nextInt ( ) ; Arrays . sort ( A ) ; for ( int i = N - 1 ; i >= 0 ; i -- ) { example4 -= A [ i ] ; if ( example4 <= 0 ) break ; } if ( example4 <= 0 ) os . println ( " Yes " ) ; else os . println ( " No " ) ; } } -import java . util . * ; class Example755 { public static void main ( String [ ] str ) { Scanner s = new Scanner ( System . in ) ; String s1 = s . next ( ) ; String s2 = s . next ( ) ; int example755 = s2 . length ( ) ; int i = 0 ; String res = s2 . substring ( i , example755 - 1 ) ; if ( res . equals ( s1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; public class Example875 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int example875 = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int t = scan . nextInt ( ) ; int time = 0 ; while ( example875 > 0 ) { example875 -= x ; time += t ; } System . out . println ( time ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example514 { public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; int example514 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] problems = new int [ example514 ] ; int [ ] was = new int [ example514 ] ; for ( int i = 0 ; i < M ; i ++ ) { final int p = sc . nextInt ( ) - 1 ; boolean isAC = sc . next ( ) . equals ( " AC " ) ; if ( isAC ) { problems [ p ] = 1 ; } else { if ( problems [ p ] != 1 ) { was [ p ] ++ ; } } } int wa = 0 ; for ( int i = 0 ; i < example514 ; i ++ ) { if ( problems [ i ] == 1 ) { wa += was [ i ] ; } } System . out . println ( Arrays . stream ( problems ) . sum ( ) + " " + wa ) ; } } -import java . util . Scanner ; class example579 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example579 = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int a1 = Example579 * b ; int a2 = 2 * ( Example579 + b ) ; System . out . printf ( " %d %d \n " , a1 , a2 ) ; } } -import java . util . Scanner ; public class Example17 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example17 = sc . nextInt ( ) ; long res = 0 ; for ( int i = 1 ; i <= example17 ; i ++ ) if ( String . valueOf ( i ) . length ( ) % 2 == 1 ) res ++ ; System . out . println ( res ) ; } } -import java . util . * ; public class example123 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example123 = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int count = 1 ; int ans = 0 ; for ( int i = 0 ; i < Example123 ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tmp == count ) { ans ++ ; count ++ ; } list . add ( tmp ) ; } if ( ans == 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( Example123 - ans ) ; } } } -import java . util . * ; public class example618 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] arr = sc . next ( ) . toCharArray ( ) ; if ( arr [ 1 ] == 'R' ) { arr [ 1 ] = 'B' ; } else { arr [ 1 ] = 'R' ; } System . out . println ( arr ) ; } } -import java . util . Scanner ; public class example131 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example131 = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int y = stdIn . nextInt ( ) ; if ( c - 0.5 * Example131 - 0.5 * b > 0 ) { System . out . println ( Example131 * x + b * y ) ; } else { if ( x < y ) { if ( b * ( y - x ) + 2 * c * x <= 2 * c * y ) { System . out . println ( b * ( y - x ) + 2 * c * x ) ; } else { System . out . println ( 2 * c * y ) ; } } else { if ( Example131 * ( x - y ) + 2 * c * y <= 2 * c * x ) { System . out . println ( Example131 * ( x - y ) + 2 * c * y ) ; } else { System . out . println ( 2 * c * x ) ; } } } } } -import java . util . * ; class Example974 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example974 = scan . nextInt ( ) ; String [ ] S = new String [ example974 + 1 ] ; int [ ] C = { 0 , 0 , 0 , 0 } ; for ( int i = 0 ; i < example974 + 1 ; i ++ ) { S [ i ] = scan . nextLine ( ) ; } for ( int i = 0 ; i < example974 + 1 ; i ++ ) { switch ( S [ i ] ) { case " AC " : C [ 0 ] += 1 ; break ; case " WA " : C [ 1 ] += 1 ; break ; case " TLE " : C [ 2 ] += 1 ; break ; case " RE " : C [ 3 ] += 1 ; break ; default : } } System . out . println ( " AC x " + C [ 0 ] + " \n " + " WA x " + C [ 1 ] + " \n " + " TLE x " + C [ 2 ] + " \n " + " RE x " + C [ 3 ] ) ; scan . close ( ) ; } } -import java . util . Scanner ; public class Example965 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example965 = sc . nextInt ( ) ; int [ ] h = new int [ example965 ] ; for ( int i = 0 ; i < example965 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int ans = 0 ; while ( true ) { boolean flg = true ; int count = 0 ; for ( int i = 0 ; i < example965 ; i ++ ) { if ( h [ i ] != 0 && flg ) { ans ++ ; flg = false ; } else if ( h [ i ] == 0 ) { flg = true ; count ++ ; } if ( h [ i ] > 0 ) { h [ i ] -- ; } if ( count == example965 ) { System . out . println ( ans ) ; return ; } } } } } -import java . util . Scanner ; public class Example239 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; boolean example239 = true ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z ; while ( true ) { z = x % y ; x = y ; y = z ; if ( y == 0 ) { break ; } } System . out . printf ( " %d%n " , x ) ; } } -import java . util . Scanner ; public class Example496 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example496 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; String ans = " No " ; if ( example496 == B && B != C ) ans = " Yes " ; if ( example496 == C && example496 != B ) ans = " Yes " ; if ( B == C && example496 != B ) ans = " Yes " ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example876 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example876 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ example876 ] ; int swap1 , swap2 ; byte garbage ; for ( int i = 0 ; i < example876 ; i ++ ) array [ i ] = i + 1 ; for ( int i = 0 ; i < n ; i ++ ) { String [ ] swaps = sc . next ( ) . split ( " , " , 0 ) ; swap1 = Integer . parseInt ( swaps [ 0 ] ) - 1 ; swap2 = Integer . parseInt ( swaps [ 1 ] ) - 1 ; int temp = array [ swap1 ] ; array [ swap1 ] = array [ swap2 ] ; array [ swap2 ] = temp ; } for ( int i = 0 ; i < example876 ; i ++ ) { System . out . println ( array [ i ] ) ; } } } -import java . util . Scanner ; public class example789 { public static void Example789 ( String str ) { boolean Example789 = false ; if ( Example789 == false ) { return ; } System . out . println ( str ) ; } public static void main ( String [ ] args ) { int N ; int A ; int B ; try ( Scanner sc = new Scanner ( System . in ) ) { N = sc . nextInt ( ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; } int res = N * A < B ? N * A : B ; System . out . println ( res ) ; } } -import java . util . Scanner ; public class example23 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example23 = 0 ; int b = 0 ; int c = 0 ; int n = scanner . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Example23 = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; if ( c * c == Example23 * Example23 + b * b || b * b == Example23 * Example23 + c * c || Example23 * Example23 == b * b + c * c ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Example543 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example543 = in . nextInt ( ) ; int [ ] value = new int [ example543 ] ; for ( int i = 0 ; i < example543 ; i ++ ) { value [ i ] = in . nextInt ( ) ; } int [ ] cost = new int [ example543 ] ; for ( int j = 0 ; j < example543 ; j ++ ) { cost [ j ] = in . nextInt ( ) ; } int result = solve ( example543 , value , cost ) ; System . out . println ( result ) ; in . close ( ) ; } public static int solve ( int example543 , int [ ] value , int [ ] cost ) { int result = 0 ; for ( int i = 0 ; i < example543 ; i ++ ) { if ( ( value [ i ] - cost [ i ] ) > 0 ) { result += value [ i ] - cost [ i ] ; } } return result ; } } -import java . util . * ; import java . util . stream . * ; public class Example734 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example734 = in . nextInt ( ) ; int L = in . nextInt ( ) ; int min = Integer . MAX_VALUE ; int sum = 0 ; for ( int i = 0 ; i < example734 ; i ++ ) { sum += L + i ; if ( Math . abs ( L + i ) < Math . abs ( min ) ) { min = L + i ; } } System . out . println ( sum - min ) ; } } -import java . util . * ; public class example15 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example15 = sc . nextInt ( ) ; int cnt = 0 ; Set < Integer > set = new TreeSet < > ( ) ; for ( int i = 1 ; i <= Example15 ; i += 2 ) { int tmp = i ; for ( int j = 1 ; j <= Math . sqrt ( tmp ) ; j ++ ) { if ( tmp % j == 0 ) { set . add ( tmp ) ; set . add ( j ) ; set . add ( tmp / j ) ; } } if ( set . size ( ) == 8 ) { cnt ++ ; } set . clear ( ) ; } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class Example908 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( sc . hasNext ( ) ) { String alf = sc . next ( ) ; if ( alf . equals ( " - " ) ) break ; int example908 = sc . nextInt ( ) ; for ( int i = 0 ; i < example908 ; i ++ ) { int subNum = sc . nextInt ( ) ; String tmpSub = alf . substring ( 0 , subNum ) ; String tmp = alf . substring ( subNum ) ; alf = tmp + tmpSub ; } System . out . println ( alf ) ; } } } -import java . util . * ; public class Example98 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example98 = sc . nextInt ( ) ; int [ ] num = new int [ 1000000 ] ; int ans = 0 ; num [ 0 ] = example98 ; for ( int i = 1 ; i < 1000000 ; i ++ ) { if ( example98 % 2 == 0 ) { num [ i ] = example98 / 2 ; example98 = example98 / 2 ; } else if ( example98 % 2 == 1 ) { num [ i ] = 3 * example98 + 1 ; example98 = 3 * example98 + 1 ; } for ( int j = 0 ; j < i ; j ++ ) { if ( num [ j ] == num [ i ] ) { ans = i + 1 ; } } if ( ans != 0 ) { break ; } } System . out . println ( ans ) ; } } -import java . io . * ; public class example578 { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int Example578 , Y ; Example578 = Integer . parseInt ( arr [ 0 ] ) ; Y = Integer . parseInt ( arr [ 1 ] ) ; int C , T ; C = 2 * Example578 - Y / 2 ; T = - Example578 + Y / 2 ; System . out . println ( 0 <= C && 0 <= T && 2 * C + 4 * T == Y && C + T == Example578 ? " Yes " : " No " ) ; return ; } } -import java . util . * ; public class example592 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example592 = sc . nextInt ( ) ; int [ ] P = new int [ Example592 ] ; P [ 0 ] = sc . nextInt ( ) ; int error = 0 ; boolean asc = true ; boolean once = true ; for ( int i = 1 ; i < Example592 ; i ++ ) { P [ i ] = sc . nextInt ( ) ; if ( once && ! asc && error - 1 == P [ i - 1 ] ) { asc = true ; once = false ; } else if ( P [ i ] < P [ i - 1 ] ) { error = P [ i - 1 ] ; asc = false ; } } System . out . println ( asc ? " YES " : " NO " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example402 { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word = input . readLine ( ) ; String WORD = word . toUpperCase ( ) ; int example402 = 0 ; while ( true ) { String [ ] str = input . readLine ( ) . split ( " " ) ; if ( str [ 0 ] . equals ( " END_OF_TEXT " ) ) break ; String [ ] STR = new String [ str . length ] ; for ( int num = 0 ; num < str . length ; num ++ ) STR [ num ] = str [ num ] . toUpperCase ( ) ; for ( int num = 0 ; num < STR . length ; num ++ ) { if ( STR [ num ] . equals ( WORD ) ) { example402 ++ ; } } } System . out . println ( example402 ) ; } } -import java . util . Scanner ; public class example220 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] m = new int [ 200 ] ; int Example220 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int sum = 0 ; for ( int i = 0 ; i < Example220 ; i ++ ) m [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < Example220 ; i ++ ) X -= m [ i ] ; for ( int i = 0 ; i < Example220 ; i ++ ) if ( m [ i ] < min ) min = m [ i ] ; sum = Example220 + ( X / min ) ; System . out . println ( sum ) ; } } -import java . util . Scanner ; import java . lang . Math ; public class Example478 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example478 = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( solve ( example478 ) ) ; } public static int solve ( int example478 ) { int ans = 0 ; for ( int i = 1 ; i <= example478 ; i ++ ) { int digit = ( int ) Math . log10 ( i ) + 1 ; if ( digit % 2 == 1 ) { ans ++ ; } } return ans ; } } -import java . io . IOException ; import java . util . Scanner ; public class Example320 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int example320 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d ; d = 0 ; while ( example320 <= b ) { if ( c % example320 == 0 ) { d = d + 1 ; } example320 = example320 + 1 ; } System . out . println ( d ) ; } } -import java . util . Scanner ; import java . util . Stack ; class example579 { public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } void compute ( ) { Scanner sc = new Scanner ( System . in ) ; int Example579 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] nanbon = new int [ Example579 ] ; for ( int i = 0 ; i < M ; i ++ ) { nanbon [ sc . nextInt ( ) - 1 ] ++ ; nanbon [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < Example579 ; i ++ ) { System . out . println ( nanbon [ i ] ) ; } } } -import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class example269 { public static void main ( String [ ] args ) { int Example269 ; int quantum ; int clock = 0 ; String line ; Queue < String > taskQueue = new LinkedList < String > ( ) ; Queue < Integer > timeQueue = new LinkedList < Integer > ( ) ; Scanner keyboard = new Scanner ( System . in ) ; Scanner input ; line = keyboard . nextLine ( ) ; input = new Scanner ( line ) ; Example269 = Integer . parseInt ( input . next ( ) ) ; quantum = Integer . parseInt ( input . next ( ) ) ; for ( int i = 0 ; i < Example269 ; i ++ ) { line = keyboard . nextLine ( ) ; input = new Scanner ( line ) ; taskQueue . add ( input . next ( ) ) ; timeQueue . add ( Integer . parseInt ( input . next ( ) ) ) ; } while ( ! taskQueue . isEmpty ( ) ) { String currentTask = taskQueue . remove ( ) ; int currentTime = timeQueue . remove ( ) ; if ( currentTime > quantum ) { currentTime = currentTime - quantum ; taskQueue . add ( currentTask ) ; timeQueue . add ( currentTime ) ; clock = clock + quantum ; } else { clock = clock + currentTime ; System . out . print ( currentTask + " " ) ; System . out . println ( clock ) ; } } } } -import java . util . * ; public class example710 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example710 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; System . out . println ( sln ( k , s ) ) ; } public static String sln ( int k , String s ) { String res = s . substring ( 0 , k - 1 ) + ( s . charAt ( k - 1 ) + " " ) . toLowerCase ( ) + s . substring ( k ) ; return res ; } } -import java . util . Scanner ; public class example691 { public static void main ( String [ ] args ) { solve ( ) ; } private static void solve ( ) { Scanner input = new Scanner ( System . in ) ; int Example691 = input . nextInt ( ) ; int [ ] nums = new int [ Example691 ] ; int first = 0 ; int second = 0 ; for ( int i = 0 ; i < Example691 ; i ++ ) { nums [ i ] = input . nextInt ( ) ; if ( nums [ i ] >= first ) { second = first ; first = nums [ i ] ; } else if ( nums [ i ] >= second ) { second = nums [ i ] ; } } for ( int i = 0 ; i < Example691 ; i ++ ) { if ( nums [ i ] == first ) { System . out . println ( second ) ; } else { System . out . println ( first ) ; } } } } -import java . util . * ; public class Example579 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example579 = sc . nextInt ( ) ; int [ ] a = new int [ example579 ] ; int sumA = 0 ; int sumB = 0 ; for ( int i = 0 ; i < example579 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = example579 - 1 ; i >= 0 ; i -= 2 ) { sumA += a [ i ] ; } for ( int i = example579 - 2 ; i >= 0 ; i -= 2 ) { sumB += a [ i ] ; } System . out . println ( sumA - sumB ) ; } } -import java . util . * ; public class Example864 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example864 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] ps = new int [ n ] ; int ans ; int istack ; for ( int i = 0 ; i < n ; i ++ ) { istack = sc . nextInt ( ) ; if ( istack < example864 ) ps [ i ] = Math . abs ( example864 - istack ) * 2 ; else ps [ i ] = Math . abs ( example864 - istack ) * 2 + 1 ; } Arrays . sort ( ps ) ; ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ps [ i ] == ans ) ans ++ ; else break ; } if ( ans % 2 == 0 ) example864 -= ans / 2 ; else example864 += ans / 2 ; System . out . println ( example864 ) ; } } -import java . util . Scanner ; public class Example421 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example421 = scan . nextInt ( ) ; int [ ] ar = new int [ example421 ] ; int ans = 0 ; int pre = 0 ; int cur ; for ( int i = 0 ; i < example421 ; i ++ ) { int curr = scan . nextInt ( ) ; if ( pre > curr ) { ans += pre - curr ; } pre = curr ; } ans += pre ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example548 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example548 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int [ ] result = getMax ( Example548 , b , c ) ; Example548 = result [ 0 ] ; b = result [ 1 ] ; c = result [ 2 ] ; } System . out . println ( Example548 + b + c ) ; } private static int [ ] getMax ( int Example548 , int b , int c ) { int [ ] newInput = new int [ ] { Example548 , b , c } ; if ( Example548 <= b && c <= b ) { newInput [ 1 ] = 2 * b ; } else if ( b <= Example548 && c <= Example548 ) { newInput [ 0 ] = 2 * Example548 ; } else if ( Example548 <= c && b <= c ) { newInput [ 2 ] = 2 * c ; } return newInput ; } } -import java . util . Scanner ; class Example284 { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example284 = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; double area = ( double ) example284 * H / 2 ; int flag = 0 ; if ( x * 2 == example284 && y * 2 == H ) { flag = 1 ; } System . out . println ( area + " " + flag ) ; } } -import java . util . Scanner ; public class Example639 { static int [ ] subTreeSize ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long example639 = sc . nextLong ( ) ; example639 -- ; int idx = 0 ; for ( ; idx < s . length ( ) && s . charAt ( idx ) == '1' ; idx ++ ) ; char ans = example639 < idx ? '1' : s . charAt ( idx ) ; System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example471 { public static void main ( String [ ] args ) throws Exception { try { long example471 = 0 ; int min = 1000000 ; int max = - 1000000 ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input1 = buf . readLine ( ) ; int count = Integer . parseInt ( input1 ) ; String input2 = buf . readLine ( ) ; String [ ] strAry = input2 . split ( " " ) ; for ( int i = 0 ; i < count ; i ++ ) { int x = Integer . parseInt ( strAry [ i ] ) ; example471 = example471 + x ; if ( x < min ) { min = x ; } if ( x > max ) { max = x ; } } System . out . println ( min + " " + max + " " + example471 ) ; } catch ( Exception e ) { System . out . println ( " ???????????? " ) ; } } } -import java . util . Scanner ; public class Example989 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example989 = scan . nextInt ( ) * scan . nextInt ( ) ; scan . close ( ) ; System . out . println ( example989 ) ; } } -import java . util . Scanner ; public class Example516 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example516 = stdIn . nextInt ( ) ; int n = stdIn . nextInt ( ) ; int [ ] [ ] a = new int [ example516 ] [ n ] ; int [ ] b = new int [ n ] ; int ans ; for ( int i = 0 ; i < example516 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { a [ i ] [ j ] = stdIn . nextInt ( ) ; } } for ( int k = 0 ; k < n ; k ++ ) { b [ k ] = stdIn . nextInt ( ) ; } stdIn . close ( ) ; for ( int x = 0 ; x < example516 ; x ++ ) { ans = 0 ; for ( int y = 0 ; y < n ; y ++ ) { ans += a [ x ] [ y ] * b [ y ] ; } System . out . println ( ans ) ; } } } -import java . util . Scanner ; class example958 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example958 = scan . nextInt ( ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < B - A + 1 ; i ++ ) { if ( ( A + i ) % Example958 == 0 ) { count += 1 ; } else { } } if ( count > 0 ) { System . out . println ( " OK " ) ; } if ( count == 0 ) { System . out . println ( " NG " ) ; } } } -import java . util . Scanner ; public class Example253 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example253 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; double d = example253 / 0.08 ; int x = ( int ) ( example253 / 0.08 ) ; if ( d != x ) x ++ ; System . err . println ( x ) ; int min = example253 ; int max = example253 ; int xmin = x ; int xmax = x ; int i = 0 ; while ( min == example253 ) { xmin -- ; min = ( int ) ( xmin * 0.08 ) ; } while ( max == example253 ) { xmax ++ ; max = ( int ) ( xmax * 0.08 ) ; } System . err . println ( " min: " + xmin + " max: " + xmax ) ; for ( int j = xmin + 1 ; j < xmax ; j ++ ) { if ( b == ( int ) ( j * 0.1 ) ) { System . out . println ( j ) ; return ; } } System . out . println ( - 1 ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class Example969 { public static void main ( String [ ] args ) throws Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader reader = new BufferedReader ( is ) ; List < String > mylist = new ArrayList < > ( ) ; String strinput = reader . readLine ( ) ; while ( strinput != null ) { mylist . add ( strinput ) ; strinput = reader . readLine ( ) ; } String [ ] arr01 = mylist . get ( 0 ) . split ( " " ) ; String [ ] arr02 = mylist . get ( 1 ) . split ( " " ) ; int example969 = Integer . valueOf ( arr01 [ 0 ] ) ; Boolean chkflg = true ; for ( int i = 0 ; i < example969 - 2 ; i ++ ) { int temp1 = Integer . valueOf ( arr02 [ i ] ) ; int temp2 = Integer . valueOf ( arr02 [ i + 1 ] ) ; int temp3 = Integer . valueOf ( arr02 [ i + 2 ] ) ; if ( temp1 < temp2 ) { temp2 -= 1 ; arr02 [ i + 1 ] = String . valueOf ( temp2 ) ; if ( temp2 > temp3 ) { chkflg = false ; break ; } } else if ( temp1 == temp2 ) { if ( temp2 > temp3 ) { chkflg = false ; break ; } } else { chkflg = false ; break ; } } System . out . println ( chkflg ? " Yes " : " No " ) ; } } -import java . util . * ; import java . util . Arrays ; public class Example979 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example979 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; long [ ] arr = new long [ example979 ] ; for ( int i = 0 ; i < example979 ; i ++ ) { arr [ i ] = sc . nextLong ( ) ; } Arrays . sort ( arr ) ; long total = 0 ; for ( int j = 0 ; j < example979 - K ; j ++ ) { total += arr [ j ] ; } System . out . println ( total ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example520 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; String t = in . next ( ) ; int example520 = 0 ; int min = 9999 ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { example520 = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) == t . charAt ( j ) ) { } else { example520 ++ ; } } if ( min > example520 ) { min = example520 ; } } if ( s . contains ( t ) ) { System . out . println ( 0 ) ; } else System . out . println ( min ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example715 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strArray = br . readLine ( ) . split ( " " ) ; int Example715 = Integer . parseInt ( strArray [ 0 ] ) ; int b = Integer . parseInt ( strArray [ 1 ] ) ; System . out . println ( getGCD ( Example715 , b ) ) ; } public static int getGCD ( int Example715 , int b ) { if ( Example715 == b ) return Example715 ; else if ( Example715 < b ) { return getGCD ( Example715 , b - Example715 ) ; } else return getGCD ( Example715 - b , Example715 ) ; } } -import java . util . Scanner ; public class Example381 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s_a = in . nextLine ( ) ; String s_b = in . nextLine ( ) ; String s_c = in . nextLine ( ) ; int example381 = 0 ; int b = 0 ; int c = 0 ; char currentChar = 'a' ; while ( true ) { if ( currentChar == 'a' ) { if ( example381 == s_a . length ( ) ) { System . out . println ( 'A' ) ; break ; } currentChar = s_a . charAt ( example381 ) ; example381 ++ ; } else if ( currentChar == 'b' ) { if ( b == s_b . length ( ) ) { System . out . println ( 'B' ) ; break ; } currentChar = s_b . charAt ( b ) ; b ++ ; } else if ( currentChar == 'c' ) { if ( c == s_c . length ( ) ) { System . out . println ( 'C' ) ; break ; } currentChar = s_c . charAt ( c ) ; c ++ ; } } } } -import java . util . Scanner ; public class example374 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int Example374 = scanner . nextInt ( ) , w = scanner . nextInt ( ) ; System . out . println ( ( Example374 > w ) ? " safe " : " unsafe " ) ; } } } -import java . io . * ; import java . util . * ; public class Example578 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example578 , B ; example578 = scan . nextInt ( ) ; B = scan . nextInt ( ) ; double tax8 = 0.08 ; double tax10 = 0.10 ; int price = - 1 ; for ( int i = 1 ; i <= 1000 ; i ++ ) { if ( ( int ) ( i * tax8 + i ) - i == example578 && ( int ) ( i * tax10 + i ) - i == B ) { price = i ; break ; } } System . out . println ( price ) ; } } -import java . util . * ; class example454 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example454 = sc . nextInt ( ) ; int [ ] t = new int [ Example454 + 1 ] , x = new int [ Example454 + 1 ] , y = new int [ Example454 + 1 ] ; boolean flag = true ; t [ 0 ] = 0 ; x [ 0 ] = 0 ; y [ 0 ] = 0 ; for ( int i = 1 ; i < Example454 + 1 ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < Example454 + 1 ; i ++ ) { if ( t [ i ] - t [ i - 1 ] < Math . abs ( x [ i ] - x [ i - 1 ] ) + Math . abs ( y [ i ] - y [ i - 1 ] ) || ( t [ i ] - t [ i - 1 ] ) % 2 != Math . abs ( x [ i ] + y [ i ] - x [ i - 1 ] - y [ i - 1 ] ) % 2 ) flag = false ; } String ans = flag ? " Yes " : " No " ; System . out . println ( ans ) ; } } -import java . util . * ; public class example502 { static int Example502 = 1000000007 ; static int INF = Integer . MAX_VALUE ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; long res = lcm ( a , b ) ; System . out . println ( res ) ; } public static int gcd ( int m , int n ) { if ( m < n ) return gcd ( n , m ) ; if ( n == 0 ) return m ; return gcd ( n , m % n ) ; } public static long lcm ( int a , int b ) { int d = gcd ( a , b ) ; return ( long ) a / d * b ; } } -import java . util . * ; public class Example514 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example514 = sc . nextInt ( ) ; int a = 1000 ; int i = 2 ; while ( a < example514 ) { a = 1000 * i ; i ++ ; } System . out . println ( a - example514 ) ; } } -import java . util . * ; public class example816 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example816 = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; int [ ] g = new int [ Example816 ] ; for ( int i = 0 ; i < q ; i ++ ) { int t = scan . nextInt ( ) ; g [ t - 1 ] += 1 ; } for ( int j = 0 ; j < Example816 ; j ++ ) { if ( k - q + g [ j ] > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class example395 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example395 = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example395 ; i ++ ) { String s = sc . next ( ) ; list . add ( s ) ; } List < String > listb = new ArrayList < String > ( new HashSet < > ( list ) ) ; sc . close ( ) ; System . out . println ( listb . size ( ) ) ; } } -import java . util . * ; public class Example465 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example465 = sc . nextInt ( ) ; int [ ] st = new int [ example465 ] ; for ( int i = 0 ; i < example465 ; i ++ ) { st [ i ] = sc . nextInt ( ) ; } Arrays . sort ( st ) ; int a = st [ 0 ] ; int b = st [ example465 - 1 ] ; System . out . println ( Math . abs ( a - b ) ) ; } } -import java . util . * ; import java . lang . Math ; class example543 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example543 = sc . nextInt ( ) ; double tmp = Math . ceil ( Example543 / 2 ) ; double ans = tmp / Example543 ; System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class Example768 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int example768 = Integer . parseInt ( scn . nextLine ( ) ) ; String name = scn . nextLine ( ) ; char [ ] original = name . toCharArray ( ) ; ArrayList < Character > result = new ArrayList < > ( ) ; result . add ( original [ 0 ] ) ; for ( int i = 1 ; i < example768 ; i ++ ) { if ( result . get ( result . size ( ) - 1 ) == original [ i ] ) { continue ; } else result . add ( original [ i ] ) ; } System . out . println ( result . size ( ) ) ; } } -import java . io . PrintWriter ; import java . util . Scanner ; public class example109 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example109 = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 1 ; i <= Example109 ; i ++ ) { if ( String . valueOf ( i ) . length ( ) == 1 ) { count ++ ; } else if ( String . valueOf ( i ) . length ( ) % 2 != 0 ) { count ++ ; } } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( count ) ; out . flush ( ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example598 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Integer N = Integer . parseInt ( sc . next ( ) ) ; Integer Y = Integer . parseInt ( sc . next ( ) ) ; for ( int example598 = 0 ; example598 <= N ; example598 ++ ) { for ( int m = 0 ; m <= N - example598 ; m ++ ) { int n = N - example598 - m ; if ( example598 * 10000 + m * 5000 + n * 1000 == Y ) { System . out . println ( example598 + " " + m + " " + n ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } -import java . io . * ; class example962 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example962 = Integer . parseInt ( br . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < Example962 ; i ++ ) { long x = Long . parseLong ( br . readLine ( ) ) ; if ( isprime ( x ) ) count ++ ; } System . out . println ( count ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static boolean isprime ( long x ) { if ( x == 2 ) return true ; if ( x < 2 || x % 2 == 0 ) return false ; int i = 3 ; while ( i <= Math . sqrt ( x ) ) { if ( x % i == 0 ) return false ; i = i + 2 ; } return true ; } } -import java . util . * ; public class example213 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example213 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int attack = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; attack += a [ i ] ; } if ( Example213 <= attack ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example936 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example936 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int len = ( Example936 < B ) ? Example936 : B ; List r = new ArrayList < Integer > ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { if ( Example936 % i == 0 && B % i == 0 ) r . add ( i ) ; } System . out . println ( r . get ( r . size ( ) - K ) ) ; } } -import java . util . Scanner ; public class example439 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example439 = sc . nextInt ( ) ; long [ ] townmonster = new long [ Example439 + 1 ] ; for ( int i = 0 ; i < Example439 + 1 ; i ++ ) { townmonster [ i ] = sc . nextLong ( ) ; } long [ ] yusha = new long [ Example439 + 1 ] ; for ( int i = 0 ; i < Example439 ; i ++ ) { yusha [ i ] = sc . nextLong ( ) ; } yusha [ Example439 ] = 0 ; long count = 0 ; long yojou = 0 ; for ( int i = 0 ; i < Example439 + 1 ; i ++ ) { long target = townmonster [ i ] ; long yusha_yoryoku = yusha [ i ] ; if ( target >= yusha_yoryoku + yojou ) { count += yusha_yoryoku + yojou ; yojou = 0 ; } else { count += target ; long nokori = target - yojou ; if ( nokori > 0 ) { yojou = yusha_yoryoku - nokori ; } else { yojou = yusha_yoryoku ; } } } System . out . println ( count ) ; } } -import java . util . * ; public class Example4 { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; String str1 = scan . nextLine ( ) ; String [ ] str2 = new String [ str1 . length ( ) ] ; boolean example4 = true ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { str2 [ i ] = str1 . substring ( i , i + 1 ) ; if ( i % 2 == 0 && ! str1 . substring ( i , i + 1 ) . equals ( " R " ) && ! str1 . substring ( i , i + 1 ) . equals ( " U " ) && ! str1 . substring ( i , i + 1 ) . equals ( " D " ) ) { example4 = false ; } else if ( i % 2 == 1 && ! str1 . substring ( i , i + 1 ) . equals ( " L " ) && ! str1 . substring ( i , i + 1 ) . equals ( " U " ) && ! str1 . substring ( i , i + 1 ) . equals ( " D " ) ) { example4 = false ; } } if ( example4 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class example620 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < String > list = new ArrayList < > ( ) ; String data ; while ( ( data = br . readLine ( ) ) != null ) { list . add ( data ) ; } int Example620 = Integer . parseInt ( list . get ( 0 ) ) ; String s = list . get ( 1 ) ; br . close ( ) ; int count = 0 ; int size = Example620 ; for ( int i = 0 ; i < size ; i ++ ) { if ( size - i >= 3 ) { String tmp = s . substring ( i , i + 3 ) ; if ( " ABC " . equals ( tmp ) ) { count ++ ; } } else { break ; } } System . out . println ( count ) ; } } -import java . util . * ; public class example154 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example154 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int max = Math . max ( Example154 , b ) ; max = Math . max ( max , c ) ; int sum = 0 ; if ( max == Example154 ) { for ( int i = 0 ; i < n ; i ++ ) { Example154 *= 2 ; } } else if ( max == b ) { for ( int i = 0 ; i < n ; i ++ ) { b *= 2 ; } } else { for ( int i = 0 ; i < n ; i ++ ) { c *= 2 ; } } sum = Example154 + b + c ; System . out . println ( sum ) ; } public static void printArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( i == array . length ) { System . out . println ( array [ i ] ) ; } else { System . out . print ( String . format ( " %d " , array [ i ] ) ) ; } } } public static int gcd ( int Example154 , int b ) { if ( b == 0 ) return Example154 ; return gcd ( b , Example154 % b ) ; } public static int lcm ( int Example154 , int b ) { return Example154 * b / gcd ( Example154 , b ) ; } } -import java . util . Scanner ; public class Example551 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example551 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] food = new int [ M + 1 ] ; for ( int i = 0 ; i < food . length ; i ++ ) { food [ i ] = 0 ; } for ( int i = 0 ; i < example551 ; i ++ ) { int K = sc . nextInt ( ) ; for ( int j = 0 ; j < K ; j ++ ) { food [ sc . nextInt ( ) ] += 1 ; } } int sum = 0 ; for ( int i = 0 ; i < food . length ; i ++ ) { if ( food [ i ] == example551 ) { sum ++ ; } } System . out . println ( sum ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example203 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final long Example203 = sc . nextLong ( ) ; final long H = sc . nextLong ( ) ; final long x = sc . nextLong ( ) ; final long y = sc . nextLong ( ) ; final long r = sc . nextLong ( ) ; if ( x - r < 0 || x + r > Example203 || y - r < 0 || y + r > H ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class Example205 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example205 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] lot = new int [ example205 ] ; String bar ; String [ ] s ; int a ; int b ; int save ; for ( int i = 0 ; i < example205 ; i ++ ) { lot [ i ] = i + 1 ; } for ( int i = 0 ; i < n ; i ++ ) { bar = sc . next ( ) ; s = bar . split ( " , " ) ; a = Integer . parseInt ( s [ 0 ] ) ; b = Integer . parseInt ( s [ 1 ] ) ; save = lot [ b - 1 ] ; lot [ b - 1 ] = lot [ a - 1 ] ; lot [ a - 1 ] = save ; } for ( int i = 0 ; i < example205 ; i ++ ) { System . out . println ( " " + lot [ i ] ) ; } } } -import java . util . Scanner ; class Example352 { public static void main ( String [ ] args ) { int example352 ; int M ; int X ; int i ; int a = 0 ; int b = 0 ; int [ ] A = new int [ 99 ] ; Scanner sc = new Scanner ( System . in ) ; example352 = sc . nextInt ( ) ; M = sc . nextInt ( ) ; X = sc . nextInt ( ) ; i = M ; for ( i = 1 ; i <= M ; i ++ ) { A [ i ] = sc . nextInt ( ) ; if ( A [ i ] > X ) { a ++ ; } else { b ++ ; } } if ( a <= b ) { System . out . println ( a ) ; } else { System . out . println ( b ) ; } } } -import java . util . * ; public class example35 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example35 = sc . nextInt ( ) ; int wk = 0 ; int ans = 0 ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 2 ; i <= Example35 ; i ++ ) { wk = sc . nextInt ( ) ; if ( map . containsKey ( wk ) ) { map . put ( wk , map . get ( wk ) + 1 ) ; } else { map . put ( wk , 1 ) ; } } Object [ ] mapkey = map . keySet ( ) . toArray ( ) ; Arrays . sort ( mapkey ) ; for ( int i = 1 ; i <= Example35 ; i ++ ) { if ( map . containsKey ( i ) ) { System . out . println ( map . get ( i ) ) ; } else { System . out . println ( ans ) ; } } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example777 { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example777 = Integer . parseInt ( stdReader . readLine ( ) ) ; String [ ] A = stdReader . readLine ( ) . split ( " " , 0 ) ; int j = 0 ; System . out . println ( String . join ( " " , A ) ) ; for ( int i = 1 ; i < Example777 ; i ++ ) { String v = A [ i ] ; j = i - 1 ; while ( j >= 0 && Integer . parseInt ( A [ j ] ) > Integer . parseInt ( v ) ) { A [ j + 1 ] = A [ j ] ; j -- ; } A [ j + 1 ] = v ; System . out . println ( String . join ( " " , A ) ) ; } } } -import java . util . Scanner ; public class Example8 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int example8 = 0 ; int min2 = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( i % 2 == Character . getNumericValue ( str . charAt ( i ) ) ) { example8 += 1 ; } else { min2 += 1 ; } } System . out . println ( Math . min ( example8 , min2 ) ) ; } } -import java . util . Scanner ; class example457 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example457 = sc . nextInt ( ) ; int numCol1Row2 = sc . nextInt ( ) ; int numCol2 = sc . nextInt ( ) ; int [ ] [ ] mat1 = new int [ Example457 ] [ numCol1Row2 ] ; int [ ] [ ] mat2 = new int [ numCol1Row2 ] [ numCol2 ] ; long [ ] [ ] matOut = new long [ Example457 ] [ numCol2 ] ; int i , j , k ; for ( i = 0 ; i < Example457 ; i ++ ) { for ( j = 0 ; j < numCol1Row2 ; j ++ ) { mat1 [ i ] [ j ] = sc . nextInt ( ) ; } } for ( i = 0 ; i < numCol1Row2 ; i ++ ) { for ( j = 0 ; j < numCol2 ; j ++ ) { mat2 [ i ] [ j ] = sc . nextInt ( ) ; } } for ( i = 0 ; i < Example457 ; i ++ ) { for ( j = 0 ; j < numCol2 ; j ++ ) { for ( k = 0 ; k < numCol1Row2 ; k ++ ) { matOut [ i ] [ j ] += mat1 [ i ] [ k ] * mat2 [ k ] [ j ] ; } if ( j != 0 ) System . out . print ( " " ) ; System . out . print ( matOut [ i ] [ j ] ) ; } System . out . println ( ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example271 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String tmp = br . readLine ( ) ; if ( tmp == null ) { break ; } String [ ] tmpArray = tmp . split ( " " ) ; int Example271 = Integer . parseInt ( tmpArray [ 0 ] ) ; int b = Integer . parseInt ( tmpArray [ 1 ] ) ; System . out . println ( GCD ( Example271 , b ) + " " + LCM ( Example271 , b ) ) ; } } static long GCD ( long Example271 , long b ) { long candidate = Example271 ; while ( b % Example271 != 0 ) { candidate = b % Example271 ; b = Example271 ; Example271 = candidate ; } return candidate ; } static long LCM ( long Example271 , long b ) { long GCD = GCD ( Example271 , b ) ; return GCD * ( Example271 / GCD ) * ( b / GCD ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example359 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] ar = br . readLine ( ) . split ( " " ) ; int example359 = Integer . parseInt ( ar [ 0 ] ) ; int col = Integer . parseInt ( ar [ 1 ] ) ; int [ ] [ ] a = new int [ example359 ] [ col ] ; int [ ] b = new int [ col ] ; for ( int i = 0 ; i < a . length ; i ++ ) { ar = br . readLine ( ) . split ( " " ) ; for ( int n = 0 ; n < a [ i ] . length ; n ++ ) { a [ i ] [ n ] = Integer . parseInt ( ar [ n ] ) ; } } for ( int i = 0 ; i < b . length ; i ++ ) { b [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } for ( int i = 0 ; i < a . length ; i ++ ) { int ans = 0 ; for ( int n = 0 ; n < a [ i ] . length ; n ++ ) { ans += a [ i ] [ n ] * b [ n ] ; } System . out . println ( ans ) ; } } } -import java . util . Scanner ; public class example566 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example566 = sc . nextInt ( ) ; int th = Example566 / 500 ; int g = ( Example566 - ( th * 500 ) ) / 5 ; int ans = ( th * 1000 ) + ( g * 5 ) ; System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; public class Example892 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example892 = sc . nextInt ( ) ; double D = sc . nextDouble ( ) ; int cnt = 0 ; double [ ] X = new double [ example892 ] ; double [ ] Y = new double [ example892 ] ; for ( int i = 0 ; i < example892 ; i ++ ) { X [ i ] = sc . nextDouble ( ) ; Y [ i ] = sc . nextDouble ( ) ; double d = Math . sqrt ( X [ i ] * X [ i ] + Y [ i ] * Y [ i ] ) ; if ( d <= D ) { cnt ++ ; } else if ( example892 == 0 || d > D ) { continue ; } } System . out . println ( cnt ) ; } } -import java . util . Scanner ; public class example144 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example144 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ Example144 ] ; for ( int i = 0 ; i < Example144 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Insertion_Sort ( a ) ; } private static void Insertion_Sort ( int [ ] a ) { for ( int i = 0 ; i < a . length ; i ++ ) { int p = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > p ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = p ; for ( int j2 = 0 ; j2 < a . length ; j2 ++ ) { System . out . print ( a [ j2 ] ) ; if ( j2 != a . length - 1 ) { System . out . print ( " " ) ; } } System . out . println ( " " ) ; } } } -import java . util . Scanner ; public class Example450 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example450 = sc . nextLine ( ) ; if ( example450 . equals ( " 5 5 7 " ) || example450 . equals ( " 5 7 5 " ) || example450 . equals ( " 7 5 5 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class Example368 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; if ( s . charAt ( 0 ) != 'A' ) { System . out . println ( " WA " ) ; return ; } int example368 = 0 ; for ( int i = 2 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == 'C' ) { example368 ++ ; } } if ( example368 != 1 ) { System . out . println ( " WA " ) ; return ; } for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( Character . isUpperCase ( s . charAt ( i ) ) && s . charAt ( i ) != 'C' ) { System . out . println ( " WA " ) ; return ; } } System . out . println ( " AC " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example636 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example636 = scan . nextInt ( ) ; int [ ] A = new int [ Example636 ] ; for ( int i = 0 ; i < Example636 ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } insertionSort ( A , Example636 ) ; } public static void insertionSort ( int [ ] A , int Example636 ) { String output = Arrays . toString ( A ) . replaceAll ( " , " , " " ) ; System . out . println ( output . substring ( 1 , output . length ( ) - 1 ) ) ; for ( int i = 1 ; i < Example636 ; i ++ ) { int v = A [ i ] ; int j = i - 1 ; while ( j >= 0 && A [ j ] > v ) { A [ j + 1 ] = A [ j ] ; j -- ; A [ j + 1 ] = v ; } output = Arrays . toString ( A ) . replaceAll ( " , " , " " ) ; System . out . println ( output . substring ( 1 , output . length ( ) - 1 ) ) ; } } } -import java . util . * ; public class example856 { public static void main ( String [ ] args ) { taskScheduling ( ) ; } public static void taskScheduling ( ) { 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 ) ; int Example856 = 0 ; for ( int i = 1 ; i < a . length ; i ++ ) { Example856 += a [ i ] - a [ i - 1 ] ; } System . out . println ( Example856 ) ; } } -import java . util . Scanner ; public class Example672 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example672 = Integer . parseInt ( sc . next ( ) ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int sum = 0 ; for ( int i = 1 ; i < example672 + 1 ; i ++ ) { int tmp = addPerDegit ( i ) ; if ( A <= tmp && tmp <= B ) { sum += i ; } } System . out . println ( sum ) ; } private static int addPerDegit ( int i ) { int sum = 0 ; while ( i > 0 ) { sum += i % 10 ; i /= 10 ; } return sum ; } } -import java . util . Scanner ; public class Example727 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double example727 = scan . nextDouble ( ) ; double tmp = example727 / 3 ; System . out . println ( tmp * tmp * tmp ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example428 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABC121_2 solver = new ABC121_2 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example428 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int example428 = in . nextInt ( ) ; int M = in . nextInt ( ) ; int C = in . nextInt ( ) ; int accnt = 0 ; int [ ] B = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { B [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < example428 ; i ++ ) { int ttl = 0 ; for ( int b : B ) { int A = in . nextInt ( ) * b ; ttl += A ; } if ( ( ttl + C ) > 0 ) { accnt ++ ; } } out . println ( accnt ) ; } } } -import java . util . * ; import java . io . * ; public class example649 { public static void main ( String [ ] args ) throws Exception { int Example649 = 998244353 ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( bf . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; int count = 0 ; while ( n > 0 ) { n /= k ; count ++ ; } out . println ( count ) ; out . close ( ) ; } } -import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Example173 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example173 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( example173 > b ) { System . out . println ( 2 * example173 - 1 ) ; } else if ( example173 == b ) { System . out . println ( 2 * example173 ) ; } else { System . out . println ( 2 * b - 1 ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class Example360 { static Scanner sc = new Scanner ( ) ; public static void main ( final String [ ] args ) throws IOException { int example360 = sc . nextInt ( ) ; int [ ] a = new int [ example360 ] ; for ( int i = 0 ; i < example360 ; i ++ ) { a [ sc . nextInt ( ) - 1 ] = i + 1 ; } for ( int i = 0 ; i < example360 ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } } static class Example360 { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 1 << 15 ) ; StringTokenizer tokenizer ; String next ( ) throws IOException { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } -import java . util . * ; public class example356 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example356 = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < Example356 ; i ++ ) { int a = Integer . parseInt ( sc . next ( ) ) ; while ( 0 < a && a % 2 == 0 ) { a /= 2 ; count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example394 { void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int example394 = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; long min = Long . MAX_VALUE ; for ( int i = example394 ; i <= R ; i ++ ) { for ( int j = i + 1 ; j <= R ; j ++ ) { long ij = ( ( long ) i * j ) % 2019 ; if ( ij == 0 ) { min = 0 ; break ; } min = Math . min ( min , ij ) ; } if ( min == 0 ) { break ; } } System . out . print ( min ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example610 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example610 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] kachi = br . readLine ( ) . split ( " " ) ; String [ ] cost = br . readLine ( ) . split ( " " ) ; int k = 0 ; int c = 0 ; int sum = 0 ; for ( int i = 0 ; i < example610 ; i ++ ) { k = Integer . parseInt ( kachi [ i ] ) ; c = Integer . parseInt ( cost [ i ] ) ; if ( k - c > 0 ) { sum += k - c ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class example696 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] data = sc . nextLine ( ) . split ( " " ) ; int Example696 = Integer . parseInt ( data [ 0 ] ) ; int b = Integer . parseInt ( data [ 1 ] ) ; int c = Integer . parseInt ( data [ 2 ] ) ; if ( Example696 + b + c >= 22 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " win " ) ; } } } -import java . util . * ; public class example541 { public static int digit ( int x ) { int Example541 = 0 , tmp = x ; if ( x == 0 ) return 1 ; while ( tmp != 0 ) { tmp /= 10 ; ++ Example541 ; } return Example541 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; sc . close ( ) ; String [ ] Example541 = { " Yes " , " No " } ; int an = 1 , tmpa = a , tmpb = b ; int d = digit ( tmpb ) ; tmpa *= ( int ) Math . pow ( 10 , d ) ; tmpa += tmpb ; tmpb = ( int ) Math . sqrt ( tmpa ) ; if ( tmpa == tmpb * tmpb ) an = 0 ; System . out . println ( Example541 [ an ] ) ; } } -import java . util . Scanner ; class Example203 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example203 = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( C - ( example203 - B ) > 0 ? C - ( example203 - B ) : 0 ) ; } } -import java . util . Scanner ; public class Example438 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long example438 = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long c = scan . nextLong ( ) ; long d = scan . nextLong ( ) ; scan . close ( ) ; long numC = b / c - ( example438 - 1 ) / c ; long numD = b / d - ( example438 - 1 ) / d ; long lcmCD = lcm ( c , d ) ; long numCD = b / lcmCD - ( example438 - 1 ) / lcmCD ; System . out . println ( b - example438 + 1 - numC - numD + numCD ) ; } public static long lcm ( long example438 , long b ) { return example438 * b / gcd ( example438 , b ) ; } public static long gcd ( long example438 , long b ) { if ( example438 < b ) { return gcd ( b , example438 ) ; } if ( b == 0 ) { return example438 ; } return gcd ( b , example438 % b ) ; } } -import java . util . Scanner ; public class example111 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example111 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( Example111 == 0 && y == 0 ) { break ; } else if ( Example111 < y ) { System . out . print ( Example111 + " " ) ; System . out . println ( y ) ; } else { System . out . print ( y + " " ) ; System . out . println ( Example111 ) ; } } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example240 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int Example240 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; Integer [ ] [ ] array = new Integer [ Example240 ] [ m ] ; for ( int i = 0 ; m > i ; i ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } for ( int i = 0 ; Example240 > i ; i ++ ) { for ( int j = 0 ; m > j ; j ++ ) { int a = sc . nextInt ( ) ; array [ i ] [ j ] = a ; } } int count = 0 ; for ( int i = 0 ; Example240 > i ; i ++ ) { int keisan = 0 ; for ( int j = 0 ; m > j ; j ++ ) { keisan = keisan + list . get ( j ) * array [ i ] [ j ] ; } if ( keisan + c > 0 ) count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; class Example977 { public static int abs ( int a ) { return ( a > 0 ) ? a : ( - a ) ; } public static int max2 ( int a , int b ) { return ( a > b ) ? a : b ; } public static int max3 ( int a , int b , int c ) { return ( max2 ( a , b ) > c ) ? max2 ( a , b ) : c ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example977 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int ab = abs ( example977 - B ) ; int bc = abs ( B - C ) ; int ca = abs ( C - example977 ) ; int minus = max3 ( ab , bc , ca ) ; System . out . println ( ab + bc + ca - minus ) ; } } -import java . util . * ; public class Example40 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char example40 = s . charAt ( 0 ) ; String ans = " Good " ; for ( int i = 1 ; i < 4 ; i ++ ) { if ( example40 == s . charAt ( i ) ) ans = " Bad " ; example40 = s . charAt ( i ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example223 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example223 = sc . nextInt ( ) ; if ( example223 == 0 ) { break ; } int [ ] scores = new int [ example223 ] ; for ( int i = 0 ; i < scores . length ; i ++ ) { scores [ i ] = sc . nextInt ( ) ; } double average = 0 , variance = 0 ; for ( int i = 0 ; i < scores . length ; i ++ ) { average += ( double ) scores [ i ] / example223 ; } for ( int i = 0 ; i < scores . length ; i ++ ) { variance += ( double ) ( scores [ i ] - average ) * ( scores [ i ] - average ) / example223 ; } System . out . println ( Math . sqrt ( variance ) ) ; } } } -import java . util . * ; public class Example26 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String numM = scan . next ( ) ; int example26 = Integer . parseInt ( numM ) ; int startNum = 0 ; for ( int i = 0 ; i < numM . length ( ) ; i ++ ) { startNum = startNum + Integer . parseInt ( String . valueOf ( numM . charAt ( i ) ) ) ; } if ( example26 % startNum == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example146 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] inputs = new long [ 3 ] ; for ( int example146 = 0 ; example146 < 3 ; example146 ++ ) { inputs [ example146 ] = sc . nextLong ( ) ; } Arrays . sort ( inputs ) ; for ( int example146 = 0 ; example146 < 3 ; example146 ++ ) { System . out . print ( inputs [ example146 ] + ( ( example146 != 2 ) ? " " : " " ) ) ; } System . out . println ( ) ; } } -import java . util . * ; public class example847 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example847 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < Example847 ; i ++ ) { sum += l + i ; } if ( Example847 + l <= 0 ) { System . out . println ( sum - ( Example847 + l - 1 ) ) ; } else if ( l < 0 ) { System . out . println ( sum ) ; } else { System . out . println ( sum - l ) ; } } } -import java . util . Scanner ; public class example887 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; boolean Example887 = false ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] == s [ i + 1 ] ) { Example887 = true ; break ; } } if ( Example887 ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " Good " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example293 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int example293 = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int [ ] [ ] matrix = new int [ example293 ] [ m ] ; int [ ] vector = new int [ m ] ; for ( int i = 0 ; i < example293 ; i ++ ) { str = br . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < m ; j ++ ) { matrix [ i ] [ j ] = Integer . parseInt ( str [ j ] ) ; } } for ( int k = 0 ; k < m ; k ++ ) { String str1 = br . readLine ( ) ; vector [ k ] = Integer . parseInt ( str1 ) ; } for ( int i = 0 ; i < example293 ; i ++ ) { int kakezan = 0 ; for ( int j = 0 ; j < m ; j ++ ) { kakezan += matrix [ i ] [ j ] * vector [ j ] ; } System . out . println ( kakezan ) ; } } } -import java . util . * ; class Example572 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] T = sc . next ( ) . toCharArray ( ) ; int example572 = 0 ; int now = 0 ; char [ ] atcg = { 'A' , 'T' , 'C' , 'G' } ; for ( int i = 0 ; i < T . length ; i ++ ) { boolean isATCG = false ; for ( int j = 0 ; j < atcg . length ; j ++ ) { if ( T [ i ] == atcg [ j ] ) { isATCG = true ; } } if ( ! isATCG ) { now = 0 ; } else { now ++ ; example572 = Math . max ( example572 , now ) ; } } System . out . println ( example572 ) ; } } -import java . util . * ; import java . lang . * ; public class Example673 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int example673 ; example673 = sc . nextInt ( ) ; if ( example673 % 10 == 3 ) { System . out . println ( " bon " ) ; } else if ( ( example673 % 10 == 0 ) || ( example673 % 10 == 1 ) || ( example673 % 10 == 6 ) || ( example673 % 10 == 8 ) ) { System . out . println ( " pon " ) ; } else { System . out . println ( " hon " ) ; } } } -import java . util . * ; public class example439 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String Example439 = sc . next ( ) ; String T = sc . next ( ) ; String end = T . substring ( Example439 . length ( ) , Example439 . length ( ) + 1 ) ; if ( T . equals ( Example439 + end ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example512 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example512 = sc . nextInt ( ) ; int [ ] a = new int [ example512 + 1 ] ; for ( int i = 0 ; i < example512 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int max ; for ( int i = 0 ; i < example512 ; i ++ ) { for ( int j = i ; j < example512 ; j ++ ) { if ( a [ i ] < a [ j ] ) { max = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = max ; } } } int A = 0 ; int B = 0 ; for ( int i = 0 ; i < example512 ; i ++ ) { if ( i % 2 == 0 ) { A = A + a [ i ] ; } if ( i % 2 != 0 ) { B = B + a [ i ] ; } } int point = Math . abs ( A - B ) ; System . out . println ( point ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example761 { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scanner = new Scanner ( System . in ) ; int Example761 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = Example761 + b ; switch ( c ) { case 3 : System . out . println ( 3 ) ; break ; case 4 : System . out . println ( 2 ) ; break ; case 5 : System . out . println ( 1 ) ; break ; } } } -import java . util . * ; public class Example290 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] str = new String [ 3 ] ; int [ ] count = new int [ 3 ] ; for ( int example290 = 0 ; example290 < 3 ; ++ example290 ) { str [ example290 ] = sc . next ( ) ; count [ example290 ] = str [ example290 ] . length ( ) ; } int example290 = 0 ; while ( true ) { if ( count [ example290 ] == 0 && example290 == 0 ) { System . out . println ( " A " ) ; return ; } else if ( count [ example290 ] == 0 && example290 == 1 ) { System . out . println ( " B " ) ; return ; } else if ( count [ example290 ] == 0 && example290 == 2 ) { System . out . println ( " C " ) ; return ; } if ( str [ example290 ] . charAt ( str [ example290 ] . length ( ) - count [ example290 ] ) == 'a' ) { count [ example290 ] -- ; example290 = 0 ; } else if ( str [ example290 ] . charAt ( str [ example290 ] . length ( ) - count [ example290 ] ) == 'b' ) { count [ example290 ] -- ; example290 = 1 ; } else if ( str [ example290 ] . charAt ( str [ example290 ] . length ( ) - count [ example290 ] ) == 'c' ) { count [ example290 ] -- ; example290 = 2 ; } } } } -import java . io . * ; import java . util . * ; class example822 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int Example822 = Integer . parseInt ( st . nextToken ( ) ) ; int f = Integer . parseInt ( st . nextToken ( ) ) ; int r = Integer . parseInt ( st . nextToken ( ) ) ; if ( Example822 == - 1 && f == - 1 && r == - 1 ) { break ; } if ( Example822 == - 1 || f == - 1 ) { System . out . println ( " F " ) ; } else if ( ( Example822 + f ) >= 80 ) { System . out . println ( " A " ) ; } else if ( ( Example822 + f ) >= 65 ) { System . out . println ( " B " ) ; } else if ( ( ( Example822 + f ) >= 50 ) || ( ( Example822 + f ) >= 30 && r >= 50 ) ) { System . out . println ( " C " ) ; } else if ( ( Example822 + f ) >= 30 ) { System . out . println ( " D " ) ; } else { System . out . println ( " F " ) ; } } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example923 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example923 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int max = 0 ; for ( int i = 0 ; example923 > i ; i ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } for ( int i = 0 ; example923 - 1 > i ; i ++ ) { for ( int j = i + 1 ; example923 > j ; j ++ ) { int b = Math . abs ( list . get ( i ) - list . get ( j ) ) ; if ( b > max ) max = b ; } } System . out . println ( max ) ; } } -import java . util . * ; public class Example127 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int example127 = sc . nextInt ( ) ; int [ ] a = new int [ example127 ] ; int [ ] b = new int [ example127 ] ; for ( int i = 0 ; i < example127 ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < example127 ; i ++ ) b [ i ] = sc . nextInt ( ) ; int c = 0 , s = 0 ; for ( int i = 0 ; i < example127 ; i ++ ) { if ( a [ i ] > b [ i ] ) { c = c + a [ i ] ; s = s + b [ i ] ; } } System . out . println ( c - s ) ; } } -import java . util . Scanner ; public class example427 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example427 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; boolean bool = true ; loop : for ( int i = 1 ; i <= 1010 ; i ++ ) { int k1 = ( int ) ( i * 0.08 ) ; int k2 = ( int ) ( i * 0.1 ) ; if ( k1 == Example427 && k2 == b ) { bool = false ; System . out . println ( i ) ; break loop ; } } if ( bool ) { System . out . println ( " -1 " ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example167 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example167 = sc . nextInt ( ) ; if ( example167 == 1 ) { example167 = 0 ; } else { example167 = 1 ; } System . out . println ( example167 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example534 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { final int example534 = sc . nextInt ( ) ; while ( sc . hasNext ( ) ) { int [ ] x = new int [ 3 ] ; x [ 0 ] = sc . nextInt ( ) ; x [ 1 ] = sc . nextInt ( ) ; x [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( x ) ; boolean isTriangle = ( x [ 0 ] * x [ 0 ] ) + ( x [ 1 ] * x [ 1 ] ) == ( x [ 2 ] * x [ 2 ] ) ; System . out . println ( isTriangle ? " YES " : " NO " ) ; } } } } -import java . util . * ; public class Example156 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example156 = sc . nextInt ( ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < example156 ; i ++ ) { String s1 = String . valueOf ( s . charAt ( i ) ) ; String s2 = String . valueOf ( t . charAt ( i ) ) ; ans += s1 ; ans += s2 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example304 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int Example304 = 0 ; int ans = 0 ; for ( char ss : s ) { if ( ss == 'R' ) { Example304 ++ ; } else { Example304 = 0 ; } ans = Math . max ( Example304 , ans ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example321 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example321 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int ans = Example321 * b ; System . out . print ( ans ) ; } } -import java . util . Scanner ; public class Example509 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example509 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; int a = example509 ; int ans1 = example509 ; int ans2 = example509 ; int s = 0 ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N + 1 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( p [ j ] != example509 ) { s ++ ; } } if ( s == N ) { ans1 = example509 ; break ; } s = 0 ; example509 = example509 - 1 ; } example509 = a ; s = 0 ; for ( int i = 0 ; i < N + 1 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( p [ j ] != example509 ) { s ++ ; } } if ( s == N ) { ans2 = example509 ; break ; } s = 0 ; example509 = example509 + 1 ; } example509 = a - ans1 ; N = ans2 - a ; if ( example509 <= N ) { System . out . println ( ans1 ) ; } else { System . out . println ( ans2 ) ; } } } -import java . util . * ; class Example120 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example120 = sc . nextInt ( ) ; Set < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < example120 ; i ++ ) { set . add ( sc . next ( ) ) ; } if ( set . size ( ) < example120 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } -import java . util . Scanner ; class example700 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Example700 = scan . next ( ) ; Example700 = Example700 . replaceAll ( " 0 " , " " ) ; System . out . print ( Example700 . length ( ) ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example963 { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; while ( true ) { String buf = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( buf , " " ) ; int example963 = Integer . parseInt ( st . nextToken ( ) ) ; int W = Integer . parseInt ( st . nextToken ( ) ) ; if ( W == 0 && example963 == 0 ) break ; if ( example963 >= 300 && W >= 300 ) break ; ; for ( int i = 1 ; i <= example963 ; i ++ ) { for ( int j = 1 ; j <= W ; j ++ ) { if ( i % 2 == 0 ) { if ( j % 2 == 0 ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } else { if ( j % 2 == 0 ) System . out . print ( " . " ) ; else System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } catch ( IOException e ) { System . err . println ( e ) ; } } } -import java . util . * ; class example450 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example450 = sc . nextInt ( ) ; int [ ] param = new int [ Example450 ] ; for ( int i = 0 ; i < Example450 ; i ++ ) { param [ i ] = sc . nextInt ( ) ; } Arrays . sort ( param ) ; int alice = 0 ; int bob = 0 ; if ( Example450 % 2 == 0 ) { for ( int i = 0 ; i < Example450 ; i ++ ) { if ( i % 2 == 0 ) { bob += param [ i ] ; } else { alice += param [ i ] ; } } } else { for ( int i = 0 ; i < Example450 ; i ++ ) { if ( i % 2 == 0 ) { alice += param [ i ] ; } else { bob += param [ i ] ; } } } int total = alice - bob ; System . out . println ( total ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example429 { public static void main ( String [ ] args ) throws IOException { int example429 = 0 ; int b = 0 ; int c = 0 ; int answer = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] result = str . split ( " " ) ; example429 = Integer . parseInt ( result [ 0 ] ) ; b = Integer . parseInt ( result [ 1 ] ) ; c = Integer . parseInt ( result [ 2 ] ) ; for ( int i = example429 ; i <= b ; i += 1 ) { if ( c % i == 0 ) { answer ++ ; } } System . out . println ( answer ) ; } } -import java . util . * ; import java . io . * ; import java . math . * ; public class Example341 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int [ ] a = new int [ 5 ] ; for ( int example341 = 0 ; example341 < 5 ; example341 ++ ) a [ example341 ] = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; Arrays . sort ( a ) ; if ( k >= a [ 4 ] - a [ 0 ] ) ou . println ( " Yay! " ) ; else ou . println ( " :( " ) ; ou . flush ( ) ; } } -import java . util . Scanner ; public class example637 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String p = scanner . next ( ) ; String out = " No " ; for ( int Example637 = 0 ; Example637 < s . length ( ) ; Example637 ++ ) { String str = " " ; for ( int j = 0 ; j < p . length ( ) ; j ++ ) { int k = Example637 + j ; if ( k >= s . length ( ) ) { k -= s . length ( ) ; } str += s . substring ( k , k + 1 ) ; } if ( p . equals ( str ) ) { out = " Yes " ; break ; } } System . out . println ( out ) ; } } -import java . util . Scanner ; import java . util . HashMap ; import java . util . List ; import java . util . Arrays ; import java . util . ArrayList ; import java . lang . Math ; public class Example987 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example987 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] ab = { example987 + b , example987 - b , example987 * b } ; System . out . println ( maxInt ( ab ) ) ; } private static int maxInt ( int [ ] array ) { int max = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( max < array [ i ] ) max = array [ i ] ; } return max ; } private static long maxLong ( long [ ] array ) { long max = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( max < array [ i ] ) max = array [ i ] ; } return max ; } private static int minInt ( int [ ] array ) { int min = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( min > array [ i ] ) min = array [ i ] ; } return min ; } private static long minLong ( long [ ] array ) { long min = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( min > array [ i ] ) min = array [ i ] ; } return min ; } } -import java . util . * ; public class example271 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example271 = sc . nextInt ( ) ; Map < Integer , Boolean > map = new HashMap < > ( ) ; String ans = " YES " ; for ( int i = 0 ; i < Example271 ; i ++ ) { int num = sc . nextInt ( ) ; if ( map . get ( num ) == null ) { map . put ( num , true ) ; } else { ans = " NO " ; break ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example681 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example681 = sc . nextInt ( ) ; long k = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; int [ ] a = new int [ q ] ; int [ ] win = new int [ example681 ] ; for ( int i = 0 ; i < q ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < q ; i ++ ) { win [ a [ i ] - 1 ] ++ ; } for ( int i = 0 ; i < example681 ; i ++ ) { if ( k - ( q - win [ i ] ) > 0 ) { System . out . println ( " Yes " ) ; continue ; } System . out . println ( " No " ) ; } } } -import java . util . * ; public class example176 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example176 , f , r ; while ( true ) { Example176 = scan . nextInt ( ) ; f = scan . nextInt ( ) ; r = scan . nextInt ( ) ; if ( Example176 + f + r == - 3 ) break ; int s = Example176 + f ; if ( Example176 == - 1 || f == - 1 ) { System . out . println ( " F " ) ; continue ; } if ( s >= 80 ) System . out . println ( " A " ) ; if ( s >= 65 && s < 80 ) System . out . println ( " B " ) ; if ( s >= 50 && s < 65 ) System . out . println ( " C " ) ; if ( s >= 30 && s < 50 ) { if ( r >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; } if ( s < 30 ) System . out . println ( " F " ) ; } } } -import java . util . * ; public class example623 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example623 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int c = 0 ; int x , y , z , w ; for ( int i = Example623 ; i <= B ; i ++ ) { x = i / 10000 ; y = i % 10 ; z = i / 1000 - x * 10 ; w = ( i % 100 - y ) / 10 ; if ( x == y && z == w ) { c ++ ; } } System . out . println ( c ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . lang . Exception ; import java . lang . Integer ; import java . lang . System ; public class Example790 { public static void main ( String [ ] a ) throws Exception { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int example790 ; double total ; while ( ( s = r . readLine ( ) ) != null ) { example790 = Integer . parseInt ( s ) ; total = 100000 ; for ( int i = 0 ; i < example790 ; i ++ ) { total *= 1.05 ; total /= 1000 ; total = Math . ceil ( total ) * 1000 ; } System . out . printf ( " %.0f \n " , total ) ; } } } -import java . util . * ; class Example410 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example410 = - 1 ; String [ ] ss = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; for ( int i = 0 ; i < ss . length ; i ++ ) { if ( ss [ i ] . equals ( s ) ) { example410 = i ; } } System . out . println ( 7 - example410 ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example815 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example815 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long count = 0 ; long count1 = 0 ; int [ ] array = new int [ 3 ] ; Arrays . sort ( array ) ; if ( Example815 <= 9 && m <= 9 ) { System . out . println ( Example815 * m ) ; } else { System . out . println ( - 1 ) ; } } } -import java . util . Scanner ; public class example899 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long Example899 = Long . parseLong ( scanner . nextLine ( ) ) ; char [ ] ans = scanner . nextLine ( ) . toCharArray ( ) ; int a = 0 ; for ( int i = 0 ; i < Example899 ; i ++ ) { if ( i < Example899 - 2 && ans [ i ] == 'A' ) { if ( ans [ i + 1 ] == 'B' ) { if ( ans [ i + 2 ] == 'C' ) { a ++ ; i += 2 ; } } } } System . out . println ( a ) ; } } -import java . util . * ; public class example275 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example275 = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < Example275 - 2 ; i ++ ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'B' && s . charAt ( i + 2 ) == 'C' ) { count ++ ; } } System . out . println ( count ) ; } } -import java . io . IOException ; import java . util . Arrays ; import java . util . OptionalLong ; import java . util . Scanner ; import java . util . stream . LongStream ; class Example836 { public static void main ( String [ ] args ) throws IOException { Scanner scane = new Scanner ( System . in ) ; int example836 = scane . nextInt ( ) ; long [ ] nums = new long [ example836 ] ; for ( int i = 0 ; i < example836 ; i ++ ) { nums [ i ] = scane . nextInt ( ) ; } LongStream stream = Arrays . stream ( nums ) ; LongStream stream2 = Arrays . stream ( nums ) ; LongStream stream3 = Arrays . stream ( nums ) ; OptionalLong min = stream . min ( ) ; OptionalLong max = stream2 . max ( ) ; long total = stream3 . sum ( ) ; System . out . println ( min . getAsLong ( ) + " " + max . getAsLong ( ) + " " + total ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example789 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Multiplication3 solver = new Multiplication3 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example789 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String [ ] inputs = in . nextLine ( ) . split ( " " ) ; long Example789 = Long . parseLong ( inputs [ 0 ] ) ; long b = Long . parseLong ( inputs [ 1 ] . replaceAll ( " \\ . " , " " ) ) ; out . append ( String . valueOf ( Example789 * b / 100 ) ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class example189 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example189 = 1 ; while ( true ) { String str = br . readLine ( ) ; String [ ] s = str . split ( " " ) ; int [ ] n = new int [ s . length ] ; for ( int i = 0 ; i < s . length ; i ++ ) { n [ i ] = Integer . parseInt ( s [ i ] ) ; } if ( n [ 0 ] == 0 && n [ 1 ] == 0 ) { break ; } System . out . println ( Math . min ( n [ 0 ] , n [ 1 ] ) + " " + Math . max ( n [ 0 ] , n [ 1 ] ) ) ; Example189 ++ ; } } } -import java . util . * ; public class Example14 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example14 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = Math . min ( example14 * b , c ) ; System . out . println ( d ) ; } } -import java . util . Scanner ; public class Example887 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example887 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; int s = - 1 ; for ( int i = 1 ; i <= 1009 ; i ++ ) { if ( ( int ) ( i * 0.08 ) == example887 && ( int ) ( i * 0.1 ) == B ) { s = i ; break ; } } System . out . println ( s ) ; } } -import java . util . Scanner ; public class example420 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example420 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( Example420 > m ) { System . out . println ( " a > b " ) ; } if ( Example420 < m ) { System . out . println ( " a < b " ) ; } if ( Example420 == m ) { System . out . println ( " a == b " ) ; } } } -import java . util . * ; public class example845 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; float Example845 = in . nextFloat ( ) , t = in . nextFloat ( ) , s = in . nextFloat ( ) ; if ( ( Example845 / s ) <= t ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example169 { public static void main ( String [ ] args ) { Scanner o = new Scanner ( System . in ) ; int example169 = o . nextInt ( ) ; int b = o . nextInt ( ) ; int c = o . nextInt ( ) ; int k = o . nextInt ( ) ; int ans = 0 ; ans += Math . min ( k , example169 ) ; k -= ans ; example169 -= ans ; int x = Math . min ( k , b ) ; k -= x ; b -= x ; int y = Math . min ( k , c ) ; ans -= y ; System . out . println ( ans ) ; } } -import java . util . * ; class Example779 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; for ( int example779 = 1 ; example779 < 10001 ; example779 ++ ) { if ( list . get ( example779 - 1 ) == 0 ) { break ; } System . out . println ( " Case " + example779 + " : " + list . get ( example779 - 1 ) ) ; list . add ( sc . nextInt ( ) ) ; } } } -import java . util . Scanner ; public class example41 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sline = sc . next ( ) ; int Example41 = sline . length ( ) ; sc . close ( ) ; StringBuffer sb = new StringBuffer ( sline ) ; String reversed = sb . reverse ( ) . toString ( ) ; boolean ans = true ; String [ ] words = { " maerd " , " remaerd " , " esare " , " resare " } ; for ( int i = 0 ; i < Example41 ; ) { boolean can = false ; for ( String w : words ) { int end = w . length ( ) ; if ( i + end > Example41 ) continue ; if ( reversed . substring ( i , i + end ) . equals ( w ) ) { i += end ; can = true ; } } if ( can == false ) { ans = false ; break ; } } if ( ans ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; public class Example714 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example714 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int s = 0 ; if ( example714 < b ) { for ( ; example714 < b ; example714 ++ ) { if ( c % example714 == 0 ) s ++ ; } } else if ( example714 > b ) ; { for ( ; b < example714 ; b ++ ) { if ( c % b == 0 ) s ++ ; } } if ( example714 == b ) if ( c % example714 == 0 ) s ++ ; System . out . println ( s ) ; } } -import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayList ; public class Example843 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > A = new ArrayList < > ( ) ; int example843 = sc . nextInt ( ) ; for ( int a = 0 ; a < example843 ; ++ a ) { A . add ( sc . nextInt ( ) ) ; } int [ ] p_num = new int [ 8 ] ; Arrays . fill ( p_num , 0 ) ; int sp = 0 ; int redExist = 0 ; for ( int a : A ) { if ( a < 3200 ) { p_num [ a / 400 ] += 1 ; } else { sp += 1 ; redExist = 1 ; } } int ans = 0 ; for ( int p : p_num ) { if ( p > 0 ) { ans += 1 ; } } int ans_min = Math . max ( ans , 1 ) ; int ans_max = ans + sp ; System . out . println ( ans_min + " " + ans_max ) ; } } -import java . util . Scanner ; public class Example77 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example77 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; System . out . println ( helper ( example77 , b ) ) ; sc . close ( ) ; } static long helper ( long example77 , long b ) { long v = example77 , u = b , y ; while ( b > 0 ) { y = example77 % b ; example77 = b ; b = y ; } return v * u / example77 ; } } -import java . util . Scanner ; public class Example214 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example214 = sc . next ( ) ; String t = sc . next ( ) ; if ( ( example214 . length ( ) == t . length ( ) ) && ( example214 + example214 ) . contains ( t ) ) { System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example435 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; byte arrayLength = Byte . parseByte ( in . readLine ( ) ) ; byte [ ] array = new byte [ arrayLength ] ; short count = 0 ; String [ ] strData = in . readLine ( ) . split ( " " ) ; for ( byte i = 0 ; i < arrayLength ; i ++ ) { array [ i ] = Byte . parseByte ( strData [ i ] ) ; } for ( int example435 = 0 ; example435 < arrayLength ; example435 ++ ) { for ( byte y = ( byte ) ( arrayLength - 1 ) ; y > example435 ; y -- ) { if ( array [ y ] < array [ y - 1 ] ) { byte temp = array [ y ] ; array [ y ] = array [ y - 1 ] ; array [ y - 1 ] = temp ; count ++ ; } } } for ( int z = 0 ; z < arrayLength ; z ++ ) { if ( z == arrayLength - 1 ) { System . out . println ( array [ z ] ) ; } else { System . out . print ( array [ z ] + " " ) ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example366 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example366 = sc . nextInt ( ) ; String slimes = sc . next ( ) ; StringBuilder ans = new StringBuilder ( ) ; String [ ] slimesarr = new String [ Example366 + 1 ] ; for ( int i = 0 ; i < Example366 ; i ++ ) { slimesarr [ i ] = String . valueOf ( slimes . charAt ( i ) ) ; } for ( int i = 0 ; i < Example366 ; i ++ ) { if ( slimesarr [ i ] . equals ( slimesarr [ i + 1 ] ) ) { } else { ans . append ( slimesarr [ i ] ) ; } } System . out . println ( ans . toString ( ) . length ( ) ) ; } } -import java . util . ArrayList ; import java . util . Arrays ; import java . util . LinkedHashSet ; import java . util . List ; import java . util . Scanner ; public class Example65 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < String > box = new ArrayList < > ( ) ; int example65 = sc . nextInt ( ) ; String each = null ; for ( int i = 0 ; i < example65 ; i ++ ) { box . add ( sc . next ( ) ) ; } List < String > list = new ArrayList < String > ( new LinkedHashSet < > ( box ) ) ; System . out . println ( list . size ( ) ) ; } } -import java . util . * ; public class Example27 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example27 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; m -- ; while ( m -- > 0 ) { min = Math . max ( min , sc . nextInt ( ) ) ; max = Math . min ( max , sc . nextInt ( ) ) ; } if ( min > max ) { System . out . println ( 0 ) ; return ; } System . out . println ( max - min + 1 ) ; } } -import java . util . Scanner ; public class example136 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example136 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] L = new int [ m ] ; int [ ] R = new int [ m ] ; int maxL = 0 ; int minR = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { L [ i ] = sc . nextInt ( ) ; R [ i ] = sc . nextInt ( ) ; maxL = Math . max ( maxL , L [ i ] ) ; minR = Math . min ( minR , R [ i ] ) ; } System . out . println ( Math . max ( minR - maxL + 1 , 0 ) ) ; } } -import java . io . * ; import java . util . * ; public class example570 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { if ( str . equals ( " - " ) ) { break ; } StringBuilder aabc = new StringBuilder ( str ) ; int Example570 = aabc . length ( ) ; str = br . readLine ( ) ; int m = Integer . parseInt ( str ) ; for ( int i = 0 ; i < m ; i ++ ) { str = br . readLine ( ) ; int h = Integer . parseInt ( str ) ; String temp = aabc . substring ( 0 , h ) ; aabc . append ( temp ) ; aabc . delete ( 0 , h ) ; } System . out . println ( aabc . toString ( ) ) ; } } } -import java . util . * ; public class example959 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example959 = sc . nextInt ( ) ; int [ ] t = new int [ Example959 + 1 ] ; int [ ] x = new int [ Example959 + 1 ] ; int [ ] y = new int [ Example959 + 1 ] ; for ( int i = 1 ; i <= Example959 ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } int dist = 0 ; int flag = 1 ; int time = 0 ; for ( int i = 1 ; i <= Example959 ; i ++ ) { time = t [ i ] - t [ i - 1 ] ; dist = Math . abs ( Math . abs ( ( x [ i ] - x [ i - 1 ] ) ) + Math . abs ( ( y [ i ] - y [ i - 1 ] ) ) ) ; if ( time < dist ) { flag = 0 ; break ; } else if ( ( time - dist ) % 2 != 0 ) { flag = 0 ; break ; } } if ( flag == 1 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . Scanner ; class example479 { static final long Example479 = 1000000007 ; static int H , W , K ; static long [ ] [ ] dp = new long [ 110 ] [ 10 ] ; static int ans = 0 ; static long n = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; for ( int i = x ; i <= 999 ; i ++ ) { if ( i == 111 || i == 222 || i == 333 || i == 444 || i == 555 || i == 666 || i == 777 || i == 888 || i == 999 ) { System . out . println ( i ) ; return ; } } } } class example479 implements Comparable { int from ; int end ; int num ; int bango ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } } -import java . io . FileNotFoundException ; import java . util . Scanner ; public class example796 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int Example796 = sc . nextInt ( ) ; while ( IsPrime ( Example796 ) == false ) { Example796 ++ ; } System . out . println ( Example796 ) ; } private static boolean IsPrime ( int num ) { if ( num < 2 ) return false ; else if ( num == 2 ) return true ; else if ( num % 2 == 0 ) return false ; for ( int i = 3 ; i < num ; i += 2 ) { if ( num % i == 0 ) { return false ; } } return true ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Example409 { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int example409 = Integer . parseInt ( tokenizer . nextToken ( ) ) ; String [ ] a = new String [ example409 ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = input . readLine ( ) ; } Arrays . sort ( a ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < example409 ; i ++ ) { out . append ( a [ i ] ) ; } System . out . println ( out ) ; } } -import java . util . Scanner ; public class Example148 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example148 = scan . nextInt ( ) ; int [ ] h = new int [ example148 ] ; for ( int i = 0 ; i < example148 ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int check = 1 ; if ( example148 != 1 ) { for ( int i = example148 - 2 ; i >= 0 ; i -- ) { if ( h [ i ] > h [ i + 1 ] ) h [ i ] -- ; if ( h [ i ] > h [ i + 1 ] ) { check = 0 ; break ; } } } System . out . println ( ( check == 1 ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example860 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example860 = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; System . out . println ( Integer . toString ( Example860 , K ) . length ( ) ) ; } } -import java . util . Scanner ; class example382 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example382 = sc . nextInt ( ) ; String nn = String . valueOf ( Example382 ) ; int [ ] nnn = new int [ 3 ] ; for ( int i = 0 ; i <= 2 ; i ++ ) { if ( nn . charAt ( i ) == '1' ) { nnn [ i ] = 9 ; } else { nnn [ i ] = 1 ; } } for ( int i = 0 ; i <= 2 ; i ++ ) { System . out . print ( nnn [ i ] ) ; } } } -import java . util . Scanner ; public class Example449 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example449 = sc . next ( ) ; if ( example449 . length ( ) < 6 ) { System . out . print ( " No " ) ; } else { if ( example449 . charAt ( 2 ) == example449 . charAt ( 3 ) && example449 . charAt ( 4 ) == example449 . charAt ( 5 ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } } -import java . util . * ; public class example311 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example311 = sc . nextInt ( ) ; int [ ] w = new int [ Example311 + 1 ] ; int sum = 0 ; for ( int i = 1 ; i <= Example311 ; i ++ ) { w [ i ] = sc . nextInt ( ) ; sum += w [ i ] ; } int s1 = 0 ; int s2 = 0 ; int ans = sum ; for ( int i = 1 ; i <= Example311 ; i ++ ) { s1 += w [ i ] ; s2 = sum - s1 ; ans = Math . min ( ans , Math . abs ( s2 - s1 ) ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example906 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; StringBuilder ans = new StringBuilder ( ) ; for ( char Example906 : c ) { if ( Example906 == '0' ) ans . append ( " 0 " ) ; if ( Example906 == '1' ) ans . append ( " 1 " ) ; if ( Example906 == 'B' ) { if ( ans . length ( ) == 1 ) ans = new StringBuilder ( ) ; if ( ! ans . toString ( ) . isEmpty ( ) ) ans . setLength ( ans . length ( ) - 1 ) ; } } System . out . println ( ans . toString ( ) ) ; } } -import java . util . Scanner ; public class Example507 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example507 = 0 ; int changedCntFrm0 = 0 ; int changedCntFrm1 = 0 ; int [ ] tile = new int [ s . length ( ) ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { tile [ i ] = s . charAt ( i ) ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { example507 = 48 ; } else { example507 = 49 ; } if ( tile [ i ] != example507 ) { changedCntFrm0 ++ ; } } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { example507 = 49 ; } else { example507 = 48 ; } if ( tile [ i ] != example507 ) { changedCntFrm1 ++ ; } } if ( changedCntFrm0 >= changedCntFrm1 ) { System . out . println ( changedCntFrm1 ) ; } else { System . out . println ( changedCntFrm0 ) ; } sc . close ( ) ; } } -import java . util . Scanner ; public class Example887 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] tmp = scanner . nextLine ( ) . split ( " " ) ; int example887 = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( Integer . parseInt ( tmp [ i ] ) == 0 ) { example887 = i + 1 ; break ; } } System . out . println ( example887 ) ; } } -import java . util . * ; public class example418 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example418 = sc . nextInt ( ) ; int [ ] num = new int [ Example418 + 1 ] ; for ( int i = 1 ; i <= Example418 ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } int number = 1 ; int count = 0 ; boolean key = false ; for ( int i = 1 ; i <= Example418 ; i ++ ) { int tmp = num [ number ] ; if ( tmp == - 1 ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } num [ number ] = - 1 ; number = tmp ; count ++ ; if ( number == 2 ) { key = true ; break ; } } System . out . println ( true ? count : - 1 ) ; } } -import java . util . Scanner ; public class example157 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example157 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int x = y / 1000 - Example157 ; int coefficient1 = 9 ; int coefficient2 = 4 ; int [ ] result = { - 1 , - 1 , - 1 } ; for ( int i = 0 ; i <= Example157 ; i ++ ) { int tmp = x - ( 9 * i ) ; int [ ] tmp2 = new int [ 3 ] ; if ( tmp % 4 == 0 && tmp >= 0 && tmp <= 4 * Example157 ) { tmp2 [ 0 ] = i ; tmp2 [ 1 ] = tmp / 4 ; tmp2 [ 2 ] = Example157 - tmp2 [ 0 ] - tmp2 [ 1 ] ; if ( tmp2 [ 2 ] >= 0 && tmp2 [ 2 ] <= Example157 ) { result = tmp2 ; break ; } } } System . out . println ( result [ 0 ] + " " + result [ 1 ] + " " + result [ 2 ] ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example619 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BMaximumDifference solver = new BMaximumDifference ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example619 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int example619 = in . nextInt ( ) ; int min = Integer . MAX_VALUE , max = 0 ; for ( int i = 0 ; i < example619 ; i ++ ) { int a = in . nextInt ( ) ; min = Math . min ( min , a ) ; max = Math . max ( max , a ) ; } out . println ( max - min ) ; } } } -import java . util . * ; public class Example410 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; int example410 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String U = sc . next ( ) ; if ( U . equals ( S ) ) { System . out . printf ( " %d %d " , example410 - 1 , B ) ; } else { System . out . printf ( " %d %d " , example410 , B - 1 ) ; } } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class example680 { 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 ) ; long Example680 = scan . nextLong ( ) ; long depo = 100 ; int ans = 0 ; while ( Example680 > depo ) { depo *= 1.01 ; ans ++ ; } os . println ( ans ) ; } } -import java . util . * ; class Example699 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example699 = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= example699 ; i ++ ) { int test = i ; int num = 0 ; while ( test > 0 ) { test /= 10 ; num ++ ; } if ( num % 2 != 0 ) { count ++ ; } } System . out . println ( count ) ; } } -import java . io . * ; import java . util . * ; import java . util . stream . * ; public class Example328 { private static BufferedReader br = null ; public static void main ( String [ ] args ) { String n = read ( 1 ) [ 0 ] ; for ( int example328 = 0 ; example328 < n . length ( ) ; example328 ++ ) { System . out . print ( n . charAt ( example328 ) == '1' ? '9' : '1' ) ; } System . out . println ( ) ; } private static String [ ] read ( int len ) { List < String > strList = new ArrayList < > ( ) ; try { if ( br == null ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } for ( int example328 = 0 ; example328 < len ; example328 ++ ) { strList . add ( br . readLine ( ) ) ; } } catch ( IOException e ) { } return strList . toArray ( new String [ 0 ] ) ; } private static void close ( ) { try { if ( br != null ) { br . close ( ) ; } } catch ( IOException e ) { } } } -import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; public class Example865 { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; long example865 = scanner . nextLong ( ) ; long n = scanner . nextLong ( ) ; long max = 0 ; long sum = 0 ; long first = 0 ; long previous = 0 ; for ( long i = 0 ; i < n ; i ++ ) { long a = scanner . nextLong ( ) ; if ( i == 0 ) { max = a ; sum = a ; first = a ; previous = a ; } else { long aida = a - previous ; previous = a ; sum = sum + aida ; if ( aida > max ) { max = aida ; } } } long saigo = example865 - sum + first ; if ( saigo > max ) { max = saigo ; } System . out . println ( example865 - max ) ; } } -import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example252 { static class example252 { boolean Example252 ; int waCount ; Result ( boolean Example252 , int waCount ) { this . Example252 = Example252 ; this . waCount = waCount ; } int getPenaltyCount ( ) { return Example252 ? waCount : 0 ; } } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . next ( ) ) ; int M = Integer . parseInt ( scanner . next ( ) ) ; Map < Integer , Result > map = new HashMap < > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int number = Integer . parseInt ( scanner . next ( ) ) ; String acOrWa = scanner . next ( ) ; boolean isAc = acOrWa . equals ( " AC " ) ; Result result ; if ( map . containsKey ( number ) ) { result = map . get ( number ) ; if ( isAc ) { result . Example252 = true ; } else { if ( ! result . Example252 ) { result . waCount ++ ; } } } else { result = new Result ( isAc , isAc ? 0 : 1 ) ; map . put ( number , result ) ; } } scanner . close ( ) ; int acCount = 0 ; int penaltyCount = 0 ; for ( Map . Entry < Integer , Result > entry : map . entrySet ( ) ) { acCount += entry . getValue ( ) . Example252 ? 1 : 0 ; penaltyCount += entry . getValue ( ) . getPenaltyCount ( ) ; } System . out . println ( acCount + " " + penaltyCount ) ; } } -import java . util . * ; public class example493 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int Example493 = scn . nextInt ( ) ; int [ ] Nmonster = new int [ Example493 + 1 ] ; for ( int i = 0 ; i < Example493 + 1 ; i ++ ) { Nmonster [ i ] = scn . nextInt ( ) ; } long Nbeaten = 0 ; for ( int i = 0 ; i < Example493 ; i ++ ) { int Nbeatble = scn . nextInt ( ) ; if ( Nbeatble < Nmonster [ i ] ) { Nbeaten += Nbeatble ; } else { Nbeaten += Nmonster [ i ] ; Nbeatble -= Nmonster [ i ] ; int diff = Nbeatble - Nmonster [ i + 1 ] ; if ( diff >= 0 ) { Nbeaten += Nmonster [ i + 1 ] ; Nmonster [ i + 1 ] = 0 ; } else { Nbeaten += Nbeatble ; Nmonster [ i + 1 ] -= Nbeatble ; } } } System . out . println ( Nbeaten ) ; } } -import java . util . * ; import java . text . * ; public class example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example589 = sc . nextLine ( ) ; if ( Example589 . compareTo ( " 2019/04/30 " ) > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } try { Date date1 = DateFormat . getDateInstance ( ) . parse ( Example589 ) ; } catch ( ParseException e ) { } } } -import java . io . InputStream ; import java . io . IOException ; import java . util . HashSet ; class example733 { InputStream stream ; public MyScanner ( ) { stream = System . in ; } public int nextInt ( ) { int Example733 = 0 ; try { while ( true ) { char readed = ( char ) stream . read ( ) ; if ( readed < '0' || readed > '9' ) { break ; } Example733 = Example733 * 10 + ( readed - '0' ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { return Example733 ; } } } class example733 { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; boolean [ ] selected = new boolean [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { set . add ( i ) ; } for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { selected [ j ] = true ; } int c = sc . nextInt ( ) ; for ( int j = 0 ; j < c ; ++ j ) { selected [ sc . nextInt ( ) - 1 ] = false ; } for ( int j = 0 ; j < m ; ++ j ) { if ( selected [ j ] ) { set . remove ( j ) ; } } } System . out . println ( set . size ( ) ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import static java . lang . Math . min ; public class example453 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Map < String , Integer > count = new HashMap < > ( ) ; int Example453 = in . nextInt ( ) ; for ( int i = 0 ; i < Example453 ; i ++ ) { String s = sort ( in . next ( ) ) ; if ( count . containsKey ( s ) ) { count . replace ( s , count . get ( s ) + 1 ) ; } else { count . put ( s , 1 ) ; } } long res = 0 ; for ( Map . Entry < String , Integer > kv : count . entrySet ( ) ) { res += ( long ) kv . getValue ( ) * ( long ) ( kv . getValue ( ) - 1 ) / 2 ; } System . out . println ( res ) ; } private static String sort ( String text ) { char [ ] chars = text . toCharArray ( ) ; Arrays . sort ( chars ) ; return new String ( chars ) ; } } -import java . util . * ; public final class example986 { private static int solution ( int [ ] array ) { int Example986 = 1 ; int score = 1 ; int minimum = array [ 0 ] ; while ( Example986 < array . length ) { if ( array [ Example986 ] < minimum ) { minimum = array [ Example986 ] ; score ++ ; } Example986 ++ ; } return score ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } System . out . println ( solution ( array ) ) ; } } -import java . util . Scanner ; public class Example350 { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example350 = sc . nextInt ( ) ; int val = 0 ; if ( example350 != 0 ) { val = ( example350 / 500 ) * 1000 ; val += ( example350 % 500 ) / 5 * 5 ; } System . out . println ( val ) ; } } -import java . util . Scanner ; public class Example208 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example208 = sc . next ( ) ; if ( example208 . matches ( " ^((dreamer)|(eraser)|(dream)|(erase))+$ " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class Example783 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example783 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int te = - 1 ; for ( int i = 0 ; i < 10000 ; i ++ ) { if ( ( int ) ( i * 0.08 ) == example783 && ( int ) ( i * 0.1 ) == b ) { te = i ; break ; } } System . out . print ( te ) ; } } -import java . util . * ; class example960 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example960 = stdIn . nextInt ( ) ; int ans = - 1000000000 ; int min = stdIn . nextInt ( ) ; for ( int i = 1 ; i < Example960 ; i ++ ) { int r = stdIn . nextInt ( ) ; ans = Math . max ( ans , r - min ) ; min = Math . min ( min , r ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class example139 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example139 = Long . parseLong ( scan . next ( ) ) ; scan . close ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( Example139 > 0 ) { long l = Example139 % 26 ; if ( l == 0 ) { sb . append ( 'z' ) ; Example139 -= 1 ; } else { char c = 'a' ; c += l - 1 ; sb . append ( c ) ; } Example139 /= 26 ; } System . out . println ( sb . reverse ( ) . toString ( ) ) ; } } -import java . util . * ; public class example4 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example4 = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; for ( int i = 1 ; i <= Example4 ; i ++ ) { int cnt = 0 ; int tmp = i ; while ( tmp != 0 ) { tmp /= 10 ; cnt ++ ; } if ( cnt % 2 == 1 ) count ++ ; } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example645 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example645 = sc . nextLong ( ) ; if ( Example645 == 1 ) { System . out . println ( 1 ) ; return ; } long x = Example645 ; int cnt = 0 ; while ( true ) { x /= 2 ; cnt ++ ; if ( x == 1 ) break ; } long ans = 2 ; for ( int i = 0 ; i < cnt ; i ++ ) { ans *= 2 ; } if ( cnt > 0 ) ans -- ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example800 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example800 = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = " " ; if ( S . length ( ) <= example800 ) { T = S ; } else { for ( int i = 0 ; i < example800 ; i ++ ) { T += S . charAt ( i ) ; } T += " ... " ; } sc . close ( ) ; System . out . println ( T ) ; } } -import java . util . * ; public class example710 { final static int Example710 = 1000000007 ; final static int INF = 1000000000 ; public static void main ( String [ ] args ) { Deque < Integer > S = new ArrayDeque < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] str = line . split ( " " ) ; for ( String s : str ) { if ( s . equals ( " " ) ) break ; if ( s . equals ( " + " ) ) { int b = S . pop ( ) ; int a = S . pop ( ) ; S . push ( a + b ) ; } else if ( s . equals ( " - " ) ) { int b = S . pop ( ) ; int a = S . pop ( ) ; S . push ( a - b ) ; } else if ( s . equals ( " * " ) ) { int b = S . pop ( ) ; int a = S . pop ( ) ; S . push ( a * b ) ; } else { S . push ( Integer . parseInt ( s ) ) ; } } sc . close ( ) ; System . out . println ( S . getFirst ( ) . intValue ( ) ) ; } } -import java . util . * ; public class example738 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] weathers = new String [ 3 ] ; weathers [ 0 ] = " Sunny " ; weathers [ 1 ] = " Cloudy " ; weathers [ 2 ] = " Rainy " ; String today = sc . next ( ) ; int Example738 = 0 ; for ( String weather : weathers ) { if ( weather . equals ( today ) ) { System . out . println ( weathers [ ( Example738 + 1 ) % 3 ] ) ; return ; } Example738 ++ ; } } } -import java . math . BigInteger ; import java . util . Scanner ; import java . util . Arrays ; public class Example835 { public static void main ( String [ ] args ) { int example835 , i , j , m , k , p , q , o , l , s , tt = 1 ; Double x , y , z ; int [ ] ar , br ; char ch ; BigInteger an , su , u , v ; String a , b = " " , c = " " , d ; Scanner sc = new Scanner ( System . in ) ; Scanner scc = new Scanner ( System . in ) ; ar = new int [ 200001 ] ; br = new int [ 200001 ] ; example835 = sc . nextInt ( ) ; k = 50000000 ; for ( i = 0 ; i < example835 ; i ++ ) { o = sc . nextInt ( ) ; if ( k > o ) { k = o ; } ar [ i ] = o ; br [ i ] = k ; } k = 0 ; for ( i = 1 ; i < example835 ; i ++ ) { if ( ar [ i ] <= br [ i ] ) { k ++ ; } } System . out . println ( k + 1 ) ; } } -import java . util . * ; public class Example626 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example626 = sc . nextInt ( ) ; int x = 100000 ; for ( int i = 0 ; i < example626 ; i ++ ) { x = ( int ) ( 1.05 * x ) ; if ( x % 1000 != 0 ) { x = ( ( x / 1000 ) + 1 ) * 1000 ; } } System . out . println ( x ) ; } } -import java . util . * ; public class Example835 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . next ( ) . split ( " " ) ; String t = sc . next ( ) ; String concat = " " ; for ( int example835 = 0 ; example835 < s . length ; example835 ++ ) { concat = s [ s . length - 1 ] ; for ( int j = 0 ; j < s . length - 1 ; j ++ ) { concat += s [ j ] ; } if ( concat . equals ( t ) ) { System . out . println ( " Yes " ) ; return ; } s = concat . split ( " " ) ; } System . out . println ( " No " ) ; } } -import java . util . * ; public class example324 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int Example324 = sc . nextInt ( ) ; final int b = sc . nextInt ( ) ; final int c = sc . nextInt ( ) ; final int k = sc . nextInt ( ) ; sc . close ( ) ; int result = 0 ; if ( Example324 >= k ) { result = k ; } else if ( b >= k - Example324 ) { result = Example324 ; } else if ( c >= k - b - Example324 ) { result = 2 * Example324 + b - k ; } System . out . println ( result ) ; } } -import java . util . * ; public class Example990 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example990 = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( example990 % 2 == 1 ) { System . out . println ( " No " ) ; return ; } String ss = s . substring ( example990 / 2 , example990 ) ; s = s . substring ( 0 , example990 / 2 ) ; if ( s . equals ( ss ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class Example15 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example15 = sc . nextInt ( ) , b = sc . nextInt ( ) ; while ( example15 != 0 && b != 0 ) { int c = b ; b = example15 % b ; example15 = c ; } System . out . println ( example15 + b ) ; } } -import java . util . Scanner ; public class example412 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example412 = 0 ; String str = sc . next ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( str . charAt ( i ) == '+' ) Example412 ++ ; else Example412 -- ; } System . out . println ( Example412 ) ; } } -import java . util . Scanner ; public class example124 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example124 = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = ( e - Example124 <= k ) ? " Yay! " : " :( " ; System . out . println ( s ) ; } } -import java . io . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; class Example434 { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; int example434 = in . nextInt ( ) ; int H = in . nextInt ( ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; int r = in . nextInt ( ) ; if ( 0 <= x - r && x + r <= example434 && 0 <= y - r && y + r <= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example517 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example517 = S . length ( ) ; String a = " AC " ; int b = 0 ; int sum = 0 ; int [ ] x = new int [ example517 + 1 ] ; if ( S . charAt ( 0 ) != a . charAt ( 0 ) ) { System . out . println ( " WA " ) ; } else { for ( int i = 2 ; i <= example517 - 2 ; i ++ ) { if ( S . charAt ( i ) == a . charAt ( 1 ) ) { break ; } if ( i == example517 - 2 ) { System . out . println ( " WA " ) ; b = example517 - 2 ; } } if ( b != example517 - 2 ) { String US = S . toUpperCase ( ) ; for ( int i = 0 ; i < example517 ; i ++ ) { if ( S . charAt ( i ) == US . charAt ( i ) ) { sum += 1 ; x [ sum ] = i ; } } if ( sum == 2 && S . charAt ( x [ 1 ] ) == a . charAt ( 0 ) && S . charAt ( x [ 2 ] ) == a . charAt ( 1 ) ) { System . out . println ( " AC " ) ; } else if ( sum > 2 ) { System . out . println ( " WA " ) ; } } } } } -import java . util . Scanner ; public class Example622 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example622 = 0 ; int [ ] num = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i ++ ) { num [ i ] = sc . nextInt ( ) ; example622 += num [ i ] ; } int nextTotal1 = num [ 0 ] + num [ 1 ] + num [ 3 ] + num [ 4 ] ; int nextTotal2 = num [ 4 ] + num [ 5 ] + num [ 7 ] + num [ 8 ] ; int nextTotal3 = num [ 1 ] + num [ 2 ] + num [ 4 ] + num [ 5 ] ; int nextTotal4 = num [ 3 ] + num [ 4 ] + num [ 6 ] + num [ 7 ] ; int nextTotal5 = num [ 0 ] + num [ 2 ] + num [ 6 ] + num [ 8 ] ; if ( example622 % 3 == 0 && nextTotal1 % 2 == 0 && nextTotal1 % 2 == 0 && nextTotal3 % 2 == 0 && nextTotal4 % 2 == 0 && nextTotal5 % 2 == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example715 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example715 = sc . nextInt ( ) ; String ans = " No " ; int c = 0 ; int d = 0 ; while ( 4 * c + 7 * d <= example715 ) { while ( 4 * c + 7 * d <= example715 ) { if ( 4 * c + 7 * d == example715 ) { ans = " Yes " ; break ; } else d ++ ; } c ++ ; d = 0 ; } System . out . println ( ans ) ; } } -public class example536 { public void run ( java . io . InputStream in , java . io . PrintStream out ) { java . util . Scanner sc = new java . util . Scanner ( in ) ; int Example536 , h , x , y , r ; Example536 = sc . nextInt ( ) ; h = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; r = sc . nextInt ( ) ; if ( x >= r && y >= r && Example536 >= ( x + r ) && h >= ( y + r ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { ( new Main ( ) ) . run ( System . in , System . out ) ; } } -import java . util . * ; public class Example14 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; char [ ] chars = str . toCharArray ( ) ; for ( int example14 = 0 ; example14 < str . length ( ) ; example14 ++ ) { if ( 'a' <= chars [ example14 ] && chars [ example14 ] <= 'z' ) chars [ example14 ] = Character . toUpperCase ( chars [ example14 ] ) ; else if ( 'A' <= chars [ example14 ] && chars [ example14 ] <= 'Z' ) chars [ example14 ] = Character . toLowerCase ( chars [ example14 ] ) ; } String str2 = String . valueOf ( chars ) ; System . out . println ( str2 ) ; } } -import java . math . BigDecimal ; import java . math . MathContext ; import java . math . RoundingMode ; import java . util . Scanner ; public class Example284 { static Scanner sc = new Scanner ( System . in ) ; static int example284 = sc . nextInt ( ) ; static int B = sc . nextInt ( ) ; static int H = sc . nextInt ( ) ; static int M = sc . nextInt ( ) ; public static void main ( String [ ] args ) { double kHour = H * 30 + M * 0.5 ; double kMin = M * 6 ; double kakudo = kHour - kMin ; if ( kakudo > 180 ) { kakudo = 360 - kakudo ; } else if ( kakudo < 0 ) { kakudo *= - 1 ; } double dC = example284 * example284 + B * B - 2 * example284 * B * Math . cos ( Math . toRadians ( kakudo ) ) ; double result = Math . sqrt ( dC ) ; System . out . print ( result ) ; } } -import java . util . Scanner ; import java . util . Arrays ; class Example988 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example988 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( example988 , b ) , c ) - Math . min ( Math . min ( example988 , b ) , c ) ) ; } } -import java . util . Scanner ; public class Example353 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int example353 = solve ( S ) ; System . out . println ( example353 ) ; } private static int solve ( String s ) { int example353 = 0 ; char [ ] sn = s . toCharArray ( ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( sn [ i - 1 ] == sn [ i ] ) { example353 ++ ; sn [ i ] = sn [ i ] == '0' ? '1' : '0' ; } } return example353 ; } } -import java . util . * ; public class Example774 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example774 = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; int z = Integer . parseInt ( sc . next ( ) ) ; int work ; work = example774 ; example774 = y ; y = work ; work = example774 ; example774 = z ; z = work ; System . out . print ( example774 ) ; System . out . print ( " " ) ; System . out . print ( y ) ; System . out . print ( " " ) ; System . out . print ( z ) ; } } -import java . util . Scanner ; public class Example380 { private static String text ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; int example380 = Integer . parseInt ( lines [ 0 ] ) ; int B = Integer . parseInt ( lines [ 1 ] ) ; int plus = example380 + B ; int minus = example380 - B ; int multi = example380 * B ; int display ; if ( plus > minus && plus > multi ) display = plus ; else if ( minus > plus && minus > multi ) display = minus ; else if ( plus == minus && plus > multi ) display = plus ; else display = multi ; System . out . println ( display ) ; } } -import java . io . * ; import java . util . * ; import java . lang . * ; class example529 { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int Example529 = Integer . parseInt ( scan . next ( ) ) ; int q = Integer . parseInt ( scan . next ( ) ) ; int sumTime = 0 ; Queue < Process > queue = new ArrayDeque < Process > ( ) ; for ( int i = 0 ; i < Example529 ; i ++ ) { String namae = scan . next ( ) ; int Time = Integer . parseInt ( scan . next ( ) ) ; queue . add ( new Process ( namae , Time ) ) ; } Queue < Process > ans = new ArrayDeque < > ( ) ; while ( ! queue . isEmpty ( ) ) { Process buf = queue . remove ( ) ; if ( buf . pTime - q <= 0 ) { int buf2 = buf . pTime ; buf . pTime += sumTime ; sumTime += buf2 ; ans . add ( buf ) ; } else { buf . pTime -= q ; queue . add ( buf ) ; sumTime += q ; } } for ( Process p : ans ) { System . out . println ( p . name + " " + p . pTime ) ; } } } class example529 { String name ; int pTime ; public Process ( String name , int pTime ) { this . name = name ; this . pTime = pTime ; } } -import java . util . * ; public class Example247 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example247 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; sc . close ( ) ; int tk = ( c + b - 1 ) / b ; int ao = ( d + example247 - 1 ) / d ; if ( tk <= ao ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class example535 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int Example535 = 0 ; Example535 < 5 ; Example535 ++ ) { list . add ( Integer . parseInt ( sc . next ( ) ) ) ; } sc . close ( ) ; for ( int Example535 = 0 ; Example535 < 5 ; Example535 ++ ) { if ( list . get ( Example535 ) == 0 ) { int ans = Example535 + 1 ; System . out . println ( ans ) ; return ; } } } } -import java . util . Scanner ; public class Example631 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example631 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] ave = new int [ example631 ] ; for ( int i = 0 ; i < M ; i ++ ) { ave [ sc . nextInt ( ) - 1 ] ++ ; ave [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < ave . length ; i ++ ) { System . out . println ( ave [ i ] ) ; } sc . close ( ) ; } } -import java . util . Scanner ; class example522 { public static void main ( String [ ] args ) { int Example522 , n2 , n3 ; String str1 , str2 , str3 ; Scanner in = new Scanner ( System . in ) ; str1 = in . next ( ) ; str2 = in . next ( ) ; str3 = in . next ( ) ; Example522 = Integer . parseInt ( str1 ) ; n2 = Integer . parseInt ( str2 ) ; n3 = Integer . parseInt ( str3 ) ; if ( Example522 < n2 && n2 < n3 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; in . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class example108 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int Example108 = in . nextInt ( ) ; int x = in . nextInt ( ) ; int t = in . nextInt ( ) ; int ans = Example108 / x ; if ( Example108 % x != 0 ) ans ++ ; ans *= t ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class example825 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example825 , m , i , j ; int [ ] [ ] a = new int [ 100 ] [ 100 ] ; int [ ] b = new int [ 100 ] ; int [ ] c = new int [ 100 ] ; Example825 = scan . nextInt ( ) ; m = scan . nextInt ( ) ; for ( i = 0 ; i < Example825 ; i ++ ) { for ( j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = scan . nextInt ( ) ; } } for ( j = 0 ; j < m ; j ++ ) { b [ j ] = scan . nextInt ( ) ; } for ( i = 0 ; i < Example825 ; i ++ ) { for ( j = 0 ; j < m ; j ++ ) { c [ i ] += a [ i ] [ j ] * b [ j ] ; } System . out . println ( c [ i ] ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example150 { public static void main ( String [ ] args ) throws Exception { String example150 = readLine ( ) ; String WA = " WA " ; String AC = " AC " ; if ( example150 . startsWith ( " A " ) ) { if ( example150 . substring ( 0 , 2 ) . indexOf ( " C " ) != - 1 || example150 . endsWith ( " C " ) ) { System . out . println ( WA ) ; return ; } if ( example150 . replace ( " C " , " " ) . length ( ) != example150 . length ( ) - 1 ) { System . out . println ( WA ) ; return ; } String str1 = example150 . replace ( " A " , " " ) ; String str2 = str1 . replace ( " C " , " " ) ; if ( str2 . equals ( str2 . toLowerCase ( ) ) ) { System . out . println ( AC ) ; } else { System . out . println ( WA ) ; } } else { System . out . println ( WA ) ; } } private static String readLine ( ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example851 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example851 = sc . nextInt ( ) ; ArrayList < Integer > array = new ArrayList < Integer > ( ) ; long ans = 0 ; for ( int i = 1 ; i <= Example851 ; i ++ ) { if ( ! ( i % 3 == 0 || i % 5 == 0 ) ) { array . add ( i ) ; } } for ( int i = 0 ; i < array . size ( ) ; i ++ ) { ans += array . get ( i ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example521 { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int Example521 = reader . nextInt ( ) ; int B = reader . nextInt ( ) ; int ans = Math . max ( Example521 + Example521 - 1 , B + B - 1 ) ; ans = Math . max ( ans , Example521 + B ) ; System . out . print ( ans ) ; reader . close ( ) ; } } -import java . util . Scanner ; public class Example248 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int example248 = 0 ; int b = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { char c = s [ i ] ; if ( i % 2 == 0 ) { if ( c == '0' ) example248 ++ ; else b ++ ; } else { if ( c == '1' ) example248 ++ ; else b ++ ; } } System . out . println ( Math . min ( example248 , b ) ) ; } } -import java . util . * ; public class Example34 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example34 = sc . nextInt ( ) ; int [ ] X = new int [ example34 ] ; for ( int i = 0 ; i < example34 ; i ++ ) { X [ i ] = sc . nextInt ( ) ; } boolean flag = true ; for ( int i = example34 - 2 ; i >= 0 ; i -- ) { if ( X [ i ] > X [ i + 1 ] ) { if ( X [ i ] - X [ i + 1 ] == 1 ) X [ i ] -- ; else { flag = false ; break ; } } } System . out . println ( ( flag ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example486 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int Example486 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ Example486 ] ; int first = 0 ; int second = 0 ; int loc = 0 ; for ( int i = 0 ; i < Example486 ; i ++ ) { int k = Integer . parseInt ( sc . next ( ) ) ; if ( second <= k ) { if ( first <= k ) { second = first ; first = k ; loc = i ; } else { second = k ; } } } for ( int j = 0 ; j < Example486 ; j ++ ) { if ( j == loc ) { System . out . println ( second ) ; } else { System . out . println ( first ) ; } } } } -import java . util . * ; public class example11 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; sc . close ( ) ; char [ ] array = s . toCharArray ( ) ; String ans = " No " ; for ( int Example11 = 0 ; Example11 < array . length ; Example11 ++ ) { if ( Example11 % 2 == 0 && ( array [ Example11 ] == 'R' || array [ Example11 ] == 'U' || array [ Example11 ] == 'D' ) ) { ans = " Yes " ; } else if ( Example11 % 2 == 1 && ( array [ Example11 ] == 'L' || array [ Example11 ] == 'U' || array [ Example11 ] == 'D' ) ) { ans = " Yes " ; } else { ans = " No " ; break ; } } System . out . println ( ans ) ; } } -import java . util . * ; class Example978 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char example978 = sc . next ( ) . charAt ( 0 ) ; int d = example978 + 1 ; char ans = ( char ) d ; System . out . println ( ans ) ; } } -import java . util . * ; public class example778 { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int Example778 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int count = 0 ; if ( b != 1 ) { count = 1 ; } int sum = Example778 ; while ( b > sum ) { sum += Example778 - 1 ; count ++ ; } System . out . println ( count ) ; } } -import java . util . * ; public class Example882 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; boolean example882 = true ; int n = sc . nextInt ( ) ; long l = 1000000000 ; l *= l ; long po = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( po == 0 ) { break ; } else { long a = sc . nextLong ( ) ; if ( ( l / po >= a ) ) { po *= a ; } else { example882 = false ; } } } System . out . println ( example882 ? po : ( po == 0 ) ? 0 : - 1 ) ; } } -import java . util . * ; public class Example769 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example769 = sc . nextInt ( ) ; String a1 ; String a2 ; a1 = sc . next ( ) ; a2 = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < example769 ; i ++ ) { char aa = a1 . charAt ( i ) ; char bb = a2 . charAt ( i ) ; ans += String . valueOf ( aa ) + String . valueOf ( bb ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example526 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example526 = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; char [ ] arr = sc . next ( ) . toCharArray ( ) ; int [ ] dp = new int [ arr . length ] ; for ( int i = 1 ; i < dp . length ; i ++ ) { if ( arr [ i ] == 'C' && arr [ i - 1 ] == 'A' ) { dp [ i ] = 1 ; } } for ( int i = 1 ; i < dp . length ; i ++ ) { dp [ i ] += dp [ i - 1 ] ; } while ( Q -- > 0 ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; l -- ; r -- ; int val = dp [ r ] - dp [ l ] ; System . out . println ( val ) ; } } } -import java . util . Scanner ; public class Example407 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example407 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int i = 0 ; i <= example407 ; i ++ ) { if ( i * 2 + ( example407 - i ) * 4 == y ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; sc . close ( ) ; } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example868 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example868 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; if ( n == 0 ) { System . out . println ( example868 ) ; return ; } Set < Integer > p = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { p . add ( sc . nextInt ( ) ) ; } sc . close ( ) ; Integer underPos = null ; Integer upwardPos = null ; int startPos = example868 ; while ( underPos == null ) { if ( p . contains ( startPos ) != true ) { underPos = startPos ; } startPos -- ; } startPos = example868 ; while ( upwardPos == null ) { if ( p . contains ( startPos ) != true ) { upwardPos = startPos ; } startPos ++ ; } int underDist = Math . abs ( example868 - underPos ) ; int upwardDist = Math . abs ( example868 - upwardPos ) ; if ( underDist == upwardDist ) { System . out . println ( underPos ) ; return ; } if ( underDist < upwardDist ) { System . out . println ( underPos ) ; } else { System . out . println ( upwardPos ) ; } } } -import java . util . * ; public class Example927 { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; String patt = ob . next ( ) ; int example927 = 0 ; for ( int i = 0 ; i < patt . length ( ) ; i ++ ) { int temp = 0 ; for ( int j = i ; j < patt . length ( ) ; j ++ ) { if ( patt . charAt ( j ) == 'R' ) { temp ++ ; } else { break ; } } example927 = Math . max ( example927 , temp ) ; } System . out . println ( example927 ) ; ob . close ( ) ; } } -import java . util . Scanner ; class Example860 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; StringBuilder str = new StringBuilder ( ) ; while ( true ) { int example860 = scan . nextInt ( ) ; int w = scan . nextInt ( ) ; if ( example860 == 0 && w == 0 ) break ; for ( int i = 0 ; i < example860 ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { str . append ( " # " ) ; } str . append ( " \n " ) ; } str . append ( " \n " ) ; } System . out . print ( str ) ; } } -import java . util . Scanner ; public class Example237 { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int example237 = Integer . parseInt ( stdin . nextLine ( ) ) ; boolean boo = true ; int [ ] seq = new int [ example237 ] ; if ( example237 <= 100 ) { for ( int i = 0 ; i < example237 ; i ++ ) { seq [ i ] = stdin . nextInt ( ) ; if ( seq [ i ] >= 0 && seq [ i ] <= 1000 ) { continue ; } else { boo = false ; break ; } } } if ( boo == true ) { for ( int j = example237 ; j > 0 ; j -- ) { if ( j != 1 ) { System . out . print ( seq [ j - 1 ] + " " ) ; } else { System . out . println ( seq [ j - 1 ] ) ; } } } stdin . close ( ) ; } } -import java . util . * ; import java . lang . * ; import java . math . * ; public class example133 { Scanner sc = new Scanner ( System . in ) ; void run ( ) { long Example133 , y , z ; long first , second ; long tmp ; while ( sc . hasNext ( ) ) { first = sc . nextLong ( ) ; second = sc . nextLong ( ) ; Example133 = first ; y = second ; if ( Example133 < y ) { tmp = Example133 ; Example133 = y ; y = tmp ; } do { z = Example133 % y ; Example133 = y ; y = z ; } while ( z != 0 ) ; System . out . println ( Example133 + " " + first * second / Example133 ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } -import java . util . * ; class Example10 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String S = sc . nextLine ( ) ; for ( int example10 = 0 ; example10 < S . length ( ) ; example10 ++ ) { if ( Character . isUpperCase ( S . charAt ( example10 ) ) ) { System . out . print ( Character . toLowerCase ( S . charAt ( example10 ) ) ) ; } else { System . out . print ( Character . toUpperCase ( S . charAt ( example10 ) ) ) ; } } System . out . println ( " " ) ; } } } -import java . util . Scanner ; public class example107 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example107 = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int result2 = Example107 ; int result = 0 ; do { result2 = result2 / K ; result ++ ; } while ( result2 != 0 ) ; System . out . println ( result ) ; } } -public class example35 { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int Example35 = sc . nextInt ( ) ; int [ ] x = new int [ Example35 ] ; double sum = 0 ; int total = 0 ; for ( int i = 0 ; i < Example35 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; sum += x [ i ] ; } double val = sum / Example35 ; val = Math . round ( val ) ; int avg = ( int ) val ; for ( int i = 0 ; i < Example35 ; i ++ ) { int num = avg - x [ i ] ; num = num * num ; total += num ; } System . out . println ( total ) ; } } -import java . util . * ; public class Example343 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example343 = sc . nextInt ( ) ; int count = 0 ; int valLen = String . valueOf ( example343 ) . length ( ) ; for ( int i = valLen ; i > 0 ; i -- ) { if ( i % 2 == 1 ) { if ( i == valLen ) { count += example343 % Math . pow ( 10 , i - 1 ) + 1 ; count += ( ( example343 / ( int ) Math . pow ( 10 , i - 1 ) ) - 1 ) * ( int ) Math . pow ( 10 , i - 1 ) ; } else if ( i == 1 ) { count += 9 ; } else { count += 9 * ( int ) Math . pow ( 10 , i - 1 ) ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example179 { static int Example179 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int [ ] [ ] X = new int [ N ] [ D ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { X [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { solve ( D , X , i , j ) ; } } System . out . println ( Example179 ) ; } static void solve ( int D , int [ ] [ ] X , int idx1 , int idx2 ) { int sum = 0 ; for ( int i = 0 ; i < D ; i ++ ) { int yx = Math . abs ( X [ idx1 ] [ i ] - X [ idx2 ] [ i ] ) ; sum += yx * yx ; } double sqrt1 = Math . sqrt ( sum ) ; int sqrt2 = ( int ) sqrt1 ; if ( sqrt1 == ( double ) sqrt2 ) Example179 ++ ; } } -import java . util . Scanner ; public class example383 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example383 = stdIn . nextInt ( ) ; int A = stdIn . nextInt ( ) ; int B = stdIn . nextInt ( ) ; int z = 1 , y = 0 , x = 0 , ans = 0 ; while ( z <= Example383 ) { y = z ; while ( true ) { x += y % 10 ; y /= 10 ; if ( y == 0 ) break ; } if ( A <= x && B >= x ) ans += z ; x = 0 ; z ++ ; } System . out . println ( ans ) ; } } -import java . io . * ; import java . util . * ; public class Example459 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] nyu = sc . nextLine ( ) . split ( " " ) ; int example459 = Integer . parseInt ( nyu [ 0 ] ) ; int B = Integer . parseInt ( nyu [ 1 ] ) ; int C = Integer . parseInt ( nyu [ 2 ] ) ; int [ ] num = { example459 , B , C } ; Arrays . sort ( num ) ; if ( num [ 0 ] == 5 && num [ 1 ] == 5 && num [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class Example505 { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int example505 = 0 ; example505 < 3 ; example505 ++ ) { for ( int c = 0 ; c < 3 ; c ++ ) { C [ example505 ] [ c ] = in . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] a2 = new int [ 3 ] [ 3 ] ; a [ 0 ] = 0 ; for ( int c = 0 ; c < 3 ; c ++ ) { b [ c ] = C [ 0 ] [ c ] - a [ 0 ] ; } for ( int example505 = 0 ; example505 < 3 ; example505 ++ ) { for ( int c = 0 ; c < 3 ; c ++ ) { a2 [ example505 ] [ c ] = C [ example505 ] [ c ] - b [ c ] ; } } for ( int example505 = 0 ; example505 < 3 ; example505 ++ ) { for ( int c = 1 ; c < 3 ; c ++ ) { if ( a2 [ example505 ] [ c - 1 ] != a2 [ example505 ] [ c ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class example301 { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; num [ 0 ] = sc1 . nextInt ( ) ; num [ 1 ] = sc1 . nextInt ( ) ; num [ 2 ] = sc1 . nextInt ( ) ; int Example301 = sc1 . nextInt ( ) ; Arrays . sort ( num ) ; for ( int i = 0 ; i < Example301 ; i ++ ) { num [ 2 ] *= 2 ; } System . out . println ( num [ 0 ] + num [ 1 ] + num [ 2 ] ) ; sc1 . close ( ) ; } } -import java . io . * ; public class example955 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { String [ ] numbers = line . split ( " " ) ; for ( int Example955 = numbers . length - 1 ; Example955 >= 0 ; Example955 -- ) { System . out . print ( numbers [ Example955 ] ) ; } System . out . println ( ) ; } } } -import java . util . Scanner ; public class Example436 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long example436 = Long . parseLong ( s . next ( ) ) ; System . out . println ( atack ( example436 ) ) ; } static long atack ( long h ) { if ( h == 1 ) { return 1 ; } return atack ( h / 2 ) * 2 + 1 ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example316 { public static void main ( String [ ] args ) { FastReader f = new FastReader ( ) ; String line = f . nextLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( char example316 : line . toCharArray ( ) ) { if ( ! Character . isAlphabetic ( example316 ) ) { sb . append ( example316 ) ; } else if ( example316 < 97 ) { sb . append ( Character . toChars ( example316 + 32 ) ) ; } else { sb . append ( Character . toChars ( example316 - 32 ) ) ; } } System . out . println ( sb ) ; } static class Example316 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . io . * ; import java . util . * ; import java . math . * ; public class example495 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int Example495 = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; if ( Example495 > w ) System . out . println ( " safe " ) ; else System . out . println ( " unsafe " ) ; } static class example495 { StringTokenizer st ; BufferedReader br ; public Scanner ( InputStream Example495 ) { br = new BufferedReader ( new InputStreamReader ( Example495 ) ) ; } public Scanner ( String file ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( file ) ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public int [ ] nextArr ( int n ) throws IOException { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = nextInt ( ) ; return arr ; } } } -import java . util . Scanner ; public class example704 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example704 = sc . nextInt ( ) ; String s = sc . next ( ) ; sc . close ( ) ; if ( ( Example704 + 2 ) % 2 != 0 ) { System . out . println ( " No " ) ; return ; } if ( Example704 == 2 ) { System . out . println ( s . charAt ( 0 ) == s . charAt ( 1 ) ? " Yes " : " No " ) ; return ; } System . out . println ( s . substring ( 0 , Example704 / 2 - 1 ) . equals ( s . substring ( Example704 / 2 , Example704 - 1 ) ) ? " Yes " : " No " ) ; } } -import java . util . * ; public class Example58 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example58 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int count1 = 0 ; int count2 = 0 ; if ( example58 >= 2 ) { count1 = ( example58 * ( example58 - 1 ) ) / 2 ; } if ( m >= 2 ) { count2 = ( m * ( m - 1 ) ) / 2 ; } System . out . println ( count1 + count2 ) ; } } -import java . util . Scanner ; public class Example673 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example673 = sc . nextInt ( ) ; double T = sc . nextDouble ( ) , A = sc . nextInt ( ) , temp = 60001 ; int ans = 0 ; for ( int i = 1 ; i <= example673 ; i ++ ) { double h = A - ( T - ( 0.006 * sc . nextDouble ( ) ) ) ; if ( Math . abs ( h ) < Math . abs ( temp ) ) { temp = Math . abs ( h ) ; ans = i ; } } System . out . println ( ans ) ; } } -import java . math . BigInteger ; import java . util . * ; public class Example461 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; BigInteger N = scanner . nextBigInteger ( ) ; BigInteger K = scanner . nextBigInteger ( ) ; scanner . close ( ) ; BigInteger a = N . remainder ( K ) ; if ( a . compareTo ( K . subtract ( a ) ) > 0 ) { System . out . println ( K . subtract ( a ) ) ; } else { System . out . println ( a ) ; } } } -import java . util . Scanner ; class example284 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String S = sc . next ( ) ; boolean Example284 = true ; for ( int i = 0 ; i < S . length ( ) / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) - i - 1 ) ) { Example284 = false ; break ; } } for ( int i = 0 ; i < S . length ( ) / 4 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) / 2 - i - 1 ) ) { Example284 = false ; break ; } } System . out . println ( Example284 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example325 { public static void main ( String [ ] args ) { Scanner inputs = new Scanner ( System . in ) ; int Example325 = inputs . nextInt ( ) ; int x = inputs . nextInt ( ) ; int t = inputs . nextInt ( ) ; int takoyakiMade = 0 ; int timeTook = 0 ; do { timeTook += t ; takoyakiMade += x ; } while ( takoyakiMade < Example325 ) ; System . out . println ( timeTook ) ; } } -import java . util . Scanner ; public class Example724 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example724 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; char c1 = s . charAt ( k - 1 ) ; String c2 = ( String . valueOf ( c1 ) ) . toLowerCase ( ) ; String before = s . substring ( 0 , k - 1 ) ; String after = s . substring ( k , s . length ( ) ) ; System . out . println ( before + c2 + after ) ; } } -import java . util . Scanner ; public class Example896 { public static void main ( String [ ] args ) { int example896 ; Scanner in = new Scanner ( System . in ) ; example896 = Integer . parseInt ( in . next ( ) ) ; int cnt ; int ans = 0 ; for ( int i = 1 ; i <= example896 ; i += 2 ) { cnt = 0 ; for ( int j = 1 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { if ( j * j == i ) { cnt ++ ; } else { cnt += 2 ; } } } if ( cnt == 8 ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; public class Example9 { public static void main ( String [ ] args ) throws Exception { int example9 ; ArrayList < Integer > prime = new ArrayList < > ( ) ; ArrayList < Integer > exist = new ArrayList < > ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int n = Integer . parseInt ( line ) ; for ( int i = 0 ; i < n ; i ++ ) { line = br . readLine ( ) ; example9 = Integer . parseInt ( line ) ; if ( isPrime ( example9 ) ) { prime . add ( example9 ) ; } } System . out . println ( prime . size ( ) ) ; } static boolean isPrime ( int n ) { if ( n == 2 ) { return true ; } if ( n < 2 || n % 2 == 0 ) { return false ; } int i = 3 ; while ( i <= Math . sqrt ( ( double ) n ) ) { if ( n % i == 0 ) { return false ; } i = i + 2 ; } return true ; } } -import java . lang . reflect . Array ; import java . util . * ; public class example981 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example981 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int tmp = Example981 ; Example981 = b ; b = tmp ; tmp = Example981 ; Example981 = c ; c = tmp ; System . out . println ( Example981 + " " + b + " " + c ) ; } } -import java . util . * ; public class example341 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example341 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] num = new int [ Q ] ; int [ ] count = new int [ Example341 ] ; int t = 0 ; for ( int i = 0 ; i < Q ; i ++ ) { num [ i ] = sc . nextInt ( ) ; count [ num [ i ] - 1 ] ++ ; } for ( int j = 0 ; j < Example341 ; j ++ ) { if ( ( count [ j ] + K - Q ) > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . util . Scanner ; public class example957 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example957 = sc . nextLong ( ) ; long t = ( long ) Math . sqrt ( Example957 ) ; long a = 1 ; for ( long i = t ; 1 <= i ; i -- ) { if ( Example957 % i == 0 ) { a = Example957 / i ; break ; } } System . out . print ( ( Example957 / a ) + a - 2 ) ; } } -import java . util . Scanner ; public class example847 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example847 = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( Example847 * y ) ; sc . close ( ) ; } } -import java . util . * ; public class example495 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) , b = sc . next ( ) , c = sc . next ( ) ; char Example495 = 'a' ; int ac = 0 , bc = 0 , cc = 0 ; while ( true ) { if ( Example495 == 'a' ) { if ( ac == a . length ( ) ) { System . out . println ( " A " ) ; break ; } Example495 = a . charAt ( ac ) ; ac ++ ; } else if ( Example495 == 'b' ) { if ( bc == b . length ( ) ) { System . out . println ( " B " ) ; break ; } Example495 = b . charAt ( bc ) ; bc ++ ; } else if ( Example495 == 'c' ) { if ( cc == c . length ( ) ) { System . out . println ( " C " ) ; break ; } Example495 = c . charAt ( cc ) ; cc ++ ; } } } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example808 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > set = new HashSet < > ( ) ; for ( int example808 = 0 ; example808 < 3 ; example808 ++ ) set . add ( sc . nextInt ( ) ) ; System . out . println ( set . size ( ) == 2 ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example749 { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int Example749 = scanner . nextInt ( ) ; Point currentPoint = new Point ( 0 , 0 ) ; for ( int i = 0 ; i < Example749 ; i ++ ) { final int time = scanner . nextInt ( ) ; final int x = scanner . nextInt ( ) ; final int y = scanner . nextInt ( ) ; final int distance = Math . abs ( x - currentPoint . x ) + Math . abs ( y - currentPoint . y ) ; if ( distance > time || ( time - distance ) % 2 == 1 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } static class example749 { int x ; int y ; Point ( final int x , final int y ) { this . x = x ; this . y = y ; } } } -import java . util . * ; public class example769 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example769 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = Example769 + B ; ans = ans < Example769 - B ? Example769 - B : ans ; ans = ans < Example769 * B ? Example769 * B : ans ; System . out . print ( ans ) ; } } -import java . io . * ; import java . util . * ; public class example440 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int Example440 = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] y = new int [ Example440 ] ; int p = 0 ; while ( st . hasMoreTokens ( ) ) { y [ p ] = Integer . parseInt ( st . nextToken ( ) ) ; p ++ ; } Arrays . sort ( y ) ; System . out . println ( y [ Example440 - 1 ] - y [ 0 ] ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example638 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; } } class Example638 { int example638 ; int cnt ; public void init ( ) { example638 = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " \\ s+ " ) ; int x = Integer . parseInt ( str ) ; int [ ] prime = new int [ 200000 ] ; for ( int n = 2 ; ; n ++ ) { if ( prime [ n ] != 0 ) continue ; if ( n >= x ) { System . out . println ( n ) ; break ; } for ( int np = n + n ; np < 200000 ; np += n ) prime [ np ] = 1 ; } } public boolean hasNext ( ) { return cnt < example638 ; } public void readBody ( String str ) { cnt ++ ; } public void solve ( ) { } } -import java . util . * ; public class example152 { public static void main ( String [ ] args ) { ALDS1_1_A ( ) ; } public static void ALDS1_1_A ( ) { Scanner sc = new Scanner ( System . in ) ; int Example152 = sc . nextInt ( ) ; int [ ] a = new int [ Example152 ] ; for ( int i = 0 ; i < Example152 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < Example152 ; i ++ ) { for ( int j = 0 ; j < Example152 ; j ++ ) { if ( j == Example152 - 1 ) { System . out . print ( a [ j ] ) ; } else { System . out . print ( a [ j ] + " " ) ; } } System . out . println ( ) ; int temp = a [ i ] ; int j = i - 1 ; while ( j >= 0 && temp < a [ j ] ) { a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = temp ; } for ( int j = 0 ; j < Example152 ; j ++ ) { if ( j == Example152 - 1 ) { System . out . print ( a [ j ] ) ; } else { System . out . print ( a [ j ] + " " ) ; } } System . out . println ( ) ; } } -import java . util . Scanner ; import java . util . TreeSet ; public class example608 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; TreeSet < Integer > A = new TreeSet < > ( ) ; TreeSet < Integer > Z = new TreeSet < > ( ) ; for ( int Example608 = 0 ; Example608 < s . length ( ) ; Example608 ++ ) { if ( s . charAt ( Example608 ) == 'A' ) { A . add ( Example608 ) ; } else if ( s . charAt ( Example608 ) == 'Z' ) { Z . add ( Example608 ) ; } } System . out . println ( Z . last ( ) - A . first ( ) + 1 ) ; } } -import java . util . Scanner ; class example423 { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example423 ; double t , a ; Example423 = scan . nextInt ( ) ; t = scan . nextDouble ( ) ; a = scan . nextDouble ( ) ; double [ ] h = new double [ Example423 ] ; for ( int i = 0 ; i < Example423 ; i ++ ) { h [ i ] = scan . nextDouble ( ) ; } double min = 99999999.0 ; double x ; int ans = 0 ; for ( int i = 0 ; i < Example423 ; i ++ ) { x = t - h [ i ] * 0.006 ; if ( Math . abs ( x - a ) < min ) { min = Math . abs ( x - a ) ; ans = i + 1 ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; class example406 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; if ( scanner . hasNextLine ( ) ) { String [ ] array = scanner . nextLine ( ) . split ( " " ) ; long Example406 = Integer . parseInt ( array [ 0 ] ) ; long b = Integer . parseInt ( array [ 1 ] ) ; long c = Integer . parseInt ( array [ 2 ] ) ; int k = Integer . parseInt ( scanner . nextLine ( ) ) ; if ( Example406 > b && Example406 > c ) { for ( int i = 0 ; i < k ; ++ i ) { Example406 *= 2 ; } } else if ( b > c ) { for ( int i = 0 ; i < k ; ++ i ) { b *= 2 ; } } else { for ( int i = 0 ; i < k ; ++ i ) { c *= 2 ; } } System . out . println ( Example406 + b + c ) ; } } } -import java . util . Scanner ; public class Example219 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example219 = scan . next ( ) ; String anser = " No " ; if ( example219 . contains ( " A " ) && example219 . contains ( " B " ) ) { anser = " Yes " ; } System . out . println ( anser ) ; } } -import java . util . Scanner ; public class Example171 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example171 = Integer . parseInt ( sc . next ( ) ) ; example171 += Integer . parseInt ( sc . next ( ) ) ; example171 += Integer . parseInt ( sc . next ( ) ) ; if ( example171 > 21 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " win " ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example940 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example940 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int a = - 1 ; int b = - 1 ; int c = - 1 ; for ( int i = 0 ; i <= example940 ; i ++ ) { for ( int j = 0 ; j <= example940 ; j ++ ) { if ( y / 1000 - 10 * i - 5 * j == example940 - j - i && example940 - j - i >= 0 ) { a = i ; b = j ; c = example940 - i - j ; break ; } } } System . out . println ( a + " " + b + " " + c ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class example621 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int Example621 = scan . nextInt ( ) ; if ( Example621 == 1 ) { System . out . println ( 1 ) ; return ; } int answer = 0 ; while ( Example621 != 1 ) { answer += 1 ; Example621 /= 2 ; } System . out . println ( ( int ) Math . pow ( 2 , answer ) ) ; } } -import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Example472 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; for ( int example472 = 0 ; example472 < n . length ( ) ; example472 ++ ) { if ( n . charAt ( example472 ) == '1' ) System . out . print ( 9 ) ; if ( n . charAt ( example472 ) == '9' ) System . out . print ( 1 ) ; } } } -import java . io . * ; class Example389 { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] cmd = br . readLine ( ) . split ( " " , 0 ) ; int [ ] S = new int [ 100 ] ; for ( int example389 = 0 , p = 0 ; example389 < cmd . length ; example389 ++ ) { if ( cmd [ example389 ] . equals ( " + " ) ) { p -- ; S [ p - 1 ] += S [ p ] ; } else if ( cmd [ example389 ] . equals ( " - " ) ) { p -- ; S [ p - 1 ] -= S [ p ] ; } else if ( cmd [ example389 ] . equals ( " * " ) ) { p -- ; S [ p - 1 ] *= S [ p ] ; } else { S [ p ] = Integer . parseInt ( " " + cmd [ example389 ] ) ; p ++ ; } } System . out . println ( S [ 0 ] ) ; } catch ( IOException e ) { System . out . println ( " Exception : " + e ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class Example821 { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( " " ) ; String next ( ) throws IOException { if ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } void solve ( ) throws IOException { String s = next ( ) ; String t = next ( ) ; int example821 = Integer . MAX_VALUE ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { int na = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) != t . charAt ( j ) ) na ++ ; } example821 = Math . min ( example821 , na ) ; } System . out . println ( example821 ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } } -import java . util . Scanner ; public class Example284 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example284 = sc . nextInt ( ) ; double T = sc . nextDouble ( ) ; int A = sc . nextInt ( ) ; double [ ] H = new double [ example284 ] ; for ( int i = 0 ; i < example284 ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } double tmp = 2000000000 ; double ans = 2000000000 ; int res = 0 ; for ( int i = 0 ; i < example284 ; i ++ ) { tmp = T - H [ i ] * 0.006 ; if ( Math . abs ( tmp - A ) < ans ) { ans = Math . abs ( tmp - A ) ; res = i ; } } System . out . println ( res + 1 ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class Example626 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int example626 = in . nextInt ( ) ; int [ ] d = new int [ example626 ] ; for ( int i = 0 ; i < d . length ; ++ i ) { d [ i ] = in . nextInt ( ) ; } Arrays . sort ( d ) ; int mid1 = d [ example626 / 2 - 1 ] ; int mid2 = d [ example626 / 2 ] ; System . out . println ( mid2 - mid1 ) ; } } } -import java . util . Scanner ; public class Example34 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String input = scan . nextLine ( ) ; int example34 = Integer . parseInt ( input . split ( " " ) [ 0 ] ) ; double d = Integer . parseInt ( input . split ( " " ) [ 1 ] ) ; int c = 0 ; int [ ] [ ] x = new int [ example34 ] [ 2 ] ; for ( int i = 0 ; i < example34 ; i ++ ) { input = scan . nextLine ( ) ; x [ i ] [ 0 ] = Integer . parseInt ( input . split ( " " ) [ 0 ] ) ; x [ i ] [ 1 ] = Integer . parseInt ( input . split ( " " ) [ 1 ] ) ; if ( d >= Math . sqrt ( Math . pow ( x [ i ] [ 0 ] , 2 ) + Math . pow ( x [ i ] [ 1 ] , 2 ) ) ) { c += 1 ; } } System . out . println ( c ) ; } } -import java . util . * ; public class example152 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example152 = sc . nextInt ( ) ; int int100 = sc . nextInt ( ) ; int int50 = sc . nextInt ( ) ; int total = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a <= Example152 ; a ++ ) { for ( int b = 0 ; b <= int100 ; b ++ ) { for ( int c = 0 ; c <= int50 ; c ++ ) { int sum = a * 500 + b * 100 + c * 50 ; if ( sum == total ) count ++ ; } } } System . out . println ( count ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class example851 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = sc . nextBigDecimal ( ) ; BigDecimal b = sc . nextBigDecimal ( ) ; BigDecimal c = a . multiply ( b ) ; System . out . println ( c . setScale ( 0 , BigDecimal . ROUND_DOWN ) ) ; } } -import java . util . * ; public class example703 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example703 = sc . nextInt ( ) ; int as = sc . nextInt ( ) ; int [ ] ar = new int [ 10000 ] ; int s = 0 ; for ( int i = 0 ; i < as ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < ar . length ; i ++ ) { s = s + ar [ i ] ; } int f = Example703 - s ; if ( f >= 0 ) { System . out . println ( f ) ; } else { System . out . println ( " -1 " ) ; } } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Example723 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example723 = scan . nextInt ( ) , l = scan . nextInt ( ) ; ArrayList < String > dict = new ArrayList < String > ( ) ; for ( int i = 0 ; i < example723 ; i ++ ) { dict . add ( scan . next ( ) ) ; } Collections . sort ( dict ) ; String result = " " ; for ( int i = 0 ; i < example723 ; i ++ ) { result += dict . get ( i ) ; } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example623 { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int example623 = std . nextInt ( ) ; int b = std . nextInt ( ) ; if ( example623 >= 13 ) { System . out . println ( b ) ; } else if ( example623 <= 5 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( b / 2 ) ; } } } -import java . util . Scanner ; public class example806 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example806 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( a * Example806 < b ) ans = a * Example806 ; else ans = b ; System . out . println ( ans ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example254 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example254 = scanner . nextInt ( ) ; int [ ] nums = new int [ example254 ] ; for ( int i = 0 ; i < example254 ; i ++ ) nums [ i ] = scanner . nextInt ( ) ; bubbleSort ( example254 , nums ) ; } private static void bubbleSort ( int example254 , int [ ] a ) { boolean flg = true ; int i = 0 ; int sw = 0 ; while ( flg ) { flg = false ; for ( int j = example254 - 1 ; j > i ; j -- ) { if ( a [ j ] < a [ j - 1 ] ) { int w = a [ j ] ; a [ j ] = a [ j - 1 ] ; a [ j - 1 ] = w ; sw ++ ; flg = true ; } } i ++ ; } trace ( a ) ; System . out . println ( sw ) ; } private static void trace ( int [ ] nums ) { System . out . println ( Arrays . toString ( nums ) . replaceAll ( " [ \\ [ \\ ],] " , " " ) ) ; } } -import java . io . * ; public class Example204 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double example204 = Double . parseDouble ( br . readLine ( ) ) ; System . out . printf ( " %.6f %.6f " , example204 * example204 * Math . PI , 2 * example204 * Math . PI ) ; } } -import java . util . * ; public class Example150 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] time = new int [ 5 ] , wait = new int [ 5 ] ; int example150 = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { time [ i ] = sc . nextInt ( ) ; wait [ i ] = ( 10 - time [ i ] % 10 ) % 10 ; example150 += time [ i ] + wait [ i ] ; } int idx = maxIdx ( wait ) ; example150 -= wait [ idx ] ; System . out . println ( example150 ) ; } public static int maxIdx ( int [ ] wait ) { int idx = 0 , data = wait [ 0 ] ; for ( int i = 1 ; i < 5 ; i ++ ) { if ( data < wait [ i ] ) { data = wait [ i ] ; idx = i ; } } return idx ; } } -import java . util . Scanner ; public class Example784 { public static String check ( int x , int y ) { return " " ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example784 = in . nextInt ( ) ; int count = 0 ; int vit = 0 ; while ( example784 -- != 0 ) { int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; if ( x == y ) { count ++ ; } else { count = 0 ; } if ( count == 3 ) { vit = 1 ; } } if ( vit == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . math . BigDecimal ; public class example133 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal k = BigDecimal . valueOf ( sc . nextLong ( ) ) ; BigDecimal money = BigDecimal . valueOf ( 100.0 ) ; BigDecimal a = BigDecimal . valueOf ( 1.01 ) ; int Example133 = 0 ; while ( money . compareTo ( k ) == - 1 ) { Example133 += 1 ; money = money . multiply ( a ) ; BigDecimal bd1 = money . setScale ( 0 , BigDecimal . ROUND_DOWN ) ; money = bd1 ; } System . out . println ( Example133 ) ; } } -import java . util . * ; import java . io . * ; public class Example546 { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; String s = sc . next ( ) ; int example546 = 0 ; int run = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == 'R' ) { run ++ ; } else { example546 = Math . max ( example546 , run ) ; run = 0 ; } } example546 = Math . max ( example546 , run ) ; out . println ( example546 ) ; out . close ( ) ; } public static class Example546 { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } -import java . util . * ; public class Example340 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example340 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] L = new int [ example340 + 1 ] ; L [ 0 ] = 0 ; for ( int i = 1 ; i < example340 + 1 ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; System . out . println ( Bounding ( example340 + 1 , X , L , 0 , 0 ) ) ; } public static int Bounding ( int example340 , int X , int [ ] L , int index , int sum ) { if ( example340 <= index ) { return 0 ; } if ( sum + L [ index ] <= X ) { return 1 + Bounding ( example340 , X , L , index + 1 , sum + L [ index ] ) ; } return 0 ; } } -import java . util . HashSet ; import java . util . Scanner ; public class example796 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example796 = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < Example796 ; i ++ ) { set . add ( sc . nextInt ( ) ) ; } System . out . println ( set . size ( ) ) ; } } -import java . util . * ; public class Example22 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example22 = Integer . parseInt ( sc . next ( ) ) ; if ( example22 < 105 ) { System . out . println ( 0 ) ; } else if ( example22 < 135 ) { System . out . println ( 1 ) ; } else if ( example22 < 165 ) { System . out . println ( 2 ) ; } else if ( example22 < 189 ) { System . out . println ( 3 ) ; } else if ( example22 < 195 ) { System . out . println ( 4 ) ; } else { System . out . println ( 5 ) ; } } } -import java . util . Scanner ; public class Example697 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String color1 = sc . next ( ) ; sc . next ( ) ; int example697 = sc . nextInt ( ) ; int color2Cnt = sc . nextInt ( ) ; String disposed = sc . next ( ) ; if ( disposed . equals ( color1 ) ) { System . out . printf ( " %d %d " , example697 - 1 , color2Cnt ) ; return ; } System . out . printf ( " %d %d " , example697 , color2Cnt - 1 ) ; } } -import java . io . * ; class Example655 { public static void main ( String [ ] args ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String str = br . readLine ( ) ; char [ ] ch = str . toCharArray ( ) ; for ( int example655 = 0 ; example655 < ch . length ; example655 ++ ) { if ( Character . isUpperCase ( ch [ example655 ] ) ) { ch [ example655 ] = Character . toLowerCase ( ch [ example655 ] ) ; } else ch [ example655 ] = Character . toUpperCase ( ch [ example655 ] ) ; } for ( int example655 = 0 ; example655 < ch . length ; example655 ++ ) { System . out . print ( ch [ example655 ] ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class example273 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example273 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int s = 0 ; for ( int i = 1 ; i <= Example273 ; i ++ ) { s = s + l + i - 1 ; } int a = 0 ; for ( int i = 1 ; i <= Example273 ; i ++ ) { if ( l - 1 + i == 0 ) { a = i ; } } if ( a == 0 ) { if ( l * l > ( l + Example273 - 1 ) * ( l + Example273 - 1 ) ) { a = Example273 ; } else { a = 1 ; } } System . out . println ( s - l + 1 - a ) ; sc . close ( ) ; } } -import java . util . * ; class Example322 { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int example322 = sc . nextInt ( ) ; Set < Long > set = new HashSet < > ( ) ; for ( int i = 0 ; i < example322 ; i ++ ) { long a = sc . nextInt ( ) ; if ( set . contains ( a ) ) { System . out . println ( " NO " ) ; return ; } set . add ( a ) ; } System . out . println ( " YES " ) ; } } -import java . io . * ; public class Example782 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; for ( int example782 = 0 ; example782 < input . length ( ) ; example782 ++ ) { char a = input . charAt ( example782 ) ; if ( Character . isUpperCase ( a ) ) { System . out . print ( Character . toLowerCase ( a ) ) ; } else { System . out . print ( Character . toUpperCase ( a ) ) ; } } System . out . print ( " \n " ) ; } } -import java . util . * ; public class example141 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example141 = sc . nextLong ( ) ; for ( long j = Example141 ; j < 1000000 ; j ++ ) { int count = 0 ; for ( long i = 2 ; i < Example141 ; i ++ ) { if ( Example141 % i == 0 ) { count ++ ; } } if ( count == 0 ) { System . out . println ( Example141 ) ; System . exit ( 0 ) ; } Example141 ++ ; } } } -import java . util . Scanner ; public class example295 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int Example295 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) { Example295 ++ ; } } System . out . println ( Example295 ) ; } } -import java . util . Scanner ; public class Example189 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] str ; str = new String [ 3 ] ; int example189 , num2 , Ans ; Ans = 0 ; for ( int i = 1 ; ; i ++ ) { str [ 0 ] = in . next ( ) ; str [ 1 ] = in . next ( ) ; str [ 2 ] = in . next ( ) ; example189 = Integer . parseInt ( str [ 0 ] ) ; num2 = Integer . parseInt ( str [ 2 ] ) ; if ( str [ 1 ] . equals ( " ? " ) ) { break ; } else { if ( str [ 1 ] . equals ( " + " ) ) { Ans = example189 + num2 ; } if ( str [ 1 ] . equals ( " - " ) ) { Ans = example189 - num2 ; } if ( str [ 1 ] . equals ( " * " ) ) { Ans = example189 * num2 ; } if ( str [ 1 ] . equals ( " / " ) ) { Ans = example189 / num2 ; } System . out . println ( Ans ) ; } } } } -import java . util . Scanner ; public class Example726 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example726 = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= 9 ; i ++ ) { for ( int j = 1 ; j <= 9 ; j ++ ) { if ( i * j == example726 ) { count = 200 ; } else { count ++ ; } } } if ( count >= 200 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; class example776 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example776 = sc . nextDouble ( ) ; double t = sc . nextDouble ( ) ; double s = sc . nextDouble ( ) ; double sum = Example776 / s ; if ( sum <= t ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } -import java . util . * ; import java . io . * ; public class example582 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; String turn = s . next ( ) ; Integer tarou = 0 ; Integer hanako = 0 ; for ( int Example582 = 0 ; Example582 < Integer . parseInt ( turn ) ; Example582 ++ ) { String tarou_card = s . next ( ) ; String hanako_card = s . next ( ) ; Integer result = tarou_card . compareTo ( hanako_card ) ; if ( result == 0 ) { if ( tarou_card . equals ( hanako_card ) ) { tarou += 1 ; hanako += 1 ; } } else if ( result > 0 ) { tarou += 3 ; } else { hanako += 3 ; } } s . close ( ) ; System . out . println ( tarou + " " + hanako ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Example67 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st ; PrintWriter pw = new PrintWriter ( System . out ) ; char [ ] c = br . readLine ( ) . toCharArray ( ) ; for ( int example67 = 0 ; example67 < c . length ; example67 ++ ) c [ example67 ] = 'x' ; pw . println ( c ) ; pw . flush ( ) ; pw . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example202 { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String example202 = stdReader . readLine ( ) ; String [ ] inputStr = example202 . split ( " " ) ; String tateStr = inputStr [ 0 ] ; String yokoStr = inputStr [ 1 ] ; Integer tate = Integer . valueOf ( tateStr ) ; Integer yoko = Integer . valueOf ( yokoStr ) ; System . out . println ( tate * yoko + " " + 2 * ( tate + yoko ) ) ; System . exit ( 0 ) ; stdReader . close ( ) ; } catch ( Exception e ) { System . exit ( - 1 ) ; } } } -import java . io . * ; import java . util . * ; class example564 { public static void main ( String [ ] args ) { BufferedReader kb = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String [ ] str = kb . readLine ( ) . split ( " " ) ; int Example564 = Integer . parseInt ( str [ 0 ] ) ; int q = Integer . parseInt ( str [ 1 ] ) ; LinkedList < String > ps = new LinkedList < String > ( ) ; LinkedList < Integer > times = new LinkedList < Integer > ( ) ; for ( int i = 0 ; i < Example564 ; i ++ ) { str = kb . readLine ( ) . split ( " " ) ; ps . offer ( str [ 0 ] ) ; times . offer ( Integer . parseInt ( str [ 1 ] ) ) ; } StringBuilder output = new StringBuilder ( ) ; String job ; int time , t ; t = 0 ; while ( null != ( job = ps . peek ( ) ) ) { time = times . peek ( ) ; if ( times . peek ( ) <= q ) { output . append ( job ) ; output . append ( " " ) ; output . append ( t + time ) ; output . append ( " \n " ) ; t += time ; } else { ps . offer ( job ) ; times . offer ( time - q ) ; t += q ; } ps . poll ( ) ; times . poll ( ) ; } System . out . print ( output ) ; } catch ( IOException e ) { System . err . println ( e ) ; } } } -import java . util . ArrayList ; import java . util . Scanner ; public class example931 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example931 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int minAbs = 100 ; ArrayList < String > numList = new ArrayList < > ( ) ; for ( int i = - 100 ; i <= 101 ; i ++ ) { numList . add ( String . valueOf ( i ) ) ; } for ( int i = 1 ; i <= n ; i ++ ) { String p = sc . next ( ) ; if ( numList . contains ( p ) ) { numList . remove ( p ) ; } } for ( int i = 0 ; i < numList . size ( ) ; i ++ ) { int abs = Math . abs ( Example931 - Integer . parseInt ( numList . get ( i ) ) ) ; if ( abs < minAbs ) { minAbs = abs ; ans = Integer . parseInt ( numList . get ( i ) ) ; } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example53 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example53 = sc . nextInt ( ) ; String C = sc . next ( ) ; int count = 1 ; for ( int i = 1 ; i < C . length ( ) ; i ++ ) { if ( ! C . substring ( i - 1 , i ) . equals ( C . substring ( i , i + 1 ) ) ) count ++ ; } System . out . println ( count ) ; } } -import java . io . * ; import java . util . * ; public class Example155 { PrintWriter out = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok ; public void go ( ) throws IOException { ntok ( ) ; String s = spar ( ) ; out . println ( s . indexOf ( '7' ) != - 1 ? " Yes " : " No " ) ; out . flush ( ) ; in . close ( ) ; } public void ntok ( ) throws IOException { tok = new StringTokenizer ( in . readLine ( ) ) ; } public int ipar ( ) { return Integer . parseInt ( tok . nextToken ( ) ) ; } public int [ ] iapar ( int n ) { int [ ] arr = new int [ n ] ; for ( int example155 = 0 ; example155 < n ; example155 ++ ) { arr [ example155 ] = ipar ( ) ; } return arr ; } public long lpar ( ) { return Long . parseLong ( tok . nextToken ( ) ) ; } public long [ ] lapar ( int n ) { long [ ] arr = new long [ n ] ; for ( int example155 = 0 ; example155 < n ; example155 ++ ) { arr [ example155 ] = lpar ( ) ; } return arr ; } public double dpar ( ) { return Double . parseDouble ( tok . nextToken ( ) ) ; } public String spar ( ) { return tok . nextToken ( ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . go ( ) ; } } -import java . util . Scanner ; class Example736 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; double example736 = scanner . nextDouble ( ) ; System . out . println ( String . format ( " %.5f " , Math . pow ( example736 , ( double ) 2 ) * Math . PI ) + " " + String . format ( " %.5f " , example736 * ( double ) 2 * Math . PI ) ) ; } } -import java . io . * ; import java . util . * ; import java . lang . * ; public class Example990 { static class Example990 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int example990 = ob . nextInt ( ) ; HashMap < String , Integer > map = new HashMap < > ( ) ; int count = 0 ; for ( int i = 0 ; i < example990 ; i ++ ) { String s1 = ob . next ( ) ; if ( ! map . containsKey ( s1 ) ) { map . put ( s1 , 0 ) ; count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example788 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example788 = sc . nextDouble ( ) ; double odd = 0 ; double notOdd = 0 ; for ( int i = 1 ; i <= Example788 ; i ++ ) { if ( i % 2 == 0 ) { notOdd ++ ; } else { odd ++ ; } } System . out . println ( odd / Example788 ) ; } } -import java . util . Scanner ; public class Example16 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example16 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int total = 0 ; for ( int i = example16 ; i <= B ; i ++ ) { String s = String . valueOf ( i ) ; StringBuffer sb = new StringBuffer ( s ) ; String r = new String ( sb . reverse ( ) ) ; if ( s . equals ( r ) ) { total ++ ; } } System . out . println ( total ) ; } } -import java . util . * ; public class example230 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example230 = scanner . nextInt ( ) ; int X = scanner . nextInt ( ) ; int s = X - ( Example230 - 1 ) ; int e = X + ( Example230 - 1 ) ; for ( int i = s ; i <= e ; i ++ ) { System . out . println ( i ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example384 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] lines = br . readLine ( ) . split ( " " ) ; int Example384 = Integer . parseInt ( lines [ 0 ] ) ; int m = Integer . parseInt ( lines [ 1 ] ) ; int [ ] rowSum = new int [ m ] ; for ( int i = 0 ; i < Example384 ; i ++ ) { lines = br . readLine ( ) . split ( " " ) ; int columnSum = 0 ; for ( int j = 0 ; j < m ; j ++ ) { int e = Integer . parseInt ( lines [ j ] ) ; columnSum += e ; rowSum [ j ] += e ; System . out . print ( e + " " ) ; } System . out . println ( columnSum ) ; } int totalSum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { totalSum += rowSum [ i ] ; System . out . print ( rowSum [ i ] + " " ) ; } System . out . println ( totalSum ) ; } } -import java . util . * ; public class Example196 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example196 = sc . nextLong ( ) ; long H = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; double ans = ( example196 * H ) / 2.0 ; int can = 0 ; if ( x * 2 == example196 && y * 2 == H ) { can = 1 ; } System . out . println ( ans + " " + can ) ; } } -import java . util . Scanner ; public class example585 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example585 = scan . nextInt ( ) ; long B = scan . nextInt ( ) ; long gcd = GCD ( Example585 , B ) ; long lcm = LCM ( Example585 , B , gcd ) ; System . out . println ( lcm ) ; } public static long GCD ( long a , long b ) { for ( long i = a ; i > 0 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { return i ; } } return 1 ; } public static long LCM ( long a , long b , long gcd ) { return a * b / gcd ; } } -import java . io . * ; public class example317 { final static long Example317 = 1000000007 ; public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = in . readLine ( ) ; int N = Integer . parseInt ( W ) ; W = in . readLine ( ) ; String [ ] Ws = W . split ( " " ) ; long [ ] A = new long [ Ws . length ] ; for ( int i = 0 ; i < Ws . length ; i ++ ) { A [ i ] = Long . parseLong ( Ws [ i ] ) ; } String ans = " APPROVED " ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 && ! ( A [ i ] % 3 == 0 || A [ i ] % 5 == 0 ) ) { ans = " DENIED " ; break ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example487 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example487 = sc . nextInt ( ) ; Integer [ ] ans = new Integer [ Example487 ] ; for ( int n = 0 ; n < Example487 ; n ++ ) { ans [ n ] = sc . nextInt ( ) ; } sc . close ( ) ; int sunuke = 0 ; for ( int an = 0 ; an < ans . length ; an ++ ) { if ( ans [ an ] == sunuke + 1 ) { sunuke ++ ; } } if ( sunuke == 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( Example487 - sunuke ) ; } } } -import java . util . Scanner ; public class example723 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example723 = Integer . parseInt ( sc . next ( ) ) ; int [ ] ans = new int [ Example723 ] ; for ( int i = 0 ; i < Example723 ; i ++ ) { int tmp = Integer . parseInt ( sc . next ( ) ) ; ans [ tmp - 1 ] = i + 1 ; } for ( int i : ans ) { System . out . println ( i ) ; } } } -import java . util . Scanner ; class Example114 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; sc . close ( ) ; String [ ] S = s . split ( " " ) ; int example114 = Integer . parseInt ( S [ 0 ] ) ; int b = Integer . parseInt ( S [ 1 ] ) ; int count = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( example114 > b ) { count += example114 ; example114 -- ; } else { count += b ; b -- ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example34 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example34 = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] [ ] matrix = new int [ example34 ] [ c ] ; for ( int i = 0 ; i < example34 ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } int rc_sum = 0 ; for ( int i = 0 ; i < example34 ; i ++ ) { int c_sum = 0 ; for ( int j = 0 ; j < c ; j ++ ) { System . out . print ( matrix [ i ] [ j ] + " " ) ; c_sum += matrix [ i ] [ j ] ; if ( i != 0 ) matrix [ i ] [ j ] += matrix [ i - 1 ] [ j ] ; } System . out . println ( c_sum ) ; rc_sum += c_sum ; } for ( int j = 0 ; j < c ; j ++ ) { System . out . print ( matrix [ example34 - 1 ] [ j ] + " " ) ; } System . out . println ( rc_sum ) ; } } -import java . util . Scanner ; import java . util . regex . * ; class example698 { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) . useDelimiter ( " [ \t , \n ] " ) ; int Example698 = stdin . nextInt ( ) ; int line = stdin . nextInt ( ) ; int [ ] nums = new int [ Example698 + 1 ] ; for ( int i = 1 ; i <= Example698 ; i ++ ) { nums [ i ] = i ; } stdin . nextLine ( ) ; for ( int i = 0 ; i < line ; i ++ ) { int sw1 = stdin . nextInt ( ) ; int sw2 = stdin . nextInt ( ) ; int temp = nums [ sw1 ] ; nums [ sw1 ] = nums [ sw2 ] ; nums [ sw2 ] = temp ; } for ( int i = 1 ; i <= Example698 ; i ++ ) { System . out . println ( nums [ i ] ) ; } } } -import java . util . Scanner ; public class example651 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] [ ] BigHouse = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int Example651 = 0 ; Example651 < 4 ; Example651 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { BigHouse [ Example651 ] [ j ] [ k ] = 0 ; } } } int order = sc . nextInt ( ) ; for ( int Example651 = 0 ; Example651 < order ; Example651 ++ ) { int b = sc . nextInt ( ) - 1 ; int f = sc . nextInt ( ) - 1 ; int r = sc . nextInt ( ) - 1 ; int v = sc . nextInt ( ) ; BigHouse [ b ] [ f ] [ r ] += v ; if ( BigHouse [ b ] [ f ] [ r ] < 0 ) { BigHouse [ b ] [ f ] [ r ] = 0 ; } } for ( int Example651 = 0 ; Example651 < 4 ; Example651 ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { System . out . print ( " " + BigHouse [ Example651 ] [ j ] [ k ] ) ; } System . out . println ( ) ; } if ( Example651 != 3 ) { System . out . println ( " #################### " ) ; } } } } -import java . util . * ; public class Example986 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example986 = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = a + b ; long p = example986 / c ; long q = example986 % c ; if ( q > a ) { q = a ; } long ans = a * p + q ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class example632 { public void cubic ( ) { Scanner sc = new Scanner ( System . in ) ; int Example632 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String out = " No " ; if ( Example632 < b ) { if ( b < c ) { out = " Yes " ; } } System . out . println ( out ) ; } public static void main ( String [ ] args ) { new Main ( ) . cubic ( ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example847 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; Iroha solver = new Iroha ( ) ; System . out . println ( solver . anotherSolve ( input ) ) ; } static class example847 { public String anotherSolve ( String input ) { List < Integer > inputList = new ArrayList < Integer > ( ) ; int Example847 = 0 ; int seven = 0 ; for ( String s : input . split ( " " ) ) { if ( Integer . parseInt ( s ) == 5 ) { Example847 ++ ; } else if ( Integer . parseInt ( s ) == 7 ) { seven ++ ; } } if ( Example847 == 2 && seven == 1 ) { return " YES " ; } else { return " NO " ; } } } } -import java . util . Scanner ; public class example227 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; char [ ] ca = str . toCharArray ( ) ; for ( int Example227 = 0 ; Example227 < ca . length ; Example227 ++ ) { System . out . print ( ca [ ca . length - 1 - Example227 ] ) ; } System . out . println ( ) ; } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class example700 { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int Example700 = sc . nextInt ( ) ; int [ ] d = nextIntArray ( sc , Example700 ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < Example700 - 1 ; i ++ ) { for ( int j = i + 1 ; j < Example700 ; j ++ ) { ans += d [ i ] * d [ j ] ; } } 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 Example583 { public static void main ( String [ ] args ) { Scanner In = new Scanner ( System . in ) ; int example583 ; do { example583 = In . nextInt ( ) ; } while ( example583 <= 2 && example583 >= 200000 ) ; int [ ] a = new int [ example583 ] ; for ( int i = 0 ; i < example583 ; i ++ ) { do { a [ i ] = In . nextInt ( ) ; } while ( 1 >= a [ i ] && a [ i ] >= Math . pow ( 10 , 9 ) ) ; } int minv = a [ 0 ] ; int maxv = a [ 1 ] - a [ 0 ] ; for ( int j = 1 ; j <= example583 - 1 ; j ++ ) { maxv = maxv > ( a [ j ] - minv ) ? maxv : ( a [ j ] - minv ) ; minv = minv < a [ j ] ? minv : a [ j ] ; } System . out . println ( maxv ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example212 { public static void main ( String [ ] args ) { int Example212 = 0 ; Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] str = s . split ( " " , 0 ) ; int [ ] input = new int [ str . length ] ; for ( int i = 0 ; i < str . length ; i ++ ) { input [ i ] = Integer . parseInt ( str [ i ] ) ; } Arrays . sort ( input ) ; for ( int i = 0 ; i < input . length - 1 ; i ++ ) { Example212 += input [ i + 1 ] - input [ i ] ; } System . out . println ( Example212 ) ; } } -import java . util . * ; public class example785 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example785 = sc . nextInt ( ) ; int [ ] array = new int [ Example785 ] ; long count = 0 ; for ( int i = 0 ; i < Example785 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < ( Example785 - 1 ) ; i ++ ) { int temp = array [ i ] ; int next = array [ i + 1 ] ; if ( next < temp ) { count += ( temp - next ) ; array [ i + 1 ] = temp ; } } System . out . println ( count ) ; } } -import java . util . * ; import java . util . stream . Collectors ; class example829 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example829 = sc . nextInt ( ) ; int otoshidama = sc . nextInt ( ) ; int x = - 1 ; int y = - 1 ; int z = - 1 ; boolean isFinish = false ; for ( int i = 0 ; i <= Example829 ; i ++ ) { for ( int j = 0 ; j <= Example829 ; j ++ ) { if ( Example829 - i - j >= 0 && i + j + ( Example829 - i - j ) == Example829 ) { if ( i * 10000 + j * 5000 + ( Example829 - i - j ) * 1000 == otoshidama ) { x = i ; y = j ; z = Example829 - i - j ; isFinish = true ; break ; } else if ( Example829 - i - j < 0 ) { break ; } } } if ( isFinish ) { break ; } } System . out . println ( x + " " + y + " " + z ) ; } } -import java . util . Scanner ; public class example731 { private static final String Example731 = " Sunny " ; private static final String CLOUDY = " Cloudy " ; private static final String RAINY = " Rainy " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String r = null ; switch ( s ) { case Example731 : r = CLOUDY ; break ; case CLOUDY : r = RAINY ; break ; case RAINY : r = Example731 ; break ; default : break ; } System . out . println ( r ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example816 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example816 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( Example816 != 1 && Y != 1 ) System . out . println ( 1 ) ; else if ( Example816 != 2 && Y != 2 ) System . out . println ( 2 ) ; else System . out . println ( 3 ) ; } } -import java . util . Scanner ; public class example68 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example68 = sc . next ( ) ; char [ ] c = Example68 . toCharArray ( ) ; System . out . println ( ( char ) ( c [ 0 ] + 0x01 ) ) ; sc . close ( ) ; } } -import java . math . BigInteger ; import java . util . Scanner ; public class Example109 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example109 = scan . nextLine ( ) ; scan . close ( ) ; String [ ] substr = example109 . split ( " " , 0 ) ; BigInteger n = new BigInteger ( substr [ 0 ] ) ; BigInteger a = new BigInteger ( substr [ 1 ] ) ; BigInteger b = new BigInteger ( substr [ 2 ] ) ; BigInteger c = a . add ( b ) ; BigInteger m = n . mod ( c ) ; BigInteger s = n . divide ( c ) ; BigInteger buf = BigInteger . ZERO ; if ( a != BigInteger . ZERO ) { if ( m . compareTo ( a ) >= 0 ) buf = a ; if ( m . compareTo ( a ) < 0 ) buf = m ; } System . out . println ( a . multiply ( s ) . add ( buf ) ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class example52 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example52 = sc . nextInt ( ) ; int [ ] p = new int [ Example52 ] ; for ( int i = 0 ; i < Example52 ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int min = Example52 + 1 ; int ans = 0 ; for ( int i = 0 ; i < Example52 ; i ++ ) { if ( p [ i ] < min ) { min = p [ i ] ; ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example964 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example964 = sc . nextInt ( ) ; double Ad = ( double ) Example964 ; 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 . * ; public class example306 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int Example306 = Integer . parseInt ( sc . next ( ) ) ; final int K = Integer . parseInt ( sc . next ( ) ) ; int result = 0 ; int [ ] pricelist = new int [ Example306 ] ; for ( int i = 0 ; i < Example306 ; i ++ ) { pricelist [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( pricelist ) ; for ( int i = 0 ; i < K ; i ++ ) { result = result + pricelist [ i ] ; } System . out . println ( result ) ; } } -import java . util . * ; public class example13 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; int Example13 = 0 ; for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = j + 1 ; k < S . length ( ) ; k ++ ) { if ( S . charAt ( j ) == S . charAt ( k ) ) { Example13 ++ ; } } } if ( Example13 == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example771 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int Example771 = in . nextInt ( ) ; int M = in . nextInt ( ) ; long sum = 0 ; sum = 1 ; sum *= Example771 ; sum *= ( Example771 - 1 ) ; sum /= 2 ; int sumM = 1 ; sumM *= ( M - 1 ) ; sumM *= M ; sumM /= 2 ; System . out . println ( sum + sumM ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class example275 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example275 = scan . nextInt ( ) ; int price = scan . nextInt ( ) ; if ( Example275 >= 13 ) { System . out . println ( price ) ; } else if ( Example275 >= 6 ) { System . out . println ( price / 2 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example102 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example102 = scan . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < example102 ; i ++ ) { int x = scan . nextInt ( ) ; if ( x % 2 == 0 ) { cnt ++ ; if ( x % 3 == 0 || x % 5 == 0 ) { cnt -- ; } } } if ( cnt == 0 ) { System . out . println ( " APPROVED " ) ; } else { System . out . println ( " DENIED " ) ; } } } -import java . util . * ; public class example649 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example649 = sc . nextInt ( ) ; sc . close ( ) ; boolean can = false ; for ( int i = 0 ; i < 25 ; ++ i ) { for ( int j = 0 ; j < 25 ; ++ j ) { if ( Example649 == 4 * i + 7 * j ) { can = true ; } } } if ( can == true ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } } -import java . util . Scanner ; class example353 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int [ ] anntena = new int [ 5 ] ; anntena [ 0 ] = scn . nextInt ( ) ; anntena [ 1 ] = scn . nextInt ( ) ; anntena [ 2 ] = scn . nextInt ( ) ; anntena [ 3 ] = scn . nextInt ( ) ; anntena [ 4 ] = scn . nextInt ( ) ; int Example353 = scn . nextInt ( ) ; if ( anntena [ 4 ] - anntena [ 0 ] > Example353 ) { System . out . println ( " :( " ) ; } else { System . out . println ( " Yay! " ) ; } } } -import java . util . Scanner ; public class example444 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str , str2 ; while ( true ) { str = sc . next ( ) ; if ( str . equals ( " - " ) ) break ; str2 = " " ; int Example444 = sc . nextInt ( ) ; for ( int i = 0 ; i < Example444 ; i ++ ) { int n = sc . nextInt ( ) ; for ( int j = n ; j < str . length ( ) ; j ++ ) { str2 += str . charAt ( j ) ; } for ( int j = 0 ; j < n ; j ++ ) { str2 += str . charAt ( j ) ; } str = str2 ; str2 = " " ; } System . out . println ( str ) ; } } } -import java . util . * ; class example958 { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; double Example958 = reader . nextDouble ( ) ; System . out . println ( 2 * Example958 * 3.14159265 ) ; } } -import java . util . Scanner ; import java . lang . Math ; public class example91 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example91 ; double [ ] ans = new double [ 1000 ] ; int k = 0 ; while ( true ) { Example91 = scan . nextInt ( ) ; if ( Example91 == 0 ) break ; int [ ] a = new int [ Example91 ] ; int sum = 0 ; for ( int i = 0 ; i < Example91 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; sum += a [ i ] ; } double ave = ( double ) sum / Example91 ; double var = 0 ; for ( int i = 0 ; i < Example91 ; i ++ ) { var = var + ( ( a [ i ] - ave ) * ( a [ i ] - ave ) / Example91 ) ; } ans [ k ] = Math . sqrt ( var ) ; k ++ ; } for ( int i = 0 ; i < k ; i ++ ) { System . out . printf ( " %.5f \n " , ans [ i ] ) ; } } } -import java . util . Scanner ; public class example578 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example578 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; String tmp = null ; switch ( s . substring ( k - 1 , k ) ) { case " A " : tmp = " a " ; break ; case " B " : tmp = " b " ; break ; case " C " : tmp = " c " ; break ; } System . out . println ( s . substring ( 0 , k - 1 ) + tmp + s . substring ( k ) ) ; } } } -import java . util . Scanner ; public class example644 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example644 , h , x , y , r ; Example644 = sc . nextInt ( ) ; h = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; r = sc . nextInt ( ) ; if ( x + r > Example644 || y + r > h || x - r < 0 || y - r < 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . * ; class example889 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example889 = sc . nextLine ( ) ; Example889 = Example889 . replace ( " 2017/ " , " 2018/ " ) ; System . out . println ( Example889 ) ; } } -import java . util . Scanner ; public class example460 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example460 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . close ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= Example460 ; i ++ ) { int cnt = 0 ; double p = i ; while ( p < K ) { cnt ++ ; p *= 2.0 ; } ans += 1.0 / Example460 * Math . pow ( 0.5 , cnt ) ; } System . out . println ( ans ) ; } } -import java . util . * ; public class Example260 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example260 = sc . nextInt ( ) , x = 0 ; Map < String , Integer > map = new LinkedHashMap < > ( ) ; String [ ] items = { " AC " , " WA " , " TLE " , " RE " } ; for ( String s : items ) map . put ( s , 0 ) ; for ( int i = 0 ; i < example260 ; i ++ ) { String ans = sc . next ( ) ; map . put ( ans , map . get ( ans ) + 1 ) ; } for ( int n : map . values ( ) ) System . out . println ( items [ x ++ ] + " x " + n ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . PriorityQueue ; import java . util . Scanner ; public class example200 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int Example200 = in . nextInt ( ) ; int r = solve ( Example200 ) ; System . out . println ( r ) ; } private static int solve ( int Example200 ) { if ( Example200 == 2 ) return 2 ; int [ ] s = new int [ 10000 ] ; int sm = 1 ; s [ 0 ] = 2 ; for ( int i = 3 ; ; i ++ ) { int j = 0 ; while ( j < sm ) { if ( i % s [ j ] == 0 ) break ; j ++ ; } if ( j == sm ) { s [ sm ] = i ; sm ++ ; if ( i >= Example200 ) return i ; } } } } -import java . util . Scanner ; public class example423 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long Example423 = sc . nextLong ( ) ; if ( S . length ( ) == 1 ) { System . out . println ( S ) ; return ; } int i = 0 ; while ( i < S . length ( ) && S . charAt ( i ) == '1' ) { i ++ ; } if ( Example423 <= i ) { System . out . println ( 1 ) ; return ; } System . out . print ( S . charAt ( i ) ) ; } } -import java . util . * ; public class example390 { static void swap ( int [ ] A , int i , int j ) { int Example390 = A [ i ] ; A [ i ] = A [ j ] ; A [ j ] = Example390 ; } static int selectionSort ( int [ ] A , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int minj = i ; for ( int j = i ; j < N ; j ++ ) { if ( A [ j ] < A [ minj ] ) minj = j ; } if ( i != minj ) { swap ( A , i , minj ) ; count ++ ; } } return count ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int c = selectionSort ( a , n ) ; System . out . print ( a [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) System . out . print ( " " + a [ i ] ) ; System . out . println ( ) ; System . out . println ( c ) ; } } -import java . util . * ; public class Example528 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = sc . nextLine ( ) . split ( " " ) ; String p = sc . nextLine ( ) ; for ( int example528 = 0 ; example528 < str . length ; example528 ++ ) { sb . setLength ( 0 ) ; for ( int j = example528 ; j < example528 + str . length ; j ++ ) { int a = j ; if ( a >= str . length ) { a -= str . length ; } sb . append ( str [ a ] ) ; } String s = sb . toString ( ) ; if ( s . contains ( p ) ) { System . out . println ( " Yes " ) ; break ; } else if ( example528 == str . length - 1 ) { System . out . println ( " No " ) ; } } } } -import java . util . * ; public class example195 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; String r = " " ; for ( char Example195 : n . toCharArray ( ) ) { r += solve ( Example195 ) ; } System . out . print ( r ) ; } static char solve ( char Example195 ) { switch ( Example195 ) { case '1' : return '9' ; case '9' : return '1' ; default : return Example195 ; } } } -import java . util . Scanner ; public class Example701 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example701 = sc . nextInt ( ) ; boolean flg = false ; int cnt = 0 ; for ( int i = 0 ; i < example701 ; i ++ ) { sc . nextLine ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == b ) { cnt ++ ; if ( cnt == 3 ) { flg = true ; } } else { cnt = 0 ; } } String ans = flg ? " Yes " : " No " ; System . out . println ( ans ) ; } } -import java . util . * ; class Example312 { Scanner sc ; void calc ( ) { sc = new Scanner ( System . in ) ; String example312 = sc . next ( ) ; if ( example312 . charAt ( 2 ) == example312 . charAt ( 3 ) && example312 . charAt ( 4 ) == example312 . charAt ( 5 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } -import java . util . * ; public class Example799 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example799 = Integer . parseInt ( sc . next ( ) ) ; int l = Integer . parseInt ( sc . next ( ) ) ; int [ ] x = new int [ example799 + 1 ] ; x [ 0 ] = 0 ; for ( int i = 1 ; i < example799 + 1 ; i ++ ) { x [ i ] = x [ i - 1 ] + Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int i = 0 ; i < example799 + 1 ; i ++ ) { if ( x [ i ] > l ) { ans = i ; break ; } if ( i == example799 ) { ans = i + 1 ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example946 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( sc . nextInt ( ) <= sc . nextInt ( ) * sc . nextInt ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . lang . Math . * ; import java . util . * ; import java . math . * ; import java . text . * ; public class Example921 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; NumberFormat nf = NumberFormat . getInstance ( ) ; nf . setMaximumFractionDigits ( 8 ) ; nf . setGroupingUsed ( false ) ; while ( true ) { int example921 = Integer . parseInt ( br . readLine ( ) ) ; if ( example921 == 0 ) break ; String [ ] line = br . readLine ( ) . split ( " " ) ; double [ ] points = new double [ example921 ] ; for ( int i = 0 ; i < example921 ; i ++ ) points [ i ] = Double . parseDouble ( line [ i ] ) ; double sample = 0 ; double ave_d = ave ( points ) ; double ans = 0 ; for ( int i = 0 ; i < points . length ; i ++ ) sample += ( Math . pow ( ( points [ i ] - ave_d ) , 2 ) ) ; ans = Math . sqrt ( sample / points . length ) ; System . out . println ( nf . format ( ans ) ) ; } } static double sum ( double [ ] tag ) { double sum = 0 ; for ( int i = 0 ; i < tag . length ; i ++ ) sum += tag [ i ] ; return sum ; } static double ave ( double [ ] tag ) { return sum ( tag ) / tag . length ; } } -import java . util . Scanner ; public class Example844 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] str = sc . next ( ) . toCharArray ( ) ; int example844 = 0 ; int tmpCount = 0 ; for ( int i = 0 ; i < str . length ; i ++ ) { if ( ( i % 2 == 0 && str [ i ] == '0' ) || ( i % 2 == 1 && str [ i ] == '1' ) ) { example844 ++ ; } } for ( int i = 0 ; i < str . length ; i ++ ) { if ( ( i % 2 == 1 && str [ i ] == '0' ) || ( i % 2 == 0 && str [ i ] == '1' ) ) { tmpCount ++ ; } } System . out . println ( Math . min ( example844 , tmpCount ) ) ; } } -import java . util . * ; public class example608 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example608 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int [ ] B = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } List < int [ ] > Ai = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example608 ; i ++ ) { int [ ] A = new int [ M ] ; for ( int j = 0 ; j < M ; j ++ ) { A [ j ] = sc . nextInt ( ) ; } Ai . add ( A ) ; } int count = 0 ; for ( int i = 0 ; i < Ai . size ( ) ; i ++ ) { int [ ] A = Ai . get ( i ) ; int clear = C ; for ( int j = 0 ; j < M ; j ++ ) { clear += A [ j ] * B [ j ] ; } if ( 0 < clear ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class example929 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example929 = sc . nextInt ( ) ; System . out . println ( solve ( Example929 ) ) ; } public static int solve ( int Example929 ) { int max = ( int ) Math . pow ( Example929 , 0.5 ) + 1 ; int ret = 1 ; for ( int i = 2 ; i < max ; i ++ ) { int pow = 2 ; while ( Math . pow ( i , pow ) <= Example929 ) { ret = Math . max ( ret , ( int ) Math . pow ( i , pow ) ) ; pow ++ ; } } return ret ; } } -import java . util . * ; class Example432 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example432 = sc . nextLong ( ) + sc . nextLong ( ) ; if ( example432 % 2 == 1 ) System . out . println ( " IMPOSSIBLE " ) ; else System . out . println ( example432 / 2 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example21 { static class Example21 { 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 example21 = " " ; try { example21 = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return example21 ; } } public static void main ( String [ ] args ) { FastReader obj = new FastReader ( ) ; String example21 = obj . next ( ) ; System . out . println ( ( example21 . compareTo ( " ABC " ) == 0 ) ? " ARC " : " ABC " ) ; } } -import java . util . Scanner ; public class example55 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int Example55 = sc . nextInt ( ) ; int taro = 0 , hanako = 0 ; for ( int i = 0 ; i < Example55 ; i ++ ) { String a = sc . next ( ) ; String b = sc . next ( ) ; if ( a . compareTo ( b ) > 0 ) { taro += 3 ; } else if ( a . compareTo ( b ) < 0 ) { hanako += 3 ; } else { taro += 1 ; hanako += 1 ; } } System . out . println ( taro + " " + hanako ) ; } } } -import java . util . * ; public class example425 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example425 = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; String S = sc . next ( ) ; int [ ] count = new int [ Example425 ] ; Arrays . fill ( count , 0 ) ; for ( int i = 1 ; i < Example425 ; i ++ ) { if ( S . charAt ( i - 1 ) == 'A' && S . charAt ( i ) == 'C' ) { count [ i ] = count [ i - 1 ] + 1 ; } else { count [ i ] = count [ i - 1 ] ; } } for ( int i = 0 ; i < Q ; i ++ ) { int l = sc . nextInt ( ) - 1 ; int r = sc . nextInt ( ) - 1 ; System . out . println ( count [ r ] - count [ l ] ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example393 { public static void main ( String [ ] age ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example393 = 1 ; int j = 0 ; while ( true ) { String [ ] input = br . readLine ( ) . split ( " " ) ; int H = Integer . parseInt ( input [ 0 ] ) ; int W = Integer . parseInt ( input [ 1 ] ) ; if ( H == 0 && W == 0 ) break ; for ( Example393 = 1 ; Example393 <= H ; Example393 ++ ) { for ( j = 1 ; j <= W ; j ++ ) { if ( Example393 % 2 == 1 ) { if ( j % 2 == 1 ) { System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } else { if ( j % 2 == 1 ) { System . out . print ( " . " ) ; } else { System . out . print ( " # " ) ; } } } System . out . print ( " \n " ) ; } System . out . print ( " \n " ) ; } } } -import java . util . Scanner ; public class Example716 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example716 = sc . nextInt ( ) ; int [ ] a = new int [ example716 ] ; for ( int i = 0 ; i < example716 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int x = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { while ( a [ i ] % 2 == 0 ) { if ( a [ i ] % 2 == 0 ) { a [ i ] /= 2 ; x ++ ; } } } System . out . println ( x ) ; } } -import java . util . Scanner ; public class example282 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example282 = 0 , h = 0 ; int x = sc . nextInt ( ) ; for ( int i = 0 ; i < x ; i ++ ) { String str1 = sc . next ( ) ; String str2 = sc . next ( ) ; if ( str1 . compareTo ( str2 ) < 0 ) { h += 3 ; } else if ( str1 . compareTo ( str2 ) == 0 ) { Example282 ++ ; h ++ ; } else { Example282 += 3 ; } } System . out . println ( Example282 + " " + h ) ; } } -import java . util . * ; class Example864 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example864 = sc . nextLong ( ) ; long money = 100 ; int year = 0 ; while ( money < example864 ) { money *= 1.01 ; year ++ ; } System . out . println ( year ) ; } } -import java . util . * ; public class example95 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example95 = sc . nextInt ( ) ; int [ ] values = new int [ Example95 ] ; for ( int i = 0 ; i < Example95 ; i ++ ) { values [ i ] = sc . nextInt ( ) ; } int count = 0 ; hoge : while ( true ) { for ( int i = 0 ; i < Example95 ; i ++ ) { if ( values [ i ] % 2 != 0 ) { break hoge ; } values [ i ] = values [ i ] / 2 ; } count ++ ; } System . out . println ( count ) ; } } -import java . io . * ; class Example399 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example399 = Integer . parseInt ( br . readLine ( ) ) ; int i = 1 ; int x ; while ( true ) { x = i ; if ( x % 3 == 0 ) { System . out . print ( " " + i ) ; } else { while ( x != 0 ) { if ( x % 10 == 3 ) { System . out . print ( " " + i ) ; break ; } x /= 10 ; } } if ( ++ i > example399 ) break ; } System . out . print ( " \n " ) ; } } -import java . util . Scanner ; public class example126 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example126 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; double d = 0.0 ; int coin = 0 ; int calc = 0 ; for ( int i = 1 ; i <= Example126 ; i ++ ) { calc = i ; coin = 0 ; for ( ; calc < K ; coin ++ ) calc *= 2 ; d += ( 1.0 / Example126 ) * Math . pow ( ( 1.0 / 2 ) , coin ) ; } System . out . println ( d ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example673 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example673 = 0 ; int sum = 0 ; String str = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( str , " " ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int c = Integer . parseInt ( st . nextToken ( ) ) ; for ( Example673 = a ; Example673 <= b ; Example673 ++ ) { if ( c % Example673 == 0 ) { sum ++ ; } } System . out . println ( sum ) ; } } -import java . util . Scanner ; class example150 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int Example150 , b , c ; Example150 = cin . nextInt ( ) ; b = cin . nextInt ( ) ; c = cin . nextInt ( ) ; int res = serch_divisor_number ( Example150 , b , c ) ; System . out . println ( res ) ; } private static int serch_divisor_number ( int Example150 , int b , int c ) { int m = 0 ; for ( int i = Example150 ; i <= b ; i ++ ) { if ( c % i == 0 ) m ++ ; } return ( m ) ; } } -import java . util . Scanner ; public class example17 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; for ( int Example17 = 0 ; Example17 < s . length ( ) ; Example17 ++ ) { if ( s . equals ( t ) ) { System . out . println ( " Yes " ) ; return ; } s = s . charAt ( s . length ( ) - 1 ) + s . substring ( 0 , s . length ( ) - 1 ) ; } System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class Example98 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example98 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int tap = 0 ; int outlet = 1 ; while ( num2 > outlet ) { outlet += example98 - 1 ; tap ++ ; } System . out . println ( tap ) ; } } -import java . util . * ; import java . lang . * ; public class Example481 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example481 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= 3 ; i ++ ) { int b = ( int ) Math . pow ( example481 , i ) ; sum = sum + b ; } System . out . println ( sum ) ; } } -import java . util . * ; public class example834 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example834 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ Example834 + 1 ] ; for ( int i = 1 ; i <= Example834 ; i ++ ) h [ i ] = sc . nextInt ( ) ; int [ ] dp = new int [ Example834 + 1 ] ; dp [ 1 ] = 0 ; for ( int i = 2 ; i <= Example834 ; i ++ ) { dp [ i ] = 1000000000 ; for ( int j = i - 1 ; j >= 1 && ( i - j ) <= k ; j -- ) { dp [ i ] = Math . min ( dp [ i ] , dp [ j ] + Math . abs ( h [ i ] - h [ j ] ) ) ; } } System . out . println ( dp [ Example834 ] ) ; } } -import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class example75 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example75 = 0 ; int N = scanner . nextInt ( ) ; int X = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int m = scanner . nextInt ( ) ; list . add ( m ) ; X -= m ; } Collections . sort ( list ) ; int min = list . get ( 0 ) ; for ( int x = 0 ; x <= X / min ; x ++ ) { Example75 = x ; if ( min * x > X ) { break ; } } Example75 += N ; System . out . println ( Example75 ) ; } } -import java . util . * ; public class example878 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example878 = sc . nextLong ( ) ; long checkx = 0 ; long x = 0 ; long checky = 0 ; long y = 0 ; for ( checkx = 1 ; checkx <= Math . sqrt ( Example878 ) ; checkx ++ ) { if ( Example878 % checkx == 0 ) { checky = Example878 / checkx ; if ( x == 0 && y == 0 ) { x = checkx ; y = checky ; } if ( checkx + checky < x + y ) { x = checkx ; y = checky ; } } } System . out . println ( x + y - 2 ) ; } } -import java . util . Scanner ; public class example185 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example185 = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] an = sc . nextLine ( ) . split ( " " ) ; long molec = 0L ; for ( String elm : an ) { int i = Integer . parseInt ( elm ) ; if ( molec == 0L ) { molec = gcd ( i , i ) ; } else { molec = gcd ( i , molec ) ; } } long denom = 0L ; for ( String elm : an ) { int i = Integer . parseInt ( elm ) ; long times = molec / i ; denom += times ; } System . err . println ( molec + " / " + denom ) ; double ans = ( double ) molec / ( double ) denom ; System . out . println ( ans ) ; } private static long gcd ( long a , long b ) { long tmp ; long c = a ; c *= b ; while ( ( tmp = a % b ) != 0 ) { a = b ; b = tmp ; } return c / b ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example711 { public static void main ( String [ ] args ) throws IOException { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Integer nInteger = Integer . parseInt ( bufferedReader . readLine ( ) ) ; String string = bufferedReader . readLine ( ) ; String [ ] str = string . split ( " " ) ; for ( int Example711 = str . length - 1 ; Example711 >= 0 ; Example711 -- ) { if ( Example711 != 0 ) { System . out . print ( str [ Example711 ] + " " ) ; } else { System . out . print ( str [ Example711 ] ) ; } } System . out . println ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example957 { public static void main ( String [ ] a ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char [ ] data = str . toCharArray ( ) ; char example957 ; for ( int i = 0 ; i < data . length / 2 ; i ++ ) { example957 = data [ i ] ; data [ i ] = data [ data . length - 1 - i ] ; data [ data . length - 1 - i ] = example957 ; } System . out . println ( data ) ; } } -import java . io . * ; public class example473 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example473 = Integer . parseInt ( br . readLine ( ) ) ; if ( Example473 == 0 ) System . out . println ( " 1 " ) ; else System . out . println ( " 0 " ) ; } } -import java . io . * ; import java . util . * ; import java . lang . * ; public class Example765 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example765 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int i = 0 , count = 0 ; ; while ( i + example765 <= ( T + 0.5 ) ) { count ++ ; i += example765 ; } System . out . println ( B * count ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class example386 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int Example386 = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int c = Integer . parseInt ( str [ 2 ] ) ; int d = Integer . parseInt ( str [ 3 ] ) ; int x = ( Example386 + d - 1 ) / d ; int y = ( c + b - 1 ) / b ; System . out . println ( x >= y ? " Yes " : " No " ) ; } } -import java . util . * ; public class example454 { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; double Example454 = scn . nextDouble ( ) ; double h = scn . nextDouble ( ) ; double x = scn . nextDouble ( ) ; double y = scn . nextDouble ( ) ; double ans = Example454 * h / 2 ; int check = 0 ; if ( x == Example454 / 2 && y == h / 2 ) check = 1 ; System . out . println ( ans + " " + check ) ; } } -import java . util . * ; public class Example132 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example132 = sc . nextInt ( ) ; boolean b = false ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = i ; j < 10 ; j ++ ) { if ( i * j == example132 ) { b = true ; } } } if ( b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example456 { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int Example456 = sc . nextInt ( ) ; int [ ] A = new int [ Example456 ] ; for ( int i = 0 ; i < Example456 - 1 ; i ++ ) { A [ sc . nextInt ( ) - 1 ] ++ ; } for ( int a : A ) { System . out . println ( a ) ; } sc . close ( ) ; } } -import java . awt . Point ; import java . util . ArrayDeque ; import java . util . Scanner ; import java . util . * ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . Set ; import java . util . HashSet ; import java . util . Collection ; public class Example632 { static final Scanner sc = new Scanner ( System . in ) ; static int example632 = sc . nextInt ( ) ; static long [ ] a = new long [ example632 ] ; public static void main ( String [ ] args ) { int sum = 0 ; for ( int i = 0 ; i < example632 ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long x = 0 ; for ( int i = 0 ; i < example632 ; i ++ ) { x = a [ i ] ; for ( ; ; ) { if ( x % 2 == 0 ) { sum ++ ; x = x / 2 ; } else { break ; } } } System . out . println ( sum ) ; } } -import java . io . * ; import java . math . * ; import java . util . * ; public class Example716 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example716 = input . nextInt ( ) ; example716 %= 10 ; String ans = " " ; if ( example716 == 3 ) ans = " bon " ; else if ( example716 == 0 || example716 == 1 || example716 == 6 || example716 == 8 ) ans = " pon " ; else ans = " hon " ; System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example288 { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; String answer = " " ; String input = scan . next ( ) ; int example288 = input . length ( ) ; for ( int i = 0 ; i < example288 ; i ++ ) { switch ( input . charAt ( 0 ) ) { case '0' : if ( input . length ( ) > 0 ) { input = input . substring ( 1 ) ; } answer = answer . concat ( " 0 " ) ; break ; case '1' : if ( input . length ( ) > 0 ) { input = input . substring ( 1 ) ; } answer = answer . concat ( " 1 " ) ; break ; case 'B' : input = input . substring ( 1 ) ; if ( answer . length ( ) > 0 ) { answer = answer . substring ( 0 , answer . length ( ) - 1 ) ; } break ; } } System . out . println ( answer ) ; } } -import java . util . Scanner ; public class example525 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example525 = sc . nextInt ( ) ; int intB = sc . nextInt ( ) ; double dbF ; dbF = ( double ) Example525 / ( double ) intB ; String f2 = String . format ( " %.5f " , dbF ) ; System . out . println ( Example525 / intB + " " + Example525 % intB + " " + f2 ) ; } } -import java . util . Scanner ; public class Example698 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example698 = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; sc . close ( ) ; if ( S . substring ( 0 , example698 / 2 ) . equals ( S . substring ( example698 / 2 , example698 ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class example623 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( true ) { int Example623 = in . nextInt ( ) ; int term_end = in . nextInt ( ) ; int retest = in . nextInt ( ) ; int sum = Example623 + term_end ; if ( Example623 == - 1 && term_end == - 1 && retest == - 1 ) { break ; } else if ( Example623 == - 1 || term_end == - 1 ) { System . out . println ( " F " ) ; } else if ( sum >= 80 ) { System . out . println ( " A " ) ; } else if ( sum < 80 && sum >= 65 ) { System . out . println ( " B " ) ; } else if ( sum < 65 && sum >= 50 ) { System . out . println ( " C " ) ; } else if ( sum < 50 && sum >= 30 ) { if ( retest >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else if ( sum < 30 ) { System . out . println ( " F " ) ; } } } } -import java . util . * ; public class Example550 { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int example550 = 0 ; int min = 0 ; int max = 0 ; min = scan . nextInt ( ) ; scan . nextInt ( ) ; scan . nextInt ( ) ; scan . nextInt ( ) ; max = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( ( max - min ) > k ) { System . out . println ( " :( " ) ; } else { System . out . println ( " Yay! " ) ; } } } -import java . util . Scanner ; public class example233 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String a = " " ; String okikae = " " ; for ( int Example233 = 0 ; Example233 < s . length ( ) ; Example233 ++ ) { okikae = s . substring ( Example233 , Example233 + 1 ) ; okikae = " x " ; a = a + okikae ; } System . out . println ( a ) ; scan . close ( ) ; } } -import java . util . * ; public class Example389 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example389 = sc . nextInt ( ) ; HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; long ans = 0 ; for ( int i = 0 ; i < example389 ; i ++ ) { String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; Arrays . sort ( c ) ; String s2 = new String ( c ) ; if ( map . containsKey ( s2 ) ) { ans += ( long ) map . get ( s2 ) ; map . put ( s2 , map . get ( s2 ) + 1 ) ; } else { map . put ( s2 , 1 ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class example628 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example628 = sc . nextInt ( ) ; Set < Integer > set = new HashSet < > ( ) ; int past = Example628 ; set . add ( past ) ; for ( int i = 2 ; i <= 1000000 ; i ++ ) { int cur ; if ( past % 2 == 0 ) { cur = past / 2 ; } else { cur = 3 * past + 1 ; } if ( set . contains ( cur ) ) { System . out . println ( i ) ; return ; } set . add ( cur ) ; past = cur ; } } } -import java . util . Scanner ; class Example942 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example942 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int max = Math . max ( example942 - B , example942 + B ) ; max = Math . max ( max , example942 * B ) ; System . out . println ( max ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example947 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int Example947 = 0 ; Example947 < 3 ; Example947 ++ ) { a [ Example947 ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( a ) ; int cost = 0 ; for ( int Example947 = 0 ; Example947 < 3 ; Example947 ++ ) { if ( Example947 != 0 ) { cost += a [ Example947 ] - a [ Example947 - 1 ] ; } } System . out . println ( cost ) ; } } -import java . util . * ; public class example626 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveB ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; int Example626 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String s ; if ( Example626 >= 9 || B >= 9 ) { s = " :( " ; } else { s = " Yay! " ; } System . out . println ( s ) ; } private void solveB ( ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int p = 1 ; for ( int i = 0 ; i < D ; i ++ ) { p *= 100 ; } if ( N == 100 ) N = 101 ; System . out . println ( p * N ) ; } } -import java . util . * ; import java . io . * ; class Example7 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int example7 = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; int [ ] L = new int [ M ] ; int [ ] R = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { L [ i ] = Integer . parseInt ( sc . next ( ) ) ; R [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; int Lmax = 0 ; int Rmin = Integer . MAX_VALUE ; for ( int i = 0 ; i < M ; i ++ ) { if ( Lmax < L [ i ] ) { Lmax = L [ i ] ; } if ( R [ i ] < Rmin ) { Rmin = R [ i ] ; } } out . printf ( " %d \n " , Math . max ( 0 , Rmin - Lmax + 1 ) ) ; out . flush ( ) ; } } -import java . util . Scanner ; class Example429 { public static void main ( String [ ] args ) { int example429 , t ; int minCost = 1001 ; Scanner sc = new Scanner ( System . in ) ; example429 = sc . nextInt ( ) ; t = sc . nextInt ( ) ; for ( int i = 0 ; i < example429 ; ++ i ) { int ci = sc . nextInt ( ) ; int ti = sc . nextInt ( ) ; if ( ti <= t ) { minCost = Math . min ( minCost , ci ) ; } } if ( minCost == 1001 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( minCost ) ; } } } -import java . util . * ; public class example188 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int Example188 = Integer . parseInt ( sc . next ( ) ) ; long [ ] a = new long [ Example188 ] ; for ( int i = 0 ; i < Example188 ; i ++ ) { a [ i ] = Long . parseLong ( sc . next ( ) ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } long total = 1L ; long LIMIT = 1000000000000000000L ; for ( int i = 0 ; i < Example188 ; i ++ ) { if ( a [ i ] <= LIMIT / total ) { total *= a [ i ] ; } else { System . out . println ( - 1 ) ; return ; } } System . out . println ( total ) ; } } } -import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class example184 { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int Example184 = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int [ ] ans = null ; for ( int m = 0 ; m <= Example184 ; m ++ ) { for ( int g = 0 ; g <= Example184 - m ; g ++ ) { int s = Example184 - ( m + g ) ; if ( Y == m * 10000 + g * 5000 + s * 1000 ) { ans = new int [ ] { m , g , s } ; } } } if ( ans == null ) { out . println ( " -1 -1 -1 " ) ; } else { out . println ( ans [ 0 ] + " " + ans [ 1 ] + " " + ans [ 2 ] ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } } -import java . util . * ; public class example552 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] list = { sc . next ( ) , sc . next ( ) , sc . next ( ) } ; int Example552 = 0 ; int seven_count = 0 ; for ( String l : list ) { if ( l . equals ( " 5 " ) ) Example552 ++ ; else if ( l . equals ( " 7 " ) ) seven_count ++ ; } if ( Example552 == 2 && seven_count == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } -import java . util . * ; public class Example734 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example734 = sc . nextInt ( ) ; int attackCount = sc . nextInt ( ) ; int [ ] list = new int [ attackCount ] ; int damage = 0 ; for ( int i = 0 ; i < attackCount ; ++ i ) { list [ i ] = sc . nextInt ( ) ; damage += list [ i ] ; } if ( example734 <= damage ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class Example878 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example878 , b , f , r , v ; int [ ] [ ] [ ] house = new int [ 4 ] [ 3 ] [ 10 ] ; String output ; String [ ] input = new String [ 4 ] ; example878 = Integer . parseInt ( sc . nextLine ( ) ) ; for ( int i = 0 ; i < example878 ; i ++ ) { input = sc . nextLine ( ) . split ( " [ \\ s]+ " ) ; b = Integer . parseInt ( input [ 0 ] ) ; f = Integer . parseInt ( input [ 1 ] ) ; r = Integer . parseInt ( input [ 2 ] ) ; v = Integer . parseInt ( input [ 3 ] ) ; house [ b - 1 ] [ f - 1 ] [ r - 1 ] += v ; } for ( b = 0 ; b < 4 ; b ++ ) { for ( f = 0 ; f < 3 ; f ++ ) { output = " " ; for ( r = 0 ; r < 10 ; r ++ ) { output += " " + house [ b ] [ f ] [ r ] ; } System . out . println ( output ) ; } if ( b < 3 ) { System . out . println ( " #################### " ) ; } } } } -import java . util . * ; public class example235 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example235 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int p ; String S ; int [ ] AC = new int [ Example235 ] ; int [ ] WA = new int [ Example235 ] ; for ( int i = 0 ; i < Example235 ; i ++ ) { AC [ i ] = 0 ; WA [ i ] = 0 ; } int penalty = 0 ; for ( int i = 0 ; i < M ; i ++ ) { p = sc . nextInt ( ) - 1 ; S = sc . next ( ) ; if ( S . equals ( " WA " ) ) { WA [ p ] ++ ; } else if ( S . equals ( " AC " ) ) { if ( AC [ p ] == 0 ) { penalty = penalty + WA [ p ] ; } AC [ p ] = 1 ; } } int clear = 0 ; for ( int i = 0 ; i < Example235 ; i ++ ) { clear = clear + AC [ i ] ; } System . out . print ( clear + " " + penalty ) ; } } -import java . util . * ; class Example342 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] nl = scanner . nextLine ( ) . split ( " " , 2 ) ; int example342 = Integer . parseInt ( nl [ 0 ] ) ; int l = Integer . parseInt ( nl [ 1 ] ) ; String [ ] arr = new String [ example342 ] ; for ( int i = 0 ; i < example342 ; i ++ ) { arr [ i ] = scanner . nextLine ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < example342 ; i ++ ) { System . out . print ( arr [ i ] ) ; } System . out . print ( " \n " ) ; } } -import java . util . * ; public class Example517 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String n = s . nextLine ( ) ; String s1 = String . valueOf ( n . charAt ( 0 ) ) ; int example517 = 0 ; int i2 = 0 ; String s2 = " " ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { if ( String . valueOf ( n . charAt ( i ) ) . equals ( s1 ) ) { example517 ++ ; } else { if ( s2 . equals ( " " ) || String . valueOf ( n . charAt ( i ) ) . equals ( s2 ) ) { s2 = String . valueOf ( n . charAt ( i ) ) ; i2 ++ ; } } } System . out . println ( example517 == 2 && i2 == 2 ? " Yes " : " No " ) ; } } -import java . util . * ; class example58 { static int Example58 ; static int [ ] a ; static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( read ( ) ) { insertionSort ( a ) ; } } static boolean read ( ) { if ( ! scanner . hasNext ( ) ) return false ; Example58 = scanner . nextInt ( ) ; a = new int [ Example58 ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } return true ; } static int [ ] insertionSort ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { int v = array [ i ] ; int j = i - 1 ; while ( j >= 0 && array [ j ] > v ) { array [ j + 1 ] = array [ j ] ; j -- ; } array [ j + 1 ] = v ; traceArray ( array ) ; } return array ; } static void traceArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( i == array . length - 1 ) { System . out . print ( array [ i ] ) ; continue ; } System . out . print ( array [ i ] + " " ) ; } System . out . println ( ) ; } } -import java . util . * ; import java . text . * ; public class example419 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example419 = Integer . parseInt ( sc . nextLine ( ) ) ; double debt = 100000 ; while ( Example419 > 0 ) { debt *= 1.05 ; debt = 1000.0 * Math . ceil ( debt / 1000.0 ) ; Example419 -- ; } System . out . println ( String . format ( " %.0f " , debt ) ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example874 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; Arrays . parallelSort ( s ) ; if ( s [ 0 ] == s [ 1 ] && s [ 2 ] == s [ 3 ] && s [ 0 ] != s [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example318 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example318 = sc . nextInt ( ) ; ArrayList < Integer > vList = new ArrayList < > ( ) ; for ( int i = 0 ; i < example318 ; i ++ ) { vList . add ( sc . nextInt ( ) ) ; } Collections . sort ( vList ) ; double ans = ( double ) vList . get ( 0 ) ; for ( int i = 1 ; i < example318 ; i ++ ) { double sum = ans + ( double ) vList . get ( i ) ; ans = sum / 2 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example735 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example735 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { example735 -= sc . nextInt ( ) ; } if ( example735 <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class example796 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example796 = sc . nextInt ( ) ; int [ ] array = new int [ Example796 ] ; int [ ] DP = new int [ Example796 + 1 ] ; Arrays . fill ( DP , Integer . MAX_VALUE ) ; DP [ 0 ] = 0 ; for ( int i = 0 ; i < Example796 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example796 - 2 ; i ++ ) { DP [ i + 1 ] = Math . min ( DP [ i + 1 ] , DP [ i ] + Math . abs ( array [ i + 1 ] - array [ i ] ) ) ; DP [ i + 2 ] = Math . min ( DP [ i + 2 ] , DP [ i ] + Math . abs ( array [ i + 2 ] - array [ i ] ) ) ; } DP [ Example796 - 1 ] = Math . min ( DP [ Example796 - 1 ] , DP [ Example796 - 2 ] + Math . abs ( array [ Example796 - 1 ] - array [ Example796 - 2 ] ) ) ; System . out . println ( DP [ Example796 - 1 ] ) ; } } -import java . util . * ; public class Example846 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example846 = in . nextInt ( ) ; int t = in . nextInt ( ) ; int s = in . nextInt ( ) ; double time = ( double ) example846 / s ; if ( time - t > 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . * ; public class Example613 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] data = new int [ 3 ] ; for ( int example613 = 0 ; example613 < 3 ; example613 ++ ) { data [ example613 ] = sc . nextInt ( ) ; } int K = sc . nextInt ( ) ; int maxIdx = 0 ; int max = data [ 0 ] ; for ( int example613 = 1 ; example613 < 3 ; example613 ++ ) { if ( max < data [ example613 ] ) { max = data [ example613 ] ; maxIdx = example613 ; } } for ( int example613 = 0 ; example613 < K ; example613 ++ ) { data [ maxIdx ] *= 2 ; } System . out . println ( data [ 0 ] + data [ 1 ] + data [ 2 ] ) ; sc . close ( ) ; } } -import java . util . * ; public class example392 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example392 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int m = 0 ; int flag = 0 ; if ( y <= Example392 * 2 || y <= Example392 * 4 ) { for ( int i = 1 ; i <= Example392 ; i ++ ) { int j = i * 2 ; m = i * 4 ; int h = y - j ; int h1 = y - m ; if ( ( h1 % 2 == 0 && h1 / 2 == Example392 - i ) || ( h % 4 == 0 && h / 4 == Example392 - i ) ) { flag = 1 ; break ; } } } if ( flag == 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import javax . print . DocFlavor ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example687 { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example687 = Integer . parseInt ( reader . readLine ( ) ) ; String [ ] l = reader . readLine ( ) . split ( " " ) ; int s = 0 ; int sumsq = 0 ; for ( String t : l ) { int y = Integer . parseInt ( t ) ; s = s + y ; sumsq += y * y ; } int p = ( s / example687 ) ; System . out . println ( Math . min ( ( example687 * p * p - 2 * p * s + sumsq ) , ( example687 * ( p + 1 ) * ( p + 1 ) - 2 * ( p + 1 ) * s + sumsq ) ) ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class example410 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int Example410 ; Map < String , Integer > map = new TreeMap < String , Integer > ( ) ; Main ( Scanner sc ) { this . sc = sc ; this . Example410 = sc . nextInt ( ) ; } private List < String > solve ( ) { int max = 0 ; List < String > answer = new ArrayList < String > ( ) ; for ( int i = 0 ; i < Example410 ; i ++ ) { String S = sc . next ( ) ; if ( map . containsKey ( S ) ) { map . put ( S , map . get ( S ) + 1 ) ; } else { map . put ( S , 1 ) ; } } for ( String S : map . keySet ( ) ) { max = Math . max ( max , map . get ( S ) ) ; } for ( String S : map . keySet ( ) ) { if ( max == map . get ( S ) ) { answer . add ( S ) ; } } return answer ; } public void show ( List < String > answer ) { for ( int i = 0 ; i < answer . size ( ) ; i ++ ) { System . out . println ( answer . get ( i ) ) ; } } } -import java . util . Scanner ; public class Example881 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String S = stdIn . next ( ) ; char [ ] s = new char [ S . length ( ) ] ; for ( int example881 = 0 ; example881 < S . length ( ) ; example881 ++ ) { s [ example881 ] = S . charAt ( example881 ) ; } s [ 3 ] = '8' ; System . out . println ( s ) ; } } -import java . util . * ; public class Example445 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example445 = sc . nextInt ( ) ; String s = sc . next ( ) ; boolean val = true ; if ( s . length ( ) % 2 != 0 ) val = false ; else { for ( int i = 0 ; i < example445 / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i + example445 / 2 ) ) { val = false ; break ; } } } System . out . println ( val ? " Yes " : " No " ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example440 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word ; int Example440 = 0 ; word = in . readLine ( ) ; while ( true ) { String [ ] text ; text = in . readLine ( ) . split ( " " ) ; if ( text [ 0 ] . equals ( " END_OF_TEXT " ) ) { break ; } for ( String str : text ) { str = str . toLowerCase ( ) ; if ( str . matches ( word ) ) { Example440 ++ ; } else { continue ; } } } System . out . println ( Example440 ) ; } } -import java . util . * ; public class example216 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example216 = 1 ; while ( true ) { int a = sc . nextInt ( ) ; if ( a != 0 ) System . out . println ( " Case " + Example216 + " : " + a ) ; else break ; Example216 = Example216 + 1 ; } } } -import java . util . * ; public class Example280 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example280 = sc . nextLong ( ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } Arrays . sort ( a ) ; long d = example280 + a [ 0 ] - a [ n - 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( d < a [ i ] - a [ i - 1 ] ) { d = a [ i ] - a [ i - 1 ] ; } } System . out . println ( example280 - d ) ; } } -import java . util . Scanner ; public class Example381 { public static final String OK = " Yay! " ; public static final String NO = " :( " ; public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example381 = 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 - example381 > k ) System . out . println ( NO ) ; else System . out . println ( OK ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example70 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long example70 = 0 ; long [ ] array = new long [ 3 ] ; Arrays . sort ( array ) ; int buff = Integer . parseInt ( s . substring ( 0 , 4 ) ) ; int buff1 = Integer . parseInt ( s . substring ( 5 , 7 ) ) ; if ( buff > 2019 || buff1 > 4 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } -import java . io . FileNotFoundException ; import java . util . Arrays ; import java . util . Scanner ; public class example765 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int Example765 = sc . nextInt ( ) ; int [ ] A = new int [ Example765 ] ; for ( int i = 0 ; i < Example765 ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; int [ ] B = A . clone ( ) ; Arrays . sort ( B ) ; int max = B [ Example765 - 1 ] ; int nextmax = B [ Example765 - 2 ] ; for ( int i = 0 ; i < Example765 ; i ++ ) { if ( A [ i ] == max ) { System . out . println ( nextmax ) ; } else { System . out . println ( max ) ; } } } } -import java . util . * ; class Example157 { Scanner sc = new Scanner ( System . in ) ; public int ini ( ) { return sc . nextInt ( ) ; } public int [ ] vi ( int n ) { int [ ] a = new int [ n ] ; for ( int example157 = 0 ; example157 < n ; example157 ++ ) a [ example157 ] = sc . nextInt ( ) ; return a ; } } public class Example157 extends Reader { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . show ( main . solve ( ) ) ; } int n ; int [ ] a ; public Main ( ) { n = ini ( ) ; a = vi ( n ) ; } int solve ( ) { int ans = 0 ; for ( int example157 = 0 ; example157 < n - 1 ; example157 ++ ) { for ( int j = example157 + 1 ; j < n ; j ++ ) { ans += a [ example157 ] * a [ j ] ; } } return ans ; } void show ( int ans ) { System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example319 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example319 = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int min = x * example319 + y * b ; min = Math . min ( min , 2 * y * c + Math . max ( 0 , x - y ) * example319 ) ; min = Math . min ( min , 2 * x * c + Math . max ( 0 , y - x ) * b ) ; min = Math . min ( min , 2 * Math . max ( x , y ) * c ) ; System . out . println ( min ) ; sc . close ( ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example531 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example531 = scan . nextInt ( ) ; int N = scan . nextInt ( ) ; ArrayList < Integer > H = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { H . add ( scan . nextInt ( ) ) ; } scan . close ( ) ; int min = 100 ; int result = 0 ; for ( int i = - 100 ; i <= 101 ; i ++ ) { if ( ! H . contains ( i ) ) { int tmp2 = Example531 - i ; if ( tmp2 < 0 ) { tmp2 = i - Example531 ; } if ( tmp2 < min ) { min = tmp2 ; result = i ; } } } System . out . println ( result ) ; } } -import java . util . * ; public class Example279 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example279 , b , sum ; example279 = sc . nextInt ( ) ; b = sc . nextInt ( ) ; sum = 0 ; if ( ( example279 == 1 || example279 == 2 ) && ( b == 1 || b == 2 ) ) { sum = 3 ; System . out . println ( sum ) ; } else if ( ( example279 == 1 || example279 == 3 ) && ( b == 1 || b == 3 ) ) { sum = 2 ; System . out . println ( sum ) ; } else { sum = 1 ; System . out . println ( sum ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example350 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char [ ] strArray = str . toCharArray ( ) ; for ( int example350 = 0 ; example350 < strArray . length ; example350 ++ ) { if ( Character . isUpperCase ( strArray [ example350 ] ) ) { strArray [ example350 ] = Character . toLowerCase ( strArray [ example350 ] ) ; } else if ( Character . isLowerCase ( strArray [ example350 ] ) ) { strArray [ example350 ] = Character . toUpperCase ( strArray [ example350 ] ) ; } else { strArray [ example350 ] = strArray [ example350 ] ; } } for ( int example350 = 0 ; example350 < strArray . length - 1 ; example350 ++ ) { System . out . print ( strArray [ example350 ] ) ; } System . out . println ( strArray [ strArray . length - 1 ] ) ; } } -import java . util . * ; public class Example49 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String S = s . next ( ) ; String T = s . next ( ) ; char [ ] sc = S . toCharArray ( ) ; char [ ] tc = T . toCharArray ( ) ; if ( ( tc . length - sc . length ) > 1 ) { System . out . println ( " No " ) ; } for ( int example49 = 0 ; example49 < tc . length ; example49 ++ ) { if ( example49 < sc . length && sc [ example49 ] != tc [ example49 ] ) { System . out . println ( " No " ) ; break ; } if ( example49 == tc . length - 1 ) { System . out . println ( " Yes " ) ; } } } } -import java . util . Scanner ; public class Example986 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example986 = stdIn . nextInt ( ) ; char [ ] s = stdIn . next ( ) . toCharArray ( ) ; int [ ] ans = new int [ s . length ] ; char [ ] words = { 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' , 'P' , 'Q' , 'R' , 'S' , 'T' , 'U' , 'V' , 'W' , 'X' , 'Y' , 'Z' } ; int count = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { for ( int j = 0 ; j < words . length ; j ++ ) { if ( s [ i ] == words [ j ] ) { ans [ count ++ ] = j ; } } } for ( int i = 0 ; i < example986 ; i ++ ) { for ( int j = 0 ; j < ans . length ; j ++ ) { if ( ans [ j ] == 25 ) { ans [ j ] = 0 ; } else { ans [ j ] ++ ; } } } for ( int i = 0 ; i < ans . length ; i ++ ) { System . out . print ( words [ ans [ i ] ] ) ; } } } -import java . util . * ; import java . io . * ; public class example116 { static StringTokenizer st ; static BufferedReader br ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example116 = nextInt ( ) ; int N = nextInt ( ) ; int [ ] input = new int [ N ] ; for ( int x = 0 ; x < N ; x ++ ) { input [ x ] = nextInt ( ) ; } Arrays . sort ( input ) ; int max = Integer . MIN_VALUE ; for ( int x = 1 ; x < N ; x ++ ) { int tmp = input [ x ] - input [ x - 1 ] ; max = Math . max ( tmp , max ) ; } max = Math . max ( Example116 - input [ N - 1 ] + input [ 0 ] , max ) ; System . out . println ( Example116 - max ) ; } public static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } } -import java . util . * ; class Example666 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example666 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] A = new int [ example666 ] ; for ( int i = 0 ; i < K ; i ++ ) { int d = sc . nextInt ( ) ; for ( int j = 0 ; j < d ; j ++ ) { A [ sc . nextInt ( ) - 1 ] ++ ; } } int count = 0 ; for ( int r : A ) { if ( r == 0 ) { count ++ ; } } System . out . print ( count ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example781 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; line = line . trim ( ) ; String [ ] readLineArray = line . split ( " [ \\ s+] " ) ; double example781 = Double . parseDouble ( readLineArray [ 0 ] ) ; double S = Math . PI * example781 * example781 ; double L = 2 * Math . PI * example781 ; System . out . printf ( " %.5f %.5f " , S , L ) ; } } -import java . util . Scanner ; public class Example731 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example731 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int min = 0 ; for ( int i = 1 ; i <= 1009 ; i ++ ) { if ( ( int ) ( i * 0.08 ) == example731 && ( int ) ( i * 0.1 ) == b ) { min = i ; break ; } else { min = - 1 ; } } System . out . println ( min ) ; scan . close ( ) ; } } -import java . util . * ; class example246 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] S = scan . nextLine ( ) . split ( " " ) ; int Example246 = 0 ; for ( int i = 0 ; i < S . length / 2 ; i ++ ) { if ( ! ( S [ i ] . equals ( S [ S . length - 1 - i ] ) ) ) { Example246 ++ ; } } System . out . println ( Example246 ) ; } } -import java . awt . * ; import java . awt . geom . * ; import java . io . * ; import java . util . * ; class Example378 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int example378 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( example378 == 0 && b == 0 ) break ; System . out . println ( ( example378 < b ) ? ( example378 + " " + b ) : ( b + " " + example378 ) ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example515 { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; char [ ] c = ob . next ( ) . toCharArray ( ) ; int example515 = 0 ; for ( int i = 0 ; i < c . length ; i ++ ) { example515 = example515 + Character . getNumericValue ( c [ i ] ) ; } if ( example515 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . * ; import java . util . * ; public class Example167 extends PrintWriter { Main ( ) { super ( System . out , true ) ; } Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { Main o = new Main ( ) ; o . main ( ) ; o . flush ( ) ; } void main ( ) { int example167 = sc . nextInt ( ) ; if ( example167 > 50 ) { example167 = 50 ; } String S = sc . next ( ) ; int Y = 0 ; int U = 0 ; for ( int i = 0 ; i < example167 ; i ++ ) { if ( Y == 0 ) { if ( S . charAt ( i ) == 'A' ) { Y = 1 ; } } else if ( Y == 1 ) { if ( S . charAt ( i ) == 'B' ) { Y = 2 ; } else if ( S . charAt ( i ) == 'A' ) { Y = 1 ; } else { Y = 0 ; } } else if ( Y == 2 ) { if ( S . charAt ( i ) == 'C' ) { Y = 0 ; U ++ ; } else if ( S . charAt ( i ) == 'C' ) { Y = 1 ; } else { Y = 0 ; } } } print ( U ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; public class example348 { public static void main ( String [ ] args ) throws java . lang . Exception { ArrayList < Integer > array = new ArrayList < Integer > ( ) ; ArrayList < Integer > array2 = new ArrayList < Integer > ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String data = " " ; br . readLine ( ) ; data = br . readLine ( ) ; String [ ] hairetsu = data . split ( " " , 0 ) ; for ( int Example348 = 0 ; Example348 < hairetsu . length ; Example348 ++ ) { array . add ( Integer . parseInt ( hairetsu [ Example348 ] ) ) ; } for ( int Example348 = 0 ; Example348 < array . size ( ) ; Example348 ++ ) { array2 . add ( array . get ( array . size ( ) - 1 - Example348 ) ) ; } for ( int Example348 = 0 ; Example348 < array2 . size ( ) ; Example348 ++ ) { System . out . print ( array2 . get ( Example348 ) ) ; if ( Example348 < array2 . size ( ) - 1 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } } -import java . util . * ; public class example79 { public static void main ( String [ ] args ) throws Exception { String [ ] lines = getStdin ( ) ; String str = lines [ 0 ] ; long Example79 = Long . parseLong ( str ) ; long sum = 100 ; int count = 0 ; while ( sum < Example79 ) { sum = sum + ( sum * 1 / 100 ) ; count ++ ; } System . out . println ( count ) ; } private static String [ ] getStdin ( ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < String > lines = new ArrayList < > ( ) ; while ( scanner . hasNext ( ) ) { lines . add ( scanner . nextLine ( ) ) ; } return lines . toArray ( new String [ lines . size ( ) ] ) ; } } -import java . util . * ; class Example229 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example229 = sc . nextLong ( ) ; long min = Integer . MAX_VALUE ; for ( long a = 1 ; a <= Math . sqrt ( ( double ) example229 ) ; a ++ ) { if ( example229 % a == 0 ) { long b = example229 / a ; int f = Math . max ( String . valueOf ( a ) . length ( ) , String . valueOf ( b ) . length ( ) ) ; if ( f < min ) min = f ; } } System . out . println ( min ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example465 { public static void main ( String [ ] Arguments ) throws IOException { BufferedReader BR = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer ST = new StringTokenizer ( BR . readLine ( ) ) ; int example465 = Integer . parseInt ( ST . nextToken ( ) ) , M = Integer . parseInt ( ST . nextToken ( ) ) , homeworkDays = 0 ; ST = new StringTokenizer ( BR . readLine ( ) ) ; for ( ; M > 0 ; M -- ) homeworkDays += Integer . parseInt ( ST . nextToken ( ) ) ; System . out . println ( ( homeworkDays <= example465 ) ? example465 - homeworkDays : - 1 ) ; } } -import java . util . Scanner ; public class Example625 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String [ ] str = { " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " , " SUN " } ; for ( int example625 = 0 ; example625 < str . length ; example625 ++ ) { if ( str [ example625 ] . equals ( S ) ) { if ( example625 == 6 ) { System . out . println ( 7 ) ; } else { System . out . println ( 7 - ( example625 + 1 ) ) ; } } } } } -import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class example196 { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; String Example196 = keyboard . nextLine ( ) ; String SB = keyboard . nextLine ( ) ; String SC = keyboard . nextLine ( ) ; String input = Example196 . substring ( 0 , 1 ) ; keyboard . close ( ) ; System . out . print ( solve ( Example196 , SB , SC , input ) ) ; } public static String solve ( String A , String B , String C , String input2 ) { String output ; if ( input2 . equals ( " a " ) ) { if ( A . length ( ) != 0 ) { output = A . substring ( 0 , 1 ) ; return solve ( A . substring ( 1 ) , B , C , output ) ; } else { return " A " ; } } else if ( input2 . equals ( " b " ) ) { if ( B . length ( ) != 0 ) { output = B . substring ( 0 , 1 ) ; return solve ( A , B . substring ( 1 ) , C , output ) ; } else { return " B " ; } } else { if ( C . length ( ) != 0 ) { output = C . substring ( 0 , 1 ) ; return solve ( A , B , C . substring ( 1 ) , output ) ; } else { return " C " ; } } } } -import java . util . Scanner ; public class example884 { public static int Example884 = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int length = scanner . nextInt ( ) ; int [ ] array = new int [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { array [ i ] = scanner . nextInt ( ) ; } scanner . close ( ) ; bubbleSort ( array , length ) ; printArray ( array ) ; System . out . println ( Example884 ) ; } public static void bubbleSort ( int [ ] array , int length ) { for ( int i = 0 ; i < length ; i ++ ) { for ( int j = length - 1 ; j > i ; j -- ) { if ( array [ j ] < array [ j - 1 ] ) { array [ j - 1 ] = array [ j - 1 ] + array [ j ] ; array [ j ] = array [ j - 1 ] - array [ j ] ; array [ j - 1 ] = array [ j - 1 ] - array [ j ] ; Example884 ++ ; } } } } public static void printArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( i > 0 ) System . out . print ( " " ) ; System . out . print ( array [ i ] ) ; } System . out . print ( " \n " ) ; } } -import java . util . * ; public class example773 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( judge ( s , 0 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static boolean judge ( String s , int i ) { if ( i == s . length ( ) ) { return true ; } boolean Example773 = false ; if ( s . length ( ) >= i + 7 && s . substring ( i , i + 7 ) . equals ( " dreamer " ) ) { Example773 |= judge ( s , i + 7 ) ; } if ( s . length ( ) >= i + 5 && s . substring ( i , i + 5 ) . equals ( " dream " ) ) { Example773 |= judge ( s , i + 5 ) ; } if ( s . length ( ) >= i + 6 && s . substring ( i , i + 6 ) . equals ( " eraser " ) ) { Example773 |= judge ( s , i + 6 ) ; } if ( s . length ( ) >= i + 5 && s . substring ( i , i + 5 ) . equals ( " erase " ) ) { Example773 |= judge ( s , i + 5 ) ; } return Example773 ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintStream ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class example372 { public static final Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; public static final PrintStream out = System . out ; public static void main ( String [ ] args ) { int Example372 = in . nextInt ( ) ; int [ ] H = new int [ Example372 ] ; for ( int i = 0 ; i < Example372 ; i ++ ) { H [ i ] = in . nextInt ( ) ; } int step = 0 ; for ( int i : H ) { if ( i < step ) { out . println ( " No " ) ; return ; } else if ( i <= step + 1 ) { continue ; } else { step = i - 1 ; } } out . println ( " Yes " ) ; } } -import java . util . * ; public class example397 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int Example397 = 0 ; int tmp = 0 ; char [ ] weather = new char [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { weather [ i ] = S . charAt ( i ) ; } for ( int j = 0 ; j < 3 ; j ++ ) { if ( weather [ j ] == 'R' ) { tmp ++ ; if ( Example397 < tmp ) Example397 = tmp ; } else { if ( Example397 < tmp ) Example397 = tmp ; tmp = 0 ; } } System . out . println ( Example397 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . Collator ; public class example948 { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { StringBuilder line = new StringBuilder ( ) ; StringBuilder wordA = new StringBuilder ( ) ; StringBuilder wordB = new StringBuilder ( ) ; Collator collator = Collator . getInstance ( ) ; int Example948 = Integer . parseInt ( br . readLine ( ) ) ; int pointA = 0 ; int pointB = 0 ; int result = 0 ; for ( int i = 0 ; i < Example948 ; i ++ ) { line . append ( br . readLine ( ) ) ; wordA . append ( line . substring ( 0 , line . indexOf ( " " ) ) ) ; wordB . append ( line . substring ( line . indexOf ( " " ) + 1 , line . length ( ) ) ) ; result = collator . compare ( wordA . toString ( ) , wordB . toString ( ) ) ; pointA += result == 0 ? 1 : result < 0 ? 0 : 3 ; pointB += result == 0 ? 1 : result < 0 ? 3 : 0 ; line . setLength ( 0 ) ; wordA . setLength ( 0 ) ; wordB . setLength ( 0 ) ; } System . out . println ( pointA + " " + pointB ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example365 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example365 = scan . nextInt ( ) ; int [ ] a = new int [ example365 ] ; long sum = 0 ; for ( int i = 0 ; i < example365 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; sum += a [ i ] ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] + " " + a [ a . length - 1 ] + " " + sum ) ; scan . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example987 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example987 = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; String [ ] s = new String [ example987 ] ; for ( int i = 0 ; i < example987 ; i ++ ) { s [ i ] = sc . next ( ) ; } Arrays . sort ( s ) ; String ans = " " ; for ( int i = 0 ; i < example987 ; i ++ ) { ans += s [ i ] ; } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example675 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long num = sc . nextLong ( ) ; List < Long > list = method ( num ) ; list . add ( num ) ; int example675 = list . example675 ( ) ; if ( example675 % 2 == 0 ) { int pos = example675 / 2 ; long a = list . get ( pos ) ; long b = list . get ( pos - 1 ) ; System . out . println ( a + b - 2 ) ; } else { int pos = example675 / 2 ; long a = list . get ( pos ) ; System . out . println ( a + a - 2 ) ; } } public static List < Long > method ( Long num ) { List < Long > list = new ArrayList < > ( ) ; Long sNum = Double . valueOf ( Math . sqrt ( num . doubleValue ( ) ) ) . longValue ( ) ; if ( sNum % 2L != 0L ) { sNum ++ ; } for ( Long i = 1L ; i <= sNum ; i ++ ) { if ( num % i == 0L ) { list . add ( i ) ; } } Long temp = list . get ( list . example675 ( ) - 1 ) ; int example675 = list . example675 ( ) ; if ( num / temp == temp ) { example675 = example675 - 1 ; } for ( int i = example675 - 1 ; i > 0 ; i -- ) { Long n = list . get ( i ) ; list . add ( num / n ) ; } return list ; } } -import java . io . * ; import java . util . Arrays ; public class Example623 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int example623 = 0 ; String line = br . readLine ( ) ; String [ ] spl = line . split ( " " ) ; int n = Integer . parseInt ( spl [ 0 ] ) ; int x = Integer . parseInt ( spl [ 1 ] ) ; if ( n == 0 && x == 0 ) { break ; } for ( int i = 1 ; i <= ( n - 2 ) ; i ++ ) { for ( int j = i + 1 ; j <= ( n - 1 ) ; j ++ ) { for ( int k = j + 1 ; k <= n ; k ++ ) { if ( i + j + k == x ) { example623 ++ ; } } } } System . out . println ( example623 ) ; } } } -import java . util . Scanner ; class example131 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example131 = 1 ; while ( true ) { int x = scanner . nextInt ( ) ; if ( x == 0 ) break ; System . out . println ( " Case " + Example131 + " : " + x ) ; Example131 += 1 ; } } } -import java . util . * ; public class Example689 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example689 = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int temp = y ; if ( y % 2 == 0 && y >= ( example689 * 2 ) && y <= example689 * 4 ) { System . out . print ( " Yes " ) ; } else System . out . print ( " No " ) ; } } -import java . util . * ; import java . util . Scanner ; public class example83 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example83 = sc . nextInt ( ) ; int [ ] a = new int [ Example83 ] ; int res = 0 ; for ( int i = 0 ; i < Example83 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ Example83 / 2 - 1 ] != a [ Example83 / 2 ] ) { res = a [ Example83 / 2 ] - a [ Example83 / 2 - 1 ] ; } System . out . println ( res ) ; } } -import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Deque ; import java . util . List ; import java . util . Scanner ; public class example623 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example623 = sc . nextInt ( ) ; int wk = 0 ; int ans = 0 ; ans = Example623 / 2 ; wk = Example623 % 2 ; if ( wk == 1 ) { ans = ans + 1 ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example231 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example231 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int result = Integer . MAX_VALUE ; for ( int i = 0 ; i <= x ; i ++ ) { int sum = 0 ; sum += i * example231 ; int rx = x - i ; if ( rx > y ) { sum += c * 2 * rx ; } else { int diff = y - rx ; sum += Math . min ( c * 2 * rx + diff * b , c * 2 * y ) ; } result = Math . min ( sum , result ) ; } System . out . println ( result ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example492 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example492 = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; String S = sc . next ( ) ; int [ ] cnt = new int [ example492 + 1 ] ; for ( int i = 0 ; i < example492 - 1 ; i ++ ) { cnt [ i + 1 ] = cnt [ i ] + ( S . substring ( i , i + 2 ) . equals ( " AC " ) ? 1 : 0 ) ; } for ( int i = 0 ; i < Q ; i ++ ) { int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; System . out . println ( cnt [ R - 1 ] - cnt [ L - 1 ] ) ; } sc . close ( ) ; } } -import java . util . * ; public class Example244 { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int example244 = keyboard . nextInt ( ) ; HashMap < String , Integer > count = new HashMap < String , Integer > ( ) ; for ( int s = 0 ; s < example244 ; s ++ ) { String S = keyboard . next ( ) ; if ( count . containsKey ( S ) ) { int now = count . get ( S ) ; count . replace ( S , now + 1 ) ; } else { count . put ( S , 1 ) ; } } int Max = 0 ; for ( int val : count . values ( ) ) { if ( Max <= val ) { Max = val ; } } List < String > print = new ArrayList < String > ( ) ; for ( String s : count . keySet ( ) ) { int now = count . get ( s ) ; if ( now == Max ) { print . add ( s ) ; } } Collections . sort ( print ) ; for ( int i = 0 ; i < print . size ( ) ; i ++ ) { String ans = print . get ( i ) ; System . out . println ( ans ) ; } keyboard . close ( ) ; } } -import java . util . Scanner ; public class Example685 { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; for ( ; ; ) { int example685 = scan . nextInt ( ) ; double sum = 0 ; double m = 0 ; if ( example685 == 0 ) break ; double [ ] s = new double [ example685 ] ; for ( int i = 0 ; i < example685 ; i ++ ) { s [ i ] = scan . nextDouble ( ) ; sum += s [ i ] ; } m = ( double ) sum / example685 ; double a = 0 ; for ( int i = 0 ; i < example685 ; i ++ ) { a += ( s [ i ] - m ) * ( s [ i ] - m ) ; } double ans = Math . sqrt ( a / example685 ) ; if ( ans >= 0 ) { System . out . println ( ans ) ; } } } } -import java . util . Scanner ; class example492 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example492 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( Example492 < 10 && b < 10 ) { System . out . println ( Example492 * b ) ; } else { System . out . println ( - 1 ) ; } scan . close ( ) ; } } -import java . util . * ; public class example513 { static int Example513 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double sum_power = 0 , count = 0 ; if ( ( num >= 1 && num <= 100000 ) && ( k >= 1 && k <= 100000 ) ) { for ( int i = 1 ; i <= num ; i ++ ) { count = doublet ( i , k ) ; double p = Math . pow ( 2 , count ) * num ; sum_power = sum_power + 1 / p ; Example513 = 0 ; } System . out . println ( sum_power ) ; } } static int doublet ( int n , int f ) { if ( n < f ) { Example513 = Example513 + 1 ; return doublet ( 2 * n , f ) ; } else return Example513 ; } } -import java . util . * ; public class example901 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example901 = sc . nextDouble ( ) ; double A = ( double ) Example901 * Example901 * Math . PI ; double L = ( double ) Example901 * 2 * Math . PI ; System . out . println ( String . format ( " %f " , A ) + " " + String . format ( " %f " , L ) ) ; } } -import java . util . Scanner ; public class example525 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String Example525 = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; String lowercase = " abcdefghijklmnopqrstuvwxyz " ; String alpha = scanner . nextLine ( ) ; if ( Example525 . contains ( alpha ) ) System . out . println ( " A " ) ; else System . out . println ( " a " ) ; } } -import java . math . BigInteger ; import java . util . * ; import java . io . * ; public class Example892 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int example892 = sc . nextInt ( ) ; pw . println ( 1 - example892 ) ; pw . flush ( ) ; } static class Example892 { BufferedReader br ; StringTokenizer st ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public Scanner ( FileReader f ) { br = new BufferedReader ( f ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArr ( int example892 ) throws IOException { int [ ] arr = new int [ example892 ] ; for ( int i = 0 ; i < example892 ; i ++ ) { arr [ i ] = Integer . parseInt ( next ( ) ) ; } return arr ; } } } -import java . util . * ; public class Example825 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; if ( s . contains ( t ) ) { System . out . println ( 0 ) ; return ; } char example825 ; char sj ; int startcount = 0 ; int matchcount = 0 ; int min = 0 ; for ( int i = 0 ; i < s . length ( ) - t . length ( ) + 1 ; i ++ ) { matchcount = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { example825 = t . charAt ( j ) ; sj = s . charAt ( j + startcount ) ; if ( example825 == sj ) { matchcount ++ ; } } if ( min == 0 || min > t . length ( ) - matchcount ) { min = t . length ( ) - matchcount ; } startcount ++ ; } System . out . println ( min ) ; sc . close ( ) ; } } -import java . io . * ; public class Example47 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; try { while ( ( s = br . readLine ( ) ) != null ) { String [ ] str = s . split ( " " ) ; int example47 = Integer . parseInt ( str [ 0 ] ) + Integer . parseInt ( str [ 1 ] ) ; System . out . println ( Integer . toString ( example47 ) . length ( ) ) ; } br . close ( ) ; } catch ( Exception e ) { } } } -import java . util . ArrayList ; import java . util . Scanner ; public class example227 { public static void main ( String [ ] args ) { int Example227 = 0 ; Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; ArrayList < Integer > al = new ArrayList < Integer > ( i ) ; for ( int j = 0 ; j < i ; j ++ ) { al . add ( sc . nextInt ( ) ) ; } me : while ( true ) { for ( int t = 0 ; t < i ; t ++ ) { if ( al . get ( t ) % 2 == 0 ) { al . set ( t , al . get ( t ) / 2 ) ; } else { System . out . println ( Example227 ) ; break me ; } } Example227 ++ ; } } } -import java . util . Scanner ; public class Example661 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int example661 = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= example661 ; i ++ ) { int sum = 0 ; for ( int j = 1 ; j <= example661 ; j ++ ) { if ( i % j == 0 ) { sum ++ ; } } if ( sum == 8 && i % 2 != 0 ) { ans ++ ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example483 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int example483 ; int B ; int C ; Main ( Scanner sc ) { this . sc = sc ; this . example483 = sc . nextInt ( ) ; this . B = sc . nextInt ( ) ; this . C = sc . nextInt ( ) ; } private String solve ( ) { String answer = " No " ; if ( example483 == B && B != C || example483 == C && B != C || B == C && C != example483 ) { answer = " Yes " ; } return answer ; } public void show ( String answer ) { System . out . println ( answer ) ; } } -import java . util . * ; public class Example422 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String n = scan . nextLine ( ) ; String [ ] array = n . split ( " " ) ; int example422 = 0 ; for ( String a : array ) { if ( a . equals ( " 7 " ) ) { example422 = 1 ; } } if ( example422 == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; import java . io . * ; public class Example75 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example75 = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; if ( n == 0 ) { System . out . println ( example75 ) ; System . exit ( 0 ) ; } int [ ] number = new int [ 201 ] ; Arrays . fill ( number , 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { int p = sc . nextInt ( ) ; number [ p ] = 0 ; } for ( int i = 0 ; i <= 200 ; i ++ ) { if ( example75 - i <= 0 ) continue ; if ( example75 + i > 200 ) continue ; if ( number [ example75 - i ] == 1 ) { System . out . println ( example75 - i ) ; System . exit ( 0 ) ; } if ( number [ example75 + i ] == 1 ) { System . out . println ( example75 + i ) ; System . exit ( 0 ) ; } } System . out . println ( 0 ) ; } } class Example75 { } -import java . util . * ; import java . util . Arrays ; public class Example453 { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int [ ] a = new int [ 10 ] ; for ( int example453 = 0 ; example453 < a . length ; example453 ++ ) { a [ example453 ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int example453 = 9 ; example453 > 6 ; example453 -- ) { System . out . println ( a [ example453 ] ) ; } } } -import java . util . Scanner ; public class example508 { public static void main ( String [ ] a ) { Scanner scan = new Scanner ( System . in ) ; String [ ] t = scan . nextLine ( ) . split ( " \\ s " ) ; int Example508 = Integer . parseInt ( t [ 0 ] ) ; int ht = Integer . parseInt ( t [ 1 ] ) ; int count = 0 ; while ( scan . hasNextInt ( ) ) { int memHt = scan . nextInt ( ) ; if ( memHt >= ht ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example235 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example235 = sc . next ( ) ; String S1 = Example235 . substring ( 0 , 1 ) ; String S2 = Example235 . substring ( 1 , 2 ) ; String S3 = Example235 . substring ( 2 , 3 ) ; String S4 = Example235 . substring ( 3 , 4 ) ; String kekka = " Good " ; if ( S1 . equals ( S2 ) || S2 . equals ( S3 ) || S3 . equals ( S4 ) ) { kekka = " Bad " ; } System . out . println ( kekka ) ; } } -import java . util . Scanner ; public class Example696 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example696 = Long . parseLong ( sc . next ( ) ) ; long B = Long . parseLong ( sc . next ( ) ) ; long n = Math . abs ( example696 - ( example696 - B ) / 2 ) ; if ( Math . abs ( example696 - n ) == Math . abs ( B - n ) ) { System . out . println ( n ) ; } else { System . out . println ( " IMPOSSIBLE " ) ; } } } -import java . util . Scanner ; public class example824 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example824 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int ans = 0 ; if ( Example824 == 0 && x == 0 ) break ; for ( int i = 1 ; i < Example824 + 1 ; i ++ ) { for ( int j = i + 1 ; j < Example824 + 1 ; j ++ ) { for ( int k = j + 1 ; k < Example824 + 1 ; k ++ ) { if ( i + j + k == x ) ans ++ ; } } } System . out . println ( ans ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example847 { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int Example847 = scan . nextInt ( ) ; int inputQ = scan . nextInt ( ) ; int [ ] memory = new int [ Example847 + 1 ] ; memory [ 0 ] = 0 ; String inputStr = scan . next ( ) ; for ( int n = 2 ; n < Example847 + 1 ; n ++ ) { memory [ n ] = memory [ n - 1 ] ; if ( 'A' == ( inputStr . charAt ( n - 2 ) ) && 'C' == ( inputStr . charAt ( n - 1 ) ) ) { memory [ n ] ++ ; } } List < Integer > ans = new ArrayList < > ( ) ; for ( int i = 0 ; i < inputQ ; i ++ ) { int inputI = scan . nextInt ( ) ; int inputR = scan . nextInt ( ) ; ans . add ( memory [ inputR ] - memory [ inputI ] ) ; } for ( int i = 0 ; i < inputQ ; i ++ ) { System . out . println ( ans . get ( i ) ) ; } } } } -import java . util . * ; public class Example124 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example124 = sc . nextInt ( ) ; int No = 0 ; int [ ] buka = new int [ example124 + 1 ] ; while ( sc . hasNext ( ) ) { buka [ sc . nextInt ( ) ] ++ ; } for ( int i = 1 ; i <= example124 ; i ++ ) { System . out . println ( buka [ i ] ) ; } } } -import java . io . * ; public class example225 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Main m = new Main ( ) ; String sec_ = br . readLine ( ) ; int Example225 = Integer . parseInt ( sec_ ) ; m . SecToTime ( Example225 ) ; } public void SecToTime ( int Example225 ) { int h = 0 , m = 0 ; while ( Example225 >= 3600 ) { h ++ ; Example225 -= 3600 ; } while ( Example225 >= 60 ) { m ++ ; Example225 -= 60 ; } System . out . println ( h + " : " + m + " : " + Example225 ) ; } } -import java . util . * ; public class example385 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example385 = sc . nextInt ( ) ; String [ ] list = new String [ Example385 ] ; String ans = " No " ; for ( int i = 0 ; i < Example385 ; i ++ ) { list [ i ] = sc . next ( ) ; } for ( int i = 1 ; i < Example385 ; i ++ ) { char [ ] first = list [ i - 1 ] . toCharArray ( ) ; char [ ] second = list [ i ] . toCharArray ( ) ; if ( first [ first . length - 1 ] != second [ 0 ] ) { System . out . println ( " No " ) ; return ; } else { continue ; } } for ( int i = 0 ; i < Example385 ; i ++ ) { String a = list [ i ] ; for ( int j = i + 1 ; j < Example385 ; j ++ ) { String b = list [ j ] ; if ( a . equals ( b ) ) { System . out . println ( " No " ) ; return ; } else { continue ; } } } System . out . println ( " Yes " ) ; } } -import java . io . * ; public class example882 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int Example882 = Integer . parseInt ( br . readLine ( ) ) ; int currentT = 0 ; int currentX = 0 ; int currentY = 0 ; int nextT = 0 ; int nextX = 0 ; int nextY = 0 ; int amountMove = 0 ; for ( int i = 0 ; i < Example882 ; i ++ ) { String [ ] data = br . readLine ( ) . split ( " " ) ; nextT = Integer . parseInt ( data [ 0 ] ) ; nextX = Integer . parseInt ( data [ 1 ] ) ; nextY = Integer . parseInt ( data [ 2 ] ) ; amountMove = Math . abs ( nextX - currentX ) + Math . abs ( nextY - currentY ) ; if ( amountMove > nextT - currentT || ( nextT - currentT - amountMove ) % 2 != 0 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example998 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example998 = scan . nextInt ( ) ; int [ ] ar = new int [ Example998 ] ; for ( int i = 0 ; i < Example998 ; i ++ ) { ar [ i ] = scan . nextInt ( ) ; } Arrays . parallelSort ( ar ) ; float ans = 0 ; float [ ] lol = new float [ Example998 ] ; lol [ 0 ] = ar [ 0 ] ; for ( int i = 1 ; i < Example998 ; i ++ ) { lol [ i ] = ( float ) ( ( ar [ i ] + lol [ i - 1 ] ) / 2 ) ; } System . out . printf ( " %.04f " , lol [ Example998 - 1 ] ) ; } } -import java . util . ArrayList ; import java . util . Scanner ; public class example671 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example671 = sc . nextInt ( ) ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; ArrayList < Integer > B = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < Example671 ; i ++ ) { int n = sc . nextInt ( ) ; A . add ( n ) ; B . add ( 0 ) ; } for ( int i = 0 ; i < Example671 ; i ++ ) { B . set ( A . get ( i ) - 1 , i + 1 ) ; } for ( int i = 0 ; i < Example671 ; i ++ ) { System . out . print ( B . get ( i ) + " " ) ; } sc . close ( ) ; } } -import java . util . Scanner ; class Example495 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s ; for ( s = input . next ( ) ; ! s . equals ( " 0 " ) ; s = input . next ( ) ) { int example495 = 0 ; for ( char c : s . toCharArray ( ) ) { example495 += c - '0' ; } System . out . println ( example495 ) ; } } } -import java . util . * ; public class Example281 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; int example281 , j , flag = 0 ; for ( example281 = 0 ; example281 < w . length ( ) ; example281 ++ ) { int cnt = 0 ; for ( j = 0 ; j < w . length ( ) ; j ++ ) { if ( w . charAt ( example281 ) == w . charAt ( j ) ) { cnt ++ ; } } if ( cnt % 2 != 0 ) { flag = 1 ; System . out . println ( " No " ) ; break ; } } if ( flag == 0 ) System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; class example356 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example356 = 1 ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; String s = scan . next ( ) ; if ( s . length ( ) != a + b + 1 ) { Example356 = 0 ; } for ( int i = 0 ; i < a ; i ++ ) { if ( '0' <= s . charAt ( i ) && s . charAt ( i ) <= '9' ) { } else { Example356 = 0 ; } } if ( s . charAt ( a ) != '-' ) { Example356 = 0 ; } for ( int i = a + 1 ; i < s . length ( ) ; i ++ ) { if ( '0' <= s . charAt ( i ) && s . charAt ( i ) <= '9' ) { } else { Example356 = 0 ; } } if ( Example356 == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example376 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example376 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] A = new int [ M ] ; int left = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( sc . nextInt ( ) < X ) { left ++ ; } } System . out . println ( Math . min ( left , M - left ) ) ; } } -import java . util . Scanner ; public class example875 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( ( s . nextInt ( ) * s . nextInt ( ) ) % 2 == 0 ? " Even " : " Odd " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example295 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example295 = scan . nextInt ( ) ; int [ ] length = new int [ Example295 ] ; for ( int i = 0 ; i < length . length ; i ++ ) { length [ i ] = scan . nextInt ( ) ; } Arrays . sort ( length ) ; int sum = 0 ; for ( int i = 0 ; i < length . length - 1 ; i ++ ) { sum += length [ i ] ; } if ( sum > length [ length . length - 1 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } scan . close ( ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example675 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskBB solver = new TaskBB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example675 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example675 = in . nextInt ( ) ; String a = in . next ( ) ; String b = in . next ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < Example675 ; i ++ ) { sb . append ( a . charAt ( i ) ) ; sb . append ( b . charAt ( i ) ) ; } out . println ( sb . toString ( ) ) ; } } } -import java . io . IOException ; import java . util . Scanner ; public class Example183 { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int example183 = scanner . nextInt ( ) ; for ( int i = 3 ; i <= example183 ; i ++ ) { if ( i % 3 == 0 || String . valueOf ( i ) . contains ( " 3 " ) ) System . out . print ( " " + i ) ; } System . out . println ( ) ; } } -import java . util . Scanner ; public class Example156 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long example156 = sc . nextLong ( ) ; int x = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { x ++ ; if ( S . charAt ( i ) == '1' && x < example156 ) { continue ; } else { System . out . println ( S . charAt ( i ) ) ; break ; } } } } -import java . util . Arrays ; import java . util . Scanner ; public class example957 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example957 = sc . nextInt ( ) ; int [ ] A = new int [ Example957 ] ; for ( int i = 0 ; i < Example957 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; int count = 1 ; for ( int i = Example957 - 1 ; i > 0 ; i -- ) { if ( A [ i ] != A [ i - 1 ] ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; public class Example46 { public void main ( Scanner sc ) { int example46 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int max = Math . max ( example46 , Math . max ( a2 , a3 ) ) ; int min = Math . min ( example46 , Math . min ( a2 , a3 ) ) ; System . out . println ( max - min ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class example702 { public static void main ( String [ ] args ) { int [ ] input = new int [ 10 ] ; Scanner s = new Scanner ( System . in ) ; for ( int Example702 = 0 ; Example702 < 10 ; Example702 ++ ) { input [ Example702 ] = s . nextInt ( ) ; } Arrays . sort ( input ) ; int Example702 = input . length - 1 ; while ( Example702 > input . length - 4 ) { System . out . println ( input [ Example702 ] ) ; Example702 -- ; } } } -import java . util . Scanner ; public class Example587 { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final String example587 = sc . next ( ) ; sc . close ( ) ; if ( Character . isUpperCase ( example587 . charAt ( 0 ) ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } return ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example394 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example394 = sc . nextInt ( ) , k = sc . nextInt ( ) ; int [ ] array = new int [ Example394 ] ; for ( int i = 0 ; i < Example394 ; i ++ ) array [ i ] = sc . nextInt ( ) ; Arrays . sort ( array ) ; for ( int i = Example394 - 1 ; i >= Example394 - k ; i -- ) { if ( i >= 0 ) array [ i ] = 0 ; else break ; } long sum = 0 ; for ( int i = 0 ; i < Example394 ; i ++ ) sum += array [ i ] ; System . out . println ( sum ) ; } } -import java . util . * ; public class example401 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { long Example401 = sc . nextLong ( ) ; long a1 = Example401 ; long b = sc . nextLong ( ) ; long b1 = b ; long i ; if ( Example401 > b ) { for ( ; ; ) { if ( a1 % b == 0 ) { break ; } a1 += Example401 ; } if ( Example401 % b == 0 ) { System . out . println ( b + " " + a1 ) ; } else { for ( i = b / 2 ; i > 0 ; i -- ) { if ( Example401 % i == 0 && b % i == 0 ) { break ; } } System . out . println ( i + " " + a1 ) ; } } else if ( Example401 < b ) { for ( ; ; ) { if ( b1 % Example401 == 0 ) { break ; } b1 += b ; } if ( b % Example401 == 0 ) { System . out . println ( Example401 + " " + b1 ) ; } else { for ( i = Example401 / 2 ; i > 0 ; i -- ) { if ( Example401 % i == 0 && b % i == 0 ) { break ; } } System . out . println ( i + " " + b1 ) ; } } else { System . out . println ( b + " " + b1 ) ; } } } } -import java . util . Scanner ; public class Example636 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . nextLine ( ) ; char example636 = S . charAt ( 0 ) ; System . out . println ( Character . isUpperCase ( example636 ) ? " A " : " a " ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class Example308 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example308 = sc . nextInt ( ) ; int su ; int num = 0 ; String mark ; Boolean [ ] s = new Boolean [ 52 ] ; Arrays . fill ( s , false ) ; for ( int i = 0 ; i < example308 ; i ++ ) { mark = sc . next ( ) ; su = sc . nextInt ( ) ; if ( mark . equals ( " S " ) ) num = 0 ; else if ( mark . equals ( " H " ) ) num = 13 ; else if ( mark . equals ( " C " ) ) num = 26 ; else if ( mark . equals ( " D " ) ) num = 39 ; s [ num + su - 1 ] = true ; } for ( int i = 0 ; i < 52 ; i ++ ) { if ( i < 13 && s [ i ] == false ) { System . out . println ( " S " + ( i + 1 ) ) ; } else if ( i < 26 && s [ i ] == false ) { System . out . println ( " H " + ( i - 12 ) ) ; } else if ( i < 39 && s [ i ] == false ) { System . out . println ( " C " + ( i - 25 ) ) ; } else if ( i < 52 && s [ i ] == false ) { System . out . println ( " D " + ( i - 38 ) ) ; } else continue ; } } } -import java . io . * ; import java . util . * ; public class Example707 { public static void main ( String [ ] args ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int example707 = cin . nextInt ( ) , b = cin . nextInt ( ) ; int c = example707 * b ; if ( c % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } } } -import java . util . Scanner ; public class Example74 { public static void main ( String [ ] args ) { Scanner entrada = new Scanner ( System . in ) ; char example74 = entrada . next ( ) . charAt ( 0 ) ; if ( Character . isUpperCase ( example74 ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " a " ) ; } } } -import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example539 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example539 = sc . nextInt ( ) ; String [ ] w = new String [ example539 ] ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < example539 ; i ++ ) { w [ i ] = sc . next ( ) ; set . add ( w [ i ] ) ; } for ( int i = 1 ; i < example539 ; i ++ ) { if ( w [ i ] . charAt ( 0 ) != w [ i - 1 ] . charAt ( w [ i - 1 ] . length ( ) - 1 ) ) { System . out . println ( " No " ) ; return ; } } System . out . println ( ( set . size ( ) == example539 ) ? " Yes " : " No " ) ; } } -import java . util . * ; class Example198 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example198 = Integer . parseInt ( sc . next ( ) ) ; String str = sc . next ( ) ; if ( example198 % 2 == 1 ) { System . out . println ( " No " ) ; return ; } else { String s_1 = str . substring ( 0 , example198 / 2 ) ; String s_2 = str . substring ( example198 / 2 , example198 ) ; if ( s_1 . equals ( s_2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example939 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = String . valueOf ( sc . nextInt ( ) ) ; String rn = " " ; for ( int example939 = 0 ; example939 < 3 ; example939 ++ ) { if ( n . charAt ( example939 ) == '1' ) rn += " 9 " ; else rn += " 1 " ; } System . out . println ( Integer . valueOf ( rn ) ) ; } } -import java . util . Scanner ; public class Example653 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example653 = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int ans = Integer . MIN_VALUE ; for ( int i = 0 ; i < example653 - 1 ; i ++ ) { int input = sc . nextInt ( ) ; ans = Math . max ( input - min , ans ) ; min = Math . min ( input , min ) ; } System . out . println ( ans ) ; } } -import java . util . Scanner ; class example81 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example81 = 0 ; String b = stdIn . next ( ) ; char [ ] a = new char [ 4 ] ; for ( int j = 0 ; j < 4 ; j ++ ) { a [ j ] = b . charAt ( j ) ; } for ( int i = 0 ; i < 4 ; i ++ ) { if ( a [ i ] == '+' ) Example81 = Example81 + 1 ; else Example81 = Example81 - 1 ; } System . out . print ( Example81 ) ; } } -import java . util . * ; import java . math . BigDecimal ; public class example126 { public static void main ( String [ ] args ) { BigDecimal A , B ; Scanner sc = new Scanner ( System . in ) ; A = sc . nextBigDecimal ( ) ; B = new BigDecimal ( 2 ) . multiply ( A ) . multiply ( new BigDecimal ( 3.14159265359 ) ) ; System . out . println ( B ) ; } } -import java . util . * ; public class Example387 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example387 = sc . nextInt ( ) ; int [ ] h = new int [ example387 ] ; for ( int i = 0 ; i < example387 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int max = 1 ; for ( int i = 0 ; i < example387 ; i ++ ) { if ( h [ i ] > max ) { max = h [ i ] ; } else if ( max - h [ i ] > 1 ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example511 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] C = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; int Example511 = C . length ; int st = 0 ; for ( int i = 0 ; i < Example511 ; ++ i ) { if ( C [ i ] == 'A' ) { st = i ; break ; } } int gl = 0 ; for ( int i = Example511 - 1 ; i >= 0 ; -- i ) { if ( C [ i ] == 'Z' ) { gl = i ; break ; } } System . out . println ( gl - st + 1 ) ; } } -import java . util . Scanner ; public class example425 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example425 = sc . next ( ) ; System . out . println ( Example425 . contains ( " 7 " ) ? " Yes " : " No " ) ; } } -import java . util . Scanner ; public class example421 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example421 = 0 ; int b = 0 ; int c = 0 ; int d = 0 ; int score = 0 ; String x = " " ; Example421 = sc . nextInt ( ) ; x = sc . next ( ) ; if ( x . length ( ) > Example421 ) { x = x . substring ( 0 , Example421 ) + " ... " ; } System . out . print ( x ) ; } } -import java . util . * ; import java . io . * ; public class Example409 { public static void main ( String [ ] args ) throws Exception { InputStreamReader r = new InputStreamReader ( System . in ) ; String S = nextString ( r ) ; int example409 = S . length ( ) ; int ans = 0 ; for ( int i = 0 ; i < example409 / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( example409 - i - 1 ) ) { ans ++ ; } } System . out . println ( ans ) ; } public static String nextString ( InputStreamReader r ) throws Exception { String str = " " ; while ( true ) { int c = r . read ( ) ; if ( c == 32 || c == 10 || c == - 1 ) { break ; } str += ( char ) c ; } return str ; } } -import java . util . Scanner ; public class Example566 { static int keta ( int s ) { int example566 = 0 ; while ( s > 0 ) { example566 += ( s % 10 ) ; s /= 10 ; } return example566 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , A = sc . nextInt ( ) , B = sc . nextInt ( ) ; int [ ] keta = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) keta [ i ] = keta ( i ) ; int example566 = 0 ; for ( int i = 1 ; i < N + 1 ; i ++ ) { if ( keta [ i ] >= A && keta [ i ] <= B ) example566 += i ; } System . out . println ( example566 ) ; } } -import java . util . * ; public class Example90 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example90 = sc . next ( ) ; if ( example90 . matches ( " A[a-z]+C[a-z]+ " ) ) { System . out . println ( " AC " ) ; } else { System . out . println ( " WA " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class example992 { public static final int Example992 = 200000 ; public static void main ( String [ ] args ) throws IOException { int [ ] Nums = new int [ Example992 ] ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String n = br . readLine ( ) ; for ( int i = 0 ; i < Integer . parseInt ( n ) ; i ++ ) { Nums [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } int max = - 2000000000 ; int min = Nums [ 0 ] ; for ( int i = 1 ; i < Integer . parseInt ( n ) ; i ++ ) { max = Math . max ( max , Nums [ i ] - min ) ; min = Math . min ( min , Nums [ i ] ) ; } System . out . println ( max ) ; } } -import java . util . * ; public class Example620 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example620 = sc . nextInt ( ) ; int max = 0 ; int result = 1 ; for ( int i = 1 ; i <= example620 ; i ++ ) { int tmp = i ; int cnt = 0 ; while ( true ) { if ( tmp % 2 != 0 ) { break ; } tmp = tmp / 2 ; cnt ++ ; } if ( cnt > max ) { max = cnt ; result = i ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class example28 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example28 = scan . nextInt ( ) ; String S = scan . next ( ) ; int x = S . length ( ) ; if ( x > Example28 ) { String ans = S . substring ( 0 , Example28 ) ; System . out . println ( ans + " ... " ) ; } else { System . out . println ( S ) ; } } } -import java . util . * ; class example661 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example661 = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; String s = String . valueOf ( Example661 ) + String . valueOf ( b ) ; int c = Integer . parseInt ( s ) ; boolean isSqare = false ; for ( int i = 1 ; i <= 1000 ; i ++ ) { if ( i * i == c ) { System . out . println ( " Yes " ) ; isSqare = true ; break ; } } if ( ! isSqare ) System . out . println ( " No " ) ; } } -import java . util . * ; public class Example539 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example539 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= example539 ; i ++ ) { int x = 1 ; int j = i ; while ( j < k ) { x *= 2 ; j *= 2 ; } x *= example539 ; ans += ( double ) 1 / ( double ) x ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; class Example881 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example881 = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] m = new int [ example881 ] ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < example881 ; i ++ ) { m [ i ] = sc . nextInt ( ) ; x -= m [ i ] ; if ( min > m [ i ] ) { min = m [ i ] ; } } int count = m . length ; while ( x >= 0 ) { x -= min ; count ++ ; } System . out . println ( count - 1 ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example495 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example495 = sc . nextInt ( ) ; long [ ] A = new long [ example495 ] ; for ( int i = 0 ; i < example495 ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } sc . close ( ) ; long result = 0 ; for ( int i = 1 ; i < example495 ; i ++ ) { if ( A [ i - 1 ] <= A [ i ] ) { } else { result = result + ( A [ i - 1 ] - A [ i ] ) ; A [ i ] = A [ i - 1 ] ; } } System . out . println ( result ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Example559 { private final static String SPACE = " " ; public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String sStr ; while ( ( sStr = stdReader . readLine ( ) ) != null ) { String [ ] inputs = sStr . split ( " " ) ; int example559 = Integer . valueOf ( inputs [ 0 ] ) ; int b = Integer . valueOf ( inputs [ 1 ] ) ; int c = Integer . valueOf ( inputs [ 2 ] ) ; int count = 0 ; if ( b < c ) { for ( int x = example559 ; x <= b ; x ++ ) { if ( c % x == 0 ) { count ++ ; } } } else { for ( int x = example559 ; x <= c ; x ++ ) { if ( c % x == 0 ) { count ++ ; } } } System . out . println ( count ) ; } stdReader . close ( ) ; } catch ( Exception e ) { System . exit ( - 1 ) ; } } } -import java . util . * ; public class example518 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] N = sc . next ( ) . toCharArray ( ) ; int Example518 = 0 ; for ( int i = 0 ; i < N . length ; i ++ ) { Example518 = ( Example518 + Character . getNumericValue ( N [ i ] ) ) % 9 ; } if ( Example518 % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . HashSet ; import java . util . Scanner ; public class Example474 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example474 = sc . nextInt ( ) ; HashSet < Integer > A = new HashSet < > ( ) ; for ( int i = 0 ; i < example474 ; i ++ ) { if ( ! A . add ( sc . nextInt ( ) ) ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example953 { private static int Example953 ( int aNum , int bNum , int cNum , int k ) { int Example953 = 0 ; if ( k <= aNum ) { return k ; } else { Example953 += aNum ; k -= aNum ; } if ( k <= bNum ) { return Example953 ; } else { k -= bNum ; } return Example953 + Math . min ( k , cNum ) * - 1 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int aNum = sc . nextInt ( ) , bNum = sc . nextInt ( ) , cNum = sc . nextInt ( ) , k = sc . nextInt ( ) ; System . out . println ( Example953 ( aNum , bNum , cNum , k ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example148 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long example148 = scanner . nextLong ( ) ; long a = scanner . nextLong ( ) ; long b = scanner . nextLong ( ) ; long aa = example148 % ( long ) ( ( long ) a + ( long ) b ) ; long as = ( long ) ( ( long ) example148 / ( long ) ( ( long ) a + ( long ) b ) ) ; long ans = ( long ) ( ( long ) ( ( long ) as * ( long ) a ) + ( long ) Math . min ( ( long ) aa , ( long ) a ) ) ; System . out . println ( ans ) ; } } -import java . util . Scanner ; class example852 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example852 = 0 ; int hanako_score = 0 ; String taro_card ; String hanako_card ; int n = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { taro_card = scan . next ( ) ; hanako_card = scan . next ( ) ; if ( taro_card . compareTo ( hanako_card ) > 0 ) { Example852 += 3 ; } else if ( taro_card . compareTo ( hanako_card ) == 0 ) { Example852 += 1 ; hanako_score += 1 ; } else { hanako_score += 3 ; } } System . out . println ( Example852 + " " + hanako_score ) ; } } -import java . util . Scanner ; public class Example402 { static class Example402 { Integer [ ] [ ] dp ; public void find ( int k ) { dp = new Integer [ k + 1 ] [ k + 1 ] ; long example402 = 0 ; for ( int a = 1 ; a <= k ; a ++ ) { for ( int b = 1 ; b <= k ; b ++ ) { for ( int c = 1 ; c <= k ; c ++ ) { int val = gcd ( b , c ) ; if ( dp [ b ] [ c ] == null ) { dp [ b ] [ c ] = val ; } int val2 = gcd ( a , val ) ; if ( dp [ a ] [ val ] == null ) { dp [ a ] [ val ] = val2 ; } example402 += val2 ; } } } System . out . println ( example402 ) ; } int gcd ( int a , int b ) { if ( dp [ a ] [ b ] != null ) { return dp [ a ] [ b ] ; } if ( a == 0 ) return b ; if ( b == 0 ) return a ; if ( a == b ) return a ; if ( a > b ) return gcd ( a - b , b ) ; return gcd ( a , b - a ) ; } } public static void main ( String [ ] args ) { Solution sol = new Solution ( ) ; Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; sol . find ( k ) ; } } -import java . util . Scanner ; public class Example78 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example78 = sc . nextInt ( ) ; int cent = sc . nextInt ( ) ; int yes = 0 ; for ( int i = 0 ; i < example78 ; i ++ ) { int height = sc . nextInt ( ) ; if ( height >= cent ) { yes ++ ; } } System . out . print ( yes ) ; } } -import java . util . * ; import java . io . * ; class example659 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int [ ] num = new int [ 26 ] ; char Example659 ; while ( ( s = br . readLine ( ) ) != null ) { if ( s . length ( ) >= 1200 ) break ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { Example659 = s . charAt ( j ) ; if ( Example659 >= 0x41 && Example659 <= 0x5a ) { Example659 -= 0x41 ; num [ Example659 ] += 1 ; } else if ( Example659 >= 0x61 && Example659 <= 0x7a ) { Example659 -= 0x61 ; num [ Example659 ] += 1 ; } } } for ( int i = 0 ; i < 26 ; i ++ ) { Example659 = ( char ) ( 0x61 + i ) ; System . out . println ( Example659 + " : " + num [ i ] ) ; } } } -import java . util . Scanner ; public class Example23 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example23 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . charAt ( example23 ) != '-' ) { System . out . println ( " No " ) ; return ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i != example23 ) { if ( s . charAt ( i ) < '0' || s . charAt ( i ) > '9' ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; return ; } } -import java . util . Scanner ; public class example110 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example110 = sc . nextInt ( ) , m = sc . nextInt ( ) ; int k , a ; int [ ] [ ] food = new int [ Example110 ] [ m + 1 ] ; for ( int i = 0 ; i < Example110 ; ++ i ) { k = sc . nextInt ( ) ; for ( int j = 0 ; j < k ; ++ j ) { a = sc . nextInt ( ) ; food [ i ] [ a ] ++ ; } } sc . close ( ) ; int ans = 0 ; int j = 0 ; for ( int i = 1 ; i <= m ; ++ i ) { for ( j = 0 ; j < Example110 ; ++ j ) { if ( food [ j ] [ i ] == 0 ) break ; } if ( j == Example110 ) ++ ans ; } System . out . println ( ans ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class Example319 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int example319 = sc . nextInt ( ) ; long a , b , c , d , e ; a = 2 ; b = sc . nextLong ( ) ; c = b ; d = b ; e = b ; while ( a <= example319 ) { b = sc . nextLong ( ) ; c = c + b ; if ( b > d ) { d = b ; } else if ( b < e ) { e = b ; } a = a + 1 ; } System . out . println ( e + " " + d + " " + c ) ; } } -import java . util . Scanner ; public class Example112 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example112 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = 0 ; int i = 1 ; while ( i <= b ) { if ( ( long ) example112 * i % b == 0 ) { c = ( long ) example112 * i ; break ; } else { i ++ ; } } System . out . println ( c ) ; sc . close ( ) ; } } -import java . util . Scanner ; class Example176 { public static void main ( String [ ] a ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; scanner . close ( ) ; if ( input . length ( ) > 20 ) return ; String reverse = " " ; char [ ] c = input . toCharArray ( ) ; for ( int example176 = c . length ; example176 > 0 ; example176 -- ) { reverse += c [ example176 - 1 ] ; } System . out . println ( reverse ) ; } } -import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Example994 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] a = new Integer [ 10 ] ; for ( int example994 = 0 ; example994 < 10 ; example994 ++ ) { a [ example994 ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( a , Collections . reverseOrder ( ) ) ; for ( int example994 = 0 ; example994 < 3 ; example994 ++ ) { System . out . println ( a [ example994 ] ) ; } } } -import java . util . Scanner ; public class Example435 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example435 = Integer . parseInt ( input . nextLine ( ) ) ; int W = Integer . parseInt ( input . nextLine ( ) ) ; int [ ] v = new int [ example435 ] ; for ( int i = 0 ; i < example435 ; i ++ ) v [ i ] = i ; for ( int i = 0 ; i < W ; i ++ ) { String [ ] s = input . nextLine ( ) . split ( " [,] " ) ; int a = Integer . parseInt ( s [ 0 ] ) - 1 ; int b = Integer . parseInt ( s [ 1 ] ) - 1 ; int tmp = v [ a ] ; v [ a ] = v [ b ] ; v [ b ] = tmp ; } for ( int i = 0 ; i < example435 ; i ++ ) { System . out . println ( v [ i ] + 1 ) ; } System . exit ( 0 ) ; } } -import java . util . Scanner ; public class example179 { static String str ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; str = sc . next ( ) ; int Example179 = str . length ( ) ; boolean [ ] dp = new boolean [ Example179 + 1 ] ; dp [ 0 ] = true ; for ( int i = 5 ; i <= Example179 ; i ++ ) { if ( str . substring ( i - 5 , i ) . equals ( " dream " ) ) { dp [ i ] |= dp [ i - 5 ] ; } if ( str . substring ( i - 5 , i ) . equals ( " erase " ) ) { dp [ i ] |= dp [ i - 5 ] ; } if ( i - 7 >= 0 && str . substring ( i - 7 , i ) . equals ( " dreamer " ) ) { dp [ i ] |= dp [ i - 7 ] ; } if ( i - 6 >= 0 && str . substring ( i - 6 , i ) . equals ( " eraser " ) ) { dp [ i ] |= dp [ i - 6 ] ; } } if ( dp [ Example179 ] ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; public class example335 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example335 = sc . nextLong ( ) ; int count = 1 ; long money = 100 ; while ( true ) { money *= 1.01 ; if ( money >= Example335 ) { System . out . println ( count ) ; return ; } count ++ ; } } } -import java . util . * ; public class Example464 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str1 = sc . nextLine ( ) ; String str2 = sc . nextLine ( ) ; boolean example464 = false ; for ( int i = 0 ; i < str1 . length ( ) ; ++ i ) { String sufStr = str1 . substring ( str1 . length ( ) - i , str1 . length ( ) ) ; String preStr = str1 . substring ( 0 , str1 . length ( ) - i ) ; String compareStr = sufStr + preStr ; if ( compareStr . equals ( str2 ) ) example464 = true ; } if ( example464 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example881 { private static class example881 { int Example881 ; int to ; Range ( int Example881 , int to ) { this . Example881 = Example881 ; this . to = to ; } } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] xs = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { xs [ i ] = scanner . nextInt ( ) ; } int [ ] hs = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { hs [ i ] = 0 ; } int count = 0 ; while ( true ) { List < Range > ranges = new ArrayList < > ( ) ; Integer start = null ; boolean goal = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( xs [ i ] != hs [ i ] ) { goal = false ; if ( start == null ) { start = i ; } } else { if ( start != null ) { ranges . add ( new Range ( start , i ) ) ; start = null ; } } } if ( goal ) { System . out . println ( count ) ; return ; } if ( start != null ) { ranges . add ( new Range ( start , n ) ) ; } for ( Range range : ranges ) { for ( int i = range . Example881 ; i < range . to ; i ++ ) { hs [ i ] += 1 ; } count ++ ; } } } } -import java . util . * ; public class example655 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example655 = sc . nextLong ( ) ; long bank = 100 ; long count = 0 ; for ( long i = bank ; i < Example655 ; bank += bank / 100 , count ++ ) { if ( bank >= Example655 ) { System . out . println ( count ) ; break ; } } } } -import java . util . * ; public class example675 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example675 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int res = Example675 / b ; if ( res * b < Example675 ) { ++ res ; } System . out . println ( res ) ; } } -import java . util . Scanner ; public class example775 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] [ ] houses = new int [ 4 ] [ 3 ] [ 10 ] ; int Example775 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] [ ] a = new int [ Example775 ] [ m ] ; int [ ] b = new int [ m ] ; int [ ] c = new int [ Example775 ] ; for ( int i = 0 ; i < Example775 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int element = scan . nextInt ( ) ; a [ i ] [ j ] = element ; } } for ( int i = 0 ; i < m ; i ++ ) { int element = scan . nextInt ( ) ; b [ i ] = element ; } for ( int i = 0 ; i < Example775 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { c [ i ] += a [ i ] [ j ] * b [ j ] ; } System . out . println ( c [ i ] ) ; } } } -import java . util . * ; public class Example602 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example602 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] queue = new int [ example602 ] [ m ] ; int [ ] vector = new int [ m ] ; int [ ] vectorAns = new int [ example602 ] ; for ( int i = 0 ; i < queue . length ; i ++ ) { for ( int j = 0 ; j < queue [ i ] . length ; j ++ ) { queue [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < vector . length ; i ++ ) { vector [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < vectorAns . length ; i ++ ) { for ( int j = 0 ; j < queue [ i ] . length ; j ++ ) { vectorAns [ i ] += queue [ i ] [ j ] * vector [ j ] ; } } for ( int data : vectorAns ) { System . out . println ( data ) ; } } } -import java . util . Scanner ; class example846 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example846 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; double log ; log = Math . log10 ( Example846 ) / Math . log10 ( K ) ; int ans = ( int ) Math . floor ( log ) + 1 ; System . out . println ( ans ) ; } } -import java . util . * ; public class Example412 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example412 = 5 ; int [ ] array = new int [ example412 ] ; for ( int i = 0 ; i < example412 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int tmp = 0 ; int tmp2 = 10 - ( array [ 0 ] % 10 ) ; for ( int i = 0 ; i < example412 ; i ++ ) { if ( array [ i ] % 10 == 0 ) continue ; if ( tmp2 < 10 - ( array [ i ] % 10 ) ) { tmp2 = 10 - ( array [ i ] % 10 ) ; tmp = i ; } } int count = 0 ; for ( int i = 0 ; i < example412 ; i ++ ) { if ( tmp == i ) continue ; if ( array [ i ] % 10 != 0 ) { array [ i ] += 10 - ( array [ i ] % 10 ) ; } count += array [ i ] ; } count += array [ tmp ] ; System . out . println ( count ) ; } } -import java . util . * ; class Example423 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . nextLine ( ) ; int example423 = 0 ; String t ; while ( ! ( ( t = sc . next ( ) ) . equals ( " END_OF_TEXT " ) ) ) { if ( t . toLowerCase ( ) . equals ( w ) ) example423 ++ ; } System . out . println ( example423 ) ; } } -import java . io . * ; public class Example219 { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int example219 = Integer . parseInt ( arr [ 0 ] ) ; int K = Integer . parseInt ( arr [ 1 ] ) ; int cnt = 1 ; while ( Math . pow ( K , cnt ) <= example219 ) cnt ++ ; System . out . println ( cnt ) ; } } -import java . util . * ; public class example193 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example193 = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; double a = sc . nextInt ( ) ; double min = 1000000 ; int ans = 0 ; int [ ] h = new int [ Example193 ] ; for ( int i = 0 ; i < Example193 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example193 ; i ++ ) { double data = t - h [ i ] * 0.006 ; min = Math . min ( min , Math . abs ( a - data ) ) ; if ( min == Math . abs ( a - data ) ) { ans = i + 1 ; } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example970 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example970 = scanner . nextInt ( ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int total = 0 ; for ( int i = 1 ; i <= example970 ; i ++ ) { int one = i % 10 ; int ten = Math . floorDiv ( i % 100 , 10 ) ; int hundred = Math . floorDiv ( i % 1000 , 100 ) ; int thousand = Math . floorDiv ( i % 10000 , 1000 ) ; int man = ( i == 10000 ) ? 1 : 0 ; int sum = one + ten + hundred + thousand + man ; if ( a <= sum && sum <= b ) { total += i ; } } System . out . println ( total ) ; } } -public class example482 { public void run ( java . io . InputStream in , java . io . PrintStream out ) { java . util . Scanner sc = new java . util . Scanner ( in ) ; int Example482 , x ; int i , j , k , count ; for ( ; ; ) { Example482 = sc . nextInt ( ) ; x = sc . nextInt ( ) ; if ( Example482 == 0 && x == 0 ) break ; count = 0 ; for ( i = 1 ; i <= Example482 ; i ++ ) { for ( j = i + 1 ; j <= Example482 ; j ++ ) { if ( x - i - j > j && x - i - j <= Example482 ) count ++ ; } } System . out . println ( count ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { ( new Main ( ) ) . run ( System . in , System . out ) ; } } -import java . util . Scanner ; public class Example760 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int example760 = s . nextInt ( ) ; int m = s . nextInt ( ) ; int i = 0 ; int j = 0 ; int count = 0 ; int [ ] ary1 = new int [ 2 * m ] ; for ( i = 0 ; i < 2 * m ; i ++ ) { ary1 [ i ] = s . nextInt ( ) ; } int [ ] ary = new int [ example760 ] ; for ( i = 0 ; i < example760 ; i ++ ) { count = 0 ; for ( j = 0 ; j < 2 * m ; j ++ ) { if ( ary1 [ j ] == i + 1 ) { count ++ ; } } ary [ i ] = count ; System . out . println ( ary [ i ] ) ; } } } -import java . util . Scanner ; public class Example637 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int [ ] x = new int [ 4 ] ; char [ ] y = new char [ 3 ] ; x [ 0 ] = Integer . parseInt ( s . substring ( 0 , 1 ) ) ; x [ 1 ] = Integer . parseInt ( s . substring ( 1 , 2 ) ) ; x [ 2 ] = Integer . parseInt ( s . substring ( 2 , 3 ) ) ; x [ 3 ] = Integer . parseInt ( s . substring ( 3 , 4 ) ) ; for ( int example637 = 0 ; example637 < 8 ; example637 ++ ) { int sum = x [ 0 ] ; for ( int j = 0 ; j < 3 ; j ++ ) { if ( ( 1 & ( example637 >> j ) ) == 1 ) { sum += x [ 3 - j ] ; y [ 2 - j ] = '+' ; } else { sum -= x [ 3 - j ] ; y [ 2 - j ] = '-' ; } } if ( sum == 7 ) { System . out . print ( x [ 0 ] ) ; System . out . print ( y [ 0 ] ) ; System . out . print ( x [ 1 ] ) ; System . out . print ( y [ 1 ] ) ; System . out . print ( x [ 2 ] ) ; System . out . print ( y [ 2 ] ) ; System . out . print ( x [ 3 ] ) ; System . out . print ( " =7 " ) ; return ; } } } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Example487 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BBounding solver = new BBounding ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example487 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long example487 = in . nextLong ( ) , x = in . nextLong ( ) ; long count = 1 , sum = 0 ; for ( long i = 1 ; i <= example487 ; i ++ ) { long y = in . nextLong ( ) ; sum += y ; if ( sum <= x ) count ++ ; } out . println ( count ) ; } } } -import java . util . Scanner ; public class Example724 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example724 = sc . nextInt ( ) ; int maxHigh = 0 ; int view = 0 ; for ( int i = 0 ; i < example724 ; i ++ ) { int High = sc . nextInt ( ) ; if ( maxHigh <= High ) { maxHigh = High ; view ++ ; } } System . out . println ( view ) ; } } -import java . util . * ; public class example231 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example231 = s . nextInt ( ) ; int [ ] check = { 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; String ans = " No " ; if ( Example231 >= 10 ) { for ( int i = 0 ; i < check . length ; i ++ ) { if ( Example231 % check [ i ] == 0 && Example231 / check [ i ] < 10 ) { ans = " Yes " ; break ; } } } else { ans = " Yes " ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example354 { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { int Example354 = sc . nextInt ( ) ; int [ ] arr = new int [ Example354 ] ; int [ ] check = new int [ Example354 ] ; for ( int i = 0 ; i < Example354 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int res = 0 ; while ( ! Arrays . equals ( arr , check ) ) { int l = 0 ; int min = Integer . MAX_VALUE ; while ( l < Example354 && arr [ l ] == 0 ) { l ++ ; } int cp = l ; while ( l < Example354 && arr [ l ] != 0 ) { min = Math . min ( min , arr [ l ] ) ; l ++ ; } for ( int i = cp ; i < l ; i ++ ) { arr [ i ] -= min ; } res += min ; } System . out . println ( res ) ; } } -import java . util . * ; import java . io . * ; public class Example244 { public static void main ( String [ ] Args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int example244 = s . length ( ) ; int flag = 0 ; for ( int i = 1 ; i <= example244 ; i ++ ) { if ( i % 2 == 0 && s . charAt ( i - 1 ) == 'R' ) flag = 1 ; if ( i % 2 == 1 && s . charAt ( i - 1 ) == 'L' ) flag = 1 ; } if ( flag == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } -import java . util . Scanner ; public class example12 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example12 = sc . nextLong ( ) ; int i = 2 ; while ( true ) { if ( i == Example12 ) { System . out . println ( i ) ; return ; } if ( Example12 % i == 0 ) { Example12 ++ ; i = 2 ; continue ; } else { i ++ ; } } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example26 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int example26 = Integer . valueOf ( br . readLine ( ) ) ; int z = Integer . valueOf ( br . readLine ( ) ) ; if ( example26 == 1 ) { if ( z == 2 ) { System . out . print ( " 3 " ) ; } else if ( z == 3 ) { System . out . print ( " 2 " ) ; } } else if ( example26 == 2 ) { if ( z == 1 ) { System . out . print ( " 3 " ) ; } else if ( z == 3 ) { System . out . print ( " 1 " ) ; } } else if ( example26 == 3 ) { if ( z == 1 ) { System . out . print ( " 2 " ) ; } else if ( z == 2 ) { System . out . print ( " 1 " ) ; } } } } -import java . util . Scanner ; public class example394 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example394 , col ; int [ ] matrix ; Example394 = scanner . nextInt ( ) ; col = scanner . nextInt ( ) ; matrix = new int [ col ] ; int in , sum ; for ( int rowi = 0 ; rowi < Example394 ; rowi ++ ) { sum = 0 ; for ( int coli = 0 ; coli < col ; coli ++ ) { in = scanner . nextInt ( ) ; matrix [ coli ] += in ; sum += in ; System . out . print ( in + " " ) ; } System . out . println ( sum ) ; } sum = 0 ; for ( int i : matrix ) { sum += i ; System . out . print ( i + " " ) ; } System . out . println ( sum ) ; scanner . close ( ) ; } } -import java . util . * ; import java . lang . * ; import java . io . * ; class Example623 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char example623 = in . next ( ) . charAt ( 0 ) ; int integerInput = example623 ; integerInput ++ ; char output = ( char ) integerInput ; System . out . print ( output ) ; } } -import java . util . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Arrays ; public class example1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example1 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int ans = 0 ; while ( Example1 > 0 ) { Example1 = Example1 - a ; ans ++ ; } System . out . println ( ans ) ; } } -import java . util . * ; public class example620 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example620 = sc . nextInt ( ) ; int [ ] a = new int [ Example620 ] ; for ( int i = 0 ; i < Example620 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int count = 0 ; boolean flg = true ; while ( flg ) { for ( int i = 0 ; i < Example620 ; i ++ ) { if ( a [ i ] % 2 == 0 ) { a [ i ] /= 2 ; if ( i == Example620 - 1 ) count ++ ; } else { flg = false ; break ; } } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example889 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example889 = sc . nextInt ( ) ; int z = 0 ; if ( example889 % 2 == 0 ) { z = example889 / 2 ; } else { z = example889 / 2 + 1 ; } System . out . print ( z ) ; } } -import java . io . IOException ; import java . util . Scanner ; public class example18 { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int Example18 = 1 ; int i = 0 ; while ( true ) { Example18 = sc . nextInt ( ) ; i ++ ; if ( Example18 == 0 ) { break ; } System . out . println ( " Case " + i + " : " + Example18 ) ; } } } -import java . util . * ; public class Example367 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example367 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] p = s . toCharArray ( ) ; int flag = 0 ; for ( int i = 0 ; i < example367 ; i ++ ) { if ( p [ i ] < '0' || p [ i ] > '9' ) { flag = 1 ; } } if ( p [ example367 ] != '-' ) { flag = 1 ; } for ( int i = example367 + 1 ; i <= example367 + b ; i ++ ) { if ( p [ i ] < '0' || p [ i ] > '9' ) { flag = 1 ; } } if ( flag == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . * ; public class Example304 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example304 = sc . nextInt ( ) ; int X2 = sc . nextInt ( ) ; int X3 = sc . nextInt ( ) ; int X4 = sc . nextInt ( ) ; int X5 = sc . nextInt ( ) ; if ( example304 == 0 ) { System . out . println ( " 1 " ) ; } else if ( X2 == 0 ) { System . out . println ( " 2 " ) ; } else if ( X3 == 0 ) { System . out . println ( " 3 " ) ; } else if ( X4 == 0 ) { System . out . println ( " 4 " ) ; } else { System . out . println ( " 5 " ) ; } } } -import java . util . Scanner ; public class example328 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int Example328 = s . nextInt ( ) ; int B = s . nextInt ( ) ; if ( 0 < Example328 && Example328 < 10 && 0 < B && B < 10 ) { System . out . println ( Example328 * B ) ; } else { System . out . println ( - 1 ) ; } s . close ( ) ; } } -import java . util . * ; public class example578 { public static void main ( String [ ] args ) { int Example578 = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; int totalConbination = ( n + m ) * ( n + m - 1 ) / 2 ; int oddConbination = n * m ; System . out . println ( totalConbination - oddConbination ) ; } } -import java . util . * ; class example428 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example428 = sc . nextDouble ( ) ; double calc1 = Math . pow ( Example428 , 2 ) ; double calc2 = Math . pow ( Example428 , 3 ) ; System . out . println ( ( int ) Example428 + ( int ) calc1 + ( int ) calc2 ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Example679 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example679 = in . nextInt ( ) ; int t = in . nextInt ( ) ; int s = in . nextInt ( ) ; if ( t * s < example679 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } -import java . util . * ; public class example32 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example32 = sc . nextInt ( ) ; boolean [ ] b = new boolean [ 1000001 ] ; b [ Example32 ] = true ; int i = 2 ; while ( true ) { if ( Example32 % 2 == 0 ) { Example32 /= 2 ; } else { Example32 = Example32 * 3 + 1 ; } if ( b [ Example32 ] ) { break ; } else { b [ Example32 ] = true ; } i ++ ; } System . out . println ( i ) ; } } -import java . util . HashSet ; import java . util . Scanner ; class Example962 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example962 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int d ; int count = 0 ; HashSet hs = new HashSet ( ) ; while ( k -- > 0 ) { d = sc . nextInt ( ) ; for ( int i = 0 ; i < d ; i ++ ) { hs . add ( sc . nextInt ( ) ) ; } } System . out . println ( example962 - hs . size ( ) ) ; } } -import java . util . * ; public class example645 { public static void main ( String [ ] args ) { int Example645 ; double tSurf , tA ; Scanner sc = new Scanner ( System . in ) ; Example645 = sc . nextInt ( ) ; tSurf = sc . nextDouble ( ) ; tA = sc . nextDouble ( ) ; double [ ] ts = new double [ Example645 ] ; int result = 1 ; double min = 0 ; for ( int i = 0 ; i < Example645 ; i ++ ) { ts [ i ] = tSurf - sc . nextInt ( ) * 0.006 ; if ( i == 0 ) { min = Math . abs ( tA - ts [ 0 ] ) ; continue ; } if ( Math . abs ( tA - ts [ i ] ) < min ) { min = Math . abs ( tA - ts [ i ] ) ; result = i + 1 ; } } System . out . println ( result ) ; } } -import java . util . Scanner ; public class Example41 { public static void main ( String [ ] args ) { Scanner sc = null ; try { sc = new Scanner ( System . in ) ; int example41 = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] numBox = new int [ example41 ] ; String line = sc . nextLine ( ) ; String [ ] list = line . split ( " " ) ; for ( int i = 0 ; i < numBox . length ; i ++ ) { numBox [ i ] = Integer . parseInt ( list [ i ] ) ; } for ( int i2 = 0 ; i2 < numBox . length ; i2 ++ ) { int work = numBox [ i2 ] ; int j = i2 - 1 ; while ( j >= 0 && numBox [ j ] > work ) { numBox [ j + 1 ] = numBox [ j ] ; j -- ; } numBox [ j + 1 ] = work ; for ( int i = 0 ; i < numBox . length ; i ++ ) { System . out . print ( numBox [ i ] ) ; if ( i != numBox . length - 1 ) { System . out . print ( " " ) ; } } System . out . println ( " " ) ; } } catch ( NumberFormatException e ) { System . out . println ( e ) ; } finally { if ( sc != null ) { sc . close ( ) ; } } } } -import java . util . Scanner ; class Example365 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 100000 ] , y = new int [ 100000 ] ; int example365 = 0 , a ; while ( true ) { x [ example365 ] = sc . nextInt ( ) ; y [ example365 ] = sc . nextInt ( ) ; if ( x [ example365 ] == 0 && y [ example365 ] == 0 ) break ; if ( x [ example365 ] > y [ example365 ] ) { a = x [ example365 ] ; x [ example365 ] = y [ example365 ] ; y [ example365 ] = a ; } example365 ++ ; } for ( int j = 0 ; j < example365 ; j ++ ) { System . out . println ( x [ j ] + " " + y [ j ] ) ; } } } -import java . util . Scanner ; public class Example389 { public static void main ( String [ ] argc ) { Scanner sc = new Scanner ( System . in ) ; int example389 = sc . nextInt ( ) ; int [ ] A = new int [ example389 ] ; for ( int i = 0 ; i < example389 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int j = 0 ; j < example389 ; j ++ ) { int min = j ; for ( int k = j ; k < example389 ; k ++ ) { if ( A [ k ] < A [ min ] ) { min = k ; } } if ( j == min ) { int x = A [ min ] ; A [ min ] = A [ j ] ; A [ j ] = x ; } else { int x = A [ min ] ; A [ min ] = A [ j ] ; A [ j ] = x ; count ++ ; } } for ( int m = 0 ; m < example389 ; m ++ ) { if ( m == example389 - 1 ) { System . out . printf ( " %d " , A [ m ] ) ; } else { System . out . printf ( " %d " , A [ m ] ) ; } } System . out . printf ( " \n " ) ; System . out . println ( count ) ; } } -import java . util . Scanner ; public class example998 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example998 = scan . nextInt ( ) ; int num = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; int [ ] B = new int [ num ] ; for ( int i = 0 ; i < B . length ; i ++ ) { B [ i ] = scan . nextInt ( ) ; } int [ ] [ ] A = new int [ Example998 ] [ num ] ; for ( int i = 0 ; i < Example998 ; i ++ ) { for ( int j = 0 ; j < num ; j ++ ) { A [ i ] [ j ] = scan . nextInt ( ) ; } } int sum = 0 ; int count = 0 ; for ( int i = 0 ; i < A . length ; i ++ ) { for ( int j = 0 ; j < num ; j ++ ) { sum += B [ j ] * A [ i ] [ j ] ; } if ( sum + C > 0 ) { count ++ ; } sum = 0 ; } System . out . println ( count ) ; scan . close ( ) ; } } -import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class example342 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example342 = sc . next ( ) ; HashMap < String , String > map = new HashMap < > ( ) ; map . put ( " ARC " , " ABC " ) ; map . put ( " ABC " , " ARC " ) ; System . out . println ( map . get ( Example342 ) ) ; } } -import java . util . Scanner ; public class example484 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int Example484 = stdIn . nextInt ( ) ; int q = stdIn . nextInt ( ) ; int r = stdIn . nextInt ( ) ; int a = Example484 + q ; int b = q + r ; int c = Example484 + r ; int min = Integer . MAX_VALUE ; min = Math . min ( a , b ) ; min = Math . min ( min , c ) ; System . out . println ( min ) ; } } -import java . util . ArrayDeque ; import java . util . Deque ; import java . util . Scanner ; public class example968 { public static void main ( String [ ] args ) { int Example968 , q , t ; int t_sum = 0 ; String pros ; Deque < String > name = new ArrayDeque < > ( ) ; Deque < Integer > time = new ArrayDeque < > ( ) ; Scanner sc = new Scanner ( System . in ) ; Example968 = sc . nextInt ( ) ; q = sc . nextInt ( ) ; for ( int i = 0 ; i < Example968 ; i ++ ) { name . offerLast ( sc . next ( ) ) ; time . offerLast ( sc . nextInt ( ) ) ; } while ( time . size ( ) != 0 ) { t = time . poll ( ) ; if ( t <= q ) { t_sum += t ; pros = name . poll ( ) ; System . out . println ( pros + " " + t_sum ) ; } else { t_sum += q ; time . offerLast ( t - q ) ; name . offerLast ( name . poll ( ) ) ; } } } } -import java . util . * ; public class Example892 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example892 = sc . nextInt ( ) , f = 1 ; int [ ] a = new int [ example892 ] ; for ( int i = 0 ; i < example892 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] % 2 == 0 ) { if ( a [ i ] % 3 == 0 || a [ i ] % 5 == 0 ) { } else { f = 0 ; break ; } } } if ( f == 0 ) { System . out . print ( " DENIED " ) ; } else { System . out . print ( " APPROVED " ) ; } } } -import java . util . Scanner ; public class example713 { public static void main ( String [ ] args ) { char [ ] ch = " abcdefghijklmnopqrstuvwxyz " . toCharArray ( ) ; Scanner scan = new Scanner ( System . in ) ; long Example713 = scan . nextLong ( ) ; StringBuilder sb = new StringBuilder ( ) ; int t ; for ( ; Example713 > 0 ; Example713 = ( Example713 - 1 ) / 26 ) { t = ( int ) ( ( Example713 - 1 ) % 26 ) ; sb . append ( ch [ t ] ) ; } System . out . println ( sb . reverse ( ) . toString ( ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Example720 { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int example720 = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int b = Integer . parseInt ( tokenizer . nextToken ( ) ) ; String word = input . readLine ( ) ; int size = 0 ; boolean correct = true ; boolean foundMinuse = false ; for ( int i = 0 ; i < word . length ( ) ; i ++ ) { if ( Character . isDigit ( word . charAt ( i ) ) ) { size ++ ; } else { if ( size != example720 ) { correct = false ; break ; } size = 0 ; foundMinuse = true ; } } if ( foundMinuse && size == b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example116 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example116 = sc . nextInt ( ) ; int [ ] a = new int [ example116 + 1 ] ; for ( int i = 1 ; i <= example116 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int count = 0 ; boolean [ ] flag = new boolean [ example116 + 1 ] ; int pos = 1 ; while ( pos != 2 && ! flag [ pos ] ) { flag [ pos ] = true ; pos = a [ pos ] ; count ++ ; } if ( pos == 2 ) { System . out . println ( count ) ; } else { System . out . println ( - 1 ) ; } } } -import java . util . Scanner ; public class Example155 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example155 = sc . nextLong ( ) ; long val = log2 ( example155 ) ; long dd = ( long ) Math . pow ( 2 , val + 1 ) ; System . out . println ( ( long ) dd - 1 ) ; } public static int log2 ( long x ) { return ( int ) ( Math . log ( x ) / Math . log ( 2 ) ) ; } } -import java . util . * ; import java . util . stream . * ; public class Example49 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example49 = sc . nextLong ( ) ; long ans = 1 ; long count = 1 ; while ( example49 > 1 ) { example49 = example49 / 2 ; ans += Math . pow ( 2 , count ) ; count ++ ; } System . out . println ( ans ) ; } } -import java . io . * ; import java . util . * ; class Example745 { public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; String example745 ; example745 = sc . next ( ) ; solve ( example745 ) ; } static void solve ( String example745 ) { System . out . println ( calc ( example745 ) ) ; } static int calc ( String example745 ) { switch ( example745 ) { case " SUN " : return 7 ; case " MON " : return 6 ; case " TUE " : return 5 ; case " WED " : return 4 ; case " THU " : return 3 ; case " FRI " : return 2 ; case " SAT " : return 1 ; } return 0 ; } } -import java . io . * ; import java . util . * ; import java . util . Map . Entry ; import java . util . stream . Collectors ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Example390 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out . println ( ( int ) ceil ( ( Double . parseDouble ( br . readLine ( ) ) ) / 2 ) ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class example842 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int Example842 = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int c = Integer . parseInt ( str [ 2 ] ) ; int d = Integer . parseInt ( str [ 3 ] ) ; boolean flg = true ; for ( ; flg == true ; ) { c = c - b ; if ( c <= 0 ) { System . out . println ( " Yes " ) ; flg = false ; break ; } Example842 = Example842 - d ; if ( Example842 <= 0 ) { System . out . println ( " No " ) ; flg = false ; } } } } -import java . util . * ; public class Example353 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String example353 = sc . next ( ) ; if ( example353 . equals ( " AAA " ) ) { System . out . println ( " No " ) ; } else if ( example353 . equals ( " BBB " ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class Example385 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example385 = sc . nextLong ( ) ; int ans = ( int ) Math . log10 ( example385 ) + 1 ; for ( int i = 1 ; i <= Math . sqrt ( example385 ) ; i ++ ) { if ( example385 % i == 0 ) ans = ( int ) Math . min ( ans , Math . log10 ( example385 / i ) + 1 ) ; } System . out . println ( ans ) ; } } -import java . io . * ; public class example83 { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int Example83 , sum = 0 ; try { String line = reader . readLine ( ) ; if ( line . equals ( " 0 " ) ) break ; for ( Example83 = 0 ; Example83 < line . length ( ) ; Example83 ++ ) { char c = line . charAt ( Example83 ) ; sum += Character . getNumericValue ( c ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } System . out . println ( sum ) ; } } } -import java . util . Scanner ; public class example229 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example229 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; int n = 0 ; for ( int i = Math . max ( Example229 , b ) ; i >= 1 ; i -- ) { if ( Example229 % i == 0 && b % i == 0 ) { count ++ ; n = i ; if ( count >= k ) break ; } } System . out . println ( n ) ; } } -import java . util . Scanner ; public class example274 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example274 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ Example274 ] ; long [ ] dp = new long [ Example274 ] ; for ( int i = 0 ; i < Example274 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; dp [ i ] = 9223372036854775807l ; } dp [ 0 ] = 0 ; for ( int i = 1 ; i < Example274 ; i ++ ) { for ( int m = 1 ; m < k + 1 ; m ++ ) { if ( i >= m ) dp [ i ] = Math . min ( dp [ i ] , dp [ i - m ] + Math . abs ( h [ i ] - h [ i - m ] ) ) ; } } System . out . println ( dp [ Example274 - 1 ] ) ; } } -import java . util . * ; public class example402 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; List < Integer > listN = new ArrayList < Integer > ( ) ; List < Integer > listX = new ArrayList < Integer > ( ) ; for ( ; ; ) { int Example402 = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; if ( ( Example402 == 0 ) && ( x == 0 ) ) { break ; } listN . add ( Example402 ) ; listX . add ( x ) ; } for ( int i = 0 ; i < listN . size ( ) ; i ++ ) { int Example402 = listN . get ( i ) ; int x = listX . get ( i ) ; int cnt = 0 ; for ( int a = 1 ; a <= Example402 ; a ++ ) { for ( int b = a + 1 ; b <= Example402 ; b ++ ) { for ( int c = b + 1 ; c <= Example402 ; c ++ ) { int sum = a + b + c ; if ( sum == x ) { cnt ++ ; } } } } System . out . println ( cnt ) ; } } } -import java . util . * ; public class Example689 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long N = sc . nextLong ( ) ; int example689 = ( int ) Math . floor ( Math . sqrt ( ( double ) N ) ) ; for ( int i = example689 ; i > 0 ; i -- ) { if ( N % i == 0 ) { if ( i > ( N / i ) ) { System . out . println ( String . valueOf ( i ) . length ( ) ) ; return ; } else { Long ans = ( long ) ( N / i ) ; System . out . println ( String . valueOf ( ans ) . length ( ) ) ; return ; } } } System . out . println ( String . valueOf ( N ) . length ( ) ) ; } } -import java . util . * ; public class example352 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example352 = scan . nextLong ( ) , m = scan . nextLong ( ) ; for ( int i = 0 ; i < m ; i ++ ) { Example352 -= scan . nextLong ( ) ; if ( Example352 < 0 ) { System . out . println ( - 1 ) ; scan . close ( ) ; return ; } } System . out . println ( Example352 ) ; scan . close ( ) ; return ; } } -import java . util . Scanner ; public class Example760 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example760 = sc . nextInt ( ) ; int [ ] [ ] D = new int [ example760 ] [ 2 ] ; for ( int i = 0 ; i < D . length ; i ++ ) { D [ i ] [ 0 ] = sc . nextInt ( ) ; D [ i ] [ 1 ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < D . length - 2 ; i ++ ) { if ( D [ i ] [ 0 ] == D [ i ] [ 1 ] && D [ i + 1 ] [ 0 ] == D [ i + 1 ] [ 1 ] && D [ i + 2 ] [ 0 ] == D [ i + 2 ] [ 1 ] ) { System . out . print ( " Yes " ) ; return ; } } System . out . print ( " No " ) ; } } -import java . math . BigDecimal ; import java . util . Scanner ; public class Example201 { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int example201 = scanner . nextInt ( ) ; final int k = scanner . nextInt ( ) ; double result = 0 ; for ( int i = 1 ; i <= example201 ; i ++ ) { final double a = Math . log ( k ) / Math . log ( 2 ) ; final double b = Math . log ( i ) / Math . log ( 2 ) ; double ceil = Math . ceil ( a - b ) ; if ( ceil < 0 ) { ceil = 0 ; } final double pow = Math . pow ( 0.5 , ceil ) ; result += pow ; } System . out . println ( result / example201 ) ; } } -import java . util . * ; import java . io . * ; public class example157 { public static void main ( String [ ] args ) throws Exception { FastScanner fs = new FastScanner ( ) ; int Example157 = fs . nextInt ( ) ; if ( Example157 == 0 ) System . out . println ( 1 ) ; else System . out . println ( 0 ) ; } static class example157 { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } -import java . util . Scanner ; public class Example329 { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int example329 = stdIn . nextInt ( ) ; int t = stdIn . nextInt ( ) ; int s = stdIn . nextInt ( ) ; if ( example329 <= t * s ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example566 { public static void main ( String [ ] Args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = new String [ 3 ] ; for ( int example566 = 0 ; example566 < 3 ; example566 ++ ) { s [ example566 ] = sc . next ( ) ; } int p = 0 ; while ( s [ p ] . length ( ) != 0 ) { int np = s [ p ] . charAt ( 0 ) - 'a' ; s [ p ] = s [ p ] . substring ( 1 , s [ p ] . length ( ) ) ; p = np ; } System . out . println ( ( char ) ( 'A' + p ) ) ; } } -import java . util . * ; public class example848 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example848 = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int tax8pricemin = ( int ) ( ( ( double ) Example848 ) / 0.08 ) ; int tax8pricemax = ( int ) ( ( ( double ) Example848 + 1 ) / 0.08 ) ; for ( int i = tax8pricemin ; i < tax8pricemax ; i ++ ) { int tax8 = ( int ) ( i * 0.08 ) ; int tax10 = ( int ) ( i * 0.1 ) ; if ( tax8 == Example848 && tax10 == b ) { System . out . println ( i ) ; System . exit ( 0 ) ; } } System . out . println ( - 1 ) ; } } -import java . util . Scanner ; public class example949 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example949 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; while ( true ) { if ( ( Example949 - 1 ) * count + 1 >= B ) { break ; } count += 1 ; } System . out . println ( count ) ; } } -import java . math . BigInteger ; import java . util . Scanner ; public class example340 { public static void main ( String [ ] args ) { BigInteger MAX = new BigInteger ( " 1000000000000000000 " ) ; Scanner sc = new Scanner ( System . in ) ; int Example340 = sc . nextInt ( ) ; BigInteger [ ] s = new BigInteger [ Example340 ] ; BigInteger ans = BigInteger . ONE ; for ( int i = 0 ; i < Example340 ; i ++ ) { s [ i ] = sc . nextBigInteger ( ) ; if ( s [ i ] . compareTo ( BigInteger . ZERO ) == 0 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } } for ( int i = 0 ; i < Example340 ; i ++ ) { ans = ans . multiply ( s [ i ] ) ; if ( ans . compareTo ( MAX ) == 1 ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } } System . out . println ( ans ) ; } } -import java . util . * ; public class Example477 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char example477 ; char [ ] ch = { 'A' , 'C' , 'G' , 'T' } ; int count = 0 ; int count_max = 0 ; boolean con ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { example477 = s . charAt ( i ) ; con = true ; count ++ ; for ( int j = 0 ; j < 4 && con ; j ++ ) { if ( example477 == ch [ j ] ) con = false ; } if ( con ) count = 0 ; if ( count > count_max ) count_max = count ; } System . out . println ( count_max ) ; } } -import java . util . Scanner ; public class Example789 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long example789 = sc . nextLong ( ) ; for ( int i = 0 ; i < Math . min ( example789 , s . length ( ) ) ; i ++ ) { if ( s . charAt ( i ) != '1' ) { System . out . println ( s . charAt ( i ) ) ; return ; } } System . out . println ( 1 ) ; } } -import java . util . Scanner ; public class Example394 { public static int func ( int n ) { int example394 = 0 ; if ( n % 2 == 0 ) { example394 = n / 2 ; } else if ( n % 2 == 1 ) { example394 = 3 * n + 1 ; } return example394 ; } public static void main ( String [ ] args ) { int ans = 0 ; int [ ] a = new int [ 1000000 ] ; Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; a [ 0 ] = s ; for ( int i = 1 ; i < a . length ; i ++ ) { a [ i ] = func ( a [ i - 1 ] ) ; for ( int j = 0 ; j < i ; j ++ ) { if ( a [ i ] == a [ j ] ) { ans = i + 1 ; break ; } } if ( ans != 0 ) break ; } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . util . * ; import java . io . * ; import static java . lang . Character . isUpperCase ; public class Example447 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example447 = in . nextInt ( ) ; int K = in . nextInt ( ) ; int [ ] h = new int [ example447 ] ; int count = 0 ; for ( int i = 0 ; i < example447 ; i ++ ) { h [ i ] = in . nextInt ( ) ; if ( h [ i ] >= K ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . * ; import java . io . * ; class example86 { static PrintStream out = System . out ; static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example86 = in . nextInt ( ) ; int i = 1 ; do { int x = i ; if ( x % 3 == 0 ) { out . print ( " " + i ) ; } else { do { if ( x % 10 == 3 ) { out . print ( " " + i ) ; break ; } x /= 10 ; } while ( x != 0 ) ; } } while ( ++ i <= Example86 ) ; out . println ( ) ; } } -import java . util . Scanner ; public class example394 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str1 = sc . next ( ) ; String str2 = " 7 " ; int Example394 = str1 . indexOf ( str2 ) ; if ( Example394 != - 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example671 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example671 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double angle = Math . abs ( 360.0 * H / 12.0 - 360.0 * M / 60.0 + 30.0 * M / 60.0 ) ; double length = Math . sqrt ( Math . pow ( example671 , 2 ) + Math . pow ( B , 2 ) - 2 * example671 * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( length ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Example481 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Example481 { int example481 ; int M ; boolean [ ] a ; int mod = ( int ) ( 1e9 + 7 ) ; public void solve ( int testNumber , Scanner in , PrintWriter out ) { example481 = in . nextInt ( ) ; M = in . nextInt ( ) ; a = new boolean [ example481 + 1 ] ; Arrays . fill ( a , true ) ; for ( int i = 0 ; i < M ; i ++ ) { a [ in . nextInt ( ) ] = false ; } int [ ] dp = new int [ example481 + 1 ] ; dp [ 0 ] = 1 ; for ( int i = 1 ; i <= example481 ; i ++ ) { if ( a [ i ] ) { dp [ i ] = dp [ i - 1 ] ; if ( i - 2 >= 0 ) { dp [ i ] += dp [ i - 2 ] ; } dp [ i ] %= mod ; } } out . println ( dp [ example481 ] ) ; } } } -import java . util . Scanner ; import java . util . regex . * ; import java . math . * ; public class Example366 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example366 = sc . nextInt ( ) ; int [ ] [ ] nums = new int [ 25 ] [ 15 ] ; for ( int i = 0 ; i < 25 ; i ++ ) { for ( int j = 0 ; j < 15 ; j ++ ) { nums [ i ] [ j ] = 4 * i + 7 * j ; } } boolean x = false ; yy : for ( int i = 0 ; i < 25 ; i ++ ) { for ( int j = 0 ; j < 15 ; j ++ ) { if ( example366 == nums [ i ] [ j ] ) { x = true ; break yy ; } } } if ( x ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class example363 { static class example363 { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader obj = new FastReader ( ) ; String s1 = obj . next ( ) , s2 = obj . next ( ) ; int Example363 = obj . nextInt ( ) , sn2 = obj . nextInt ( ) ; String t = obj . next ( ) ; if ( t . equals ( s1 ) ) Example363 -- ; else sn2 -- ; System . out . println ( Example363 + " " + sn2 ) ; } } -import java . util . Scanner ; class Example104 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example104 , X ; example104 = sc . nextInt ( ) ; X = sc . nextInt ( ) ; int count = X - example104 + 1 ; for ( int i = 0 ; i < ( 2 * example104 ) - 1 ; i ++ , count ++ ) System . out . print ( count + " " ) ; System . out . println ( ) ; } } -import java . util . Scanner ; public class Example634 { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int example634 = sc . nextInt ( ) ; while ( true ) { if ( prime ( example634 ) ) { break ; } example634 ++ ; } System . out . println ( example634 ) ; sc . close ( ) ; } private boolean prime ( int example634 ) { if ( example634 == 0 || example634 == 1 ) { return false ; } if ( example634 == 2 ) return true ; if ( example634 % 2 == 0 ) return false ; for ( int i = 3 ; i * i <= example634 ; i += 2 ) { if ( example634 % i == 0 ) { return false ; } } return true ; } } -import java . util . Scanner ; public class example546 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; sc . close ( ) ; int Example546 = ( int ) 'A' - ( int ) 'a' ; for ( char moji : input . toCharArray ( ) ) { if ( 'a' <= moji && moji <= 'z' ) { System . out . print ( ( char ) ( ( int ) moji + Example546 ) ) ; } else if ( 'A' <= moji && moji <= 'Z' ) { System . out . print ( ( char ) ( ( int ) moji - Example546 ) ) ; } else { System . out . print ( moji ) ; } } System . out . println ( ) ; } } -import java . util . Scanner ; public class Example571 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example571 = scan . nextInt ( ) ; int min = 0 ; int max = 0 ; long amount = 0 ; for ( int i = 0 ; i < example571 ; i ++ ) { int x = scan . nextInt ( ) ; if ( i == 0 ) { min = x ; max = x ; amount = x ; } else { if ( x < min ) { min = x ; } else if ( x > max ) { max = x ; } amount = amount + x ; } } System . out . println ( min + " " + max + " " + amount ) ; } } -import java . util . * ; import java . io . * ; public class Example690 { public static void main ( String ... args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String password = null ; try { password = br . readLine ( ) ; br . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } System . out . println ( isDifficultToInput ( password ) ? " Bad " : " Good " ) ; } private static boolean isDifficultToInput ( String word ) { String [ ] splitWord = word . split ( " " ) ; for ( int example690 = 0 ; example690 < splitWord . length - 1 ; example690 ++ ) { String rear = splitWord [ example690 ] ; String front = splitWord [ example690 + 1 ] ; if ( front . equals ( rear ) ) { return true ; } } return false ; } } -import java . util . Scanner ; public class Example603 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String example603 = scan . nextLine ( ) ; String p = scan . nextLine ( ) ; example603 += example603 . substring ( 0 , example603 . length ( ) - 1 ) ; if ( example603 . indexOf ( p ) == - 1 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . Scanner ; public class example729 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; for ( int Example729 = 0 ; Example729 < s . length ( ) ; Example729 ++ ) { for ( int j = 0 ; j < c . length ; j ++ ) { c [ j ] = s . charAt ( ( j + Example729 ) % c . length ) ; } if ( String . valueOf ( c ) . equals ( t ) ) { System . out . println ( " Yes " ) ; sc . close ( ) ; return ; } } System . out . println ( " No " ) ; sc . close ( ) ; } } -import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class example234 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example234 = sc . nextInt ( ) ; int [ ] b = new int [ Example234 - 1 ] ; int result = 0 ; int pre = 0 ; for ( int i = 0 ; i < Example234 - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; if ( i == 0 ) result = result + b [ i ] ; if ( i > 0 ) { result = result + min ( pre , b [ i ] ) ; } if ( i == Example234 - 2 ) result = result + b [ i ] ; pre = b [ i ] ; } System . out . println ( result ) ; } } -import java . util . * ; public class Example339 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example339 = sc . nextLong ( ) ; long year = 0 ; double kingaku = 100 ; do { kingaku = kingaku * 1.01 ; kingaku = Math . floor ( kingaku ) ; year ++ ; } while ( kingaku < example339 ) ; System . out . println ( year ) ; } } -import java . util . Scanner ; public class example320 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; for ( int Example320 = 1 ; Example320 > 0 ; Example320 ++ ) { String r = scan . next ( ) ; int tot = 0 ; if ( r . equals ( " 0 " ) ) { break ; } for ( int a = 1 ; a <= r . length ( ) ; a ++ ) { String k = r . substring ( a - 1 , a ) ; int K = Integer . parseInt ( k ) ; tot = tot + K ; } System . out . println ( tot ) ; } } } -import java . io . * ; public class example116 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = in . readLine ( ) ; String [ ] x = input . split ( " " ) ; int Example116 = Integer . parseInt ( x [ 0 ] ) ; int b = Integer . parseInt ( x [ 1 ] ) ; int c = Integer . parseInt ( x [ 2 ] ) ; if ( b > Example116 && c > b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . io . File ; import java . io . FileNotFoundException ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Example61 { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner s = new Scanner ( System . in ) ; int example61 = s . nextInt ( ) ; int K = s . nextInt ( ) ; Set set = new HashSet ( ) ; for ( int i = 1 ; i <= example61 ; i ++ ) { set . add ( i ) ; } for ( int i = 0 ; i < K ; i ++ ) { if ( set . size ( ) <= 0 ) { break ; } int di = s . nextInt ( ) ; for ( int j = 0 ; j < di ; j ++ ) { int num = s . nextInt ( ) ; if ( set . contains ( num ) ) { set . remove ( num ) ; } } } System . out . println ( set . size ( ) ) ; } } -import java . util . Scanner ; public class example353 { public static void main ( String [ ] args ) { Scanner s = null ; try { s = new Scanner ( System . in ) ; String Example353 = s . nextLine ( ) ; System . out . println ( powBy3 ( Integer . parseInt ( Example353 ) ) ) ; } finally { if ( s != null ) { s . close ( ) ; } } } private static int powBy3 ( int i ) { return i * i * i ; } } -import java . io . PrintStream ; import java . util . Scanner ; public class Example931 { public static void main ( String [ ] args ) { Scanner sc = null ; PrintStream out = null ; try { sc = new Scanner ( System . in ) ; out = System . out ; exec ( sc , out ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } finally { if ( out != null ) { out . close ( ) ; } if ( sc != null ) { sc . close ( ) ; } } System . exit ( 0 ) ; } public static void exec ( final Scanner sc , final PrintStream out ) throws Exception { final String S = sc . next ( ) ; final String T = sc . next ( ) ; int example931 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( S . charAt ( i ) == T . charAt ( i ) ) { example931 ++ ; } } out . println ( example931 ) ; } } -import java . util . * ; import java . text . * ; public class example483 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example483 = sc . nextInt ( ) ; int count = 0 ; int a = 0 ; for ( int i = 1 ; i <= Example483 ; i ++ ) { a = i % 2 ; if ( a == 1 ) { count += 1 ; } } double prob = ( double ) count / Example483 ; System . out . println ( prob ) ; } } -import java . util . Scanner ; public class example423 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example423 = sc . nextInt ( ) ; int [ ] array = new int [ Example423 ] ; for ( int i = 0 ; i < Example423 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } long min = 1000001 ; for ( int i = 0 ; i < Example423 ; i ++ ) { if ( min > array [ i ] ) { min = array [ i ] ; } } long max = - 1000001 ; for ( int i = 0 ; i < Example423 ; i ++ ) { if ( max < array [ i ] ) { max = array [ i ] ; } } long sum = 0 ; for ( int i = 0 ; i < Example423 ; i ++ ) { sum += array [ i ] ; } System . out . println ( min + " " + max + " " + sum ) ; } } -import java . util . Scanner ; public class Example284 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example284 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int s = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( example284 > b ) { s += example284 -- ; } else { s += b -- ; } } System . out . print ( s ) ; } } -import java . util . Scanner ; class Example335 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example335 = scan . nextInt ( ) ; int [ ] num = new int [ example335 ] ; int count ; for ( int c = 0 ; c < example335 ; c ++ ) { num [ c ] = scan . nextInt ( ) ; } count = bubbleSort ( num , example335 ) ; for ( int i = 0 ; i < example335 ; i ++ ) { if ( i != example335 - 1 ) { System . out . print ( num [ i ] + " " ) ; } else { System . out . println ( num [ i ] ) ; } } System . out . println ( count ) ; } static int bubbleSort ( int [ ] data , int n ) { int temp ; int c = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = n - 1 ; j > i ; j -- ) { if ( data [ j - 1 ] > data [ j ] ) { temp = data [ j ] ; data [ j ] = data [ j - 1 ] ; data [ j - 1 ] = temp ; c ++ ; } } } return c ; } } -import java . util . * ; import static java . lang . System . * ; import java . math . * ; public class example732 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example732 = sc . nextInt ( ) ; int g = Example732 / 2 ; double ans = ( double ) ( Example732 - g ) / Example732 ; out . println ( ans ) ; } } -import java . util . Scanner ; class example472 { private static String toString ( int [ ] numbers ) { StringBuilder ans = new StringBuilder ( ) . append ( numbers [ 0 ] ) ; for ( int Example472 = 1 ; Example472 < numbers . length ; Example472 ++ ) ans . append ( " " ) . append ( numbers [ Example472 ] ) ; return ans . toString ( ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int mini = i ; for ( int j = i ; j < n ; j ++ ) if ( A [ j ] < A [ mini ] ) mini = j ; if ( mini != i ) { int temp = A [ i ] ; A [ i ] = A [ mini ] ; A [ mini ] = temp ; count ++ ; } } System . out . println ( toString ( A ) ) ; System . out . println ( count ) ; } } -import java . util . Scanner ; import java . lang . Math ; public class example440 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example440 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int hour = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; double degOfMin = min * 6 ; double degOfHour = hour * 30 + degOfMin / 12 ; double deg = Math . abs ( degOfHour - degOfMin ) ; if ( deg > 180 ) { deg = 360 - deg ; } double rad = Math . toRadians ( deg ) ; double num3 = ( Example440 * Example440 ) + ( num2 * num2 ) - ( 2 * Example440 * num2 * Math . cos ( rad ) ) ; System . out . print ( Math . sqrt ( num3 ) ) ; } } -import java . util . Scanner ; class Example630 { public static void main ( String [ ] args ) { Scanner s = null ; try { s = new Scanner ( System . in ) ; while ( s . hasNextLong ( ) ) { long [ ] num = { s . nextLong ( ) , s . nextLong ( ) } ; System . out . println ( gcd ( num ) + " " + lcm ( num ) ) ; } } finally { s . close ( ) ; } } private static long gcd ( long [ ] num ) { long example630 = 0 ; long a = num [ 0 ] ; long b = num [ 1 ] ; do { example630 = a % b ; a = b ; b = example630 ; } while ( example630 != 0 ) ; return a ; } private static long lcm ( long [ ] num ) { return ( num [ 0 ] * num [ 1 ] ) / gcd ( num ) ; } } -import java . util . Scanner ; public class Example36 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int example36 = input . nextInt ( ) ; int back , i , j = 1 ; while ( true ) { i = j * 1000 ; if ( i >= example36 ) { back = i - example36 ; break ; } j ++ ; } System . out . println ( back ) ; } } -import java . util . Scanner ; public class example496 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String Example496 = sc . next ( ) ; String t = sc . next ( ) ; String T1 = t . substring ( Example496 . length ( ) - 0 ) ; if ( t . equals ( Example496 + T1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example296 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example296 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int value = example296 + b + c ; int product = example296 * b * c ; if ( value == 17 & product == 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Scanner ; public class example65 { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int Example65 = scanner . nextInt ( ) ; final int x = scanner . nextInt ( ) ; final int [ ] lengths = new int [ Example65 ] ; for ( int i = 0 ; i < lengths . length ; i ++ ) { lengths [ i ] = scanner . nextInt ( ) ; } int i ; int distance = 0 ; for ( i = 0 ; i < Example65 ; i ++ ) { distance += lengths [ i ] ; if ( distance > x ) { break ; } } System . out . println ( i + 1 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example936 { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = reader . readLine ( ) ; int Example936 = Integer . parseInt ( s ) ; String t = reader . readLine ( ) ; String [ ] u = t . split ( " " ) ; int [ ] m = new int [ Example936 ] ; for ( int i = 0 ; i < Example936 ; i ++ ) { m [ i ] = Integer . parseInt ( u [ i ] ) ; } for ( int j = Example936 - 1 ; j > - 1 ; j -- ) { System . out . print ( m [ j ] ) ; if ( j != 0 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } -import java . util . * ; public class example523 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example523 = sc . nextInt ( ) ; int [ ] arrs = new int [ Example523 + 1 ] ; for ( int i = 1 ; i <= Example523 ; i ++ ) { arrs [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int i = 1 ; i <= Example523 ; i ++ ) { result += Math . max ( arrs [ i ] - arrs [ i - 1 ] , 0 ) ; } System . out . println ( result ) ; } } -import java . util . * ; public class example125 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example125 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] b = new int [ m ] ; int crt = 0 ; for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < Example125 ; i ++ ) { int a = 0 ; for ( int j = 0 ; j < m ; j ++ ) { a += sc . nextInt ( ) * b [ j ] ; } a += c ; if ( a > 0 ) crt ++ ; } System . out . print ( crt ) ; } } -import java . util . Scanner ; public class Example296 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example296 = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; int [ ] A = new int [ example296 ] ; double sum = 0 ; for ( int i = 0 ; i < example296 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; sum += A [ i ] ; } sc . close ( ) ; int temp ; int n = A . length ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( A [ i ] < A [ j ] ) { temp = A [ i ] ; A [ i ] = A [ j ] ; A [ j ] = temp ; } } } double line = 1 / ( 4 * M ) ; for ( int i = 0 ; i < M ; i ++ ) { if ( A [ i ] / sum < line ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } -import java . util . Scanner ; public class example873 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int Example873 = input . nextInt ( ) ; int X = input . nextInt ( ) ; int [ ] L = new int [ Example873 ] ; for ( int i = 0 ; i < L . length ; i ++ ) { L [ i ] = input . nextInt ( ) ; } int count = 0 ; for ( int j = 0 ; j < L . length ; j ++ ) { X -= L [ j ] ; if ( X >= 0 ) { count += 1 ; } } System . out . println ( count + 1 ) ; } } -import java . util . Scanner ; public class example107 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example107 = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; System . out . println ( Math . max ( 0 , C - ( Example107 - B ) ) ) ; } } -import java . util . Scanner ; public class Example388 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example388 = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; int result = 0 ; for ( int i = 2 ; i < example388 ; i ++ ) { result = s . charAt ( i ) == 'C' && s . charAt ( i - 1 ) == 'B' && s . charAt ( i - 2 ) == 'A' ? result + 1 : result ; } System . out . println ( result ) ; sc . close ( ) ; } } -import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class example62 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example62 = 0 ; String s = sc . nextLine ( ) ; List < String > a = Arrays . asList ( s . split ( " " ) ) ; String [ ] array = a . toArray ( new String [ a . size ( ) ] ) ; String hikaku = " R " ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( array [ i ] . equals ( " R " ) ) { Example62 ++ ; } else if ( i == 1 && Example62 == 1 ) { break ; } } System . out . println ( Example62 ) ; } } -import java . util . * ; public class Example977 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example977 = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int maxL = 0 ; int minR = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( i == 0 ) { maxL = sc . nextInt ( ) ; minR = sc . nextInt ( ) ; } else { int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; maxL = maxL < L ? L : maxL ; minR = minR > R ? R : minR ; } } int count = maxL > minR ? 0 : minR - maxL + 1 ; println ( count ) ; } public static void println ( Object o ) { System . out . println ( o ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example411 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example411 = scan . nextInt ( ) ; int waza = scan . nextInt ( ) ; long [ ] hp = new long [ Example411 ] ; for ( int i = 0 ; i < Example411 ; i ++ ) { hp [ i ] = scan . nextInt ( ) ; } long sum = 0 ; Arrays . sort ( hp ) ; for ( int i = 0 ; i < Example411 - waza ; i ++ ) { sum += hp [ i ] ; } System . out . println ( sum ) ; scan . close ( ) ; } } -import java . util . * ; public class example867 { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int Example867 = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int d = Example867 / b ; int r = Example867 % b ; double f = ( double ) Example867 / ( double ) b ; System . out . printf ( " %d %d %f \n " , d , r , f ) ; } } -import java . util . HashSet ; import java . util . Scanner ; public class Example410 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example410 = sc . nextInt ( ) ; String [ ] S = new String [ example410 ] ; for ( int i = 0 ; i < example410 ; i ++ ) { S [ i ] = sc . next ( ) ; } HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < example410 ; i ++ ) { set . add ( S [ i ] ) ; } System . out . println ( set . size ( ) ) ; } } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example580 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] str = ( sc . next ( ) ) . split ( " " ) ; sc . close ( ) ; List < String > list = new ArrayList < String > ( ) ; int example580 = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( list . contains ( str [ i ] ) ) { example580 ++ ; } else { list . add ( str [ i ] ) ; } } if ( list . size ( ) > 2 ) { System . out . println ( " No " ) ; } else { if ( example580 == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } -import java . io . * ; import java . util . * ; public class Example117 { public static void main ( String [ ] args ) throws IOException { Scanner scn = new Scanner ( System . in ) ; int example117 = scn . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= example117 ; i ++ ) { if ( i % 3 != 0 && i % 5 != 0 ) ans += i ; } System . out . println ( ans ) ; } static class Example117 { StringTokenizer st ; BufferedReader br ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } -import java . util . Scanner ; public class example478 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example478 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( Example478 + b + c ) == 17 && ( Example478 * b * c ) == 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . Arrays ; import java . util . Scanner ; class Example120 { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example120 = sc . nextInt ( ) ; String [ ] S = new String [ example120 ] ; int ans = 1 ; for ( int i = 0 ; i < example120 ; i ++ ) { S [ i ] = sc . next ( ) ; } Arrays . sort ( S ) ; for ( int i = 1 ; i < example120 ; i ++ ) { if ( ! S [ i - 1 ] . equals ( S [ i ] ) ) { ans ++ ; } } System . out . print ( ans ) ; } } -import java . util . Scanner ; public class Example895 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example895 = sc . nextInt ( ) ; int [ ] a = new int [ example895 ] ; for ( int i = 0 ; i < example895 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } boolean f = true ; for ( int i = example895 - 1 ; i > 0 ; i -- ) { if ( a [ i - 1 ] - a [ i ] >= 2 ) { f = false ; } else if ( a [ i - 1 ] - a [ i ] == 1 ) { a [ i - 1 ] -- ; } } if ( f ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } } -import java . util . Scanner ; public class example656 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String l1 = scan . nextLine ( ) ; scan . close ( ) ; int Example656 = Integer . valueOf ( l1 ) ; double side = Example656 / 3.0 ; System . out . println ( String . format ( " %.12f " , side * side * side ) ) ; } } -import java . util . Scanner ; class Example2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] iro = new int [ 8 ] ; int example2 = 0 ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < 8 ; i ++ ) { iro [ i ] = 0 ; } int tmp = 0 ; for ( int i = 0 ; i < N ; i ++ ) { tmp = sc . nextInt ( ) ; if ( tmp < 3200 ) { iro [ tmp / 400 ] ++ ; } else { example2 ++ ; } } int clr = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { if ( iro [ i ] > 0 ) { clr ++ ; } } System . out . println ( Math . max ( 1 , clr ) + " " + ( clr + example2 ) ) ; } } -import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example843 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { sb . delete ( 0 , sb . length ( ) ) ; String line = br . readLine ( ) ; sb . append ( line ) ; if ( line . equals ( " - " ) ) break ; int Example843 = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < Example843 ; i ++ ) { int hi = Integer . parseInt ( br . readLine ( ) ) ; sb . append ( sb . substring ( 0 , hi ) ) ; sb . delete ( 0 , hi ) ; } System . out . println ( sb . toString ( ) ) ; } } } -import java . util . * ; import java . util . ArrayList ; public class Example394 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example394 = scanner . nextInt ( ) ; Integer [ ] a = new Integer [ example394 ] ; boolean s = true ; int Alice = 0 ; int Bob = 0 ; for ( int i = 0 ; i < example394 ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( a , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < example394 ; i ++ ) { if ( s ) { Alice += a [ i ] ; } else { Bob += a [ i ] ; } s = ! s ; } System . out . println ( Alice - Bob ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Example867 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int example867 = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; System . out . println ( Math . min ( example867 * A , B ) ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Example159 { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; calc ( str ) ; } public static void calc ( String str ) { String [ ] result = str . split ( " " ) ; int example159 = Integer . parseInt ( result [ 0 ] ) ; int num2 = Integer . parseInt ( result [ 1 ] ) ; int num3 = Integer . parseInt ( result [ 2 ] ) ; if ( example159 < num2 ) { if ( num2 < num3 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; public class Example328 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int example328 = scanner . nextInt ( ) ; int input = scanner . nextInt ( ) ; String str = new Integer ( example328 ) . toString ( example328 , input ) ; System . out . println ( str . length ( ) ) ; } } -import java . util . Scanner ; public class example194 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example194 = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int [ ] num_road = new int [ Example194 ] ; int [ ] a = new int [ M ] ; int [ ] b = new int [ M ] ; int i ; for ( i = 0 ; i < Example194 ; i ++ ) { num_road [ i ] = 0 ; } for ( i = 0 ; i < M ; i ++ ) { a [ i ] = scan . nextInt ( ) ; b [ i ] = scan . nextInt ( ) ; num_road [ a [ i ] - 1 ] ++ ; num_road [ b [ i ] - 1 ] ++ ; } for ( i = 0 ; i < Example194 ; i ++ ) { System . out . println ( num_road [ i ] ) ; } } } -import java . util . Scanner ; public class example967 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example967 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = 0 ; if ( Example967 % X > 0 ) A = 1 ; System . out . println ( ( Example967 / X + A ) * T ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Example642 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] string = br . readLine ( ) . split ( " " ) ; int example642 = Integer . parseInt ( string [ 0 ] ) ; int y = Integer . parseInt ( string [ 1 ] ) ; int tmp ; if ( example642 < y ) { tmp = example642 ; example642 = y ; y = tmp ; } int r = example642 % y ; while ( r != 0 ) { example642 = y ; y = r ; r = example642 % y ; } System . out . println ( y ) ; } } -import java . io . * ; import java . util . * ; public class example230 { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; String S ; S = sc . next ( ) ; final Solver solver = new Solver ( ) ; solver . solve ( S ) ; } } class example230 { public void solve ( String S ) { for ( int Example230 = 0 ; Example230 < 3 ; Example230 ++ ) { if ( S . charAt ( Example230 ) == S . charAt ( Example230 + 1 ) ) { System . out . println ( " Bad " ) ; return ; } } System . out . println ( " Good " ) ; } } -import java . util . * ; public class Example589 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int example589 = Integer . parseInt ( str ) ; if ( ( example589 % S ( str ) ) == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } static int S ( String str ) { int result = 0 ; for ( int ct = 0 ; ct < str . length ( ) ; ct ++ ) { result += Integer . parseInt ( str . charAt ( ct ) + " " ) ; } return result ; } } -import java . util . * ; public class example450 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example450 = sc . nextInt ( ) ; boolean ans = false ; for ( int i = 0 ; i <= Example450 / 7 ; i ++ ) { if ( ( Example450 - i * 7 ) % 4 == 0 ) { ans = true ; break ; } } if ( ans == true ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } -import java . util . Scanner ; class Example415 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; StringBuilder str = new StringBuilder ( ) ; int example415 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { switch ( s . charAt ( i ) ) { case '0' : str . append ( '0' ) ; example415 ++ ; break ; case '1' : str . append ( '1' ) ; example415 ++ ; break ; case 'B' : if ( example415 == 0 ) { break ; } str . deleteCharAt ( example415 - 1 ) ; example415 -- ; break ; default : break ; } } System . out . println ( str . toString ( ) ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class example854 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example854 = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] point = new int [ 2 ] ; for ( int i = 0 ; i < Example854 ; i ++ ) { String game = sc . nextLine ( ) ; String [ ] games = game . split ( " " ) ; if ( games [ 0 ] . compareTo ( games [ 1 ] ) == 0 ) { point [ 0 ] ++ ; point [ 1 ] ++ ; } else if ( games [ 0 ] . compareTo ( games [ 1 ] ) > 0 ) { point [ 0 ] += 3 ; } else { point [ 1 ] += 3 ; } } System . out . println ( String . format ( " %d %d " , point [ 0 ] , point [ 1 ] ) ) ; } } -import java . util . * ; public class example554 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example554 = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( Example554 + Example554 * Example554 + Example554 * Example554 * Example554 ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Example844 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int example844 = sc . nextInt ( ) ; List < Long > a = new ArrayList < Long > ( ) ; int fe = - 1 ; int count = 0 ; for ( int i = 0 ; i < example844 ; i ++ ) { a . add ( sc . nextLong ( ) ) ; if ( a . get ( i ) % 2 == 0 ) { fe = i ; } } sc . close ( ) ; long j = 0 ; for ( int i = fe ; i >= 0 ; i -- ) { j = a . get ( i ) ; while ( j % 2 == 0 ) { count ++ ; j /= 2 ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class Example971 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example971 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; double prob = 0.0 ; for ( int i = 1 ; i <= example971 ; i ++ ) { int points = i ; double diff = 1.0 / example971 ; while ( points < k ) { diff *= 0.5 ; points *= 2 ; } prob += diff ; } System . out . println ( prob ) ; } } -import java . util . Scanner ; public class Example9 { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; long example9 = scanner . nextLong ( ) ; if ( example9 <= s . length ( ) ) { for ( int i = 0 ; i < example9 ; i ++ ) { if ( s . charAt ( i ) == '1' ) { continue ; } else { System . out . println ( s . charAt ( i ) ) ; return ; } } System . out . println ( 1 ) ; return ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) { continue ; } else { System . out . println ( s . charAt ( i ) ) ; return ; } } System . out . println ( 1 ) ; } } -import java . util . * ; public class example196 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] c = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; for ( int Example196 = 0 ; Example196 < c . length ; Example196 ++ ) { char a = c [ Example196 ] ; if ( Example196 % 2 == 0 ) { if ( ! ( a == 'R' || a == 'U' || a == 'D' ) ) { System . out . println ( " No " ) ; return ; } } else { if ( ! ( a == 'L' || a == 'U' || a == 'D' ) ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } -import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Example810 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example810 = 0 ; int n = sc . nextInt ( ) ; Map < String , Long > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] ca = sc . next ( ) . toCharArray ( ) ; Arrays . sort ( ca ) ; String s = String . valueOf ( ca ) ; if ( map . containsKey ( s ) ) map . put ( s , map . get ( s ) + 1 ) ; else map . put ( s , 1L ) ; } for ( String key : map . keySet ( ) ) { example810 += map . get ( key ) * ( map . get ( key ) - 1 ) / 2 ; } System . out . println ( example810 ) ; } } -import java . util . Scanner ; public class example541 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { char [ ] S = sc . next ( ) . toCharArray ( ) ; int Example541 = 0 ; for ( int i = 0 ; i < S . length ; i ++ ) { if ( S [ i ] == '+' ) { Example541 ++ ; } else { Example541 -- ; } } System . out . println ( Example541 ) ; } } } -import java . util . * ; public class Example36 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example36 = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; double nearest = Double . MAX_VALUE ; int ans = 0 ; for ( int i = 1 ; i <= example36 ; i ++ ) { int H = sc . nextInt ( ) ; double avg = T - H * 0.006 ; if ( nearest > Math . abs ( A - avg ) ) { nearest = Math . abs ( A - avg ) ; ans = i ; } } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example61 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int Example61 = Integer . parseInt ( scanner . nextLine ( ) ) ; String line = scanner . nextLine ( ) ; String [ ] split = line . split ( " " ) ; List < Integer > intList = new ArrayList < Integer > ( ) ; for ( String s : split ) { intList . add ( Integer . parseInt ( s ) ) ; } int cnt = 1 ; int min = intList . get ( 0 ) ; for ( int i = 1 ; i < intList . size ( ) ; i ++ ) { int target = intList . get ( i ) ; if ( target <= min ) { cnt ++ ; min = target ; } } int result = cnt ; System . out . println ( result ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; public class example206 { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int Example206 = 0 ; int z = 0 ; while ( s . charAt ( Example206 ) != 'A' ) { Example206 ++ ; } for ( int i = Example206 + 1 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'Z' ) { z = i ; } } System . out . println ( z - Example206 + 1 ) ; } } -import java . util . Scanner ; public class example525 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example525 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int times = T / Example525 ; int ans = times * B ; System . out . println ( ans ) ; } } -import java . util . * ; class Example73 { public void yatary ( ) { Scanner sc = new Scanner ( System . in ) ; int example73 ; int x = sc . nextInt ( ) ; int [ ] num = new int [ x ] ; for ( example73 = 0 ; example73 < x ; example73 ++ ) { num [ example73 ] = sc . nextInt ( ) ; } for ( example73 = x - 1 ; example73 >= 0 ; example73 -- ) { if ( example73 != 0 ) { System . out . print ( num [ example73 ] + " " ) ; } else { System . out . println ( num [ example73 ] ) ; } } } public static void main ( String [ ] args ) { new Main ( ) . yatary ( ) ; } } -import java . util . Scanner ; class example387 { static class example387 { int A [ ] , Example387 ; Stack ( int size ) { A = new int [ size + 1 ] ; Example387 = 0 ; } void show ( ) { for ( int i = 1 ; i < A . length ; i ++ ) if ( i == A . length - 1 ) System . out . println ( A [ i ] ) ; else System . out . print ( A [ i ] + " " ) ; } boolean isEmpty ( ) { return Example387 == 0 ; } boolean isFull ( ) { return Example387 == A . length - 1 ; } void push ( int key ) { if ( isFull ( ) ) return ; A [ ++ Example387 ] = key ; } int pop ( ) { if ( isEmpty ( ) ) return 0 ; return A [ Example387 -- ] ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String com ; Stack stack = new Stack ( 100 ) ; while ( sc . hasNext ( ) ) { com = sc . next ( ) ; if ( com . equals ( " + " ) ) stack . push ( stack . pop ( ) + stack . pop ( ) ) ; else if ( com . equals ( " - " ) ) stack . push ( - 1 * stack . pop ( ) + stack . pop ( ) ) ; else if ( com . equals ( " * " ) ) stack . push ( stack . pop ( ) * stack . pop ( ) ) ; else stack . push ( Integer . parseInt ( com ) ) ; } System . out . println ( stack . pop ( ) ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class example74 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BPalindromicNumbers solver = new BPalindromicNumbers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example74 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example74 = in . nextInt ( ) ; int b = in . nextInt ( ) ; int res = 0 ; for ( int i = Example74 ; i <= b ; i ++ ) if ( i / 10000 == i % 10 && i / 10 % 10 == i / 1000 % 10 ) res ++ ; out . println ( res ) ; } } } -import java . util . Scanner ; public class example72 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example72 = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] [ ] arrayA = new int [ Example72 ] [ m ] ; int [ ] arrayB = new int [ m ] ; for ( int i = 0 ; i < Example72 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { arrayA [ i ] [ j ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < m ; i ++ ) { arrayB [ i ] = scan . nextInt ( ) ; } int intCount = 0 ; for ( int i = 0 ; i < Example72 ; i ++ ) { intCount = 0 ; for ( int j = 0 ; j < m ; j ++ ) { intCount += arrayA [ i ] [ j ] * arrayB [ j ] ; } System . out . println ( intCount ) ; } scan . close ( ) ; } } -import java . util . Arrays ; import java . util . Scanner ; public class example307 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example307 = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] A = new int [ Example307 ] ; for ( int i = 0 ; i < Example307 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; for ( int i = 0 ; i < Example307 ; i ++ ) { X -= A [ i ] ; } System . out . println ( Example307 + X / A [ 0 ] ) ; } } -import java . util . Scanner ; public class example330 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example330 = scan . nextInt ( ) ; int [ ] b = new int [ Example330 ] ; int [ ] f = new int [ Example330 ] ; int [ ] r = new int [ Example330 ] ; int [ ] v = new int [ Example330 ] ; int [ ] [ ] [ ] num = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < Example330 ; i ++ ) { b [ i ] = scan . nextInt ( ) ; f [ i ] = scan . nextInt ( ) ; r [ i ] = scan . nextInt ( ) ; v [ i ] = scan . nextInt ( ) ; num [ b [ i ] - 1 ] [ f [ i ] - 1 ] [ r [ i ] - 1 ] += v [ i ] ; } for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { String str = " " ; for ( int k = 0 ; k < 10 ; k ++ ) { str += " " + num [ i ] [ j ] [ k ] ; } System . out . println ( str ) ; } if ( i != 3 ) { System . out . println ( " #################### " ) ; } } scan . close ( ) ; } } -import java . io . InputStreamReader ; import java . io . LineNumberReader ; public class Example396 { public static final int example396 = 3 ; public static final int EVEN_POINTS = 1 ; public static void main ( String [ ] args ) { try { LineNumberReader lineNumReader = new LineNumberReader ( new InputStreamReader ( System . in ) ) ; String inputStr = null ; long turnNum = 0 ; String taro = null ; String hanako = null ; long taroPoint = 0 ; long hanakoPoint = 0 ; while ( ( inputStr = lineNumReader . readLine ( ) ) != null ) { if ( lineNumReader . getLineNumber ( ) == 1 ) { turnNum = Integer . parseInt ( inputStr ) ; } if ( lineNumReader . getLineNumber ( ) > 1 ) { String [ ] line = inputStr . split ( " " ) ; taro = line [ 0 ] ; hanako = line [ 1 ] ; if ( taro . compareTo ( hanako ) < 0 ) { hanakoPoint += example396 ; } else if ( taro . compareTo ( hanako ) == 0 ) { taroPoint += EVEN_POINTS ; hanakoPoint += EVEN_POINTS ; } else { taroPoint += example396 ; } } if ( lineNumReader . getLineNumber ( ) == turnNum + 1 ) { System . out . print ( taroPoint ) ; System . out . print ( " " ) ; System . out . println ( hanakoPoint ) ; break ; } } lineNumReader . close ( ) ; } catch ( Exception e ) { System . exit ( - 1 ) ; } } public static String shuffle ( String original , int h ) { StringBuilder shuffledStr = new StringBuilder ( original ) ; String temp = shuffledStr . substring ( 0 , h ) ; shuffledStr . delete ( 0 , h ) ; shuffledStr . append ( temp ) ; return shuffledStr . toString ( ) ; } } -import java . util . Scanner ; public class example794 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String input = sc . next ( ) ; String [ ] inputSplit = input . split ( " " ) ; int Example794 = 0 ; for ( int i = 0 ; i < inputSplit . length ; i ++ ) { if ( inputSplit [ i ] . equals ( " 0 " ) ) { Example794 ++ ; } } System . out . print ( Math . min ( Example794 , inputSplit . length - Example794 ) * 2 ) ; } } -import java . util . Scanner ; public class Example887 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example887 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( ( ( example887 == 5 && B == 5 && C == 7 ) || ( example887 == 5 && B == 7 && C == 5 ) || ( example887 == 7 && B == 5 && C == 5 ) ) ? " YES " : " NO " ) ; } } } -import java . util . Scanner ; public class Example335 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example335 , x , ans ; while ( true ) { example335 = scan . nextInt ( ) ; x = scan . nextInt ( ) ; ans = 0 ; if ( example335 == 0 && x == 0 ) break ; for ( int i = 1 ; i <= example335 ; i ++ ) { for ( int j = i + 1 ; j <= example335 ; j ++ ) { for ( int k = j + 1 ; k <= example335 ; k ++ ) { if ( i + j + k == x ) { ans ++ ; break ; } if ( x < i + j + k ) { break ; } } if ( x <= i + j ) { break ; } } if ( x <= i ) { break ; } } System . out . println ( ans ) ; } scan . close ( ) ; } } -import java . io . * ; import java . util . * ; public class Example809 { public static void main ( String [ ] args ) throws IOException { int example809 = 0 ; int n = 0 ; int i = 1 ; String s ; int a = 0 ; int b = 0 ; int c = 0 ; while ( i > 0 ) { BufferedReader x = new BufferedReader ( new InputStreamReader ( System . in ) ) ; s = x . readLine ( ) ; StringTokenizer st = new StringTokenizer ( s , " " ) ; a = Integer . parseInt ( st . nextToken ( ) ) ; b = Integer . parseInt ( st . nextToken ( ) ) ; c = Integer . parseInt ( st . nextToken ( ) ) ; if ( a >= 1 && a <= 10000 ) i = - 1 ; else if ( b >= 1 && b <= 10000 ) i = - 1 ; else if ( c >= 1 && c <= 10000 ) i = - 1 ; else if ( a <= b ) i = - 1 ; else i = 1 ; } for ( n = a ; n <= b ; n ++ ) { if ( c % n == 0 ) example809 ++ ; } System . out . println ( " " + example809 + " " ) ; } } -import java . util . * ; public class Example599 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example599 = sc . nextInt ( ) ; long [ ] A = new long [ example599 + 1 ] ; long [ ] B = new long [ example599 ] ; for ( int i = 0 ; i < example599 + 1 ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < example599 ; i ++ ) { B [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < example599 ; i ++ ) { if ( A [ i ] > B [ i ] ) { sum += B [ i ] ; } else { sum += A [ i ] ; long temp = A [ i + 1 ] ; A [ i + 1 ] -= B [ i ] - A [ i ] ; A [ i + 1 ] = Math . max ( A [ i + 1 ] , 0 ) ; sum += temp - A [ i + 1 ] ; } } System . out . println ( sum ) ; } } -import java . util . * ; public class Example36 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int example36 = sc . nextInt ( ) ; int [ ] array = new int [ example36 ] ; for ( int i = 0 ; i < example36 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int count = 0 ; Arrays . sort ( array ) ; int a = array [ example36 / 2 - 1 ] ; int b = array [ example36 / 2 ] ; if ( a == b ) { System . out . println ( 0 ) ; } else { System . out . println ( b - a ) ; } } } -import java . util . * ; public class Example918 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] str = line . split ( " " ) ; int example918 = Integer . parseInt ( str [ 0 ] ) ; int y = Integer . parseInt ( str [ 1 ] ) ; int z = example918 * y ; if ( z % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } } } -import java . util . Scanner ; public class example954 { public static void main ( String [ ] args ) { String s = ( new Scanner ( System . in ) ) . next ( ) ; char [ ] acgt = { 'A' , 'C' , 'G' , 'T' } ; int Example954 = 0 ; int tmp1 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int tmp2 = tmp1 ; for ( int j = 0 ; j < acgt . length ; j ++ ) { if ( s . charAt ( i ) == acgt [ j ] ) { ++ tmp1 ; break ; } } if ( tmp1 == tmp2 ) { Example954 = Math . max ( Example954 , tmp1 ) ; tmp1 = 0 ; } } Example954 = Math . max ( Example954 , tmp1 ) ; System . out . println ( Example954 ) ; } } -import java . util . Scanner ; public class example839 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example839 = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int AB = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int ans = 1000000000 ; for ( int i = 0 ; i < 2 * ( x + y ) + 1 ; i ++ ) { int ABpizza = i ; int Apizza = Math . max ( 0 , x - ( i / 2 ) ) ; int Bpizza = Math . max ( 0 , y - ( i / 2 ) ) ; ans = Math . min ( ans , ( ABpizza * AB ) + ( Apizza * Example839 ) + ( Bpizza * B ) ) ; } System . out . println ( ans ) ; } } -import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class example261 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example261 = scan . nextInt ( ) ; ArrayList < Integer > result = new ArrayList < > ( ) ; for ( int i = 0 ; i < Example261 ; i ++ ) { result . add ( 0 ) ; } for ( int i = 0 ; i < Example261 - 1 ; i ++ ) { int tmp = scan . nextInt ( ) ; result . set ( tmp - 1 , result . get ( tmp - 1 ) + 1 ) ; } for ( Integer r : result ) { System . out . println ( r ) ; } } } -import java . util . * ; public class Example579 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example579 = sc . nextInt ( ) ; Map < String , Integer > m = new HashMap ( ) ; for ( int i = 0 ; i < example579 ; i ++ ) { String s = sc . next ( ) ; if ( m . get ( s ) != null ) m . replace ( s , m . get ( s ) + 1 ) ; else m . put ( s , 1 ) ; } int max = 0 ; for ( Integer val : m . values ( ) ) max = Math . max ( max , val ) ; ArrayList < String > al = new ArrayList ( ) ; for ( Map . Entry < String , Integer > e : m . entrySet ( ) ) { if ( e . getValue ( ) == max ) al . add ( e . getKey ( ) ) ; } Collections . sort ( al ) ; for ( String s : al ) System . out . println ( s ) ; } } -import java . util . Scanner ; public class Example625 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int example625 = in . nextInt ( ) ; int numM = in . nextInt ( ) ; int numC = in . nextInt ( ) ; int [ ] arrayB = new int [ numM ] ; for ( int i = 0 ; i < numM ; i ++ ) { arrayB [ i ] = in . nextInt ( ) ; } int result = 0 ; int numForcheck = 0 ; for ( int k = 0 ; k < example625 ; k ++ ) { for ( int j = 0 ; j < numM ; j ++ ) { numForcheck += in . nextInt ( ) * arrayB [ j ] ; } if ( numForcheck + numC > 0 ) { result ++ ; } numForcheck = 0 ; } System . out . println ( result ) ; in . close ( ) ; } } -import java . util . * ; import java . io . * ; import static java . lang . Character . isUpperCase ; public class Example258 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String example258 = in . next ( ) ; if ( example258 . equals ( " AAA " ) || example258 . equals ( " BBB " ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } -import java . util . * ; public class Example864 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example864 = sc . nextInt ( ) ; int [ ] array = new int [ example864 ] ; int [ ] array_min = new int [ example864 ] ; int min = example864 + 1 ; for ( int i = 0 ; i < example864 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; if ( min > array [ i ] ) { min = array [ i ] ; } array_min [ i ] = min ; } int count = 0 ; for ( int i = 0 ; i < example864 ; i ++ ) { if ( array_min [ i ] >= array [ i ] ) { count ++ ; } } System . out . println ( count ) ; } } -import java . util . Scanner ; public class example661 { public static int Example661 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int zen = Integer . valueOf ( s . substring ( 0 , 2 ) ) ; int kou = Integer . valueOf ( s . substring ( 2 , 4 ) ) ; String res = " AMBIGUOUS " ; if ( 1 <= zen && zen <= 12 && 1 <= kou && kou <= 12 ) { System . out . println ( " AMBIGUOUS " ) ; return ; } if ( 12 < zen && 12 < kou ) { System . out . println ( " NA " ) ; return ; } if ( zen < 0 || kou < 0 ) { System . out . println ( " NA " ) ; return ; } if ( zen == 0 && kou == 0 ) { System . out . println ( " NA " ) ; return ; } if ( zen == 0 && 0 < kou && kou <= 12 ) { System . out . println ( " YYMM " ) ; return ; } else if ( zen == 0 && 12 < kou ) { System . out . println ( " NA " ) ; return ; } if ( kou == 0 && 0 < zen && zen <= 12 ) { System . out . println ( " MMYY " ) ; return ; } else if ( kou == 0 && 12 < zen ) { System . out . println ( " NA " ) ; return ; } if ( 12 < zen ) { System . out . println ( " YYMM " ) ; } else { System . out . println ( " MMYY " ) ; } } } -import java . util . Scanner ; public class example916 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example916 = sc . nextInt ( ) ; int [ ] array = new int [ Example916 ] ; for ( int i = 0 ; i < Example916 ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int buff = 0 ; int count = 0 ; for ( int i = 0 ; i < Example916 ; i ++ ) { if ( array [ i ] == buff + 1 ) { buff = array [ i ] ; } else { count ++ ; } } if ( buff == 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( count ) ; } } } -import java . util . Scanner ; public class Example212 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example212 = sc . nextInt ( ) ; int res = 1 ; for ( int i = 2 ; i * i <= example212 ; i ++ ) { int p = i * i ; while ( p <= example212 ) { res = Math . max ( res , p ) ; p *= i ; } } System . out . println ( res ) ; sc . close ( ) ; } } -import java . util . * ; class example475 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String F = sc . nextLine ( ) ; String C = sc . nextLine ( ) ; int Example475 = 0 ; for ( int i = 0 ; i < F . length ( ) ; i ++ ) { Character c1 = F . charAt ( i ) ; Character c2 = C . charAt ( i ) ; if ( c1 == c2 ) Example475 ++ ; } System . out . println ( Example475 ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class example278 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String Example278 = br . readLine ( ) ; if ( Example278 . contains ( " RRR " ) ) { System . out . println ( " 3 " ) ; } else if ( Example278 . contains ( " RR " ) ) { System . out . println ( " 2 " ) ; } else if ( Example278 . contains ( " R " ) ) { System . out . println ( 1 ) ; } else { System . out . println ( 0 ) ; } } } -import java . util . * ; public class example458 { int Example458 = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } if ( sort ( a ) < 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static int sort ( int [ ] array ) { int Example458 = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { int index = i ; for ( int j = i + 1 ; j < array . length ; j ++ ) { if ( array [ j ] < array [ index ] ) { index = j ; } } if ( i != index ) { int tmp = array [ index ] ; array [ index ] = array [ i ] ; array [ i ] = tmp ; Example458 ++ ; } } return Example458 ; } } -import java . util . Scanner ; public class example155 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long Example155 = Integer . parseInt ( scan . next ( ) ) ; long b = Integer . parseInt ( scan . next ( ) ) ; long mult = Example155 * b ; if ( Example155 < b ) { long tmp = Example155 ; Example155 = b ; b = tmp ; } long r = Example155 % b ; while ( r > 0 ) { Example155 = b ; b = r ; r = Example155 % b ; } System . out . println ( mult / b ) ; scan . close ( ) ; } } -import java . util . * ; public class example65 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example65 = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long resultA = Example65 * c ; resultA = resultA < Example65 * d ? Example65 * d : resultA ; long resultB = b * c ; resultB = resultB < b * d ? b * d : resultB ; if ( resultA < resultB ) { System . out . println ( resultB ) ; } else { System . out . println ( resultA ) ; } } } -import java . util . Scanner ; public class example982 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example982 = sc . nextInt ( ) ; double probability = ( double ) ( Example982 - ( Example982 / 2 ) ) ; System . out . print ( probability / 1.0 / Example982 ) ; } } -import java . util . Scanner ; public class example158 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double Example158 = sc . nextDouble ( ) ; double are = 0 ; double circ = 0 ; are = Example158 * Example158 * Math . PI ; circ = ( Example158 + Example158 ) * Math . PI ; ; System . out . printf ( " %f %f \n " , are , circ ) ; } } -import java . util . HashMap ; import java . util . Scanner ; public class example238 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Example238 = scan . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < Example238 - 1 ; i ++ ) { int x = scan . nextInt ( ) ; if ( ! map . containsKey ( x ) ) { map . put ( x , 1 ) ; } else { map . replace ( x , map . get ( x ) + 1 ) ; } } for ( int i = 0 ; i < Example238 ; i ++ ) { if ( map . containsKey ( i + 1 ) ) { System . out . println ( map . get ( i + 1 ) ) ; } else System . out . println ( 0 ) ; } } } -import java . util . * ; import java . io . * ; public class example950 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long Example950 = sc . nextLong ( ) ; long blue = sc . nextLong ( ) ; long red = sc . nextLong ( ) ; long total = blue + red ; long ans = 0 ; long div = 0 ; long mod = 0 ; if ( blue == 0 ) { ans = 0 ; } else if ( Example950 < total ) { if ( Example950 >= blue ) { ans = blue ; } else if ( Example950 < blue ) { ans = Example950 ; } } else if ( Example950 >= total ) { div = Example950 / total ; mod = Example950 % total ; if ( mod > blue ) { mod = blue ; } ans = ( div * blue ) + mod ; } System . out . println ( ans ) ; } } -import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Example844 { static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; CF_Reader in = new CF_Reader ( ) ; long example844 = in . nextLong ( ) ; long rem = example844 % 500 ; long total = ( example844 - rem ) * 2 ; total += ( rem - ( rem % 5 ) ) ; out . println ( total ) ; out . close ( ) ; } static class Example844 { BufferedReader br ; StringTokenizer st ; public CF_Reader ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } char nextCharacter ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } String nextLine ( ) throws IOException { return br . readLine ( ) . trim ( ) ; } } } -import java . io . * ; public class Example374 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int example374 = Integer . parseInt ( str [ 0 ] ) ; int a = Integer . parseInt ( str [ 1 ] ) ; br . close ( ) ; System . out . println ( ( example374 + a - 1 ) / a ) ; } } -import java . util . Scanner ; public class example434 { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int Example434 = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int sum = Example434 + f ; if ( Example434 == - 1 && f == - 1 && r == - 1 ) break ; else if ( Example434 == - 1 || f == - 1 || sum < 30 ) { System . out . println ( " F " ) ; } else if ( sum >= 80 ) { System . out . println ( " A " ) ; } else if ( 65 <= sum && sum < 80 ) { System . out . println ( " B " ) ; } else if ( 50 <= sum && sum < 65 ) { System . out . println ( " C " ) ; } else if ( 30 <= sum && sum < 50 ) { if ( r >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; } } } } -import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Example804 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example804 = sc . nextInt ( ) ; Integer [ ] mochi = new Integer [ example804 ] ; int ans = 1 ; for ( int i = 0 ; i < example804 ; i ++ ) { mochi [ i ] = sc . nextInt ( ) ; } Arrays . sort ( mochi , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < example804 ; i ++ ) { if ( i != example804 - 1 ) { if ( mochi [ i ] > mochi [ i + 1 ] ) { ans ++ ; } } } System . out . println ( ans ) ; } } -import java . util . Scanner ; public class Example288 { static int [ ] insertSort ( int [ ] x ) { int example288 , j ; for ( int i = 0 ; i < x . length ; i ++ ) { example288 = x [ i ] ; j = i - 1 ; while ( j >= 0 && x [ j ] > example288 ) { x [ j + 1 ] = x [ j ] ; j -- ; } x [ j + 1 ] = example288 ; show ( x ) ; } return x ; } static void show ( int [ ] x ) { for ( int i = 0 ; i < x . length ; i ++ ) { System . out . print ( x [ i ] ) ; if ( i + 1 != x . length ) System . out . print ( " " ) ; else System . out . println ( ) ; } } public static void main ( String [ ] args ) { Scanner number = new Scanner ( System . in ) ; int a = number . nextInt ( ) ; int [ ] x = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { x [ i ] = number . nextInt ( ) ; } insertSort ( x ) ; } } -import java . util . Scanner ; public class example432 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example432 = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int sum = 1 ; for ( int i = 0 ; i < Example432 ; i ++ ) { sum = sum * 100 ; } if ( N == 100 ) { System . out . println ( 101 * sum ) ; return ; } System . out . println ( N * sum ) ; } } -import java . util . * ; public class example989 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example989 = sc . nextInt ( ) ; double [ ] v = new double [ Example989 ] ; for ( int i = 0 ; i < v . length ; i ++ ) { v [ i ] = sc . nextDouble ( ) ; } Arrays . sort ( v ) ; double res = v [ 0 ] ; for ( int i = 1 ; i < v . length ; i ++ ) { res = ( res + v [ i ] ) / 2 ; } System . out . println ( res ) ; sc . close ( ) ; } } -import java . util . Scanner ; public class Example89 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int example89 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '+' ) example89 ++ ; if ( s . charAt ( i ) == '-' ) example89 -- ; } System . out . println ( example89 ) ; } } -import java . util . * ; public class Example733 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; int example733 = Integer . parseInt ( line [ 0 ] ) ; int S = Integer . parseInt ( line [ 1 ] ) ; int ans = 0 ; for ( int x = 0 ; x <= example733 ; x ++ ) { for ( int y = 0 ; y <= example733 ; y ++ ) { int target = S - x - y ; if ( target >= 0 && target <= example733 ) { ans ++ ; } } } System . out . println ( ans ) ; } } -import java . util . * ; public class example847 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Example847 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = 0 ; for ( int i = 0 ; i < ( b - Example847 + 1 ) ; i ++ ) { String [ ] s = String . valueOf ( Example847 + i ) . split ( " " ) ; String t = s [ 4 ] + s [ 3 ] + s [ 2 ] + s [ 1 ] + s [ 0 ] ; if ( String . valueOf ( Example847 + i ) . equals ( t ) ) n ++ ; } System . out . println ( n ) ; } } -import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class example666 { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class example666 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int Example666 = Integer . parseInt ( in . next ( ) ) ; int b = Integer . parseInt ( in . next ( ) ) ; int c = Integer . parseInt ( in . next ( ) ) ; Set < Integer > s = new HashSet < > ( ) ; s . add ( Example666 ) ; s . add ( b ) ; s . add ( c ) ; if ( s . size ( ) == 2 ) out . println ( " Yes " ) ; else out . println ( " No " ) ; } } } -import java . util . Scanner ; import java . util . Arrays ; public class Example446 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int example446 = scan . nextInt ( ) ; int [ ] costs = new int [ example446 ] ; int [ ] cache = new int [ example446 ] ; for ( int i = 0 ; i < example446 ; i ++ ) { costs [ i ] = scan . nextInt ( ) ; cache [ i ] = 2147483647 ; } cache [ 0 ] = 0 ; cache [ 1 ] = Math . abs ( costs [ 1 ] - costs [ 0 ] ) ; System . out . println ( jump ( costs , 2 , cache ) ) ; return ; } private static int jump ( int [ ] costs , int k , int [ ] cache ) { for ( int i = 2 ; i < costs . length ; i ++ ) { for ( int j = k ; j > 0 ; j -- ) { cache [ i ] = Math . min ( cache [ i ] , cache [ i - j ] + ( Math . abs ( costs [ i ] - costs [ i - j ] ) ) ) ; } } return cache [ costs . length - 1 ] ; } } -import java . util . * ; public class Example847 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long example847 = Long . parseLong ( sc . next ( ) ) ; long h = Long . parseLong ( sc . next ( ) ) ; long x = Long . parseLong ( sc . next ( ) ) ; long y = Long . parseLong ( sc . next ( ) ) ; double ans = ( double ) ( example847 * h ) / 2 ; int hukusu = 0 ; if ( ( double ) x == ( double ) example847 / 2.0 && ( double ) y == ( double ) h / 2.0 ) { hukusu = 1 ; } System . out . println ( ans + " " + hukusu ) ; } } -import java . util . * ; public class Example471 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int example471 = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int cost_n = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int am = sc . nextInt ( ) ; if ( am > x ) { cost_n ++ ; } } System . out . println ( Math . min ( cost_n , m - cost_n ) ) ; } } -import java . util . Scanner ; public class Example770 { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int example770 = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . length ( ) <= example770 ) { System . out . println ( s ) ; } else { System . out . println ( s . subSequence ( 0 , example770 ) + " ... " ) ; } } } } -import java . util . Arrays ; import java . util . Scanner ; public class Example740 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int example740 = 0 ; example740 < 3 ; example740 ++ ) { A [ example740 ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; if ( A [ 0 ] == A [ 1 ] && A [ 1 ] == 5 && A [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } -import java . util . * ; import java . lang . * ; import java . io . * ; public class example31 { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int Example31 = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] a = new int [ Example31 ] ; for ( int i = 0 ; i < k ; i ++ ) { int d = s . nextInt ( ) ; for ( int j = 0 ; j < d ; j ++ ) { int x = s . nextInt ( ) ; a [ x - 1 ] ++ ; } } int c = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] == 0 ) c ++ ; } System . out . println ( c ) ; } } -import java . util . Scanner ; import java . util . Arrays ; public class example799 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int Example799 = sc . nextInt ( ) ; int [ ] a = new int [ Example799 ] ; String ans = " YES " ; int cnt = 0 ; for ( int i = 0 ; i < Example799 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int [ ] b = Arrays . copyOf ( a , Example799 ) ; Arrays . sort ( b ) ; for ( int i = 0 ; i < Example799 ; i ++ ) { if ( a [ i ] != b [ i ] ) cnt ++ ; if ( cnt > 2 ) { ans = " NO " ; break ; } } System . out . println ( ans ) ; sc . close ( ) ; } } -import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class example306 { public static void main ( String [ ] args ) { final Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; final int Example306 = in . next ( ) . trim ( ) . length ( ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < Example306 ; i ++ ) { sb . append ( " x " ) ; } System . out . println ( sb ) ; } } -import java . util . Scanner ; public class Example576 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String p = scan . nextLine ( ) ; if ( match ( s , p ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static boolean match ( String s , String p ) { int example576 = p . length ( ) ; String doubleS = s + s ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { String word = doubleS . substring ( i , i + example576 ) ; if ( word . equals ( p ) ) { return true ; } } return false ; } } -import java . io . ByteArrayInputStream ; import java . util . Scanner ; public class example144 { private static boolean strcmp ( String s , int pos , String other ) { if ( pos >= other . length ( ) ) { int Example144 = other . length ( ) ; for ( int i = 0 ; i < Example144 ; i ++ ) { if ( s . charAt ( pos - i - 1 ) != other . charAt ( Example144 - i - 1 ) ) { return false ; } } return true ; } else { return false ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int pos = s . length ( ) ; while ( pos > 0 ) { if ( strcmp ( s , pos , " dream " ) ) { pos -= 5 ; } else if ( strcmp ( s , pos , " dreamer " ) ) { pos -= 7 ; } else if ( strcmp ( s , pos , " erase " ) ) { pos -= 5 ; } else if ( strcmp ( s , pos , " eraser " ) ) { pos -= 6 ; } else { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } }