diff --git "a/codenet_4000_log/java/input.in" "b/codenet_4000_log/java/input.in" new file mode 100644--- /dev/null +++ "b/codenet_4000_log/java/input.in" @@ -0,0 +1,3951 @@ +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; if ( 0 < A && A < 10 && 0 < B && B < 10 ) { System . out . println ( A * B ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } s . close ( ) ; } } +import java . util . * ; public class Main { private static final int INF = 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int pos = k ; k *= - 1 ; k += 1 ; while ( k < pos ) { System . out . println ( " [LOG] Block: System.out.print(x + k + \" \" ); \n k++; " ) ; System . out . print ( x + k + " " ) ; k ++ ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] [ ] arrayA = new int [ n ] [ m ] ; int [ ] arrayB = new int [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { intCount = 0 ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: intCount += arrayA[i][j] * arrayB[j]; " ) ; intCount += arrayA [ i ] [ j ] * arrayB [ j ] ; } System . out . println ( intCount ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int Y = stdIn . nextInt ( ) / 1000 ; int ans10 = - 1 ; int ans5 = - 1 ; int ans1 = - 1 ; for ( int i = 0 ; i <= N ; i ++ ) { for ( int j = 0 ; j <= N - i ; j ++ ) { if ( 10 * i + 5 * j + ( N - i - j ) == Y ) { System . out . println ( " [LOG] Block: ans10 = i; \n ans5 = j; \n ans1 = N - i - j; \n break; " ) ; ans10 = i ; ans5 = j ; ans1 = N - i - j ; break ; } } } System . out . println ( ans10 + " " + ans5 + " " + ans1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int x = Integer.parseInt(sc.next()); \n int y = Integer.parseInt(sc.next()); \n System.out.println(x * y); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( x * y ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 0 ; while ( true ) { if ( n <= 1000 ) { x = 1000 - n ; break ; } else { System . out . println ( " [LOG] Block: n = n - 1000; " ) ; n = n - 1000 ; } } System . out . println ( x ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String [ ] s = new String [ n ] ; int [ ] cnt = new int [ n ] ; String [ ] scheck = new String [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( i != 0 && s [ i ] . equals ( s [ i - 1 ] ) == false ) { scheck [ suffix ] = s [ i - 1 ] ; suffix += 1 ; } if ( i == n - 1 ) scheck [ suffix ] = s [ i ] ; if ( i == n - 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 ++ ) { System . out . println ( " [LOG] Block: if (cnt[i] == max) \n System.out.println(scheck[i]); " ) ; if ( cnt [ i ] == max ) System . out . println ( scheck [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long number = scanner . nextLong ( ) ; String result = new String ( ) ; while ( number > 0 ) { System . out . println ( " [LOG] Block: int nums = (int) ('a' + (number - 1) % 26); \n char temporal = (char) nums; \n result = temporal + result; \n number = number / 26; \n if (temporal == 'z') \n number--; " ) ; int nums = ( int ) ( 'a' + ( number - 1 ) % 26 ) ; char temporal = ( char ) nums ; result = temporal + result ; number = number / 26 ; if ( temporal == 'z' ) number -- ; } System . out . print ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int tmp ; if ( a > b ) { System . out . println ( " [LOG] Block: tmp = a; \n a = b; \n b = tmp; " ) ; tmp = a ; a = b ; b = tmp ; } if ( b > c ) { tmp = b ; b = c ; c = tmp ; } if ( a > b ) { System . out . println ( " [LOG] Block: tmp = a; \n a = b; \n b = tmp; " ) ; tmp = a ; a = b ; b = tmp ; } System . out . println ( a + " " + b + " " + c ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 flag = 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 ] ) { flag = false ; System . out . println ( " No " ) ; break outside ; } } } if ( flag ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] argv ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String s = scan.next(); \n String t = scan.next(); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n String u = scan.next(); \n if (u.equals(s)) \n a--; \n if (u.equals(t)) \n b--; \n System.out.println(a + \" \" + b); \n scan.close(); " ) ; Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String t = scan . next ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; String u = scan . next ( ) ; if ( u . equals ( s ) ) a -- ; if ( u . equals ( t ) ) b -- ; System . out . println ( a + " " + b ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int A1 = 0 , A2 = 0 , A3 = 0 , result = 0 ; A1 = input . nextInt ( ) ; A2 = input . nextInt ( ) ; A3 = input . nextInt ( ) ; if ( 1 <= A1 && A1 <= 13 && 1 <= A2 && A2 <= 13 && 1 <= A3 && A3 <= 13 ) { if ( A1 + A2 + A3 == 22 || A1 + A2 + A3 > 22 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" win \" ); " ) ; System . out . println ( " win " ) ; } } else { } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) , t ; int countOdd = 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 ) ) countOdd ++ ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (i % 2 == 0) \n t = \" 1 \" ; \n else \n t = \" 0 \" ; \n if (!s.substring(i, i + 1).equals(t)) \n countEven++; " ) ; if ( i % 2 == 0 ) t = " 1 " ; else t = " 0 " ; if ( ! s . substring ( i , i + 1 ) . equals ( t ) ) countEven ++ ; } System . out . println ( ( int ) Math . min ( countOdd , countEven ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int R = sc.nextInt(); \n double pi = 3.141592653558209749448214808651; \n double l = 2 * pi * R; \n System.out.println(l); " ) ; Scanner sc = new Scanner ( System . in ) ; int R = sc . nextInt ( ) ; double pi = 3.141592653558209749448214808651 ; double l = 2 * pi * R ; System . out . println ( l ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: A.add(Integer.parseInt(sc.next())); " ) ; A . add ( Integer . parseInt ( sc . next ( ) ) ) ; } Collections . sort ( A ) ; System . out . println ( A . get ( 2 ) - A . get ( 0 ) ) ; } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > arrays = new HashSet < > ( ) ; int cnt = 1 ; int s = sc . nextInt ( ) ; arrays . add ( s ) ; while ( true ) { cnt ++ ; s = result ( s ) ; if ( arrays . contains ( s ) ) { System . out . println ( cnt ) ; break ; } arrays . add ( s ) ; } } public static int result ( int a ) { if ( a % 2 == 0 ) { System . out . println ( " [LOG] Block: return a / 2; " ) ; return a / 2 ; } return 3 * a + 1 ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; int y = 0 ; for ( int i = 0 ; i < x . length ( ) ; i ++ ) { y += Character . getNumericValue ( x . charAt ( i ) ) ; } if ( y % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = Integer.parseInt(sc.next()); \n switch(N % 10) { \n case 3: \n System.out.println( \" bon \" ); \n return; \n case 0: \n case 1: \n case 6: \n case 8: \n System.out.println( \" pon \" ); \n return; \n default: \n System.out.println( \" hon \" ); \n return; \n } " ) ; Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; switch ( N % 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 . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = Integer . parseInt ( sc . next ( ) ) ; long [ ] a = new long [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( a [ i ] <= LIMIT / total ) { total *= a [ i ] ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); \n return; " ) ; System . out . println ( - 1 ) ; return ; } } System . out . println ( total ) ; } } } +import java . util . * ; import java . math . BigDecimal ; public class Main { 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 cnt = 0 ; while ( money . compareTo ( k ) == - 1 ) { System . out . println ( " [LOG] Block: cnt += 1; \n money = money.multiply(a); \n BigDecimal bd1 = money.setScale(0, BigDecimal.ROUND_DOWN); \n money = bd1; " ) ; cnt += 1 ; money = money . multiply ( a ) ; BigDecimal bd1 = money . setScale ( 0 , BigDecimal . ROUND_DOWN ) ; money = bd1 ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int h = scanner . nextInt ( ) ; int w = scanner . nextInt ( ) ; while ( h + w > 0 ) { for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { System . out . println ( " [LOG] Block: if (j == 0 || j == w - 1 || i == 0 || i == h - 1) \n System.out.print( \" # \" ); \n else \n System.out.print( \" . \" ); " ) ; if ( j == 0 || j == w - 1 || i == 0 || i == h - 1 ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } System . out . println ( ) ; } System . out . println ( ) ; h = scanner . nextInt ( ) ; w = scanner . nextInt ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String day = sc.nextLine(); \n String[] str = day.split( \" / \" ); \n int[] a = new int[3]; \n for (int i = 0; i < str.length; i++) a[i] = Integer.parseInt(str[i]); \n if (a[0] > 2019) \n System.out.println( \" TBD \" ); \n else if (a[0] == 2019 && a[1] > 4) \n System.out.println( \" TBD \" ); \n else if (a[0] == 2019 && a[1] > 4 && a[2] < 31) \n System.out.println( \" TBD \" ); \n else \n System.out.println( \" Heisei \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String day = sc . nextLine ( ) ; String [ ] str = day . split ( " / " ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < str . length ; i ++ ) a [ i ] = Integer . parseInt ( str [ i ] ) ; 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.valueOf(sc.next()); \n int b = Integer.valueOf(sc.next()); \n int t = Integer.valueOf(sc.next()); \n System.out.println(t / a * b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . valueOf ( sc . next ( ) ) ; int b = Integer . valueOf ( sc . next ( ) ) ; int t = Integer . valueOf ( sc . next ( ) ) ; System . out . println ( t / a * b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; char [ ] s = scanner . next ( ) . toCharArray ( ) ; for ( int i = 1 ; i < 3 ; i ++ ) { if ( s [ i ] != s [ i - 1 ] ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String EOT = " END_OF_TEXT " ; String w , t ; int count = 0 ; w = sc . next ( ) ; while ( true ) { t = sc . next ( ) ; if ( t . equals ( EOT ) ) { break ; } if ( t . equalsIgnoreCase ( w ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { 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 B { static void solve ( ) { final Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; final int d = sc . nextInt ( ) ; final int res = calc ( n , d ) ; System . out . println ( res ) ; } static int calc ( final int n , final int d ) { final int max = ( 2 * d + 1 ) ; int res = n / max ; if ( n % max != 0 ) { res += 1 ; } return res ; } } class A { 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 ) { System . out . println ( " [LOG] Block: return 3 * r * r; " ) ; return 3 * r * r ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] p = new int [ n ] ; int a = 0 ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = scan . nextInt ( ) ; } 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 ] ) { System . out . println ( " [LOG] Block: a++; " ) ; a ++ ; } } System . out . println ( a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; 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 + n ] ; break ; } } } for ( char t : list ) { System . out . println ( " [LOG] Block: sb.append(String.valueOf(t)); " ) ; sb . append ( String . valueOf ( t ) ) ; } System . out . println ( sb . toString ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String ans = " APPROVED " ; int tmp ; for ( int i = 0 ; i < N ; i ++ ) { tmp = sc . nextInt ( ) ; if ( tmp % 2 == 0 ) { if ( tmp % 3 != 0 && tmp % 5 != 0 ) { System . out . println ( " [LOG] Block: ans = \" DENIED \" ; " ) ; ans = " DENIED " ; } } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int ans = 0 ; while ( true ) { boolean flg = true ; int count = 0 ; for ( int i = 0 ; i < n ; 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 == n ) { System . out . println ( " [LOG] Block: System.out.println(ans); \n return; " ) ; System . out . println ( ans ) ; return ; } } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; if ( a1 + 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 Pair { int a , b ; Pair ( int a , int b ) { System . out . println ( " [LOG] Block: this.a = a; \n this.b = b; " ) ; this . a = a ; this . b = b ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int d ; int A ; int [ ] people = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: if (people[i] == 0) \n res++; " ) ; if ( people [ i ] == 0 ) res ++ ; } System . out . println ( res ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int[] ai = new int[N]; \n for (int i = 0; i < N; i++) ai[i] = sc.nextInt(); \n int[] ans = new int[N]; \n for (int i = 0; i < N; i++) ans[ai[i] - 1] = i + 1; \n for (int i = 0; i < N; i++) System.out.print(ans[i] + \" \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] ai = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) ai [ i ] = sc . nextInt ( ) ; int [ ] ans = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) ans [ ai [ i ] - 1 ] = i + 1 ; for ( int i = 0 ; i < N ; i ++ ) System . out . print ( ans [ i ] + " " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = a ; int ans = 0 ; while ( a > 0 ) { System . out . println ( " [LOG] Block: ans += a % 10; \n a /= 10; " ) ; ans += a % 10 ; a /= 10 ; } System . out . println ( b % ans == 0 ? " Yes " : " No " ) ; } } +import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; long n = 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 { System . out . println ( " [LOG] Block: long sum = a + b; \n sum = n % sum; \n if (sum > a) \n sum = a; \n long x = n / (a + b); \n System.out.println(x * a + sum); " ) ; long sum = a + b ; sum = n % sum ; if ( sum > a ) sum = a ; long x = n / ( a + b ) ; System . out . println ( x * a + sum ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = 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 ) % K == 0 ) { count += 1 ; } else { } } if ( count > 0 ) { System . out . println ( " OK " ) ; } if ( count == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" NG \" ); " ) ; System . out . println ( " NG " ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { System . out . println ( " [LOG] Block: BufferedReader re = new BufferedReader(new InputStreamReader(System.in), 1); \n String line = re.readLine(); \n String[] w = line.split( \" \" , 0); \n int W = Integer.parseInt(w[0]); \n int H = Integer.parseInt(w[1]); \n int x = Integer.parseInt(w[2]); \n int y = Integer.parseInt(w[3]); \n int r = Integer.parseInt(w[4]); \n String ret = \" No \" ; \n if (W >= (x + r) && H >= (y + r) && (x - r) >= 0 && (y - r) >= 0) \n ret = \" Yes \" ; \n System.out.println(ret); \n re.close(); " ) ; BufferedReader re = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String line = re . readLine ( ) ; String [ ] w = line . split ( " " , 0 ) ; int W = 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 ( W >= ( x + r ) && H >= ( y + r ) && ( x - r ) >= 0 && ( y - r ) >= 0 ) ret = " Yes " ; System . out . println ( ret ) ; re . close ( ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; String t = in . next ( ) ; int count = 0 ; int min = 9999 ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { count = 0 ; for ( int j = 0 ; j < t . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) == t . charAt ( j ) ) { } else { count ++ ; } } if ( min > count ) { min = count ; } } if ( s . contains ( t ) ) { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } else System . out . println ( min ) ; } } +import java . util . * ; public class Main { public static double result = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double x = sc . nextInt ( ) ; if ( ( x % 2 ) == 0 ) { result = ( ( x / 2 ) / x ) ; } else { if ( x == 1 ) { result = 1 ; } else { System . out . println ( " [LOG] Block: result = ((((x - 1) / 2) + 1) / x); " ) ; result = ( ( ( ( x - 1 ) / 2 ) + 1 ) / x ) ; } } System . out . println ( String . format ( " %.10f " , result ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long n = Long . parseLong ( scan . next ( ) ) ; scan . close ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( n > 0 ) { long l = n % 26 ; if ( l == 0 ) { sb . append ( 'z' ) ; n -= 1 ; } else { System . out . println ( " [LOG] Block: char c = 'a'; \n c += l - 1; \n sb.append(c); " ) ; char c = 'a' ; c += l - 1 ; sb . append ( c ) ; } n /= 26 ; } System . out . println ( sb . reverse ( ) . toString ( ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int count = 0 ; char c ; String word , temp ; Scanner sc = new Scanner ( System . in ) ; word = sc . next ( ) ; temp = sc . next ( ) ; while ( ! temp . equals ( " END_OF_TEXT " ) ) { System . out . println ( " [LOG] Block: if (temp.equalsIgnoreCase(word)) \n count++; \n temp = sc.next(); " ) ; if ( temp . equalsIgnoreCase ( word ) ) count ++ ; temp = sc . next ( ) ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int N = Integer . parseInt ( input . nextLine ( ) ) ; int W = Integer . parseInt ( input . nextLine ( ) ) ; int [ ] v = new int [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(v[i] + 1); " ) ; System . out . println ( v [ i ] + 1 ) ; } System . exit ( 0 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner obj = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: a.add(obj.nextInt()); " ) ; a . add ( obj . nextInt ( ) ) ; } Collections . sort ( a ) ; int sum = a . get ( 0 ) + a . get ( 1 ) ; System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int count = 0 ; while ( n != 0 || x != 0 ) { for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { for ( int k = j + 1 ; k <= n ; k ++ ) { if ( i + j + k == x ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } } System . out . println ( count ) ; n = scan . nextInt ( ) ; x = scan . nextInt ( ) ; count = 0 ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i , 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 ( i = 0 ; i < n ; i ++ ) array [ i ] = 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 ) { System . out . println ( " [LOG] Block: taihi = array[q]; \n array[q] = array[minj]; \n array[minj] = taihi; \n count++; " ) ; 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 . io . * ; import java . util . * ; public class Main { 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 { System . out . println ( " [LOG] Block: int N = readInt(); \n if (N % 1000 == 0) \n pw.println(0); \n else \n pw.println(1000 - N % 1000); \n pw.close(); " ) ; int N = readInt ( ) ; if ( N % 1000 == 0 ) pw . println ( 0 ) ; else pw . println ( 1000 - N % 1000 ) ; pw . close ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String str = in . next ( ) ; int ans = 0 ; for ( char c : str . toCharArray ( ) ) { if ( c == '1' ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } out . print ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] av ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextInt ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int k = 0 ; k < n ; k ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[k]); \n if (k != n - 1) \n System.out.print( \" \" ); " ) ; System . out . print ( a [ k ] ) ; if ( k != n - 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 < n ; k ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[k]); \n if (k != n - 1) \n System.out.print( \" \" ); " ) ; System . out . print ( a [ k ] ) ; if ( k != n - 1 ) System . out . print ( " " ) ; } System . out . println ( " " ) ; } } +import java . util . * ; public class Main { 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 top = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == 'o' ) top += 100 ; } System . out . println ( 700 + top ) ; } 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 ++ ) { System . out . println ( " [LOG] Block: x -= m[i]; \n cnt++; " ) ; x -= m [ i ] ; cnt ++ ; } System . out . println ( cnt + x / m [ 0 ] ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; if ( n > m ) System . out . println ( n * m / gcd ( n , m ) ) ; else System . out . println ( n * m / gcd ( m , n ) ) ; } static long gcd ( long a , long b ) { long temp ; while ( ( temp = a % b ) != 0 ) { System . out . println ( " [LOG] Block: a = b; \n b = temp; " ) ; a = b ; b = temp ; } return b ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = scan . nextInt ( ) ; if ( a % 2 == 0 && ! ( a % 3 == 0 || a % 5 == 0 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" DENIED \" ); \n scan.close(); \n return; " ) ; System . out . println ( " DENIED " ) ; scan . close ( ) ; return ; } } System . out . println ( " APPROVED " ) ; scan . close ( ) ; return ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner dataScanner = new Scanner ( System . in ) ; String [ ] data = dataScanner . nextLine ( ) . split ( " " ) ; int numCards = 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 ( numCards , 0 ) + 1 ; i ++ ) { for ( Integer j = 0 ; j < Math . max ( numCards - i , 0 ) + 1 ; j ++ ) { int k = numCards - 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 ( " [LOG] Block: System.out.println( \" -1 -1 -1 \" ); " ) ; System . out . println ( " -1 -1 -1 " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n sc.close(); \n int result = a * b; \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int result = a * b ; System . out . println ( result ) ; } } +public class Main { public void run ( java . io . InputStream in , java . io . PrintStream out ) { java . util . Scanner sc = new java . util . Scanner ( in ) ; int w , h , x , y , r ; w = sc . nextInt ( ) ; h = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; r = sc . nextInt ( ) ; if ( x >= r && y >= r && w >= ( x + r ) && h >= ( y + r ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: (new Main()).run(System.in, System.out); " ) ; ( new Main ( ) ) . run ( System . in , System . out ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = sc.nextInt(); " ) ; a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ ( n - 1 ) / 2 + 1 ] - a [ ( n - 1 ) / 2 ] ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < ch . length ; i ++ ) { if ( Character . isAlphabetic ( ch [ i ] ) ) { int x = ch [ i ] - 'a' ; count [ x ] ++ ; } } } for ( int i = 0 ; i < count . length ; i ++ ) { System . out . println ( " [LOG] Block: char x = (char) ('a' + i); \n System.out.print(x + \" : \" ); \n System.out.println(count[i]); " ) ; char x = ( char ) ( 'a' + i ) ; System . out . print ( x + " : " ) ; System . out . println ( count [ i ] ) ; } } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int a = cin . nextInt ( ) , b = cin . nextInt ( ) ; int c = a * b ; if ( c % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Odd \" ); " ) ; System . out . println ( " Odd " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int cnt = 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' ) { cnt ++ ; } else { cnt = 0 ; } if ( max < cnt ) { System . out . println ( " [LOG] Block: max = cnt; " ) ; max = cnt ; } } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { run ( ) ; } static void run ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = isDivisor ( a , b , c ) ; System . out . println ( ans ) ; } static int isDivisor ( int a , int b , int c ) { int ans = 0 ; for ( int i = a ; i <= b ; i ++ ) { if ( c % i == 0 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } return ans ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int a = A ; int b = B ; int c = C ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: a *= 2; \n b *= 2; \n c *= 2; " ) ; a *= 2 ; b *= 2 ; c *= 2 ; } System . out . println ( Math . max ( a + B + C , Math . max ( A + b + C , A + B + c ) ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n int a = stdIn.nextInt(); \n int b = stdIn.nextInt(); \n int a1 = a * b; \n int a2 = 2 * (a + b); \n System.out.printf( \" %d %d \n \" , a1, a2); " ) ; Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int a1 = a * b ; int a2 = 2 * ( a + b ) ; System . out . printf ( " %d %d \n " , a1 , a2 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String dow = sc.next(); \n ArrayList<String> week = new ArrayList<>(Arrays.asList( \" SUN \" , \" MON \" , \" TUE \" , \" WED \" , \" THU \" , \" FRI \" , \" SAT \" )); \n int result = 7 - week.indexOf(dow); \n System.out.println(result); " ) ; 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 result = 7 - week . indexOf ( dow ) ; System . out . println ( result ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { 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 A = Long . parseLong ( Ws [ 0 ] ) ; long B = Long . parseLong ( Ws [ 1 ] ) ; long K = A + B ; if ( K % 2 == 1 ) { System . out . println ( " IMPOSSIBLE " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(K / 2); " ) ; System . out . println ( K / 2 ) ; } } } +public class Main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int W = 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 < W && W <= 100 && 0 < H && H <= 100 ) { if ( W >= ( x + r ) && H >= ( y + r ) && ( y + r ) > 0 && ( x + r ) > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" x \" ); " ) ; System . out . print ( " x " ) ; } System . out . println ( " " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long input = scanner . nextLong ( ) ; long answer = input - 1 ; answer = getAnswer ( input , answer ) ; System . out . println ( answer ) ; } private static long getAnswer ( long input , long answer ) { int newStart = ( int ) Math . sqrt ( input ) ; for ( long i = newStart ; i > 1 ; i -- ) { if ( input % i == 0 ) { System . out . println ( " [LOG] Block: long divisible = input / i; \n long possibleAnswer = (i - 1) + (divisible - 1); \n return possibleAnswer; " ) ; long divisible = input / i ; long possibleAnswer = ( i - 1 ) + ( divisible - 1 ) ; return possibleAnswer ; } } return answer ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int tyuukan = scan . nextInt ( ) ; int kimatu = scan . nextInt ( ) ; int saisiken = scan . nextInt ( ) ; while ( tyuukan != - 1 || kimatu != - 1 || saisiken != - 1 ) { int y ; y = tyuukan + kimatu ; if ( tyuukan == - 1 || kimatu == - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; 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 ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } tyuukan = scan . nextInt ( ) ; kimatu = scan . nextInt ( ) ; saisiken = scan . nextInt ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int Length = S . length ( ) ; char [ ] tmp ; tmp = new char [ Length ] ; for ( int i = 0 ; i < Length ; i ++ ) { System . out . println ( " [LOG] Block: tmp[i] = 'x'; " ) ; tmp [ i ] = 'x' ; } System . out . println ( tmp ) ; } } +import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n char[] alp = s.toCharArray(); \n int a = (int) (alp[0]); \n alp[0] = (char) (a + 1); \n System.out.print(alp[0]); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] alp = s . toCharArray ( ) ; int a = ( int ) ( alp [ 0 ] ) ; alp [ 0 ] = ( char ) ( a + 1 ) ; System . out . print ( alp [ 0 ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Integer [ ] dArr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { dArr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( dArr , Collections . reverseOrder ( ) ) ; int count = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( dArr [ i - 1 ] == dArr [ i ] ) continue ; if ( dArr [ i - 1 ] > dArr [ i ] ) { count ++ ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( count ) ; } } +import java . util . * ; import java . util . PriorityQueue ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; boolean flag = true ; PriorityQueue in = new PriorityQueue ( ) ; for ( int x = 0 ; x < num ; x ++ ) { int input = scan . nextInt ( ) ; in . offer ( input ) ; } int before = ( int ) in . poll ( ) ; int after ; for ( int x = 1 ; x < num ; x ++ ) { after = ( int ) in . poll ( ) ; if ( before == after ) { flag = false ; break ; } else { before = after ; } } if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public Main ( ) { } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n ; int h ; int index ; int index2 ; int result = 1 ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; n = sc . nextInt ( ) ; for ( index = 0 ; index < n ; index ++ ) { h = sc . nextInt ( ) ; map . put ( index , h ) ; } sc . close ( ) ; loop1 : for ( index = 1 ; index < n ; index ++ ) { loop2 : for ( index2 = 0 ; index2 < index ; index2 ++ ) { if ( map . get ( index2 ) > map . get ( index ) ) { System . out . println ( " [LOG] Block: result--; \n break loop2; " ) ; result -- ; break loop2 ; } } result ++ ; } System . out . println ( result ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { 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 a = 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 = a ; x <= b ; x ++ ) { if ( c % x == 0 ) { count ++ ; } } } else { for ( int x = a ; x <= c ; x ++ ) { if ( c % x == 0 ) { count ++ ; } } } System . out . println ( count ) ; } stdReader . close ( ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.exit(-1); " ) ; System . exit ( - 1 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String string = scan.nextLine(); \n String strings = string + string; \n String keywords = scan.nextLine(); \n System.out.println(strings.matches( \" .* \" + keywords + \" .* \" ) ? \" Yes \" : \" No \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; String string = scan . nextLine ( ) ; String strings = string + string ; String keywords = scan . nextLine ( ) ; System . out . println ( strings . matches ( " .* " + keywords + " .* " ) ? " Yes " : " No " ) ; } } +import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; String Sa = sc . next ( ) ; String Sb = sc . next ( ) ; String Sc = sc . next ( ) ; int a = Sa . length ( ) , b = Sb . length ( ) , c = Sc . length ( ) ; char p = Sa . charAt ( Sa . length ( ) - a ) ; a -- ; while ( true ) { switch ( p ) { case 'a' : if ( a == 0 ) { out . println ( " A " ) ; exit ( 0 ) ; } p = Sa . charAt ( Sa . length ( ) - a ) ; a -- ; break ; case 'b' : if ( b == 0 ) { out . println ( " B " ) ; exit ( 0 ) ; } p = Sb . charAt ( Sb . length ( ) - b ) ; b -- ; break ; case 'c' : if ( c == 0 ) { System . out . println ( " [LOG] Block: out.println( \" C \" ); \n exit(0); " ) ; out . println ( " C " ) ; exit ( 0 ) ; } p = Sc . charAt ( Sc . length ( ) - c ) ; c -- ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int C = sc.nextInt(); \n int D = sc.nextInt(); \n int start = Math.max(A, C); \n int end = Math.min(B, D); \n int reult = end - start; \n System.out.println(reult < 0 ? 0 : reult); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int start = Math . max ( A , C ) ; int end = Math . min ( B , D ) ; int reult = end - start ; System . out . println ( reult < 0 ? 0 : reult ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = 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 ] + ( k - array [ n - 1 ] ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { distance = array [ i + 1 ] - array [ i ] ; if ( distance >= max ) { System . out . println ( " [LOG] Block: max = distance; " ) ; max = distance ; } } System . out . println ( k - max ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int X = scan . nextInt ( ) ; int N = scan . nextInt ( ) ; int [ ] box = new int [ N ] ; int con = 0 ; int min = X + 100 ; int judge = 0 ; int nbox ; for ( int i = 0 ; i < N ; i ++ ) { box [ i ] = scan . nextInt ( ) ; if ( X == box [ i ] ) { con = 1 ; } } if ( con == 0 ) { System . out . print ( X ) ; } else { for ( int i = 1 ; i <= 200 - X ; i ++ ) { int a = X - i ; int b = X + 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 ) { System . out . println ( " [LOG] Block: min = b; \n break; " ) ; min = b ; break ; } } } System . out . print ( min ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int a = 0 ; int z = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'A' ) { a = i ; break ; } } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'Z' ) { System . out . println ( " [LOG] Block: z = i + 1; " ) ; z = i + 1 ; } } System . out . println ( z - a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int x = y / 1000 - n ; int coefficient1 = 9 ; int coefficient2 = 4 ; int [ ] result = { - 1 , - 1 , - 1 } ; for ( int i = 0 ; i <= n ; i ++ ) { int tmp = x - ( 9 * i ) ; int [ ] tmp2 = new int [ 3 ] ; if ( tmp % 4 == 0 && tmp >= 0 && tmp <= 4 * n ) { tmp2 [ 0 ] = i ; tmp2 [ 1 ] = tmp / 4 ; tmp2 [ 2 ] = n - tmp2 [ 0 ] - tmp2 [ 1 ] ; if ( tmp2 [ 2 ] >= 0 && tmp2 [ 2 ] <= n ) { System . out . println ( " [LOG] Block: result = tmp2; \n break; " ) ; result = tmp2 ; break ; } } } System . out . println ( result [ 0 ] + " " + result [ 1 ] + " " + result [ 2 ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int x = Integer.parseInt(sc.next()); \n int y = Integer.parseInt(sc.next()); \n int z = Integer.parseInt(sc.next()); \n int work; \n work = x; \n x = y; \n y = work; \n work = x; \n x = z; \n z = work; \n System.out.print(x); \n System.out.print( \" \" ); \n System.out.print(y); \n System.out.print( \" \" ); \n System.out.print(z); " ) ; Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; int z = Integer . parseInt ( sc . next ( ) ) ; int work ; work = x ; x = y ; y = work ; work = x ; x = z ; z = work ; System . out . print ( x ) ; System . out . print ( " " ) ; System . out . print ( y ) ; System . out . print ( " " ) ; System . out . print ( z ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int t = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] y = new int [ t ] ; int p = 0 ; while ( st . hasMoreTokens ( ) ) { System . out . println ( " [LOG] Block: y[p] = Integer.parseInt(st.nextToken()); \n p++; " ) ; y [ p ] = Integer . parseInt ( st . nextToken ( ) ) ; p ++ ; } Arrays . sort ( y ) ; System . out . println ( y [ t - 1 ] - y [ 0 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; int ans = ( int ) Math . log10 ( n ) + 1 ; for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { System . out . println ( " [LOG] Block: if (n % i == 0) \n ans = (int) Math.min(ans, Math.log10(n / i) + 1); " ) ; if ( n % i == 0 ) ans = ( int ) Math . min ( ans , Math . log10 ( n / i ) + 1 ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; String anser = " No " ; if ( S . contains ( " A " ) && S . contains ( " B " ) ) { System . out . println ( " [LOG] Block: anser = \" Yes \" ; " ) ; anser = " Yes " ; } System . out . println ( anser ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; long i = a * x + b * y ; long ii = c * 2 * Math . max ( x , y ) ; long iii = 0 ; if ( x > y ) { iii = c * 2 * y + a * ( x - y ) ; } else { System . out . println ( " [LOG] Block: iii = c * 2 * x + b * (y - x); " ) ; iii = c * 2 * x + b * ( y - x ) ; } System . out . println ( Math . min ( Math . min ( i , ii ) , iii ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numStones = sc . nextInt ( ) ; int [ ] stoneHeights = new int [ numStones ] ; for ( int i = 0 ; i < numStones ; i ++ ) { stoneHeights [ i ] = sc . nextInt ( ) ; } int [ ] minCostForStones = new int [ numStones ] ; Arrays . fill ( minCostForStones , Integer . MAX_VALUE ) ; minCostForStones [ 0 ] = 0 ; for ( int i = 0 ; i < numStones ; i ++ ) { for ( int j = i + 1 ; j < i + 3 ; j ++ ) { if ( j < numStones ) { System . out . println ( " [LOG] Block: minCostForStones[j] = Math.min(minCostForStones[j], minCostForStones[i] + Math.abs(stoneHeights[j] - stoneHeights[i])); " ) ; minCostForStones [ j ] = Math . min ( minCostForStones [ j ] , minCostForStones [ i ] + Math . abs ( stoneHeights [ j ] - stoneHeights [ i ] ) ) ; } } } System . out . println ( minCostForStones [ numStones - 1 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int[] m = new int[200]; \n int N = sc.nextInt(); \n int X = sc.nextInt(); \n int min = Integer.MAX_VALUE; \n int sum = 0; \n for (int i = 0; i < N; i++) m[i] = sc.nextInt(); \n for (int i = 0; i < N; i++) X -= m[i]; \n for (int i = 0; i < N; i++) if (m[i] < min) \n min = m[i]; \n sum = N + (X / min); \n System.out.println(sum); " ) ; Scanner sc = new Scanner ( System . in ) ; int [ ] m = new int [ 200 ] ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) m [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) X -= m [ i ] ; for ( int i = 0 ; i < N ; i ++ ) if ( m [ i ] < min ) min = m [ i ] ; sum = N + ( X / min ) ; System . out . println ( sum ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; int d = 0 ; ArrayList < ArrayList < Integer > > arraylist = new ArrayList < ArrayList < Integer > > ( N ) ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( arraylist . get ( i ) . size ( ) == 0 ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } System . out . println ( count ) ; } } +import javax . print . DocFlavor ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; String [ ] l = reader . readLine ( ) . split ( " " ) ; int s = 0 ; int sumsq = 0 ; for ( String t : l ) { System . out . println ( " [LOG] Block: int y = Integer.parseInt(t); \n s = s + y; \n sumsq += y * y; " ) ; int y = Integer . parseInt ( t ) ; s = s + y ; sumsq += y * y ; } int p = ( s / N ) ; System . out . println ( Math . min ( ( N * p * p - 2 * p * s + sumsq ) , ( N * ( p + 1 ) * ( p + 1 ) - 2 * ( p + 1 ) * s + sumsq ) ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; if ( n % 10 == 7 || n % 100 - n % 10 == 70 || n % 1000 - n % 100 == 700 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scan . close ( ) ; return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int h = sc.nextInt(); \n int m = sc.nextInt(); \n double Mangle = (m * 360.0) / 60.0; \n double Hangle = (h * 60.0 + m) * 360.0 / (12.0 * 60.0); \n double MHangle = 0; \n MHangle = Hangle - Mangle; \n double cosA = Math.cos(MHangle * (Math.PI / 180.0)); \n double answer = Math.sqrt((a * a) + (b * b) - (2 * a * b * cosA)); \n System.out.println(answer); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double Mangle = ( m * 360.0 ) / 60.0 ; double Hangle = ( h * 60.0 + m ) * 360.0 / ( 12.0 * 60.0 ) ; double MHangle = 0 ; MHangle = Hangle - Mangle ; double cosA = Math . cos ( MHangle * ( Math . PI / 180.0 ) ) ; double answer = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * cosA ) ) ; System . out . println ( answer ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); \n String[] str = in.readLine().split( \" \" ); \n int a = Integer.parseInt(str[0]); \n int b = Integer.parseInt(str[1]); \n int c = Integer.parseInt(str[2]); \n System.out.println(((a == b) && (b != c)) || ((b == c) && (c != a)) || ((c == a) && (a != b)) ? \" Yes \" : \" No \" ); " ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int c = Integer . parseInt ( str [ 2 ] ) ; System . out . println ( ( ( a == b ) && ( b != c ) ) || ( ( b == c ) && ( c != a ) ) || ( ( c == a ) && ( a != b ) ) ? " Yes " : " No " ) ; } } +import java . util . * ; class Main { 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; int c = 0 ; int d = 0 ; int score = 0 ; String x = " " ; a = sc . nextInt ( ) ; x = sc . next ( ) ; if ( x . length ( ) > a ) { System . out . println ( " [LOG] Block: x = x.substring(0, a) + \" ... \" ; " ) ; x = x . substring ( 0 , a ) + " ... " ; } System . out . print ( x ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String q = " Odd " ; if ( a % 2 == 0 || b % 2 == 0 ) { System . out . println ( " [LOG] Block: q = \" Even \" ; " ) ; q = " Even " ; } System . out . println ( q ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= 10 ; i ++ ) { if ( ( n - 1000 * i ) <= 0 ) { System . out . println ( " [LOG] Block: System.out.println((n - 1000 * i) * -1); \n break; " ) ; System . out . println ( ( n - 1000 * i ) * - 1 ) ; break ; } } } } +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 Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < Integer > heightsOfMountain = new ArrayList < Integer > ( ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { System . out . println ( " [LOG] Block: heightsOfMountain.add(Integer.valueOf(line)); " ) ; heightsOfMountain . add ( Integer . valueOf ( line ) ) ; } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( true ) { String s = in . nextLine ( ) ; if ( s . equals ( " 0 " ) ) return ; long ans = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: ans += Integer.parseInt( \" \" + s.charAt(i)); " ) ; ans += Integer . parseInt ( " " + s . charAt ( i ) ) ; } System . out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int i ; for ( i = 1 ; i <= n ; i ++ ) { if ( i > n ) break ; String x = String . valueOf ( i ) ; if ( ( ( i % 3 ) == 0 ) || ( ( i % 10 ) == 3 ) || ( ( i / 10 ) == 3 ) ) { System . out . println ( " [LOG] Block: System.out.print( \" \" + i); " ) ; System . out . print ( " " + i ) ; } else if ( x . contains ( " 3 " ) ) { System . out . println ( " [LOG] Block: System.out.print( \" \" + i); " ) ; System . out . print ( " " + i ) ; } } System . out . println ( ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int num = 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 < num ; i ++ ) { System . out . println ( " [LOG] Block: sb.append(str_1[i]); \n sb.append(str_2[i]); " ) ; sb . append ( str_1 [ i ] ) ; sb . append ( str_2 [ i ] ) ; } System . out . println ( sb ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int P = scanner . nextInt ( ) ; int Q = scanner . nextInt ( ) ; int R = scanner . nextInt ( ) ; int t = P + Q ; if ( t > R + P ) { t = R + P ; } if ( t > Q + R ) { System . out . println ( " [LOG] Block: t = Q + R; " ) ; t = Q + R ; } System . out . println ( t ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int l = S . length ( ) ; String a = " AC " ; int b = 0 ; int sum = 0 ; int [ ] x = new int [ l + 1 ] ; if ( S . charAt ( 0 ) != a . charAt ( 0 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); " ) ; System . out . println ( " WA " ) ; } else { for ( int i = 2 ; i <= l - 2 ; i ++ ) { if ( S . charAt ( i ) == a . charAt ( 1 ) ) { break ; } if ( i == l - 2 ) { System . out . println ( " WA " ) ; b = l - 2 ; } } if ( b != l - 2 ) { String US = S . toUpperCase ( ) ; for ( int i = 0 ; i < l ; 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 ( " [LOG] Block: System.out.println( \" WA \" ); " ) ; System . out . println ( " WA " ) ; } } } } } +import java . util . Scanner ; class Main { 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 ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n System.out.println(gcd(a, b)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( gcd ( a , b ) ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int len = ( A < B ) ? A : B ; List r = new ArrayList < Integer > ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { System . out . println ( " [LOG] Block: if (A % i == 0 && B % i == 0) \n r.add(i); " ) ; if ( A % i == 0 && B % i == 0 ) r . add ( i ) ; } System . out . println ( r . get ( r . size ( ) - K ) ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int x = 1 ; int i = 0 ; while ( true ) { x = sc . nextInt ( ) ; i ++ ; if ( x == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . println ( " Case " + i + " : " + x ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] data = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { data [ i ] = sc . nextInt ( ) ; } int K = sc . nextInt ( ) ; int maxIdx = 0 ; int max = data [ 0 ] ; for ( int i = 1 ; i < 3 ; i ++ ) { if ( max < data [ i ] ) { max = data [ i ] ; maxIdx = i ; } } for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: data[maxIdx] *= 2; " ) ; data [ maxIdx ] *= 2 ; } System . out . println ( data [ 0 ] + data [ 1 ] + data [ 2 ] ) ; sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] arge ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int men = a * b; \n int syu = (a + b) * 2; \n System.out.print(men); \n System.out.println( \" \" + syu); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int men = a * b ; int syu = ( a + b ) * 2 ; System . out . print ( men ) ; System . out . println ( " " + syu ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = 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 > X ) { break ; } if ( max < exp ) { System . out . println ( " [LOG] Block: max = (int) exp; " ) ; max = ( int ) exp ; } } } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int count = 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' ) { count ++ ; if ( max <= count ) { max = count ; } } else { System . out . println ( " [LOG] Block: count = 0; " ) ; count = 0 ; } } System . out . println ( max ) ; } } +import java . io . * ; public class Main { 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 n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int [ ] [ ] matrix = new int [ n ] [ m ] ; int [ ] vector = new int [ m ] ; int [ ] result = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { for ( int k = 0 ; k < m ; k ++ ) { result [ i ] += matrix [ i ] [ k ] * vector [ k ] ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(result[i]); " ) ; System . out . println ( result [ i ] ) ; } } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String in = br.readLine(); \n double x = Math.pow(Integer.parseInt(in), 3); \n System.out.println((int) x); \n br.close(); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( in ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean ans = false ; for ( int i = 0 ; i <= n / 7 ; i ++ ) { if ( ( n - i * 7 ) % 4 == 0 ) { ans = true ; break ; } } if ( ans == true ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int start ; int end ; if ( a < c ) { start = c ; } else { start = a ; } if ( b < d ) { end = b ; } else { end = d ; } if ( start < end ) { System . out . println ( end - start ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" 0 \" ); " ) ; System . out . println ( " 0 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . next ( ) ) ; int Y = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; for ( int x = 0 ; x <= N ; x ++ ) { for ( int y = 0 ; y <= N ; y ++ ) { int z = N - x - y ; if ( z < 0 ) continue ; if ( ( x * 10000 + y * 5000 + z * 1000 ) == Y ) { System . out . println ( " [LOG] Block: System.out.println(String.format( \" %d %d %d \" , x, y, z)); \n return; " ) ; System . out . println ( String . format ( " %d %d %d " , x , y , z ) ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int d = sc.nextInt(); \n int f = sc.nextInt(); \n int t = sc.nextInt(); \n System.out.println(d <= f * t ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; System . out . println ( d <= f * t ? " Yes " : " No " ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int H = in . nextInt ( ) ; int A = in . nextInt ( ) ; out . println ( ( int ) Math . ceil ( H / ( double ) A ) ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . Scanner ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int [ ] sort = { a , b , c } ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < 2 - i ; j ++ ) { if ( sort [ j ] < sort [ j + 1 ] ) { System . out . println ( " [LOG] Block: int temp = sort[j]; \n sort[j] = sort[j + 1]; \n sort[j + 1] = temp; " ) ; int temp = sort [ j ] ; sort [ j ] = sort [ j + 1 ] ; sort [ j + 1 ] = temp ; } } } System . out . println ( sort [ 2 ] + " " + sort [ 1 ] + " " + sort [ 0 ] ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; public class Main { 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 n = Integer . valueOf ( arr01 [ 0 ] ) ; String [ ] arr_result = new String [ n ] ; Arrays . fill ( arr_result , " 0 " ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { System . out . println ( " [LOG] Block: int a = Integer.valueOf(arr02[i - 1]); \n int val = Integer.valueOf(arr_result[a - 1]); \n arr_result[a - 1] = String.valueOf(val + 1); " ) ; 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 . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " / " ) ; int y = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; if ( y > 2019 || ( y <= 2019 && m > 4 ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Heisei \" ); " ) ; System . out . println ( " Heisei " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = Integer . parseInt ( String . valueOf ( a ) + String . valueOf ( b ) ) ; for ( int i = 1 ; i < 330 ; i ++ ) { if ( i * i == n ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +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 Main { 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 N = in . nextInt ( ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: step = i - 1; " ) ; step = i - 1 ; } } out . println ( " Yes " ) ; } } +import java . util . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int count = 0 ; int a = 0 ; for ( int i = 1 ; i <= num ; i ++ ) { a = i % 2 ; if ( a == 1 ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } double prob = ( double ) count / num ; System . out . println ( prob ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] in = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { in [ i ] = sc . nextInt ( ) ; } int count = 0 ; int ans = 0 ; for ( int i = 0 ; i < a - 1 ; i ++ ) { if ( in [ i ] >= in [ i + 1 ] ) { count ++ ; } else { ans = Math . max ( ans , count ) ; count = 0 ; } if ( i == a - 2 ) { System . out . println ( " [LOG] Block: ans = Math.max(ans, count); " ) ; ans = Math . max ( ans , count ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; int cnt = 0 ; boolean a = num > 99 ; if ( a ) { cnt ++ ; num = num - 100 ; } boolean b = num > 9 ; if ( b ) { num = num - 10 ; cnt ++ ; } boolean c = num == 1 ; if ( c ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] res = new int [ N ] ; for ( int i = 0 ; i < res . length - 1 ; i ++ ) { int index = sc . nextInt ( ) - 1 ; res [ index ] ++ ; } for ( int i : res ) { System . out . println ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { 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 i = 0 ; i < s . length ; i ++ ) { concat = s [ s . length - 1 ] ; for ( int j = 0 ; j < s . length - 1 ; j ++ ) { concat += s [ j ] ; } if ( concat . equals ( t ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } s = concat . split ( " " ) ; } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; s = s . replace ( " eraser " , " " ) . replace ( " erase " , " " ) . replace ( " dreamer " , " " ) . replace ( " dream " , " " ) ; if ( s . equals ( " " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Question question = new Question ( ) ; question . solve ( sc ) ; } static class Question { public void solve ( Scanner sc ) { int len = 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 ) { System . out . println ( " [LOG] Block: int t = (i + 1) % n; \n int dist = distances[t] - distances[i]; \n m = Math.max(m, Math.min(Math.abs(dist), len - Math.abs(dist))); " ) ; int t = ( i + 1 ) % n ; int dist = distances [ t ] - distances [ i ] ; m = Math . max ( m , Math . min ( Math . abs ( dist ) , len - Math . abs ( dist ) ) ) ; } System . out . println ( len - m ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; for ( ; ; ) { int n = scan . nextInt ( ) ; double sum = 0 ; double m = 0 ; if ( n == 0 ) break ; double [ ] s = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = scan . nextDouble ( ) ; sum += s [ i ] ; } m = ( double ) sum / n ; double a = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a += ( s [ i ] - m ) * ( s [ i ] - m ) ; } double ans = Math . sqrt ( a / n ) ; if ( ans >= 0 ) { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } } +import java . util . * ; class Rectangle { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int a = sc . nextInt ( ) ; final int b = sc . nextInt ( ) ; System . out . printf ( " %d %d \n " , a * b , ( a + b ) * 2 ) ; } } public class Main { public static void main ( String ... args ) { System . out . println ( " [LOG] Block: Rectangle.main(); " ) ; Rectangle . main ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; int [ ] DP = new int [ n + 1 ] ; Arrays . fill ( DP , Integer . MAX_VALUE ) ; DP [ 0 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - 2 ; i ++ ) { System . out . println ( " [LOG] Block: DP[i + 1] = Math.min(DP[i + 1], DP[i] + Math.abs(array[i + 1] - array[i])); \n DP[i + 2] = Math.min(DP[i + 2], DP[i] + Math.abs(array[i + 2] - array[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 [ n - 1 ] = Math . min ( DP [ n - 1 ] , DP [ n - 2 ] + Math . abs ( array [ n - 1 ] - array [ n - 2 ] ) ) ; System . out . println ( DP [ n - 1 ] ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { 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 n = Integer . parseInt ( br . readLine ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; char [ ] c1 = st . nextToken ( ) . toCharArray ( ) ; char [ ] c2 = st . nextToken ( ) . toCharArray ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: pw.print(c1[i]); \n pw.print(c2[i]); " ) ; pw . print ( c1 [ i ] ) ; pw . print ( c2 [ i ] ) ; } pw . flush ( ) ; pw . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long min = Long . MAX_VALUE ; int cnt = 0 ; if ( r - l >= 2018 ) { System . out . println ( 0 ) ; return ; } for ( long i = l ; i < r ; i ++ ) { for ( long j = i + 1 ; j <= r ; j ++ ) { System . out . println ( " [LOG] Block: cnt++; \n min = Math.min((i * j) % 2019, min); " ) ; cnt ++ ; min = Math . min ( ( i * j ) % 2019 , min ) ; } if ( min == 0 ) break ; } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int X = sc.nextInt(); \n int Y = sc.nextInt(); \n int Z = sc.nextInt(); \n System.out.printf( \" %d %d %d \" , Z, X, Y); " ) ; Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int Z = sc . nextInt ( ) ; System . out . printf ( " %d %d %d " , Z , X , Y ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 ) { System . out . println ( " [LOG] Block: cost_n++; " ) ; cost_n ++ ; } } System . out . println ( Math . min ( cost_n , m - cost_n ) ) ; } } +import java . io . * ; import java . util . * ; public class Main 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 N = sc . nextInt ( ) ; if ( N > 50 ) { N = 50 ; } String S = sc . next ( ) ; int Y = 0 ; int U = 0 ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: Y = 0; " ) ; Y = 0 ; } } else if ( Y == 2 ) { if ( S . charAt ( i ) == 'C' ) { Y = 0 ; U ++ ; } else if ( S . charAt ( i ) == 'C' ) { Y = 1 ; } else { System . out . println ( " [LOG] Block: Y = 0; " ) ; Y = 0 ; } } } print ( U ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); \n String s = buf.readLine(); \n int x = Integer.parseInt(s); \n int res = x * x * x; \n System.out.println(res); " ) ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = buf . readLine ( ) ; int x = Integer . parseInt ( s ) ; int res = x * x * x ; System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = Integer . parseInt ( scan . next ( ) ) ; int 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 <= N ; i ++ ) { H = Integer . parseInt ( scan . next ( ) ) ; temp = T * 1000 - H * 6 - A * 1000 ; if ( temp < 0 ) temp = - temp ; if ( temp < cc ) { System . out . println ( " [LOG] Block: cc = temp; \n res = i; " ) ; cc = temp ; res = i ; } } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } long prod = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( 1000000000000000000l / prod < a [ i ] ) { System . out . println ( - 1 ) ; return ; } else { System . out . println ( " [LOG] Block: prod *= a[i]; " ) ; prod *= a [ i ] ; } } System . out . println ( prod ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long a = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long c = scan . nextLong ( ) ; long d = scan . nextLong ( ) ; scan . close ( ) ; long numC = b / c - ( a - 1 ) / c ; long numD = b / d - ( a - 1 ) / d ; long lcmCD = lcm ( c , d ) ; long numCD = b / lcmCD - ( a - 1 ) / lcmCD ; System . out . println ( b - a + 1 - numC - numD + numCD ) ; } public static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } public static long gcd ( long a , long b ) { if ( a < b ) { return gcd ( b , a ) ; } if ( b == 0 ) { System . out . println ( " [LOG] Block: return a; " ) ; return a ; } return gcd ( b , a % b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long startTime = 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 ) { System . out . println ( " [LOG] Block: i = ii; \n j = (thing / ii); " ) ; i = ii ; j = ( thing / ii ) ; } } System . out . println ( i + j - 2 ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { int num = 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 ) { System . out . println ( " [LOG] Block: n /= k; \n count++; " ) ; n /= k ; count ++ ; } out . println ( count ) ; out . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int min = 0 ; int min2 = 0 ; if ( a < b ) { min = a ; if ( b < c ) { min2 = b ; } else { System . out . println ( " [LOG] Block: min2 = c; " ) ; min2 = c ; } } else { min = b ; if ( a < c ) { min2 = a ; } else { System . out . println ( " [LOG] Block: min2 = c; " ) ; min2 = c ; } } System . out . println ( min + min2 ) ; } } +import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Iterator ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > list = new ArrayList < > ( ) ; ArrayList < String > anslist = new ArrayList < > ( ) ; int n = sc . nextInt ( ) ; String [ ] a = new String [ n ] ; int max = 1 ; int count = 1 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . next ( ) ; list . add ( a [ i ] ) ; } Collections . sort ( list ) ; for ( int j = 1 ; j < n ; j ++ ) { if ( list . get ( j - 1 ) . equals ( list . get ( j ) ) ) { count ++ ; if ( j == n - 1 ) max = Math . max ( max , count ) ; } else { max = Math . max ( max , count ) ; count = 1 ; } } for ( int x = 0 ; x < n - 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 ( " [LOG] Block: System.out.println(it.next()); " ) ; System . out . println ( it . next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( Math . min ( p [ i - 1 ] , p [ i ] ) == p [ i ] ) { if ( Math . min ( p [ i ] , p [ i + 1 ] ) == p [ i + 1 ] ) { System . out . println ( " [LOG] Block: cnt += 1; " ) ; cnt += 1 ; } } else { if ( Math . min ( p [ i ] , p [ i + 1 ] ) == p [ i ] ) { System . out . println ( " [LOG] Block: cnt += 1; " ) ; cnt += 1 ; } } } System . out . println ( cnt ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final long W = 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 > W || y - r < 0 || y + r > H ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] d = new int [ n ] ; List < Integer > list = new ArrayList < > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = stdIn . nextInt ( ) ; if ( ! list . contains ( a ) ) { System . out . println ( " [LOG] Block: list.add(a); \n cnt++; " ) ; list . add ( a ) ; cnt ++ ; } } System . out . println ( cnt ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BBounding solver = new BBounding ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BBounding { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int x = in . nextInt ( ) ; int d = 0 ; int best = 1 ; for ( int i = 0 ; i < n ; i ++ ) { d += in . nextInt ( ) ; if ( d > x ) { System . out . println ( " [LOG] Block: best = i + 1; \n break; " ) ; best = i + 1 ; break ; } if ( i == n - 1 ) best = n + 1 ; } out . println ( best ) ; } } } +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 Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 0 ; if ( n % 2 == 1 ) { count ++ ; } char [ ] work = new char [ s . length ( ) ] ; for ( int i = 0 ; i < n ; i ++ ) { work [ i ] = s . charAt ( i ) ; } for ( int i = 0 ; i < n / 2 ; i ++ ) { if ( work [ i ] == work [ i + n / 2 ] ) { } else { count ++ ; } } if ( count == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int years = scan . nextInt ( ) ; int money = scan . nextInt ( ) ; if ( years >= 13 ) { System . out . print ( money ) ; } else if ( years >= 6 ) { System . out . print ( money / 2 ) ; } else if ( years >= 0 ) { System . out . println ( " [LOG] Block: System.out.print(0); " ) ; System . out . print ( 0 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int[] d = new int[3]; \n d[0] = a; \n d[1] = b; \n d[2] = c; \n Arrays.sort(d); \n if ((d[0] == 5 && d[1] == 5) && d[2] == 7) \n System.out.println( \" YES \" ); \n else \n System.out.println( \" NO \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] d = new int [ 3 ] ; d [ 0 ] = a ; d [ 1 ] = b ; d [ 2 ] = c ; Arrays . sort ( d ) ; if ( ( d [ 0 ] == 5 && d [ 1 ] == 5 ) && d [ 2 ] == 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 100000 ; for ( int i = 0 ; i < n ; i ++ ) { sum += Main . DeptMaker ( sum ) ; } System . out . println ( sum ) ; } private static int DeptMaker ( int sum ) { System . out . println ( " [LOG] Block: int dept = (int) Math.ceil((sum * 0.05) / 1000) * 1000; \n return dept; " ) ; int dept = ( int ) Math . ceil ( ( sum * 0.05 ) / 1000 ) * 1000 ; return dept ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; final int MOD = 1000000007 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; 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 ) { System . out . println ( " [LOG] Block: new Main().doIt(); " ) ; new Main ( ) . doIt ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int sum = 0 ; int count = 0 ; while ( sum <= N ) { System . out . println ( " [LOG] Block: count++; \n sum = (int) Math.pow(2, count); " ) ; count ++ ; sum = ( int ) Math . pow ( 2 , count ) ; } System . out . println ( ( int ) Math . pow ( 2 , count - 1 ) ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int word = scan . nextInt ( ) ; int last = word % 100 ; int first = ( word - 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 { System . out . println ( " [LOG] Block: return 0; " ) ; return 0 ; } } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ans = a * ( n / ( a + b ) ) ; n %= ( a + b ) ; if ( n >= a ) { System . out . println ( ans + a ) ; } else { System . out . println ( " [LOG] Block: System.out.println(ans + n); " ) ; System . out . println ( ans + n ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int A = sc.nextInt(); \n int B = sc.nextInt(); \n int C = sc.nextInt(); \n System.out.println(((A == 5 && B == 5 && C == 7) || (A == 5 && B == 7 && C == 5) || (A == 7 && B == 5 && C == 5)) ? \" YES \" : \" NO \" ); " ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( ( ( A == 5 && B == 5 && C == 7 ) || ( A == 5 && B == 7 && C == 5 ) || ( A == 7 && B == 5 && C == 5 ) ) ? " YES " : " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] A = new int [ 2 ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ 0 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { A [ 1 ] [ i ] = sc . nextInt ( ) ; } int ans ; int tempofans = 0 ; int num = 0 ; for ( int k = 0 ; k < N ; k ++ ) { num = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( j <= k ) { num += A [ 0 ] [ j ] ; } if ( j >= k ) { num += A [ 1 ] [ j ] ; } } if ( num > tempofans ) { System . out . println ( " [LOG] Block: tempofans = num; " ) ; tempofans = num ; } } ans = tempofans ; System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; Integer [ ] tmpA = new Integer [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( a [ i ] == first ) { System . out . println ( second ) ; } else { System . out . println ( " [LOG] Block: System.out.println(first); " ) ; System . out . println ( first ) ; } } sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int P , Q , R ; int max = 0 ; P = sc . nextInt ( ) ; Q = sc . nextInt ( ) ; R = sc . nextInt ( ) ; if ( P >= Q ) { if ( P >= R ) { max = Q + R ; } else { max = P + Q ; } } else if ( Q >= R ) { if ( Q >= P ) { System . out . println ( " [LOG] Block: max = P + R; " ) ; max = P + R ; } else { max = Q + R ; } } else if ( R >= P ) { if ( R >= Q ) { max = P + Q ; } else { System . out . println ( " [LOG] Block: max = P + R; " ) ; max = P + R ; } } System . out . println ( max ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { num [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; Arrays . sort ( num ) ; for ( int i = 1 ; i <= k ; i ++ ) { num [ 2 ] *= 2 ; } int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: sum += num[i]; " ) ; sum += num [ i ] ; } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { boolean flag = true ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a >= b ) { System . out . println ( " [LOG] Block: flag = false; " ) ; flag = false ; } int c = sc . nextInt ( ) ; if ( b >= c ) { System . out . println ( " [LOG] Block: flag = false; " ) ; flag = false ; } System . out . println ( flag == true ? " Yes " : " No " ) ; } } +import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); \n BufferedReader in = new BufferedReader(reader); \n char[] str = in.readLine().toCharArray(); \n str[3] = '8'; \n String s = new String(str); \n System.out.println(s); " ) ; InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; char [ ] str = in . readLine ( ) . toCharArray ( ) ; str [ 3 ] = '8' ; String s = new String ( str ) ; System . out . println ( s ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] a ) { Scanner scan = new Scanner ( System . in ) ; String [ ] t = scan . nextLine ( ) . split ( " \\ s " ) ; int people = Integer . parseInt ( t [ 0 ] ) ; int ht = Integer . parseInt ( t [ 1 ] ) ; int count = 0 ; while ( scan . hasNextInt ( ) ) { int memHt = scan . nextInt ( ) ; if ( memHt >= ht ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s , t ; int con ; s = scan . next ( ) ; t = scan . next ( ) ; con = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) == t.charAt(i)) \n con += 1; " ) ; if ( s . charAt ( i ) == t . charAt ( i ) ) con += 1 ; } System . out . println ( con ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; StringTokenizer stk = new StringTokenizer ( in . readLine ( ) ) ; String s = stk . nextToken ( ) ; String abc = " ABC " ; int cnt = 0 ; for ( int i = 0 ; i + 3 <= n ; i ++ ) { System . out . println ( " [LOG] Block: if (s.substring(i, i + 3).equals(abc)) \n cnt++; " ) ; if ( s . substring ( i , i + 3 ) . equals ( abc ) ) cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long H = sc.nextLong(); \n long num = 2; \n while (num <= H) num *= 2; \n System.out.println(num - 1); " ) ; Scanner sc = new Scanner ( System . in ) ; long H = sc . nextLong ( ) ; long num = 2 ; while ( num <= H ) num *= 2 ; System . out . println ( num - 1 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: FastReader obj = new FastReader(); \n String s1 = obj.next(), s2 = obj.next(); \n int sn1 = obj.nextInt(), sn2 = obj.nextInt(); \n String t = obj.next(); \n if (t.equals(s1)) \n sn1--; \n else \n sn2--; \n System.out.println(sn1 + \" \" + sn2); " ) ; FastReader obj = new FastReader ( ) ; String s1 = obj . next ( ) , s2 = obj . next ( ) ; int sn1 = obj . nextInt ( ) , sn2 = obj . nextInt ( ) ; String t = obj . next ( ) ; if ( t . equals ( s1 ) ) sn1 -- ; else sn2 -- ; System . out . println ( sn1 + " " + sn2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) { double p = 1 ; int tmp = i ; while ( tmp < k ) { System . out . println ( " [LOG] Block: p *= 0.5; \n tmp *= 2; " ) ; p *= 0.5 ; tmp *= 2 ; } ans += p / n ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int tmp = Integer . parseInt ( sc . next ( ) ) ; ans [ tmp - 1 ] = i + 1 ; } for ( int i : ans ) { System . out . println ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { private static int total = 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 . total ) ; } public static void me ( int [ ] nums ) { int min = Integer . MAX_VALUE ; for ( int num : nums ) { min = num < min ? num : min ; } Main . total += min ; int ti = 0 ; int i ; for ( i = 0 ; i < nums . length ; i ++ ) { nums [ i ] -= min ; if ( nums [ i ] == 0 ) { if ( ti < i ) { System . out . println ( " [LOG] Block: me(Arrays.copyOfRange(nums, ti, i)); " ) ; me ( Arrays . copyOfRange ( nums , ti , i ) ) ; } ti = i + 1 ; } } if ( ti < i ) { System . out . println ( " [LOG] Block: me(Arrays.copyOfRange(nums, ti, i)); " ) ; me ( Arrays . copyOfRange ( nums , ti , i ) ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdIn = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int inCnt = 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 ( ++ inCnt , in1 , in2 ) ; } System . exit ( 0 ) ; } private static void doMain ( int inCnt , int in1 , int in2 ) { System . out . println ( " [LOG] Block: if (in1 < in2) \n System.out.println(in1 + \" \" + in2); \n else \n System.out.println(in2 + \" \" + in1); " ) ; if ( in1 < in2 ) System . out . println ( in1 + " " + in2 ) ; else System . out . println ( in2 + " " + in1 ) ; } } +import java . util . * ; import java . util . stream . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long h = sc . nextLong ( ) ; long ans = 1 ; long count = 1 ; while ( h > 1 ) { System . out . println ( " [LOG] Block: h = h / 2; \n ans += Math.pow(2, count); \n count++; " ) ; h = h / 2 ; ans += Math . pow ( 2 , count ) ; count ++ ; } System . out . println ( ans ) ; } } +import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int tap = 1 ; int atap = 0 ; while ( tap < b ) { System . out . println ( " [LOG] Block: tap--; \n tap += a; \n atap++; " ) ; tap -- ; tap += a ; atap ++ ; } System . out . println ( atap ) ; } } +import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = 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 ( " [LOG] Block: System.out.println(b); " ) ; System . out . println ( b ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z = sc . nextInt ( ) ; int j = 0 ; while ( x <= y ) { if ( z % x == 0 ) { System . out . println ( " [LOG] Block: j++; " ) ; j ++ ; } x ++ ; } System . out . println ( j ) ; sc . close ( ) ; } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" DENIED \" ); " ) ; System . out . println ( " DENIED " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { map . put ( Integer . parseInt ( sc . next ( ) ) , i ) ; } StringBuilder builder = new StringBuilder ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { System . out . println ( " [LOG] Block: builder.append(map.get(i)).append( \" \" ); " ) ; builder . append ( map . get ( i ) ) . append ( " " ) ; } System . out . println ( builder . toString ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int [ ] b = new int [ n + 1 ] ; int [ ] c = new int [ n ] ; String dm = " " ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: ans += b[a[i]]; \n if (i < n && a[i + 1] == a[i] + 1) \n ans += c[a[i]]; " ) ; ans += b [ a [ i ] ] ; if ( i < n && a [ i + 1 ] == a [ i ] + 1 ) ans += c [ a [ i ] ] ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int result = 0 ; if ( A == B ) { result = A + B ; } else if ( A > B ) { result = A + A - 1 ; } else if ( B > A ) { System . out . println ( " [LOG] Block: result = B + B - 1; " ) ; result = B + B - 1 ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int T_hp = 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 ( T_hp > 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 ) { T_hp = T_hp - A_attack ; T_turn = 1 ; A_turn = 0 ; } } if ( T_hp > 0 ) { System . out . println ( " Yes " ) ; } else if ( T_hp <= 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; import java . io . PrintWriter ; import static java . lang . Integer . * ; import static java . lang . Long . * ; import static java . lang . Math . * ; import static java . lang . System . * ; public class Main { public static int MAX = 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 ) { System . out . println ( " [LOG] Block: ans = x; \n break; " ) ; ans = x ; break ; } x += 2 ; } } out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] tmp = br . readLine ( ) . split ( " " ) ; int N = 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 ( " [LOG] Block: System.out.println(max - min + 1); " ) ; System . out . println ( max - min + 1 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ns = sc . next ( ) ; String [ ] s = ns . split ( " " ) ; int count = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( Integer . parseInt ( s [ i ] ) == 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder builder = new StringBuilder ( ) ; while ( true ) { String [ ] data = reader . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( data [ 0 ] ) ; int b = Integer . parseInt ( data [ 1 ] ) ; if ( a == 0 && b == 0 ) break ; for ( int y = 0 ; y < a ; y ++ ) { for ( int x = 0 ; x < b ; x ++ ) { System . out . println ( " [LOG] Block: builder.append( \" # \" ); " ) ; builder . append ( " # " ) ; } builder . append ( " \n " ) ; } builder . append ( " \n " ) ; } System . out . print ( builder ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int n = sc.nextInt(); \n int k = sc.nextInt(); \n String s = sc.next(); \n String tmp = null; \n switch(s.substring(k - 1, k)) { \n case \" A \" : \n tmp = \" a \" ; \n break; \n case \" B \" : \n tmp = \" b \" ; \n break; \n case \" C \" : \n tmp = \" c \" ; \n break; \n } \n System.out.println(s.substring(0, k - 1) + tmp + s.substring(k)); " ) ; int n = 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 . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextInt ( ) ; int count = 0 ; boolean flag = false ; int j = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == j ) { j ++ ; flag = true ; } else count ++ ; } if ( flag ) System . out . println ( count ) ; else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n long res = 0; \n for (int i = 1; i <= n; i++) if (String.valueOf(i).length() % 2 == 1) \n res++; \n System.out.println(res); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( String . valueOf ( i ) . length ( ) % 2 == 1 ) res ++ ; System . out . println ( res ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Stack ; public class Main { 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 a = 0 ; int b = 0 ; for ( int i = 0 ; i < inputArray . length ; i ++ ) { if ( inputArray [ i ] . equals ( " + " ) ) { a = stack . pop ( ) ; b = stack . pop ( ) ; stack . add ( b + a ) ; continue ; } if ( inputArray [ i ] . equals ( " - " ) ) { a = stack . pop ( ) ; b = stack . pop ( ) ; stack . add ( b - a ) ; continue ; } if ( inputArray [ i ] . equals ( " * " ) ) { System . out . println ( " [LOG] Block: a = stack.pop(); \n b = stack.pop(); \n stack.add(b * a); \n continue; " ) ; a = stack . pop ( ) ; b = stack . pop ( ) ; stack . add ( b * a ) ; continue ; } stack . push ( Integer . parseInt ( inputArray [ i ] ) ) ; } System . out . println ( stack . pop ( ) ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; String s = sc . next ( ) ; int ans = 0 ; int run = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == 'R' ) { run ++ ; } else { ans = Math . max ( ans , run ) ; run = 0 ; } } ans = Math . max ( ans , run ) ; out . println ( ans ) ; out . close ( ) ; } public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; int 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 < N ; i ++ ) { int result = 0 ; for ( int j = 0 ; j < M ; j ++ ) { result += sc . nextInt ( ) * BArray [ j ] ; } if ( 0 < ( result + C ) ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } sc . nextLine ( ) ; } System . out . println ( answer ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; char [ ] S = scanner . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < S . length ; i ++ ) { if ( ( i + 1 ) % 2 == 1 ) { if ( S [ i ] == 'L' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } else { if ( S [ i ] == 'R' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 < n ; i ++ ) { int a = 0 ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: a += sc.nextInt() * b[j]; " ) ; a += sc . nextInt ( ) * b [ j ] ; } a += c ; if ( a > 0 ) crt ++ ; } System . out . print ( crt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int ans = 0 ; Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . nextLine ( ) . toCharArray ( ) ; for ( int cnt = 0 ; cnt < s . length ; cnt ++ ) { if ( s [ cnt ] == '1' ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n char[] c = s.toCharArray(); \n c[3] = '8'; \n String st = new String(c); \n System.out.println(st); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; c [ 3 ] = '8' ; String st = new String ( c ) ; System . out . println ( st ) ; } } +import java . util . Scanner ; public class Main { public static int cost ( int a , int b , int c ) { int cost = 0 ; cost = cost + Math . abs ( b - a ) + Math . abs ( c - b ) ; return ( cost ) ; } 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 ] = cost ( A , B , C ) ; costSum [ 1 ] = cost ( A , C , B ) ; costSum [ 2 ] = cost ( B , A , C ) ; costSum [ 3 ] = cost ( B , C , A ) ; costSum [ 4 ] = cost ( C , A , B ) ; costSum [ 5 ] = cost ( C , B , A ) ; int min = costSum [ 0 ] ; for ( int i = 0 ; i < costSum . length ; i ++ ) { if ( min > costSum [ i ] ) { System . out . println ( " [LOG] Block: min = costSum[i]; " ) ; min = costSum [ i ] ; } } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = Integer . parseInt ( scanner . next ( ) ) ; int B = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; if ( A == 1 && B == 2 ) { System . out . println ( " 3 " ) ; } else if ( A == 1 && B == 3 ) { System . out . println ( " 2 " ) ; } else if ( A == 2 && B == 1 ) { System . out . println ( " 3 " ) ; } else if ( A == 2 && B == 3 ) { System . out . println ( " [LOG] Block: System.out.println( \" 1 \" ); " ) ; System . out . println ( " 1 " ) ; } else if ( A == 3 && B == 1 ) { System . out . println ( " 2 " ) ; } else if ( A == 3 && B == 2 ) { System . out . println ( " [LOG] Block: System.out.println( \" 1 \" ); " ) ; System . out . println ( " 1 " ) ; } } } +import java . util . Scanner ; public class Main { static long bignum = 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 ) { System . out . println ( " [LOG] Block: if (a < 0) \n a += 1000000000 + 7; \n return a % (1000000000 + 7); " ) ; if ( a < 0 ) a += 1000000000 + 7 ; return a % ( 1000000000 + 7 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String a = br . readLine ( ) ; int aCount = 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 ( aCount >= a . length ( ) ) { System . out . println ( " A " ) ; break ; } now = a . substring ( aCount , aCount + 1 ) ; aCount ++ ; } 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { StringBuilder sb = new StringBuilder ( ) ; Scanner as = new Scanner ( System . in ) ; int N = 0 ; int tre = 0 ; int count = 0 ; int [ ] A ; Boolean flag = true ; N = Integer . parseInt ( as . next ( ) ) ; A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = Integer . parseInt ( as . next ( ) ) ; } while ( flag ) { flag = false ; for ( int j = N - 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 < N ; i ++ ) { if ( i != N - 1 ) { sb . append ( A [ i ] ) . append ( ' ' ) ; } else { System . out . println ( " [LOG] Block: sb.append(A[i]); " ) ; sb . append ( A [ i ] ) ; } } System . out . println ( sb . toString ( ) ) ; sb . setLength ( 0 ) ; sb . append ( count ) ; System . out . println ( sb . toString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int target = 0 ; int kekka = 10000 ; while ( target < 10000 ) { if ( ( int ) Math . floor ( ( double ) target * 0.08 ) == A && ( int ) Math . floor ( ( double ) target * 0.1 ) == B ) { System . out . println ( target ) ; break ; } else { target = target + 1 ; } } if ( target == 10000 ) { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int 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 == A && b_tax == B ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] argsp ) { Scanner sc = new Scanner ( System . in ) ; int a = 0 ; String s = sc . next ( ) , t = sc . next ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) { System . out . println ( " [LOG] Block: a++; " ) ; a ++ ; } } System . out . print ( a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String answer = " Good " ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( i + 1 ) ) { System . out . println ( " [LOG] Block: answer = \" Bad \" ; \n break; " ) ; answer = " Bad " ; break ; } } System . out . println ( answer ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; System . out . println ( lcm ( A , 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 ) { System . out . println ( " [LOG] Block: return a * b / gcd(a, b); " ) ; return a * b / gcd ( a , b ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int [ ] [ ] table = new int [ x + 1 ] [ y + 1 ] ; for ( int i = 0 ; i < x ; i ++ ) { for ( int j = 0 ; j < y ; j ++ ) { table [ i ] [ j ] = sc . nextInt ( ) ; table [ i ] [ y ] += table [ i ] [ j ] ; table [ x ] [ j ] += table [ i ] [ j ] ; table [ x ] [ y ] += table [ i ] [ j ] ; } } for ( int i = 0 ; i < x + 1 ; i ++ ) { for ( int j = 0 ; j < y + 1 ; j ++ ) { System . out . print ( table [ i ] [ j ] ) ; if ( j != y ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String answer = " " ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( String . valueOf ( str . charAt ( i ) ) . equals ( " B " ) && answer . length ( ) != 0 ) { answer = answer . substring ( 0 , answer . length ( ) - 1 ) ; } else if ( String . valueOf ( str . charAt ( i ) ) . equals ( " 0 " ) || String . valueOf ( str . charAt ( i ) ) . equals ( " 1 " ) ) { System . out . println ( " [LOG] Block: answer = answer + str.charAt(i); " ) ; answer = answer + str . charAt ( i ) ; } } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = 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 ( N == a ) { flag = true ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int y = stdIn . nextInt ( ) ; if ( c - 0.5 * a - 0.5 * b > 0 ) { System . out . println ( a * 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 ( a * ( x - y ) + 2 * c * y <= 2 * c * x ) { System . out . println ( a * ( x - y ) + 2 * c * y ) ; } else { System . out . println ( " [LOG] Block: System.out.println(2 * c * x); " ) ; System . out . println ( 2 * c * x ) ; } } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a , b , w ; String str ; String [ ] s ; str = br . readLine ( ) ; while ( str != null ) { System . out . println ( " [LOG] Block: StringBuilder out = new StringBuilder(); \n s = str.split( \" \" ); \n a = Integer.parseInt(s[0]); \n b = Integer.parseInt(s[1]); \n w = a + b; \n out.append(w); \n System.out.println(out.length()); \n str = br.readLine(); " ) ; StringBuilder out = new StringBuilder ( ) ; s = str . split ( " " ) ; a = Integer . parseInt ( s [ 0 ] ) ; b = Integer . parseInt ( s [ 1 ] ) ; w = a + b ; out . append ( w ) ; System . out . println ( out . length ( ) ) ; str = br . readLine ( ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int num ; int i = 1 ; while ( true ) { num = scan . nextInt ( ) ; ; if ( num != 0 ) { System . out . println ( " Case " + " " + i + " : " + " " + num ) ; i ++ ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < 2 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[i] + \" \" ); " ) ; System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ 2 ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int num = 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 ( " [LOG] Block: System.out.println( \" Yay! \" ); " ) ; System . out . println ( " Yay! " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] x = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) x [ i ] = sc . nextInt ( ) ; Arrays . sort ( x ) ; int alice = 0 ; int bob = 0 ; if ( N % 2 == 0 ) { for ( int i = N - 1 ; i >= 0 ; i -= 2 ) { alice += x [ i ] ; bob += x [ i - 1 ] ; } } if ( N % 2 != 0 ) { if ( N == 1 ) alice += x [ 0 ] ; else { System . out . println ( " [LOG] Block: for (int i = 0; i < N; i += 2) alice += x[i]; \n for (int i = 1; i < N; i += 2) bob += x[i]; " ) ; for ( int i = 0 ; i < N ; i += 2 ) alice += x [ i ] ; for ( int i = 1 ; i < N ; i += 2 ) bob += x [ i ] ; } } System . out . println ( alice - bob ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] m = new int [ n ] ; int sumG = 0 ; int minDonut = 1001 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: m[i] = sc.nextInt(); \n sumG += m[i]; \n minDonut = Math.min(minDonut, m[i]); " ) ; m [ i ] = sc . nextInt ( ) ; sumG += m [ i ] ; minDonut = Math . min ( minDonut , m [ i ] ) ; } int sumDonut = n + ( x - sumG ) / minDonut ; System . out . println ( sumDonut ) ; } } +import java . util . LinkedHashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; String [ ] list = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { list [ i ] = scan . next ( ) ; } scan . close ( ) ; Set < String > linkedHashSet = new LinkedHashSet < String > ( ) ; for ( int i = 0 ; i < list . length ; i ++ ) { System . out . println ( " [LOG] Block: linkedHashSet.add(list[i]); " ) ; linkedHashSet . add ( list [ i ] ) ; } Object [ ] num = linkedHashSet . toArray ( ) ; System . out . println ( num . length ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int i = 1 ; while ( true ) { int n = Integer . parseInt ( br . readLine ( ) ) ; if ( n == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } sb . append ( " Case " ) . append ( i ) . append ( " : " ) . append ( n ) . append ( " \n " ) ; i ++ ; } System . out . print ( sb ) ; } } +import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int k = ob . nextInt ( ) , a = ob . nextInt ( ) , b = ob . nextInt ( ) ; int ans = ( a - ( a % k ) ) + k ; if ( ans >= a && ans <= b || a % k == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); \n return; " ) ; System . out . println ( " OK " ) ; return ; } System . out . println ( " NG " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; sc . close ( ) ; if ( a < c ) { c -= a ; a = 0 ; if ( b < c ) { b = 0 ; } else { b -= c ; } } else { System . out . println ( " [LOG] Block: a -= c; " ) ; a -= c ; } System . out . println ( a + " " + b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; int rows = inp . nextInt ( ) ; int cols = inp . nextInt ( ) ; int [ ] [ ] aMatrix = new int [ rows ] [ cols ] ; int [ ] [ ] bMatrix = new int [ cols ] [ 1 ] ; for ( int k = 0 ; k < rows ; 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 , rows , cols ) ; for ( int [ ] item : total ) { for ( int secondItem : item ) { System . out . println ( secondItem ) ; } } } public static int [ ] [ ] matrixCalc ( int [ ] [ ] aMatrix , int [ ] [ ] bMatrix , int rows , int cols ) { int [ ] [ ] totals = new int [ rows ] [ 1 ] ; for ( int k = 0 ; k < rows ; k ++ ) { int total = 0 ; for ( int j = 0 ; j < cols ; j ++ ) { System . out . println ( " [LOG] Block: total += aMatrix[k][j] * bMatrix[j][0]; " ) ; total += aMatrix [ k ] [ j ] * bMatrix [ j ] [ 0 ] ; } totals [ k ] [ 0 ] = total ; } return totals ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > arrayList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: idx = j; \n min = arrayList.get(j); " ) ; idx = j ; min = arrayList . get ( j ) ; } } sum += arrayList . get ( idx ) ; arrayList . remove ( idx ) ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int a = in.nextInt(); \n int b = in.nextInt(); \n int sum1 = 0, sum2 = 0, sum = 0; \n a = a - 1; \n b = b - 1; \n sum1 = (a * (a + 1)) / 2; \n sum2 = (b * (b + 1)) / 2; \n sum = sum1 + sum2; \n System.out.println(sum); " ) ; Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int sum1 = 0 , sum2 = 0 , sum = 0 ; a = a - 1 ; b = b - 1 ; sum1 = ( a * ( a + 1 ) ) / 2 ; sum2 = ( b * ( b + 1 ) ) / 2 ; sum = sum1 + sum2 ; System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] w = new int [ n + 1 ] ; int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { w [ i ] = sc . nextInt ( ) ; sum += w [ i ] ; } int s1 = 0 ; int s2 = 0 ; int ans = sum ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: s1 += w[i]; \n s2 = sum - s1; \n ans = Math.min(ans, Math.abs(s2 - s1)); " ) ; s1 += w [ i ] ; s2 = sum - s1 ; ans = Math . min ( ans , Math . abs ( s2 - s1 ) ) ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String o = \" \" ; \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long k = sc.nextLong(); \n k = k - a; \n a = Math.max(-k, 0); \n if (k > 0) \n b = Math.max(b - k, 0); \n o = Long.toString(a, 10) + \" \" + Long.toString(b, 10); \n System.out.println(o); " ) ; Scanner sc = new Scanner ( System . in ) ; String o = " " ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; k = k - a ; a = Math . max ( - k , 0 ) ; if ( k > 0 ) b = Math . max ( b - k , 0 ) ; o = Long . toString ( a , 10 ) + " " + Long . toString ( b , 10 ) ; System . out . println ( o ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A , B ; A = 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 == A && ( int ) ( i * tax10 + i ) - i == B ) { System . out . println ( " [LOG] Block: price = i; \n break; " ) ; price = i ; break ; } } System . out . println ( price ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int n = s . length ( ) ; int m = t . length ( ) ; int count = 0 ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n - 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } ans = Math . min ( ans , count ) ; count = 0 ; } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n System.out.printf( \" %d \" , c); \n System.out.printf( \" %d \" , a); \n System.out.print(b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . printf ( " %d " , c ) ; System . out . printf ( " %d " , a ) ; System . out . print ( b ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int [ ] input = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { input [ i ] = Integer . parseInt ( tmpArray [ i ] ) ; } int target = 1 ; int length = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( input [ i ] == target ) { System . out . println ( " [LOG] Block: target++; \n length++; " ) ; target ++ ; length ++ ; } } System . out . println ( length > 0 ? n - length : - 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; if ( a >= 0 ) { if ( d >= 0 ) { System . out . println ( " [LOG] Block: System.out.println(b * d); " ) ; System . out . println ( b * d ) ; } else { System . out . println ( d * a ) ; } } else if ( b < 0 ) { if ( c >= 0 ) { System . out . println ( b * c ) ; } else { System . out . println ( c * a ) ; } } else { if ( d < 0 ) { System . out . println ( c * a ) ; } else if ( c >= 0 ) { System . out . println ( " [LOG] Block: System.out.println(b * d); " ) ; System . out . println ( b * d ) ; } else { if ( a * c > b * d ) { System . out . println ( a * c ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b * d); " ) ; System . out . println ( b * d ) ; } } } } } +import java . util . * ; import java . io . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n System.out.println(a * b); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; System . out . println ( a * b ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; 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 ) { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } ok ++ ; ng += acIndex ; } System . out . println ( ok + " " + ng ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String s = Integer . toString ( n ) ; if ( s . charAt ( 0 ) == '7' || s . charAt ( 1 ) == '7' || s . charAt ( 2 ) == '7' ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public Main ( ) { } static int input ; public static void main ( String [ ] args ) throws NumberFormatException , IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String str = br.readLine(); \n input = Integer.parseInt(str); \n System.out.println((int) Math.pow(input, 3)); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; input = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; List < Integer > primes = primeList ( 200 ) ; int N = 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 <= N ; 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 ++ ) { System . out . println ( " [LOG] Block: if (prime[i]) \n list.add(i); " ) ; if ( prime [ i ] ) list . add ( i ) ; } return list ; } } +import java . util . Scanner ; public class Main { 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 result = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( forecast . charAt ( i ) == weather . charAt ( i ) ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } return result ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int N = 0; \n int K = 0; \n String S; \n Scanner sc = new Scanner(System.in); \n N = Integer.parseInt(sc.next()); \n K = Integer.parseInt(sc.next()); \n S = sc.next(); \n StringBuilder sb = new StringBuilder(); \n sb.append(S); \n char s; \n String lower; \n s = sb.charAt(K - 1); \n lower = String.valueOf(s); \n sb.setCharAt(K - 1, (lower.toLowerCase()).toCharArray()[0]); \n System.out.println(sb.toString()); " ) ; int N = 0 ; int K = 0 ; String S ; Scanner sc = new Scanner ( System . in ) ; N = 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = sc . nextInt ( ) ; h -= A [ i ] ; } if ( h <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; import java . lang . * ; public class Main { public static void solve ( long a , long b , long c , long d ) { while ( a > 0 && c > 0 ) { c -= b ; if ( c <= 0 ) { System . out . println ( " Yes " ) ; return ; } a -= d ; } if ( c == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static void gora ( ) { Scanner scn = new Scanner ( System . in ) ; long a = scn . nextLong ( ) ; long b = scn . nextLong ( ) ; long c = scn . nextLong ( ) ; long d = scn . nextLong ( ) ; solve ( a , b , c , d ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: gora(); " ) ; gora ( ) ; } } +import java . util . Scanner ; import java . text . DecimalFormat ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner key = new Scanner(System.in); \n double num = key.nextInt(); \n key.close(); \n System.out.println((num / 3) * (num / 3) * (num / 3)); " ) ; Scanner key = new Scanner ( System . in ) ; double num = key . nextInt ( ) ; key . close ( ) ; System . out . println ( ( num / 3 ) * ( num / 3 ) * ( num / 3 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n long n = scanner.nextLong(); \n long a = scanner.nextLong(); \n long b = scanner.nextLong(); \n long aa = n % (long) ((long) a + (long) b); \n long as = (long) ((long) n / (long) ((long) a + (long) b)); \n long ans = (long) ((long) ((long) as * (long) a) + (long) Math.min((long) aa, (long) a)); \n System.out.println(ans); " ) ; Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextLong ( ) ; long a = scanner . nextLong ( ) ; long b = scanner . nextLong ( ) ; long aa = n % ( long ) ( ( long ) a + ( long ) b ) ; long as = ( long ) ( ( long ) n / ( 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 ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int A = scanner.nextInt(); \n int B = scanner.nextInt(); \n int T = scanner.nextInt(); \n int ans = T / A * B; \n System.out.println(ans); \n scanner.close(); " ) ; Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; int ans = T / A * B ; System . out . println ( ans ) ; scanner . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n String c = s.next(); \n switch(c) { \n case \" MON \" : \n System.out.println( \" 6 \" ); \n break; \n case \" TUE \" : \n System.out.println( \" 5 \" ); \n break; \n case \" WED \" : \n System.out.println( \" 4 \" ); \n break; \n case \" THU \" : \n System.out.println( \" 3 \" ); \n break; \n case \" FRI \" : \n System.out.println( \" 2 \" ); \n break; \n case \" SAT \" : \n System.out.println( \" 1 \" ); \n break; \n default: \n System.out.println( \" 7 \" ); \n } " ) ; Scanner s = new Scanner ( System . in ) ; String c = s . next ( ) ; switch ( c ) { 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; long [ ] h = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = s . nextLong ( ) ; } long [ ] dp = new long [ n ] ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < n ; 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 { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } System . out . println ( dp [ n - 1 ] ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double d = sc . nextDouble ( ) ; double t = sc . nextDouble ( ) ; double s = sc . nextDouble ( ) ; double sum = d / s ; if ( sum <= t ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n ; double [ ] b = new double [ 1111 ] ; double av ; double sum ; while ( true ) { n = input . nextInt ( ) ; if ( n == 0 ) break ; else { sum = 0 ; av = 0 ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = input . nextDouble ( ) ; av += b [ i ] ; } av /= n ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: sum += (b[i] - av) * (b[i] - av) / n; " ) ; sum += ( b [ i ] - av ) * ( b [ i ] - av ) / n ; } System . out . println ( Math . sqrt ( sum ) ) ; } } input . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 2 ; i < x ; i ++ ) { int j = i ; if ( x >= Math . pow ( j , 2 ) ) { while ( j <= x ) { System . out . println ( " [LOG] Block: j *= i; " ) ; j *= i ; } j /= i ; ans = Math . max ( ans , j ) ; } } System . out . println ( ans ) ; } } +public class Main { public void run ( java . io . InputStream in , java . io . PrintStream out ) { java . util . Scanner sc = new java . util . Scanner ( in ) ; int n , x ; int i , j , k , count ; for ( ; ; ) { n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; if ( n == 0 && x == 0 ) break ; count = 0 ; for ( i = 1 ; i <= n ; i ++ ) { for ( j = i + 1 ; j <= n ; j ++ ) { if ( x - i - j > j && x - i - j <= n ) count ++ ; } } System . out . println ( count ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: (new Main()).run(System.in, System.out); " ) ; ( new Main ( ) ) . run ( System . in , System . out ) ; } } +import java . util . Scanner ; public class Main { 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 now = 0 ; String ans = " " ; while ( true ) { switch ( C [ now ] [ t [ now ] ] ) { case 'a' : t [ now ] ++ ; now = 0 ; break ; case 'b' : t [ now ] ++ ; now = 1 ; break ; case 'c' : t [ now ] ++ ; now = 2 ; break ; } if ( t [ 0 ] == Sa . length ( ) && now == 0 ) { ans = " A " ; break ; } if ( t [ 1 ] == Sb . length ( ) && now == 1 ) { ans = " B " ; break ; } if ( t [ 2 ] == Sc . length ( ) && now == 2 ) { System . out . println ( " [LOG] Block: ans = \" C \" ; \n break; " ) ; ans = " C " ; break ; } } System . out . println ( ans ) ; scanner . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; list . add ( N ) ; while ( true ) { if ( N % 2 == 0 ) { N /= 2 ; } else { N = N * 3 + 1 ; } if ( list . contains ( N ) ) { list . add ( N ) ; System . out . println ( list . size ( ) ) ; break ; } else { System . out . println ( " [LOG] Block: list.add(N); " ) ; list . add ( N ) ; } } } } +import static java . lang . Integer . parseInt ; public class Main { public static void main ( String [ ] args ) { String line = new java . util . Scanner ( System . in ) . nextLine ( ) ; String [ ] number = line . 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 ) { System . out . println ( " [LOG] Block: return \" a == b \" ; " ) ; return " a == b " ; } return null ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int temp = y ; if ( y % 2 == 0 && y >= ( x * 2 ) && y <= x * 4 ) { System . out . println ( " [LOG] Block: System.out.print( \" Yes \" ); " ) ; System . out . print ( " Yes " ) ; } else System . out . print ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int max = Math . max ( a , b ) ; max = Math . max ( max , c ) ; int sum = 0 ; if ( max == a ) { for ( int i = 0 ; i < n ; i ++ ) { a *= 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 = a + 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 a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static int lcm ( int a , int b ) { System . out . println ( " [LOG] Block: return a * b / gcd(a, b); " ) ; return a * b / gcd ( a , b ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; LinkedList < Integer > ll = new LinkedList < > ( ) ; int n = 999 ; int x = 999 ; int cnt = 0 ; while ( n != 0 || x != 0 ) { n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; int ans = 0 ; if ( n == 0 && x == 0 ) { break ; } else { cnt ++ ; for ( int i = 1 ; i <= n ; 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 ( " [LOG] Block: System.out.println(ll.get(i)); " ) ; System . out . println ( ll . get ( i ) ) ; } } } +import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal a = new BigDecimal(sc.next()); \n BigDecimal b = new BigDecimal(sc.next()); \n System.out.println(a.multiply(b).setScale(0, RoundingMode.DOWN)); " ) ; 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 . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int i = 0 ; int sum = 0 ; if ( k >= a ) { sum += a ; k = k - a ; } else { System . out . println ( " [LOG] Block: sum = k; \n k = 0; " ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] numberArray = br . readLine ( ) . split ( " " ) ; int N = Integer . parseInt ( numberArray [ 0 ] ) ; int K = Integer . parseInt ( numberArray [ 1 ] ) ; String [ ] inputArray = br . readLine ( ) . split ( " " ) ; int [ ] priceArray = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { priceArray [ i ] = Integer . parseInt ( inputArray [ i ] ) ; } Arrays . sort ( priceArray ) ; int result = 0 ; for ( int j = 0 ; j < K ; j ++ ) { System . out . println ( " [LOG] Block: result += priceArray[j]; " ) ; result += priceArray [ j ] ; } System . out . println ( result ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { String line = sc . next ( ) ; d [ i ] = Integer . parseInt ( line ) ; } int K = 0 ; int count = 0 ; int countLeft = 0 ; int countRight = N ; Arrays . sort ( d ) ; for ( int i = 0 ; i < N ; i ++ ) { countLeft ++ ; countRight -- ; if ( countLeft == countRight ) { K = d [ i ] ; while ( d [ i ] <= K && K < d [ i + 1 ] ) { System . out . println ( " [LOG] Block: K++; \n count++; " ) ; K ++ ; count ++ ; } break ; } } System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; long S , L ; long Ri = 1 ; if ( A > B ) { L = A ; S = B ; } else { L = B ; S = A ; } long X = L % S ; for ( long i = 1 ; i <= S ; i ++ ) { if ( ( i * L ) % S == 0 ) { System . out . println ( " [LOG] Block: Ri = i; \n i = S + 1; " ) ; Ri = i ; i = S + 1 ; } } System . out . println ( Ri * L ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int x = 0 ; int y = 0 ; int t = 0 ; boolean possible = true ; for ( int i = 0 ; i < n ; ++ 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; String a1 ; String a2 ; a1 = sc . next ( ) ; a2 = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < A ; i ++ ) { System . out . println ( " [LOG] Block: char aa = a1.charAt(i); \n char bb = a2.charAt(i); \n ans += String.valueOf(aa) + String.valueOf(bb); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = s . nextInt ( ) ; } int cnt = 0 ; List < Integer > l = new ArrayList < > ( ) ; for ( int j = 0 ; j < N ; j ++ ) { if ( j == 0 ) continue ; if ( H [ j - 1 ] >= H [ j ] ) cnt ++ ; else { System . out . println ( " [LOG] Block: l.add(cnt); \n cnt = 0; " ) ; l . add ( cnt ) ; cnt = 0 ; } } l . add ( cnt ) ; Collections . sort ( l , Collections . reverseOrder ( ) ) ; System . out . print ( l . get ( 0 ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int int500 = sc . nextInt ( ) ; int int100 = sc . nextInt ( ) ; int int50 = sc . nextInt ( ) ; int total = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a <= int500 ; a ++ ) { for ( int b = 0 ; b <= int100 ; b ++ ) { for ( int c = 0 ; c <= int50 ; c ++ ) { System . out . println ( " [LOG] Block: int sum = a * 500 + b * 100 + c * 50; \n if (sum == total) \n count++; " ) ; int sum = a * 500 + b * 100 + c * 50 ; if ( sum == total ) count ++ ; } } } System . out . println ( count ) ; } } +import java . util . * ; class Problem { long n ; long a = 0 ; long b = 0 ; final long START_DISTANCE_FROM_ORIGIN = 2 ; public Problem ( long n ) { this . n = n ; } public void solve ( ) { for ( long i = 1 ; i * i <= n ; i ++ ) if ( n % i == 0 ) update ( i ) ; } private void update ( long i ) { a = i ; b = n / i ; } public void show ( ) { System . out . println ( a + b - START_DISTANCE_FROM_ORIGIN ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n Problem p = new Problem(n); \n p.solve(); \n p.show(); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; Problem p = new Problem ( n ) ; p . solve ( ) ; p . show ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ 101 ] ; for ( int i = 1 ; i <= 100 ; i ++ ) { if ( ( a % 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 ( " [LOG] Block: System.out.println(i); \n break; " ) ; System . out . println ( i ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt() + sc.nextInt(); \n int[] nums = { 1, 2, 3 } ; \n switch(a) { \n case 3: \n System.out.println(3); \n break; \n case 4: \n System.out.println(2); \n break; \n case 5: \n System.out.println(1); \n break; \n default: \n return; \n } " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) + sc . nextInt ( ) ; int [ ] nums = { 1 , 2 , 3 } ; switch ( a ) { 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 . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int i = Integer . parseInt ( br . readLine ( ) ) ; for ( int f = 0 ; f < i ; f ++ ) { System . out . println ( " [LOG] Block: String[] str = br.readLine().split( \" \\ s \" ); \n int a = Integer.parseInt(str[0]); \n a *= a; \n int b = Integer.parseInt(str[1]); \n b *= b; \n int c = Integer.parseInt(str[2]); \n c *= c; \n if (a + b == c || b + c == a || c + a == b) \n System.out.println( \" YES \" ); \n else \n System.out.println( \" NO \" ); " ) ; 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 . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( Math . max ( 0 , C - ( A - B ) ) ) ; } void tr ( Object ... objects ) { System . out . println ( " [LOG] Block: System.out.println(Arrays.deepToString(objects)); " ) ; System . out . println ( Arrays . deepToString ( objects ) ) ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n int c = scan.nextInt(); \n HashSet h = new HashSet(); \n h.add(a); \n h.add(b); \n h.add(c); \n if (h.size() == 2) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; HashSet h = new HashSet ( ) ; h . add ( a ) ; h . add ( b ) ; h . add ( c ) ; if ( h . size ( ) == 2 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) , e = sc . nextInt ( ) , k = sc . nextInt ( ) ; String res = " Yay! " ; if ( e - a > k ) { System . out . println ( " [LOG] Block: res = \" :( \" ; " ) ; res = " :( " ; } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int D = scanner . nextInt ( ) ; int [ ] [ ] X = new int [ N ] [ D ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { X [ i ] [ j ] = scanner . nextInt ( ) ; } } int resultNumber = 0 ; int temp = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; 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 ) ) { System . out . println ( " [LOG] Block: resultNumber++; " ) ; resultNumber ++ ; } temp = 0 ; } } } } System . out . println ( resultNumber ) ; scanner . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String nn = String . valueOf ( n ) ; 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 . println ( " [LOG] Block: System.out.print(nnn[i]); " ) ; System . out . print ( nnn [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; if ( n <= x ) { System . out . println ( t ) ; return ; } long ans = 0 ; ans += ( n / x ) * t ; n %= x ; if ( n > 0 ) { System . out . println ( " [LOG] Block: ans += t; " ) ; ans += t ; } sc . close ( ) ; System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { 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 H = Integer . parseInt ( st . nextToken ( ) ) ; int W = Integer . parseInt ( st . nextToken ( ) ) ; if ( W == 0 && H == 0 ) break ; if ( H >= 300 && W >= 300 ) break ; ; for ( int i = 1 ; i <= H ; 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 . out . println ( " [LOG] Block: System.err.println(e); " ) ; System . err . println ( e ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class Main { static Scanner sc = new Scanner ( ) ; public static void main ( final String [ ] args ) throws IOException { int n = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; char temp = c [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( c [ i ] != temp ) { temp = c [ i ] ; ans ++ ; } } System . out . println ( ans ) ; } static class Scanner { 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 { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . HashMap ; import java . util . Scanner ; public class Main { 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 length = str . length ( ) ; String firstHalf = str . substring ( 0 , ( length - 1 ) / 2 ) ; if ( ! isPalindrone ( firstHalf ) ) { return Result . No ; } String lastHalf = str . substring ( ( length + 1 ) / 2 ) ; if ( ! isPalindrone ( lastHalf ) ) { return Result . No ; } return Result . Yes ; } private static boolean isPalindrone ( String str ) { int length = str . length ( ) ; if ( length == 1 ) { return true ; } for ( int i = 0 ; i < ( length + 1 ) / 2 ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( length - i - 1 ) ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } public static enum Result { Yes , No } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int a1 = a + b ; int a2 = a - b ; int a3 = a * 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 ( " [LOG] Block: System.out.println(a3); " ) ; System . out . println ( a3 ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s1 = sc.next(); \n double r = Double.parseDouble(s1); \n double s = Math.PI * r * r; \n double l = Math.PI * (r + r); \n System.out.println(String.format( \" %1$3f \" , s) + \" \" + String.format( \" %1$3f \" , l)); " ) ; Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; double r = Double . parseDouble ( s1 ) ; double s = Math . PI * r * r ; double l = Math . PI * ( r + r ) ; System . out . println ( String . format ( " %1$3f " , s ) + " " + String . format ( " %1$3f " , l ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int LMax = 0 ; int RMin = N ; 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 ( " [LOG] Block: System.out.println(RMin - LMax + 1); " ) ; System . out . println ( RMin - LMax + 1 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { int x = 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' ) { System . out . println ( " [LOG] Block: x += 1; " ) ; x += 1 ; } } } System . out . println ( x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 0 ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int temp = sc . nextInt ( ) ; if ( max <= temp ) { System . out . println ( " [LOG] Block: count++; \n max = temp; " ) ; count ++ ; max = temp ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; String b = scan . next ( ) ; String c = scan . next ( ) ; String next = " a " ; while ( true ) { if ( next . equals ( " a " ) && a . length ( ) > 0 ) { next = a . substring ( 0 , 1 ) ; a = a . 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 { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( next . toUpperCase ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X1 = sc . nextInt ( ) ; int X2 = sc . nextInt ( ) ; int X3 = sc . nextInt ( ) ; int X4 = sc . nextInt ( ) ; int X5 = sc . nextInt ( ) ; if ( X1 == 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 ( " [LOG] Block: System.out.println( \" 5 \" ); " ) ; System . out . println ( " 5 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int cnt = 0 ; for ( int i = A ; i <= B ; i ++ ) { if ( i % K == 0 ) { cnt = cnt + 1 ; } } if ( cnt >= 1 ) { System . out . println ( " OK " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NG \" ); " ) ; System . out . println ( " NG " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; if ( a - c < 0 && a + b >= c ) { System . out . println ( " 0 " + ( b - ( c - a ) ) ) ; } else if ( a + b <= c ) { System . out . println ( " 0 0 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(a - c + \" \" + b); " ) ; System . out . println ( a - c + " " + b ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] str ; str = new String [ 3 ] ; int num1 , num2 , Ans ; Ans = 0 ; for ( int i = 1 ; ; i ++ ) { str [ 0 ] = in . next ( ) ; str [ 1 ] = in . next ( ) ; str [ 2 ] = in . next ( ) ; num1 = Integer . parseInt ( str [ 0 ] ) ; num2 = Integer . parseInt ( str [ 2 ] ) ; if ( str [ 1 ] . equals ( " ? " ) ) { break ; } else { if ( str [ 1 ] . equals ( " + " ) ) { Ans = num1 + num2 ; } if ( str [ 1 ] . equals ( " - " ) ) { Ans = num1 - num2 ; } if ( str [ 1 ] . equals ( " * " ) ) { Ans = num1 * num2 ; } if ( str [ 1 ] . equals ( " / " ) ) { System . out . println ( " [LOG] Block: Ans = num1 / num2; " ) ; Ans = num1 / num2 ; } System . out . println ( Ans ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int N = keyboard . nextInt ( ) ; HashMap < String , Integer > count = new HashMap < String , Integer > ( ) ; for ( int s = 0 ; s < N ; 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 ++ ) { System . out . println ( " [LOG] Block: String ans = print.get(i); \n System.out.println(ans); " ) ; String ans = print . get ( i ) ; System . out . println ( ans ) ; } keyboard . close ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] S = br . readLine ( ) . toCharArray ( ) ; char [ ] T = br . readLine ( ) . toCharArray ( ) ; int roop = S . length - T . length + 1 ; int [ ] cnt = new int [ roop ] ; int max = 0 ; for ( int i = 0 ; i < roop ; 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 ] ) { System . out . println ( " [LOG] Block: max = cnt[k]; " ) ; max = cnt [ k ] ; } } System . out . println ( T . length - max ) ; } } +import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double divM = ( double ) 1 / ( 4 * M ) ; boolean judge = true ; int voteSum = 0 ; Integer [ ] arrayA = new Integer [ N ] ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: judge = false; \n break; " ) ; judge = false ; break ; } } System . out . println ( judge ? " Yes " : " No " ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; BigDecimal ans = new BigDecimal ( 1 ) ; BigDecimal over = new BigDecimal ( 1000000000000000000L ) ; boolean ov = false ; boolean ze = false ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayDeque ; import java . util . Queue ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder builder = new StringBuilder ( ) ; String [ ] line = reader . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int q = Integer . parseInt ( line [ 1 ] ) ; Queue < String [ ] > queue = new ArrayDeque < String [ ] > ( ) ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: time -= q; \n elapse += q; \n work[1] = String.valueOf(time); \n queue.add(work); " ) ; time -= q ; elapse += q ; work [ 1 ] = String . valueOf ( time ) ; queue . add ( work ) ; } } System . out . print ( builder ) ; } } +import java . util . * ; import java . util . stream . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int L = in . nextInt ( ) ; int min = Integer . MAX_VALUE ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += L + i ; if ( Math . abs ( L + i ) < Math . abs ( min ) ) { System . out . println ( " [LOG] Block: min = L + i; " ) ; min = L + i ; } } System . out . println ( sum - min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextLong ( ) ; y [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( Math . sqrt ( x [ i ] * x [ i ] + y [ i ] * y [ i ] ) <= d ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N - 1 ] ; for ( int i = 0 ; i < N - 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 < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: sum += Math.min(B[i], B[i - 1]); " ) ; sum += Math . min ( B [ i ] , B [ i - 1 ] ) ; } } sum += B [ N - 2 ] ; System . out . println ( sum ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int price1 ; int price2 ; if ( X > Y ) { price1 = ( C * 2 * Y ) + ( A * ( X - Y ) ) ; price2 = C * 2 * X ; } else { System . out . println ( " [LOG] Block: price1 = (C * 2 * X) + (B * (Y - X)); \n price2 = C * 2 * Y; " ) ; price1 = ( C * 2 * X ) + ( B * ( Y - X ) ) ; price2 = C * 2 * Y ; } int price3 = A * X + B * Y ; int ans = Math . min ( price1 , price2 ) ; ans = Math . min ( ans , price3 ) ; System . out . println ( + ans ) ; } } +import java . math . BigInteger ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Long K ; Scanner sc = new Scanner ( System . in ) ; K = sc . nextLong ( ) ; Long bank = 100L ; int toshi = 0 ; while ( bank < K ) { System . out . println ( " [LOG] Block: bank = (long) (bank * 1.01); \n toshi++; " ) ; bank = ( long ) ( bank * 1.01 ) ; toshi ++ ; } System . out . println ( toshi ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] r = new int [ n ] ; int maxv = - 999999999 ; for ( int i = 0 ; i < r . length ; i ++ ) { r [ i ] = sc . nextInt ( ) ; } int minv = r [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: maxv = r[i] - minv > maxv ? r[i] - minv : maxv; \n minv = minv > r[i] ? r[i] : minv; " ) ; maxv = r [ i ] - minv > maxv ? r [ i ] - minv : maxv ; minv = minv > r [ i ] ? r [ i ] : minv ; } System . out . println ( maxv ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; boolean isZero = false ; for ( int i = 0 ; i < n ; 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 = n - 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 ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = a ; i <= n ; i ++ ) { int x = i ; int total = x % 10 ; while ( x >= 10 ) { System . out . println ( " [LOG] Block: x /= 10; \n total += x % 10; " ) ; x /= 10 ; total += x % 10 ; } if ( total >= a && total <= b ) cnt += i ; } System . out . println ( cnt ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; String j = sc . next ( ) ; if ( a . equals ( j ) ) { c = c - 1 ; } else if ( b . equals ( j ) ) { System . out . println ( " [LOG] Block: d = d - 1; " ) ; d = d - 1 ; } System . out . println ( c ) ; System . out . println ( d ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n int c = a * (a - 1) / 2; \n int d = b * (b - 1) / 2; \n System.out.println(c + d); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = a * ( a - 1 ) / 2 ; int d = b * ( b - 1 ) / 2 ; System . out . println ( c + d ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String result = new String ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: result = result.concat(String.valueOf(s.charAt(i))); \n result = result.concat(String.valueOf(t.charAt(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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; if ( n % 1000 == 0 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " [LOG] Block: int a = (n / 1000) + 1; \n System.out.println((a * 1000) - n); " ) ; int a = ( n / 1000 ) + 1 ; System . out . println ( ( a * 1000 ) - n ) ; } } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] 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 c : c_array ) { if ( 'a' <= c && c <= 'z' ) array [ c - 'a' ] ++ ; else if ( 'A' <= c && c <= 'Z' ) array [ c - 'A' ] ++ ; } } while ( true ) ; for ( int i = 0 ; i < 26 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println((char) ('a' + i) + \" : \" + array[i]); " ) ; System . out . println ( ( char ) ( 'a' + i ) + " : " + array [ i ] ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == '1' ) { System . out . println ( " [LOG] Block: ans += 1; " ) ; ans += 1 ; } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] nl = scanner . nextLine ( ) . split ( " " , 2 ) ; int n = Integer . parseInt ( nl [ 0 ] ) ; int l = Integer . parseInt ( nl [ 1 ] ) ; String [ ] arr = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextLine ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(arr[i]); " ) ; System . out . print ( arr [ i ] ) ; } System . out . print ( " \n " ) ; } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Integer [ ] arrays = new Integer [ n ] ; 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 ) { System . out . println ( " [LOG] Block: stepCnt++; \n stepSize = size; " ) ; stepCnt ++ ; stepSize = size ; } } System . out . println ( stepCnt ) ; } } +import java . util . Scanner ; public class Main { private static final int MOD = 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 ++ ) { System . out . println ( " [LOG] Block: long x = X[i][k] - X[j][k]; \n sum += x * x; " ) ; long x = X [ i ] [ k ] - X [ j ] [ k ] ; sum += x * x ; } double s = Math . sqrt ( sum ) ; return s == Math . floor ( s ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < Integer > numList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { numList . add ( scanner . nextInt ( ) ) ; } scanner . close ( ) ; int flag = 1 ; int c = 0 ; while ( flag == 1 ) { flag = 0 ; for ( int j = n - 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 < n ; i ++ ) { System . out . print ( numList . get ( i ) ) ; if ( i < n - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; System . out . println ( c ) ; } } +import java . util . Scanner ; public class Main { public static int head1 = 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 ( head1 != 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 [ head1 ++ ] ; } public static int intDequeue ( ) { System . out . println ( " [LOG] Block: return queue2[head2++]; " ) ; return queue2 [ head2 ++ ] ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n long n = s.nextLong(); \n long a = s.nextLong(); \n long b = s.nextLong(); \n long set = n / (a + b); \n long rem = n % (a + b); \n long ans = a * set; \n ans = ans + Math.min(a, rem); \n System.out.println(ans); " ) ; Scanner s = new Scanner ( System . in ) ; long n = s . nextLong ( ) ; long a = s . nextLong ( ) ; long b = s . nextLong ( ) ; long set = n / ( a + b ) ; long rem = n % ( a + b ) ; long ans = a * set ; ans = ans + Math . min ( a , rem ) ; System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int alice = 0 ; int bob = 0 ; int check = 0 ; for ( int i = N - 1 ; i > - 1 ; i -- ) { if ( check == 0 ) { alice += a [ i ] ; check = 1 ; } else { System . out . println ( " [LOG] Block: bob += a[i]; \n check = 0; " ) ; bob += a [ i ] ; check = 0 ; } } System . out . println ( alice - bob ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int length = str . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { System . out . println ( " [LOG] Block: if (str.charAt(i) == '1') \n System.out.print(9); \n else \n System.out.print(1); " ) ; if ( str . charAt ( i ) == '1' ) System . out . print ( 9 ) ; else System . out . print ( 1 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 2 ] ; while ( true ) { System . out . println ( " [LOG] Block: a[0] = sc.nextInt(); \n a[1] = sc.nextInt(); \n if (a[0] == 0 && a[1] == 0) \n break; \n Arrays.sort(a); \n System.out.println(a[0] + \" \" + a[1]); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String result = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { switch ( s . charAt ( i ) ) { case '0' : result += 0 ; break ; case '1' : result += 1 ; break ; case 'B' : if ( ! result . isEmpty ( ) ) { System . out . println ( " [LOG] Block: result = result.substring(0, result.length() - 1); " ) ; result = result . substring ( 0 , result . length ( ) - 1 ) ; } break ; } } System . out . println ( result ) ; } } +import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; a [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = a [ i - 1 ] + sc . nextInt ( ) ; } int min = 10000000 ; for ( int t = 1 ; t < n ; t ++ ) { System . out . println ( " [LOG] Block: min = Math.min(Math.abs((a[t] - a[0]) - (a[n] - a[t])), min); " ) ; min = Math . min ( Math . abs ( ( a [ t ] - a [ 0 ] ) - ( a [ n ] - a [ t ] ) ) , min ) ; } System . out . println ( min ) ; } } +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 Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; int count = 0 ; if ( b + c - a <= 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b + c - a); " ) ; System . out . println ( b + c - a ) ; } } } +import java . io . * ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { int tmp ; 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 ) { System . out . println ( " [LOG] Block: tmp = a; \n a = b; \n b = tmp; " ) ; tmp = a ; a = b ; b = tmp ; } if ( b > c ) { tmp = b ; b = c ; c = tmp ; } if ( a > b ) { System . out . println ( " [LOG] Block: tmp = a; \n a = b; \n b = tmp; " ) ; tmp = a ; a = b ; b = tmp ; } System . out . println ( a + " " + b + " " + c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int ans = n * a ; if ( ans < b ) { System . out . println ( ans ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b); " ) ; System . out . println ( b ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int l = Integer . parseInt ( str [ 1 ] ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = in . readLine ( ) ; } Arrays . sort ( s ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(s[i]); " ) ; System . out . print ( s [ i ] ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { void run ( ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int prime = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: bob += a[i]; " ) ; bob += a [ i ] ; } isAlice = ! isAlice ; } System . out . println ( alice - bob ) ; } } +import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: String s = sc.next(); \n list.add(s); " ) ; String s = sc . next ( ) ; list . add ( s ) ; } List < String > listb = new ArrayList < String > ( new HashSet < > ( list ) ) ; sc . close ( ) ; System . out . println ( listb . size ( ) ) ; } } +public class Main { 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 cnt = 0 ; while ( cnt != s . length ( ) ) { if ( s . contains ( p ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } s = s . substring ( 1 ) + s . charAt ( 0 ) ; cnt ++ ; } System . out . println ( " No " ) ; } } } +import java . util . * ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int [ ] d = new int [ num ] ; int ans = 0 ; for ( int i = 0 ; i < num ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < num ; i ++ ) { for ( int j = i + 1 ; j < num ; j ++ ) { System . out . println ( " [LOG] Block: ans = ans + d[i] * d[j]; " ) ; ans = ans + d [ i ] * d [ j ] ; } } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n , x , t = 0 ; String [ ] brr = br . readLine ( ) . split ( " " ) ; n = Integer . parseInt ( brr [ 0 ] ) ; x = Integer . parseInt ( brr [ 1 ] ) ; t = Integer . parseInt ( brr [ 2 ] ) ; long ans = 0 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: ans += t; \n n -= x; " ) ; ans += t ; n -= x ; } System . out . println ( ans ) ; } } +import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; public class Main { 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 ci = 0 ; for ( int si = 0 ; si < s . length ; si ++ ) { if ( c . equals ( s [ si ] ) ) { System . out . println ( " [LOG] Block: ci = si; \n break; " ) ; ci = si ; break ; } } System . out . println ( s [ ci + 1 ] ) ; sc . close ( ) ; } } +import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; int cnt = 0 ; for ( int i = 0 ; i < N - 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) throws 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 n = Integer . parseInt ( list . get ( 0 ) ) ; String s = list . get ( 1 ) ; br . close ( ) ; int count = 0 ; int size = n ; for ( int i = 0 ; i < size ; i ++ ) { if ( size - i >= 3 ) { String tmp = s . substring ( i , i + 3 ) ; if ( " ABC " . equals ( tmp ) ) { count ++ ; } } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . RoundingMode ; class Main { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double input = Double . parseDouble ( br . readLine ( ) ) ; double countOdd = Math . round ( input / 2 ) ; BigDecimal result = new BigDecimal ( countOdd / input ) ; result . setScale ( 10 , RoundingMode . HALF_UP ) ; System . out . println ( result ) ; } catch ( IOException | NumberFormatException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); \n System.exit(0); " ) ; e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); \n System.exit(0); " ) ; e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String word ; String [ ] sen = new String [ 1000 ] ; int i = 0 ; word = scan . next ( ) ; while ( true ) { sen [ i ] = scan . next ( ) ; if ( sen [ i ] . equals ( " END_OF_TEXT " ) ) break ; i ++ ; } int ans = 0 ; int num = word . length ( ) ; ; for ( int j = 0 ; j < i + 1 ; j ++ ) { System . out . println ( " [LOG] Block: if (sen[j].equalsIgnoreCase(word)) \n ans++; " ) ; if ( sen [ j ] . equalsIgnoreCase ( word ) ) ans ++ ; } System . out . println ( ans ) ; return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String A = sc.next(); \n String B = sc.next(); \n String C = sc.next(); \n System.out.println(C + \" \" + A + \" \" + B); " ) ; Scanner sc = new Scanner ( System . in ) ; String A = sc . next ( ) ; String B = sc . next ( ) ; String C = sc . next ( ) ; System . out . println ( C + " " + A + " " + B ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] text = str . split ( " " ) ; int a = Integer . parseInt ( text [ 0 ] ) ; String b = text [ 1 ] ; int c = Integer . parseInt ( text [ 2 ] ) ; while ( b . equals ( " ? " ) == false ) { if ( b . equals ( " + " ) ) { System . out . println ( a + c ) ; } else if ( b . equals ( " - " ) ) { System . out . println ( a - c ) ; } else if ( b . equals ( " * " ) ) { System . out . println ( a * c ) ; } else if ( b . equals ( " / " ) ) { System . out . println ( " [LOG] Block: System.out.println(a / c); " ) ; System . out . println ( a / c ) ; } str = br . readLine ( ) ; text = str . split ( " " ) ; a = Integer . parseInt ( text [ 0 ] ) ; b = text [ 1 ] ; c = Integer . parseInt ( text [ 2 ] ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = 0 ; int W = 0 ; boolean flg = true ; while ( true ) { H = sc . nextInt ( ) ; W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) { break ; } for ( int i = 1 ; i <= H ; 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 . println ( " [LOG] Block: System.out.print( \" . \" ); \n flg = true; " ) ; System . out . print ( " . " ) ; flg = true ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ N ] ; int first = 0 ; int second = 0 ; int loc = 0 ; for ( int i = 0 ; i < N ; 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 < N ; j ++ ) { if ( j == loc ) { System . out . println ( second ) ; } else { System . out . println ( " [LOG] Block: System.out.println(first); " ) ; System . out . println ( first ) ; } } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { String line = readLine ( ) ; String WA = " WA " ; String AC = " AC " ; if ( line . startsWith ( " A " ) ) { if ( line . substring ( 0 , 2 ) . indexOf ( " C " ) != - 1 || line . endsWith ( " C " ) ) { System . out . println ( WA ) ; return ; } if ( line . replace ( " C " , " " ) . length ( ) != line . length ( ) - 1 ) { System . out . println ( WA ) ; return ; } String str1 = line . 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 { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n return br.readLine(); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , C , X , Y ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; X = sc . nextInt ( ) ; Y = sc . nextInt ( ) ; int min = A * X + B * Y ; if ( X > Y ) { if ( C * 2 * X < min ) { min = C * 2 * X ; } if ( C * 2 * Y + ( X - Y ) * A < min ) { min = C * 2 * Y + ( X - Y ) * A ; } } else { if ( C * 2 * Y < min ) { min = C * 2 * Y ; } if ( C * 2 * X + ( Y - X ) * B < min ) { System . out . println ( " [LOG] Block: min = C * 2 * X + (Y - X) * B; " ) ; min = C * 2 * X + ( Y - X ) * B ; } } System . out . println ( min ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String s = reader . readLine ( ) ; String p = reader . readLine ( ) ; String ss = s + s ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +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 Main { 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 A = nextInt ( ) ; int B = nextInt ( ) ; if ( A == 1 ) { if ( B == 3 ) { println ( 2 ) ; return ; } else { println ( 3 ) ; return ; } } else if ( A == 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 ) { System . out . println ( " [LOG] Block: PrintWriter out = new PrintWriter(System.out); \n out.print(o); \n out.flush(); " ) ; PrintWriter out = new PrintWriter ( System . out ) ; out . print ( o ) ; out . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long w = sc.nextLong(); \n long h = sc.nextLong(); \n long x = sc.nextLong(); \n long y = sc.nextLong(); \n double ans = 0.5 * w * h; \n StringBuilder builder = new StringBuilder(String.valueOf(ans)); \n int flag = 0.5 * w == x && 0.5 * h == y ? 1 : 0; \n builder.append( \" \" + flag); \n System.out.println(builder); " ) ; Scanner sc = new Scanner ( System . in ) ; long w = sc . nextLong ( ) ; long h = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; double ans = 0.5 * w * h ; StringBuilder builder = new StringBuilder ( String . valueOf ( ans ) ) ; int flag = 0.5 * w == x && 0.5 * h == y ? 1 : 0 ; builder . append ( " " + flag ) ; System . out . println ( builder ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String a = scanner . nextLine ( ) ; if ( a . equals ( " 0 " ) ) break ; int sum = 0 ; for ( char b : a . toCharArray ( ) ) { System . out . println ( " [LOG] Block: sum += Integer.parseInt(String.valueOf(b)); " ) ; sum += Integer . parseInt ( String . valueOf ( b ) ) ; } System . out . println ( sum ) ; } } } +import java . util . Scanner ; class Main { 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 x = 0 ; long a = num [ 0 ] ; long b = num [ 1 ] ; do { x = a % b ; a = b ; b = x ; } while ( x != 0 ) ; return a ; } private static long lcm ( long [ ] num ) { System . out . println ( " [LOG] Block: return (num[0] * num[1]) / gcd(num); " ) ; return ( num [ 0 ] * num [ 1 ] ) / gcd ( num ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; int a = sc1 . nextInt ( ) ; int b = sc1 . nextInt ( ) ; int max = a + b ; if ( max < a - b ) { max = a - b ; } if ( max < a * b ) { System . out . println ( " [LOG] Block: max = a * b; " ) ; max = a * b ; } System . out . print ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveB ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String s ; if ( A >= 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 ++ ) { System . out . println ( " [LOG] Block: p *= 100; " ) ; p *= 100 ; } if ( N == 100 ) N = 101 ; System . out . println ( p * N ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z = sc . nextInt ( ) ; int [ ] [ ] a = new int [ x ] [ y ] ; int [ ] [ ] b = new int [ y ] [ z ] ; for ( int i = 0 ; i < x ; 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 < x ; 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 . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } tmp = 0 ; } System . out . println ( ) ; } sc . close ( ) ; } } +import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( solve ( n ) ) ; } public static int solve ( int n ) { int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int digit = ( int ) Math . log10 ( i ) + 1 ; if ( digit % 2 == 1 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } return ans ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String T = sc . nextLine ( ) ; sc . close ( ) ; boolean isOK = true ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char sVal = S . charAt ( i ) ; char tVal = T . charAt ( i ) ; if ( sVal != tVal ) { isOK = false ; break ; } } if ( isOK ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; String next = a . substring ( 0 , 1 ) ; a = a . substring ( 1 , a . length ( ) ) ; for ( ; ; ) { if ( next . equals ( " a " ) ) { if ( a . isEmpty ( ) ) { System . out . println ( " A " ) ; return ; } next = a . substring ( 0 , 1 ) ; a = a . substring ( 1 , a . 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 ( " [LOG] Block: System.out.println( \" C \" ); \n return; " ) ; System . out . println ( " C " ) ; return ; } next = c . substring ( 0 , 1 ) ; c = c . substring ( 1 , c . length ( ) ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int answer = a + a * a + a * a * a; \n System.out.println(answer); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int answer = a + a * a + a * a * a ; System . out . println ( answer ) ; } } +import java . util . ArrayDeque ; import java . util . Scanner ; public class Main { static final Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] __ ) { D [ ] deques = new D [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { deques [ i ] = new D ( ) ; for ( char c : s . next ( ) . toCharArray ( ) ) deques [ i ] . add ( c ) ; } char next = 'a' ; while ( ! deques [ next - 'a' ] . isEmpty ( ) ) { System . out . println ( " [LOG] Block: next = deques[next - 'a'].poll(); " ) ; next = deques [ next - 'a' ] . poll ( ) ; } System . out . println ( Character . toUpperCase ( next ) ) ; } static class D extends ArrayDeque < Character > { } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { FastScanner fs = new FastScanner ( ) ; int x = fs . nextInt ( ) ; if ( x == 0 ) System . out . println ( 1 ) ; else System . out . println ( 0 ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int n = scanner.nextInt(); \n int k = scanner.nextInt(); \n String s = scanner.next(); \n char conv = Character.toLowerCase(s.charAt(k - 1)); \n String pre = (k == 1 ? \" \" : s.substring(0, k - 1)); \n String next = (k == n ? \" \" : s.substring(k)); \n System.out.println(pre + conv + next); " ) ; Scanner scanner = new Scanner ( System . in ) ; int n = 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 == n ? " " : s . substring ( k ) ) ; System . out . println ( pre + conv + next ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int n1, n2, n3; \n String str1, str2, str3; \n Scanner in = new Scanner(System.in); \n str1 = in.next(); \n str2 = in.next(); \n str3 = in.next(); \n n1 = Integer.parseInt(str1); \n n2 = Integer.parseInt(str2); \n n3 = Integer.parseInt(str3); \n if (n1 < n2 && n2 < n3) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); \n in.close(); " ) ; int n1 , n2 , n3 ; String str1 , str2 , str3 ; Scanner in = new Scanner ( System . in ) ; str1 = in . next ( ) ; str2 = in . next ( ) ; str3 = in . next ( ) ; n1 = Integer . parseInt ( str1 ) ; n2 = Integer . parseInt ( str2 ) ; n3 = Integer . parseInt ( str3 ) ; if ( n1 < n2 && n2 < n3 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; in . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner yomi = new Scanner ( System . in ) ; int a = yomi . nextInt ( ) ; boolean tf = true ; int [ ] n = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { n [ i ] = yomi . nextInt ( ) ; } for ( int i = 0 ; i < a ; i ++ ) { if ( n [ i ] % 2 == 0 ) { if ( n [ i ] % 3 == 0 || n [ i ] % 5 == 0 ) { } else tf = false ; } } if ( tf ) { System . out . println ( " [LOG] Block: System.out.println( \" APPROVED \" ); " ) ; System . out . println ( " APPROVED " ) ; } else System . out . println ( " DENIED " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int m = stdIn . nextInt ( ) ; int n = stdIn . nextInt ( ) ; int [ ] [ ] a = new int [ m ] [ n ] ; int [ ] b = new int [ n ] ; int ans ; for ( int i = 0 ; i < m ; 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 < m ; x ++ ) { ans = 0 ; for ( int y = 0 ; y < n ; y ++ ) { System . out . println ( " [LOG] Block: ans += a[x][y] * b[y]; " ) ; ans += a [ x ] [ y ] * b [ y ] ; } System . out . println ( ans ) ; } } } +import java . io . * ; import java . util . * ; import java . util . stream . * ; public class Main { private static BufferedReader br = null ; public static void main ( String [ ] args ) { String n = read ( 1 ) [ 0 ] ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { System . out . print ( n . charAt ( i ) == '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 i = 0 ; i < len ; i ++ ) { strList . add ( br . readLine ( ) ) ; } } catch ( IOException e ) { } return strList . toArray ( new String [ 0 ] ) ; } private static void close ( ) { try { if ( br != null ) { System . out . println ( " [LOG] Block: br.close(); " ) ; br . close ( ) ; } } catch ( IOException e ) { } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String input = br.readLine(); \n double r = Double.parseDouble(input); \n double s = r * r * Math.PI; \n double l = r * 2 * Math.PI; \n String ansS = String.format( \" %.6f \" , s); \n String ansL = String.format( \" %.6f \" , l); \n System.out.println(ansS + \" \" + ansL); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; double r = Double . parseDouble ( input ) ; double s = r * r * Math . PI ; double l = r * 2 * Math . PI ; String ansS = String . format ( " %.6f " , s ) ; String ansL = String . format ( " %.6f " , l ) ; System . out . println ( ansS + " " + ansL ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 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 ( x ) ; } else { for ( int i = 0 ; i < a . length ; i ++ ) { if ( min <= ( int ) Math . abs ( x - a [ i ] ) ) { System . out . println ( a [ i - 1 ] ) ; break ; } else { System . out . println ( " [LOG] Block: min = (int) Math.abs(x - a[i]); " ) ; min = ( int ) Math . abs ( x - a [ i ] ) ; } } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int last = sc . nextInt ( ) ; int res = last ; for ( int i = 0 ; i < n - 2 ; i ++ ) { System . out . println ( " [LOG] Block: int t = sc.nextInt(); \n res += Math.min(t, last); \n last = t; " ) ; int t = sc . nextInt ( ) ; res += Math . min ( t , last ) ; last = t ; } System . out . println ( res + last ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] lot = new int [ w ] ; String bar ; String [ ] s ; int a ; int b ; int save ; for ( int i = 0 ; i < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println( \" \" + lot[i]); " ) ; System . out . println ( " " + lot [ i ] ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double [ ] v = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { v [ i ] = sc . nextDouble ( ) ; } Arrays . sort ( v ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: v[i + 1] = (v[i] + v[i + 1]) / 2d; " ) ; v [ i + 1 ] = ( v [ i ] + v [ i + 1 ] ) / 2d ; } System . out . println ( v [ n - 1 ] ) ; sc . close ( ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] ary = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ary [ i ] = sc . nextInt ( ) ; sc . close ( ) ; Arrays . sort ( ary ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ary [ i ] >= k ) { System . out . println ( " [LOG] Block: System.out.println(n - i); \n System.exit(0); " ) ; System . out . println ( n - i ) ; System . exit ( 0 ) ; } } System . out . println ( " 0 " ) ; } } +import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { String w = sc . nextLine ( ) ; int len = w . length ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < len ; 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 { System . out . println ( " [LOG] Block: sc.close(); " ) ; sc . close ( ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; 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 ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { if ( i == 0 || j == 0 || i == H - 1 || j == W - 1 ) { sb . append ( " # " ) ; } else { System . out . println ( " [LOG] Block: sb.append( \" . \" ); " ) ; sb . append ( " . " ) ; } } sb . append ( " \n " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = 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 ] + ( k - A [ N - 1 ] ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { X = A [ i + 1 ] - A [ i ] ; if ( X >= Y ) { System . out . println ( " [LOG] Block: Y = X; " ) ; Y = X ; } } System . out . print ( k - Y ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int res = 1 ; for ( int i = 2 ; i * i <= x ; i ++ ) { int p = i * i ; while ( p <= x ) { System . out . println ( " [LOG] Block: res = Math.max(res, p); \n p *= i; " ) ; res = Math . max ( res , p ) ; p *= i ; } } System . out . println ( res ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String [ ] s = sc . next ( ) . split ( " " ) ; String ans = " Yes " ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( i == a ) { if ( ! s [ a ] . equals ( " - " ) ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } else { if ( s [ i ] . equals ( " - " ) ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } } System . out . println ( ans ) ; } } +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 Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: int a = Integer.parseInt(in.next()); \n int b = Integer.parseInt(in.next()); \n int c = Integer.parseInt(in.next()); \n Set<Integer> s = new HashSet<>(); \n s.add(a); \n s.add(b); \n s.add(c); \n if (s.size() == 2) \n out.println( \" Yes \" ); \n else \n out.println( \" No \" ); " ) ; int a = Integer . parseInt ( in . next ( ) ) ; int b = Integer . parseInt ( in . next ( ) ) ; int c = Integer . parseInt ( in . next ( ) ) ; Set < Integer > s = new HashSet < > ( ) ; s . add ( a ) ; s . add ( b ) ; s . add ( c ) ; if ( s . size ( ) == 2 ) out . println ( " Yes " ) ; else out . println ( " No " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] B = new int [ N - 1 ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) B [ i ] = sc . nextInt ( ) ; int count = B [ 0 ] ; for ( int i = 0 ; i < N - 2 ; i ++ ) { System . out . println ( " [LOG] Block: if (B[i] < B[i + 1]) \n count += B[i]; \n else \n count += B[i + 1]; " ) ; if ( B [ i ] < B [ i + 1 ] ) count += B [ i ] ; else count += B [ i + 1 ] ; } count += B [ N - 2 ] ; System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n int p = stdIn.nextInt(); \n int q = stdIn.nextInt(); \n int r = stdIn.nextInt(); \n int a = p + q; \n int b = q + r; \n int c = p + r; \n int min = Integer.MAX_VALUE; \n min = Math.min(a, b); \n min = Math.min(min, c); \n System.out.println(min); " ) ; Scanner stdIn = new Scanner ( System . in ) ; int p = stdIn . nextInt ( ) ; int q = stdIn . nextInt ( ) ; int r = stdIn . nextInt ( ) ; int a = p + q ; int b = q + r ; int c = p + r ; int min = Integer . MAX_VALUE ; min = Math . min ( a , b ) ; min = Math . min ( min , c ) ; System . out . println ( min ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { solve_148_A ( ) ; return ; } private static void solve_148_A ( ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int C; \n C = (6 - A - B); \n System.out.println(C); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C ; C = ( 6 - A - B ) ; System . out . println ( C ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; int [ ] b = new int [ N - 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < N - 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 < N - 1 ; c ++ ) { if ( b [ c ] == 1 ) { count ++ ; } else { if ( count > b_max ) { System . out . println ( " [LOG] Block: b_max = count; " ) ; b_max = count ; } count = 0 ; } } if ( count > b_max ) { System . out . println ( " [LOG] Block: b_max = count; " ) ; b_max = count ; } System . out . println ( b_max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int a = scanner.nextInt(); \n int b = scanner.nextInt(); \n System.out.println(a * b); " ) ; Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; System . out . println ( a * b ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { 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 i = 0 ; i < string . length ( ) ; i ++ ) { lig [ i ] = string . substring ( i , i + 1 ) ; } int sum = 0 ; int [ ] v = new int [ lig . length ] ; for ( int i = 0 ; i < lig . length ; i ++ ) { System . out . println ( " [LOG] Block: v[i] = Integer.parseInt(lig[i]); \n sum += v[i]; " ) ; v [ i ] = Integer . parseInt ( lig [ i ] ) ; sum += v [ i ] ; } System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long ans = 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 ) { ans = ans + tmp ; array [ i ] = array [ i ] - ( int ) tmp ; } else { ans = ans + array [ i ] ; array [ i ] = 0 ; } tmp = 0 ; } if ( i == n ) { continue ; } if ( array [ i ] >= array2 [ i ] ) { ans = ans + array2 [ i ] ; tmp = 0 ; } else { System . out . println ( " [LOG] Block: ans = ans + array[i]; \n tmp = (array2[i] - array[i]); " ) ; ans = ans + array [ i ] ; tmp = ( array2 [ i ] - array [ i ] ) ; } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { int N ; int M ; boolean [ ] a ; int mod = ( int ) ( 1e9 + 7 ) ; public void solve ( int testNumber , Scanner in , PrintWriter out ) { N = in . nextInt ( ) ; M = in . nextInt ( ) ; a = new boolean [ N + 1 ] ; Arrays . fill ( a , true ) ; for ( int i = 0 ; i < M ; i ++ ) { a [ in . nextInt ( ) ] = false ; } int [ ] dp = new int [ N + 1 ] ; dp [ 0 ] = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( a [ i ] ) { dp [ i ] = dp [ i - 1 ] ; if ( i - 2 >= 0 ) { System . out . println ( " [LOG] Block: dp[i] += dp[i - 2]; " ) ; dp [ i ] += dp [ i - 2 ] ; } dp [ i ] %= mod ; } } out . println ( dp [ N ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . charAt ( A ) != '-' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i != A ) { if ( s . charAt ( i ) < '0' || s . charAt ( i ) > '9' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; return ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { 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 max = Integer . parseInt ( numberStr [ 0 ] ) ; int sum = Integer . parseInt ( numberStr [ 1 ] ) ; if ( ( max == 0 ) && ( sum == 0 ) ) { break ; } int set = 0 ; for ( int oneNum = 1 ; oneNum <= max - 2 ; oneNum ++ ) { for ( int twoNum = oneNum + 1 ; twoNum <= max + 1 ; twoNum ++ ) { for ( int threeNum = twoNum + 1 ; threeNum <= max ; threeNum ++ ) { if ( oneNum + twoNum + threeNum == sum ) { System . out . println ( " [LOG] Block: set++; " ) ; set ++ ; } } } } System . out . println ( set ) ; } } } +import java . io . * ; import java . util . * ; import java . lang . * ; class Main { 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 m = Integer . parseInt ( scan . next ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int h = Integer.parseInt(scan.next()); \n String buf = sb.substring(0, h); \n sb.delete(0, h); \n sb.append(buf); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; String s = scanner . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print((char) ((s.charAt(i) - 'A' + n) % 26 + 'A')); " ) ; System . out . print ( ( char ) ( ( s . charAt ( i ) - 'A' + n ) % 26 + 'A' ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = Integer . parseInt ( sc . next ( ) ) ; while ( 0 < a && a % 2 == 0 ) { System . out . println ( " [LOG] Block: a /= 2; \n count++; " ) ; a /= 2 ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; double [ ] Temp = new double [ N ] ; double min = ( double ) Integer . MAX_VALUE ; int minNum = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { double temp = sc . nextDouble ( ) ; if ( Math . abs ( A - ( T - temp * 0.006 ) ) < min ) { System . out . println ( " [LOG] Block: min = Math.abs(A - (T - temp * 0.006)); \n minNum = i + 1; " ) ; min = Math . abs ( A - ( T - temp * 0.006 ) ) ; minNum = i + 1 ; } } System . out . println ( minNum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int ans = 0 , o = 0 , e = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x % 2 == 0 ) { a [ e ] = x ; e ++ ; } else { o ++ ; } } if ( o != n ) { for ( int i = 0 ; i < e ; i ++ ) { while ( a [ i ] % 2 == 0 ) { System . out . println ( " [LOG] Block: ans++; \n a[i] = a[i] / 2; " ) ; ans ++ ; a [ i ] = a [ i ] / 2 ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int a = scan.nextInt(); \n int b = scan.nextInt(); \n int d = a / b; \n int r = a % b; \n double f = (double) a / (double) b; \n System.out.printf( \" %d %d %f \n \" , d, r, f); " ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int d = a / b ; int r = a % b ; double f = ( double ) a / ( double ) b ; System . out . printf ( " %d %d %f \n " , d , r , f ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; char [ ] p = { 'A' , 'B' , 'C' } ; int idx = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) != p [ idx ] ) { idx = s . charAt ( i ) == p [ 0 ] ? 1 : 0 ; } else idx ++ ; if ( idx == 3 ) { System . out . println ( " [LOG] Block: idx = 0; \n count++; " ) ; idx = 0 ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . IOException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; 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 = n - 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 { System . out . println ( " [LOG] Block: count++; \n break; " ) ; count ++ ; break ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static int x ; public static int y ; public static int z ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; if ( x > y ) { solve ( x , y ) ; } else { solve ( y , x ) ; } System . out . println ( z ) ; } public static void solve ( int big , int small ) { z = big % small ; if ( z == 0 ) { z = small ; } else { System . out . println ( " [LOG] Block: solve(small, z); " ) ; solve ( small , z ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int limit = sc . nextInt ( ) ; int max = 0 ; int result = 1 ; for ( int i = 1 ; i <= limit ; i ++ ) { int tmp = i ; int cnt = 0 ; while ( true ) { if ( tmp % 2 != 0 ) { break ; } tmp = tmp / 2 ; cnt ++ ; } if ( cnt > max ) { System . out . println ( " [LOG] Block: max = cnt; \n result = i; " ) ; max = cnt ; result = i ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int bnd = in . nextInt ( ) ; int lim = in . nextInt ( ) ; int pos = 0 ; int ans = 0 ; for ( int i = 0 ; i < bnd ; i ++ ) { pos += in . nextInt ( ) ; if ( lim < pos ) { ans = i + 1 ; break ; } else if ( lim == pos ) { ans = i + 2 ; break ; } else if ( i == bnd - 1 ) { System . out . println ( " [LOG] Block: ans = bnd + 1; " ) ; ans = bnd + 1 ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . next ( ) ) ; } Collections . sort ( list ) ; String output = " " ; for ( String s : list ) { System . out . println ( " [LOG] Block: output = output + s; " ) ; output = output + s ; } System . out . println ( output ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; List < Integer > list_two = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; n > 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 ; n > i ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(list_in_max); " ) ; System . out . println ( list_in_max ) ; } System . exit ( 0 ) ; } else { for ( int i = 0 ; n > i ; i ++ ) { if ( i == maxIndex ) { list_two . remove ( i ) ; System . out . println ( Collections . max ( list_two ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(list_in_max); " ) ; System . out . println ( list_in_max ) ; } } } } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int i , sum = 0 ; try { String line = reader . readLine ( ) ; if ( line . equals ( " 0 " ) ) break ; for ( i = 0 ; i < line . length ( ) ; i ++ ) { char c = line . charAt ( i ) ; sum += Character . getNumericValue ( c ) ; } } catch ( IOException e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; long n = scanner . nextLong ( ) ; if ( n <= s . length ( ) ) { for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '1' ) { continue ; } else { System . out . println ( " [LOG] Block: System.out.println(s.charAt(i)); \n return; " ) ; 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 ( " [LOG] Block: System.out.println(s.charAt(i)); \n return; " ) ; System . out . println ( s . charAt ( i ) ) ; return ; } } System . out . println ( 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int tmp = 0 ; int ans = 0 ; for ( char ss : s ) { if ( ss == 'R' ) { tmp ++ ; } else { System . out . println ( " [LOG] Block: tmp = 0; " ) ; tmp = 0 ; } ans = Math . max ( tmp , ans ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int n = Integer . parseInt ( S [ i ] ) ; while ( n % 2 == 0 ) { System . out . println ( " [LOG] Block: n /= 2; \n ans++; " ) ; n /= 2 ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; if ( n % 2 == 0 ) { System . out . println ( n / 2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println((n + 1) / 2); " ) ; System . out . println ( ( n + 1 ) / 2 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = in . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: sum += d[i] * d[j]; " ) ; sum += d [ i ] * d [ j ] ; } } System . out . println ( sum ) ; } } } +import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashSet < Integer > A = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: A.add(sc.nextInt()); " ) ; A . add ( sc . nextInt ( ) ) ; } System . out . println ( A . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int A = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: A += sc.nextInt(); " ) ; A += sc . nextInt ( ) ; } System . out . println ( H > A ? " No " : " Yes " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a1 = new int [ n + 2 ] ; int [ ] a2 = new int [ n + 1 ] ; a1 [ 0 ] = 0 ; a2 [ 0 ] = 0 ; int sum = 0 ; int subsum = 0 ; int sum1 = 0 ; int sum2 = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a1 [ i ] = sc . nextInt ( ) ; } sum1 = a1 [ 1 ] ; a1 [ n + 1 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a2 [ i ] = sc . nextInt ( ) ; sum2 += a2 [ i ] ; } for ( int i = 1 ; i <= n ; i ++ ) { subsum = sum1 + sum2 ; if ( subsum > sum ) { System . out . println ( " [LOG] Block: sum = subsum; " ) ; sum = subsum ; } sum1 += a1 [ i + 1 ] ; sum2 -= a2 [ i ] ; } System . out . println ( sum ) ; } } +import java . util . * ; import java . util . stream . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal A = new BigDecimal(sc.next()); \n BigDecimal B = new BigDecimal(sc.next()); \n System.out.println(A.multiply(B).setScale(0, RoundingMode.DOWN)); " ) ; 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 . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; int sum = 0 ; if ( a + b < c * 2 ) { sum = a * x + b * y ; System . out . println ( sum ) ; } else { while ( x >= 1 && y >= 1 ) { sum += c * 2 ; x -- ; y -- ; } int sum2 = sum ; sum += a * x + b * y ; if ( a > c * 2 || b > c * 2 ) { while ( x >= 1 || y >= 1 ) { sum2 += c * 2 ; x -- ; y -- ; } x = 0 ; y = 0 ; } sum2 += a * x + b * y ; if ( sum < sum2 ) { System . out . println ( sum ) ; } else { System . out . println ( " [LOG] Block: System.out.println(sum2); " ) ; System . out . println ( sum2 ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a ; int b ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; sizeComparison ( a , b ) ; } public static void sizeComparison ( int a , int b ) { String i = " == " ; if ( a < b ) { i = " < " ; } else if ( a > b ) { System . out . println ( " [LOG] Block: i = \" > \" ; " ) ; i = " > " ; } System . out . println ( " a " + i + " b " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int n , t ; int minCost = 1001 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; t = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; ++ 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 ( " [LOG] Block: System.out.println(minCost); " ) ; System . out . println ( minCost ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(); \n int x = sc.nextInt(), y = sc.nextInt(); \n int min = x * a + y * b; \n min = Math.min(min, 2 * y * c + Math.max(0, x - y) * a); \n min = Math.min(min, 2 * x * c + Math.max(0, y - x) * b); \n min = Math.min(min, 2 * Math.max(x, y) * c); \n System.out.println(min); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int min = x * a + y * b ; min = Math . min ( min , 2 * y * c + Math . max ( 0 , x - y ) * a ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int X = sc.nextInt(); \n int ans = (10000 - X) % 1000; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int ans = ( 10000 - X ) % 1000 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } boolean result = true ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { 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 cnt = 0 ; for ( int i = 0 ; i < s1 . length ; i ++ ) { if ( s1 [ i ] != t1 [ i ] ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } System . out . println ( cnt ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: String str = scan.nextLine(); \n if (str.equals( \" 0 \" )) \n break; \n int sum = 0; \n char[] box = str.toCharArray(); \n for (int i = 0; i < box.length; i++) sum += box[i] - '0'; \n System.out.println(sum); " ) ; String str = scan . nextLine ( ) ; if ( str . equals ( " 0 " ) ) break ; int sum = 0 ; char [ ] box = str . toCharArray ( ) ; for ( int i = 0 ; i < box . length ; i ++ ) sum += box [ i ] - '0' ; System . out . println ( sum ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int monster = scan . nextInt ( ) ; int waza = scan . nextInt ( ) ; long [ ] hp = new long [ monster ] ; for ( int i = 0 ; i < monster ; i ++ ) { hp [ i ] = scan . nextInt ( ) ; } long sum = 0 ; Arrays . sort ( hp ) ; for ( int i = 0 ; i < monster - waza ; i ++ ) { System . out . println ( " [LOG] Block: sum += hp[i]; " ) ; sum += hp [ i ] ; } System . out . println ( sum ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) , n = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; if ( n == 100 ) n ++ ; sb . append ( n ) ; for ( int i = 0 ; i < d ; i ++ ) { System . out . println ( " [LOG] Block: sb.append( \" 00 \" ); " ) ; sb . append ( " 00 " ) ; } System . out . println ( sb . toString ( ) ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String tmpS = " " ; while ( ! s . equals ( tmpS ) ) { if ( s . endsWith ( " dreamer " + tmpS ) ) { tmpS = " dreamer " + tmpS ; } else if ( s . endsWith ( " dream " + tmpS ) ) { tmpS = " dream " + tmpS ; } else if ( s . endsWith ( " eraser " + tmpS ) ) { tmpS = " eraser " + tmpS ; } else if ( s . endsWith ( " erase " + tmpS ) ) { tmpS = " erase " + tmpS ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); \n sc.close(); \n return; " ) ; System . out . println ( " NO " ) ; sc . close ( ) ; return ; } } System . out . println ( " YES " ) ; sc . close ( ) ; return ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; ArrayList < Integer > B = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int n = sc . nextInt ( ) ; A . add ( n ) ; B . add ( 0 ) ; } for ( int i = 0 ; i < N ; i ++ ) { B . set ( A . get ( i ) - 1 , i + 1 ) ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(B.get(i) + \" \" ); " ) ; System . out . print ( B . get ( i ) + " " ) ; } sc . close ( ) ; } } +import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( Character . isUpperCase ( s . charAt ( 0 ) ) ) { System . out . println ( " [LOG] Block: System.out.println('A'); " ) ; System . out . println ( 'A' ) ; } else System . out . println ( 'a' ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; int j = 0 ; while ( k -- > 0 ) { System . out . println ( " [LOG] Block: sum += a[j]; \n j++; " ) ; sum += a [ j ] ; j ++ ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int n1 = Integer . parseInt ( str ) ; for ( int i = 1 ; i < 10 ; i ++ ) { if ( n1 % i == 0 & n1 / i < 10 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int tt = 0 ; int tx = 0 ; int ty = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n sc.close(); \n return; " ) ; System . out . println ( " No " ) ; sc . close ( ) ; return ; } } sc . close ( ) ; System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int tairyoku = scanner . nextInt ( ) ; int hissatsuwazashurui = scanner . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < hissatsuwazashurui ; i ++ ) { sum += scanner . nextInt ( ) ; } if ( tairyoku > sum ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; StringBuilder str = new StringBuilder ( ) ; while ( true ) { int h = scan . nextInt ( ) ; int w = scan . nextInt ( ) ; if ( h == 0 && w == 0 ) break ; for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { System . out . println ( " [LOG] Block: str.append( \" # \" ); " ) ; str . append ( " # " ) ; } str . append ( " \n " ) ; } str . append ( " \n " ) ; } System . out . print ( str ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n Integer[] button = { a, b, a - 1, b - 1 } ; \n Arrays.sort(button); \n int result = button[3] + button[2]; \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; Integer [ ] button = { a , b , a - 1 , b - 1 } ; Arrays . sort ( button ) ; int result = button [ 3 ] + button [ 2 ] ; System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int ac = 0 ; int wa = 0 ; int tle = 0 ; int re = 0 ; for ( int i = 0 ; i <= n ; ++ i ) { System . out . println ( " [LOG] Block: String curr = in.nextLine(); \n if (curr.equals( \" AC \" )) \n ++ac; \n if (curr.equals( \" WA \" )) \n ++wa; \n if (curr.equals( \" TLE \" )) \n ++tle; \n if (curr.equals( \" RE \" )) \n ++re; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int buff = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( array [ i ] == buff + 1 ) { buff = array [ i ] ; } else { count ++ ; } } if ( buff == 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(count); " ) ; System . out . println ( count ) ; } } } +import java . util . * ; public class Main { 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 i = 0 ; i < 3 ; i ++ ) { ODD_STEP . add ( ODD_STEP_STR . charAt ( i ) ) ; EVEN_STEP . add ( EVEN_STEP_STR . charAt ( i ) ) ; } int current_step = 0 ; String steps = sc . next ( ) ; for ( int i = 0 ; i < steps . length ( ) ; i ++ ) { char step = steps . charAt ( i ) ; if ( ( i + 1 ) % 2 == 0 && ! EVEN_STEP . contains ( step ) ) { break ; } else if ( ( i + 1 ) % 2 != 0 && ! ODD_STEP . contains ( step ) ) { break ; } current_step ++ ; } if ( current_step == steps . length ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; import java . util . * ; import java . lang . * ; class Main { 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 i = 'a' ; i <= 'z' ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < input . length ( ) ; j ++ ) { if ( input . toString ( ) . charAt ( j ) == i || Character . toUpperCase ( input . toString ( ) . charAt ( j ) ) == Character . toUpperCase ( i ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( i + " : " + count ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A_1 = sc.nextInt(); \n int A_2 = sc.nextInt(); \n int A_3 = sc.nextInt(); \n int[] S = new int[] { A_1, A_2, A_3 } ; \n Arrays.sort(S); \n System.out.println((S[2] - S[1]) + (S[1] - S[0])); " ) ; Scanner sc = new Scanner ( System . in ) ; int A_1 = sc . nextInt ( ) ; int A_2 = sc . nextInt ( ) ; int A_3 = sc . nextInt ( ) ; int [ ] S = new int [ ] { A_1 , A_2 , A_3 } ; Arrays . sort ( S ) ; System . out . println ( ( S [ 2 ] - S [ 1 ] ) + ( S [ 1 ] - S [ 0 ] ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Random rand = new Random ( ) ; int hp = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; } if ( hp <= sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String sub; \n int max = -1; \n sub = s.substring(s.indexOf( \" A \" ), s.lastIndexOf( \" Z \" ) + 1); \n max = sub.length(); \n System.out.println(max); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String sub ; int max = - 1 ; sub = s . substring ( s . indexOf ( " A " ) , s . lastIndexOf ( " Z " ) + 1 ) ; max = sub . length ( ) ; System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String [ ] SSplit = S . split ( " " ) ; int res = 0 ; for ( int i = 0 ; i < SSplit . length / 2 ; i ++ ) { if ( ! SSplit [ i ] . equals ( SSplit [ SSplit . length - i - 1 ] ) ) { System . out . println ( " [LOG] Block: res++; " ) ; res ++ ; } } System . out . print ( res ) ; } } +import static java . lang . System . out ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n int divideAns = a / b; \n int modAns = a % b; \n double fewAns = (double) a / b; \n out.printf( \" %d %d %f%n \" , divideAns, modAns, fewAns); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int divideAns = a / b ; int modAns = a % b ; double fewAns = ( double ) a / b ; out . printf ( " %d %d %f%n " , divideAns , modAns , fewAns ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) , b = sc . next ( ) , c = sc . next ( ) ; char t = 'a' ; int ac = 0 , bc = 0 , cc = 0 ; while ( true ) { if ( t == 'a' ) { if ( ac == a . length ( ) ) { System . out . println ( " A " ) ; break ; } t = a . charAt ( ac ) ; ac ++ ; } else if ( t == 'b' ) { if ( bc == b . length ( ) ) { System . out . println ( " B " ) ; break ; } t = b . charAt ( bc ) ; bc ++ ; } else if ( t == 'c' ) { if ( cc == c . length ( ) ) { System . out . println ( " [LOG] Block: System.out.println( \" C \" ); \n break; " ) ; System . out . println ( " C " ) ; break ; } t = c . charAt ( cc ) ; cc ++ ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int A = Integer.parseInt(sc.next()); \n int B = Integer.parseInt(sc.next()); \n int T = Integer.parseInt(sc.next()); \n System.out.println((T / A) * B); " ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int T = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( T / A ) * B ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; sc . close ( ) ; int sa = ( int ) 'A' - ( int ) 'a' ; for ( char moji : input . toCharArray ( ) ) { if ( 'a' <= moji && moji <= 'z' ) { System . out . print ( ( char ) ( ( int ) moji + sa ) ) ; } else if ( 'A' <= moji && moji <= 'Z' ) { System . out . print ( ( char ) ( ( int ) moji - sa ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(moji); " ) ; System . out . print ( moji ) ; } } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String p = scan . nextLine ( ) ; s += s . substring ( 0 , s . length ( ) - 1 ) ; if ( s . indexOf ( p ) == - 1 ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; double x = ( double ) a / 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { int ans = 0 ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: ans += x[j] * a[i][j]; " ) ; ans += x [ j ] * a [ i ] [ j ] ; } System . out . println ( ans ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x , y , z , a , b , c ; Scanner sc = new Scanner ( System . in ) ; a = 0 ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; y = y / 1000 ; if ( y < x ) { System . out . println ( " -1 -1 -1 " ) ; } else if ( y == x ) { System . out . println ( " 0 0 " + y ) ; } else { z = y - x ; while ( z % 9 != 0 ) { z = z - 4 ; a ++ ; } b = z / 9 ; c = x - a - b ; if ( a < 0 || b < 0 || c < 0 ) { System . out . println ( " -1 -1 -1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b + \" \" + a + \" \" + c); " ) ; System . out . println ( b + " " + a + " " + c ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int l = Integer . parseInt ( sc . next ( ) ) ; int [ ] x = new int [ n + 1 ] ; x [ 0 ] = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { x [ i ] = x [ i - 1 ] + Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int i = 0 ; i < n + 1 ; i ++ ) { if ( x [ i ] > l ) { ans = i ; break ; } if ( i == n ) { System . out . println ( " [LOG] Block: ans = i + 1; " ) ; ans = i + 1 ; } } System . out . println ( ans ) ; } } +import java . io . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] str = br.readLine().split( \" \" ); \n int x = Integer.parseInt(str[0]); \n int y = Integer.parseInt(str[1]); \n System.out.println(x * y + \" \" + (2 * x + 2 * y)); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int x = Integer . parseInt ( str [ 0 ] ) ; int y = Integer . parseInt ( str [ 1 ] ) ; System . out . println ( x * y + " " + ( 2 * x + 2 * y ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 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 ) { System . out . println ( " [LOG] Block: nowSize = size; \n count++; " ) ; nowSize = size ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in))); \n int N = scanner.nextInt(); \n int A = scanner.nextInt(); \n int B = scanner.nextInt(); \n System.out.println(Math.min(N * A, B)); " ) ; Scanner scanner = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int N = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; System . out . println ( Math . min ( N * A , B ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int times = 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 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . println ( Math . min ( n [ 0 ] , n [ 1 ] ) + " " + Math . max ( n [ 0 ] , n [ 1 ] ) ) ; times ++ ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; int [ ] arr = new int [ n ] ; int sum = 0 ; int min = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = l + i ; sum += arr [ i ] ; } if ( l >= 0 ) { System . out . print ( sum - l ) ; } else { if ( n + l > 0 ) { min = sum ; } else { System . out . println ( " [LOG] Block: min = sum - (n + l - 1); " ) ; min = sum - ( n + l - 1 ) ; } System . out . print ( min ) ; } } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int N = sc . nextInt ( ) ; int [ ] d = nextIntArray ( sc , N ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; 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 ++ ) { System . out . println ( " [LOG] Block: result[i] = sc.nextInt(); " ) ; result [ i ] = sc . nextInt ( ) ; } return result ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long answer = A * B / calcGcd ( A , 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 ) { System . out . println ( " [LOG] Block: m = n; \n n = remainder; " ) ; m = n ; n = remainder ; } return n ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num1 = scan . nextInt ( ) ; int num2 = scan . nextInt ( ) ; int num3 = scan . nextInt ( ) ; int count = 0 ; if ( num1 != num2 ) { count ++ ; } if ( num2 != num3 ) { count ++ ; } if ( num1 != num3 ) { count ++ ; } if ( count == 1 || count == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = 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 ( X - j ) ) ; } int a = X - min ; if ( Arrays . asList ( p ) . contains ( a ) ) { System . out . println ( X + min ) ; } else { System . out . println ( " [LOG] Block: System.out.println(a); " ) ; System . out . println ( a ) ; } } } +import java . io . IOException ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner scan = new Scanner ( System . in ) ; int n = 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 < n ; 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 < n ; 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 . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( " " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int M = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: M -= sc.nextInt(); " ) ; M -= sc . nextInt ( ) ; } System . out . println ( M >= 0 ? M : - 1 ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 n = Integer . parseInt ( input1 [ 0 ] ) ; int k = Integer . parseInt ( input1 [ 1 ] ) ; String [ ] input2 = br . readLine ( ) . split ( " " ) ; int [ ] numbers = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { numbers [ i ] = Integer . parseInt ( input2 [ i ] ) ; if ( numbers [ i ] >= k ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } out . println ( ans ) ; out . close ( ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < 40 ; i ++ ) { if ( N >= K ) { count ++ ; N = N / K ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( count + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] list = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } int count = 0 ; int Max = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( list [ i - 1 ] >= list [ i ] ) { count ++ ; if ( Max < count ) { System . out . println ( " [LOG] Block: Max = count; " ) ; Max = count ; } } else { if ( Max < count ) { System . out . println ( " [LOG] Block: Max = count; " ) ; Max = count ; } count = 0 ; } } System . out . println ( Max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] A = new int [ n ] ; int i ; int count = 0 ; for ( i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } else { i = 3 ; while ( i <= Math . sqrt ( x ) ) { if ( ( x % i ) == 0 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } i = i + 2 ; } } return true ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringBuilder sb = new StringBuilder ( ) ; String str = br . readLine ( ) ; String [ ] s = str . split ( " " , 0 ) ; for ( int i = 0 ; i < s . length ; i ++ ) { sb . append ( s [ s . length - 1 - i ] ) ; } System . out . println ( sb ) ; } catch ( Exception ex ) { System . out . println ( " [LOG] Block: System.exit(0); " ) ; System . exit ( 0 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; 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 ) { System . out . println ( " [LOG] Block: max = -1; \n min = 0; \n break; " ) ; max = - 1 ; min = 0 ; break ; } } System . out . println ( max - min + 1 ) ; } } +import java . util . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; if ( S . compareTo ( " 2019/04/30 " ) > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } try { System . out . println ( " [LOG] Block: Date date1 = DateFormat.getDateInstance().parse(S); " ) ; Date date1 = DateFormat . getDateInstance ( ) . parse ( S ) ; } catch ( ParseException e ) { } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int [ ] cities = new int [ num + 1 ] ; int [ ] savers = new int [ num ] ; for ( int i = 0 ; i <= num ; i ++ ) cities [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < num ; i ++ ) savers [ i ] = sc . nextInt ( ) ; double ans = 0 ; for ( int i = 0 ; i < num ; 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 { System . out . println ( " [LOG] Block: ans += cities[i + 1]; \n cities[i + 1] = 0; " ) ; ans += cities [ i + 1 ] ; cities [ i + 1 ] = 0 ; } } System . out . printf ( " %.0f \n " , ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] ans = new Integer [ N ] ; for ( int n = 0 ; n < N ; 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 ( " [LOG] Block: System.out.println(N - sunuke); " ) ; System . out . println ( N - sunuke ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextInt ( ) ; long total = 0 ; for ( long i = 0 ; i <= N ; i ++ ) { if ( i % 3 != 0 && i % 5 != 0 ) { System . out . println ( " [LOG] Block: total += i; " ) ; total += i ; } } System . out . println ( total ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A * B > C ) { System . out . println ( C ) ; } else { System . out . println ( " [LOG] Block: System.out.println(A * B); " ) ; System . out . println ( A * B ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int i ; for ( i = 0 ; i < q ; i ++ ) a [ scan . nextInt ( ) ] ++ ; int border = q - k ; for ( i = 1 ; i <= n ; i ++ ) { if ( a [ i ] > border ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double ans1 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: ans1 += 1 / (double) sc.nextInt(); " ) ; ans1 += 1 / ( double ) sc . nextInt ( ) ; } sc . close ( ) ; double ans2 = ( 1 / ans1 ) ; System . out . println ( ans2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String[] list = sc.nextLine().split( \" \" , 0); \n int A = Integer.parseInt(list[0]); \n int B = Integer.parseInt(list[1]); \n int T = Integer.parseInt(list[2]); \n System.out.println(B * (T / A)); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; String [ ] list = sc . nextLine ( ) . split ( " " , 0 ) ; int A = Integer . parseInt ( list [ 0 ] ) ; int B = Integer . parseInt ( list [ 1 ] ) ; int T = Integer . parseInt ( list [ 2 ] ) ; System . out . println ( B * ( T / A ) ) ; sc . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] cnt = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { cnt [ i ] = 0 ; } String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: s[i] = sc.next(); \n switch(s[i]) { \n case \" AC \" : \n cnt[0]++; \n break; \n case \" WA \" : \n cnt[1]++; \n break; \n case \" TLE \" : \n cnt[2]++; \n break; \n case \" RE \" : \n cnt[3]++; \n break; \n } " ) ; 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 . 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 Main { public static void main ( String [ ] args ) throws Exception { Scanner fr = new Scanner ( System . in ) ; int n = fr . nextInt ( ) ; int x = fr . nextInt ( ) ; int xx = x ; int t = fr . nextInt ( ) ; int tt = t ; if ( n < x ) { System . out . println ( t ) ; } else { while ( x < n ) { System . out . println ( " [LOG] Block: x += xx; \n t += tt; " ) ; x += xx ; t += tt ; } System . out . println ( t ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int [ ] x = new int [ N ] ; int [ ] y = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { x [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( x [ i ] >= y [ i ] ) { System . out . println ( " [LOG] Block: sum += x[i] - y[i]; " ) ; sum += x [ i ] - y [ i ] ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int d = scn . nextInt ( ) ; int [ ] [ ] dot = new int [ n ] [ d ] ; int answer = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < d ; j ++ ) { dot [ i ] [ j ] = scn . nextInt ( ) ; } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; 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 ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } } } System . out . println ( answer ) ; } } +import java . util . * ; class Main { 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 ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int C = sc.nextInt(); \n int ab = abs(A - B); \n int bc = abs(B - C); \n int ca = abs(C - A); \n int minus = max3(ab, bc, ca); \n System.out.println(ab + bc + ca - minus); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int ab = abs ( A - B ) ; int bc = abs ( B - C ) ; int ca = abs ( C - A ) ; int minus = max3 ( ab , bc , ca ) ; System . out . println ( ab + bc + ca - minus ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r , c , e = 0 ; r = scan . nextInt ( ) ; c = scan . nextInt ( ) ; int [ ] [ ] a = new int [ r ] [ c ] ; for ( int i = 0 ; i < r ; 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 < r ; j ++ ) { System . out . println ( " [LOG] Block: d += a[j][i]; " ) ; d += a [ j ] [ i ] ; } System . out . print ( d + " " ) ; } System . out . println ( e ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; long A = N % K ; long ans = 0 ; if ( N % K == 0 ) { ans = 0 ; } else { System . out . println ( " [LOG] Block: ans = Math.min(A, K - A); " ) ; ans = Math . min ( A , K - A ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int [ ] A = new int [ N ] ; int count = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" DENIED \" ); " ) ; System . out . println ( " DENIED " ) ; } stdIn . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = Integer.parseInt(sc.next()); \n System.out.println(n + n * n + n * n * n); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( n + n * n + n * n * n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int moveCount = Integer . parseInt ( sc . nextLine ( ) ) ; boolean okFlag = true ; int prePosX = 0 ; int prePosY = 0 ; int preTime = 0 ; for ( int i = 1 ; i <= moveCount ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { Scanner sc ; int L ; private void calc ( ) { sc = new Scanner ( System . in ) ; L = sc . nextInt ( ) ; double l = L / 3d ; System . out . println ( l * l * l ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +import java . util . Scanner ; import java . util . HashMap ; import java . util . TreeMap ; import java . util . Arrays ; import java . util . Stack ; public class Main { static Scanner scn = new Scanner ( System . in ) ; static long count = 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 ) { count ++ ; return ; } if ( sum > n ) return ; for ( int i = prev ; i < arr . length ; i ++ ) { System . out . println ( " [LOG] Block: coin(arr, sum + arr[i], n, i); " ) ; coin ( arr , sum + arr [ i ] , n , i ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int res = 9999 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" TLE \" ); " ) ; System . out . println ( " TLE " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( method ( a , b , c ) ) ; } static int method ( int a , int b , int c ) { int divisor = 0 ; for ( int i = a ; i < b + 1 ; i ++ ) { if ( c % i == 0 ) { System . out . println ( " [LOG] Block: divisor++; " ) ; divisor ++ ; } } return divisor ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long a = Integer . parseInt ( scan . next ( ) ) ; long b = Integer . parseInt ( scan . next ( ) ) ; long mult = a * b ; if ( a < b ) { long tmp = a ; a = b ; b = tmp ; } long r = a % b ; while ( r > 0 ) { System . out . println ( " [LOG] Block: a = b; \n b = r; \n r = a % b; " ) ; a = b ; b = r ; r = a % b ; } System . out . println ( mult / b ) ; scan . close ( ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long ans = 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 ( ) ) { System . out . println ( " [LOG] Block: ans += map.get(key) * (map.get(key) - 1) / 2; " ) ; ans += map . get ( key ) * ( map . get ( key ) - 1 ) / 2 ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String S = s . nextLine ( ) ; int count = 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' ) { count ++ ; if ( ans < count ) { ans = count ; } } else { System . out . println ( " [LOG] Block: count = 0; " ) ; count = 0 ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = Long . parseLong ( sc . next ( ) ) ; long r = Long . parseLong ( sc . next ( ) ) ; long ans = Long . MAX_VALUE ; long num = 0 ; for ( long i = l ; 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 ( " [LOG] Block: System.out.println(0); \n return; " ) ; System . out . println ( 0 ) ; return ; } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n System.out.println(a + a * a + a * a * a); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( a + a * a + a * a * a ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int quantity = Integer . parseInt ( br . readLine ( ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; long min = 1000000 ; long max = - 1000000 ; long sum = 0 ; for ( int i = 0 ; i < quantity ; i ++ ) { System . out . println ( " [LOG] Block: long value = Integer.parseInt(str[i]); \n if (min > value) \n min = value; \n if (max < value) \n max = value; \n sum += value; " ) ; 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 . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int h = sc.nextInt(), a = sc.nextInt(); \n if (h % a == 0) \n System.out.println(h / a); \n else \n System.out.println(h / a + 1); " ) ; Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) , a = sc . nextInt ( ) ; if ( h % a == 0 ) System . out . println ( h / a ) ; else System . out . println ( h / a + 1 ) ; } } +import java . util . Scanner ; class Main { 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 i = 0 ; i < t . length ( ) ; i ++ ) { if ( c [ 0 ] == al [ i ] ) { System . out . println ( " [LOG] Block: System.out.println(al[i + 1]); " ) ; System . out . println ( al [ i + 1 ] ) ; } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] [ ] h = new int [ r + 1 ] [ c + 1 ] ; StringBuilder sb1 = new StringBuilder ( ) ; StringBuilder sb2 = new StringBuilder ( ) ; String b = " " , n = " \n " ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { System . out . println ( " [LOG] Block: h[i][j] = sc.nextInt(); \n h[i][c] += h[i][j]; \n h[r][j] += h[i][j]; \n h[r][c] += h[i][j]; \n sb1.append(h[i][j] + b); \n if (i == r - 1) \n sb2.append(h[r][j] + b); " ) ; h [ i ] [ j ] = sc . nextInt ( ) ; h [ i ] [ c ] += h [ i ] [ j ] ; h [ r ] [ j ] += h [ i ] [ j ] ; h [ r ] [ c ] += h [ i ] [ j ] ; sb1 . append ( h [ i ] [ j ] + b ) ; if ( i == r - 1 ) sb2 . append ( h [ r ] [ j ] + b ) ; } sb1 . append ( h [ i ] [ c ] + n ) ; } sb2 . append ( h [ r ] [ c ] ) ; System . out . print ( sb1 ) ; System . out . println ( sb2 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long ans = Long . MAX_VALUE / 2 ; for ( int i = 1 ; ( long ) i * i <= n ; i ++ ) { if ( n % i == 0 ) { long a = i ; long b = n / i ; long tmp = Math . max ( a , b ) ; ans = Math . min ( ans , tmp ) ; } } int res = 0 ; while ( ans > 0 ) { System . out . println ( " [LOG] Block: ans /= 10; \n res++; " ) ; ans /= 10 ; res ++ ; } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int Q = stdIn . nextInt ( ) ; int [ ] ans = new int [ N ] ; int [ ] kota = new int [ Q ] ; String S = stdIn . next ( ) ; int z = 1 , y = 0 , l = 0 , r = 0 , num = 0 ; while ( z < N ) { 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 ( " [LOG] Block: System.out.println(kota[z]); \n z++; " ) ; System . out . println ( kota [ z ] ) ; z ++ ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = x ; if ( x == 2 ) { System . out . println ( 2 ) ; System . exit ( 0 ) ; } else if ( x == 3 ) { System . out . println ( 3 ) ; System . exit ( 0 ) ; } if ( y % 2 == 0 ) { y ++ ; } int n = 3 ; while ( n <= x ) { boolean b = true ; for ( int i = 3 ; i * i < y ; i += 2 ) { if ( y % i == 0 ) { b = false ; break ; } } if ( b ) { System . out . println ( " [LOG] Block: System.out.println(y); \n System.exit(0); " ) ; System . out . println ( y ) ; System . exit ( 0 ) ; } y += 2 ; } sc . close ( ) ; } } +import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int n = ob . nextInt ( ) ; HashMap < String , Integer > map = new HashMap < > ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s1 = ob . next ( ) ; if ( ! map . containsKey ( s1 ) ) { System . out . println ( " [LOG] Block: map.put(s1, 0); \n count++; " ) ; map . put ( s1 , 0 ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int a2 = a * a; \n int a3 = a * a * a; \n int ans = a + a2 + a3; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int a2 = a * a ; int a3 = a * a * a ; int ans = a + a2 + a3 ; System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] Arguments ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer ST = new StringTokenizer(BR.readLine()); \n int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0; \n ST = new StringTokenizer(BR.readLine()); \n for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken()); \n System.out.println((homeworkDays <= N) ? N - homeworkDays : -1); " ) ; BufferedReader BR = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer ST = new StringTokenizer ( BR . readLine ( ) ) ; int N = Integer . parseInt ( ST . nextToken ( ) ) , M = Integer . parseInt ( ST . nextToken ( ) ) , homeworkDays = 0 ; ST = new StringTokenizer ( BR . readLine ( ) ) ; for ( ; M > 0 ; M -- ) homeworkDays += Integer . parseInt ( ST . nextToken ( ) ) ; System . out . println ( ( homeworkDays <= N ) ? N - homeworkDays : - 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String word = sc . nextLine ( ) ; int count = 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 0 ; if ( N % 2 == 0 ) { cnt = N / 2 ; System . out . println ( cnt ) ; } else { System . out . println ( " [LOG] Block: cnt = (int) (N / 2) + 1; \n System.out.println(cnt); " ) ; cnt = ( int ) ( N / 2 ) + 1 ; System . out . println ( cnt ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String str = scan.next(); \n int a = Integer.parseInt(str); \n str = scan.next(); \n int b = Integer.parseInt(str); \n if (a < b) \n System.out.println( \" a < b \" ); \n else if (a > b) \n System.out.println( \" a > b \" ); \n else if (a == b) \n System.out.println( \" a == b \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int a = Integer . parseInt ( str ) ; str = scan . next ( ) ; int b = Integer . parseInt ( str ) ; if ( a < b ) System . out . println ( " a < b " ) ; else if ( a > b ) System . out . println ( " a > b " ) ; else if ( a == b ) System . out . println ( " a == b " ) ; } } +import java . util . ArrayDeque ; import java . util . Deque ; import java . util . Scanner ; public class Main { 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 i = 0 ; i < s . length ; i ++ ) que . addLast ( s [ i ] ) ; while ( true ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) 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 ( " [LOG] Block: System.out.println( \" NO \" ); \n System.exit(0); " ) ; System . out . println ( " NO " ) ; System . exit ( 0 ) ; } } } if ( que . isEmpty ( ) ) break ; } System . out . println ( " YES " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; class Main { 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 i = 0 ; i < 2 ; i ++ ) { x [ i ] = Integer . parseInt ( str2 [ i ] ) ; } if ( x [ 0 ] == 0 && x [ 1 ] == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } Arrays . sort ( x ) ; System . out . println ( x [ 0 ] + " " + x [ 1 ] ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); \n String[] str = in.readLine().split( \" \" ); \n int a = Integer.parseInt(str[0]); \n int b = Integer.parseInt(str[1]); \n int c = Integer.parseInt(str[2]); \n int d = Integer.parseInt(str[3]); \n int x = (a + d - 1) / d; \n int y = (c + b - 1) / b; \n System.out.println(x >= y ? \" Yes \" : \" No \" ); " ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int c = Integer . parseInt ( str [ 2 ] ) ; int d = Integer . parseInt ( str [ 3 ] ) ; int x = ( a + d - 1 ) / d ; int y = ( c + b - 1 ) / b ; System . out . println ( x >= y ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; int k = 1 ; long z = 26L ; long d = 0L ; while ( z < n ) { d = z ; k ++ ; z += ( long ) Math . pow ( 26 , k ) ; } long y = n - d - 1L ; String alp = " abcdefghijklmnopqrstuvwxyz " ; String [ ] s = new String [ k ] ; for ( int i = k - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: int c = (int) (y % 26L); \n s[i] = alp.substring(c, c + 1); \n y = y / 26L; " ) ; int c = ( int ) ( y % 26L ) ; s [ i ] = alp . substring ( c , c + 1 ) ; y = y / 26L ; } System . out . println ( String . join ( " " , s ) ) ; } } +import java . util . * ; public class Main { private static final int INF = 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 = INF ; for ( int tmp = 0 ; tmp < m ; tmp ++ ) { System . out . println ( " [LOG] Block: int x = sc.nextInt(); \n l = Math.max(x, l); \n int y = sc.nextInt(); \n r = Math.min(y, r); " ) ; 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 Main { 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 ch : c ) { if ( ch == '0' ) ans . append ( " 0 " ) ; if ( ch == '1' ) ans . append ( " 1 " ) ; if ( ch == 'B' ) { System . out . println ( " [LOG] Block: if (ans.length() == 1) \n ans = new StringBuilder(); \n if (!ans.toString().isEmpty()) \n ans.setLength(ans.length() - 1); " ) ; if ( ans . length ( ) == 1 ) ans = new StringBuilder ( ) ; if ( ! ans . toString ( ) . isEmpty ( ) ) ans . setLength ( ans . length ( ) - 1 ) ; } } System . out . println ( ans . toString ( ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int k = stdIn . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = stdIn . nextInt ( ) ; } int [ ] dp = new int [ n ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= i + k ; j ++ ) { if ( j >= n ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } dp [ j ] = Math . min ( dp [ i ] + Math . abs ( h [ j ] - h [ i ] ) , dp [ j ] ) ; } } System . out . println ( dp [ n - 1 ] ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); \n int S = in.nextInt(); \n int W = in.nextInt(); \n System.out.println(W >= S ? \" unsafe \" : \" safe \" ); " ) ; Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int S = in . nextInt ( ) ; int W = in . nextInt ( ) ; System . out . println ( W >= S ? " unsafe " : " safe " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] m = new int [ N ] ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println((m[i] - Q) > 0 ? \" Yes \" : \" No \" ); " ) ; System . out . println ( ( m [ i ] - Q ) > 0 ? " Yes " : " No " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int A = scanner.nextInt(); \n int B = scanner.nextInt(); \n int C = scanner.nextInt(); \n System.out.println(Math.max(0, C - (A - B))); " ) ; Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; System . out . println ( Math . max ( 0 , C - ( A - B ) ) ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int cnt = scn . nextInt ( ) ; String a = scn . next ( ) ; String b = scn . next ( ) ; String result = " " ; String [ ] c = new String [ cnt ] ; String [ ] d = new String [ cnt ] ; for ( int i = 0 ; i < cnt ; i ++ ) { System . out . println ( " [LOG] Block: c[i] = a.charAt(i) + \" \" ; \n d[i] = b.charAt(i) + \" \" ; \n result += c[i] + d[i]; " ) ; c [ i ] = a . charAt ( i ) + " " ; d [ i ] = b . charAt ( i ) + " " ; result += c [ i ] + d [ i ] ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; String op = sc . next ( ) ; int b = sc . nextInt ( ) ; for ( ; ! op . equals ( " ? " ) ; ) { int ans = 0 ; switch ( op ) { case " + " : ans = a + b ; break ; case " - " : ans = a - b ; break ; case " * " : ans = a * b ; break ; case " / " : if ( a == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } ans = a / b ; } System . out . println ( ans ) ; a = sc . nextInt ( ) ; op = sc . next ( ) ; b = sc . nextInt ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String a = " " ; String okikae = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: okikae = s.substring(i, i + 1); \n okikae = \" x \" ; \n a = a + okikae; " ) ; okikae = s . substring ( i , i + 1 ) ; okikae = " x " ; a = a + okikae ; } System . out . println ( a ) ; scan . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int h = sc.nextInt(); \n int a = sc.nextInt(); \n int ans = (h + a - 1) / a; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int ans = ( h + a - 1 ) / a ; System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . Collator ; public class Main { 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 turn = Integer . parseInt ( br . readLine ( ) ) ; int pointA = 0 ; int pointB = 0 ; int result = 0 ; for ( int i = 0 ; i < turn ; i ++ ) { System . out . println ( " [LOG] Block: line.append(br.readLine()); \n wordA.append(line.substring(0, line.indexOf( \" \" ))); \n wordB.append(line.substring(line.indexOf( \" \" ) + 1, line.length())); \n result = collator.compare(wordA.toString(), wordB.toString()); \n pointA += result == 0 ? 1 : result < 0 ? 0 : 3; \n pointB += result == 0 ? 1 : result < 0 ? 3 : 0; \n line.setLength(0); \n wordA.setLength(0); \n wordB.setLength(0); " ) ; 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 . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n System.out.println(4 - in.nextLine().replace( \" + \" , \" \" ).length() * 2); " ) ; Scanner in = new Scanner ( System . in ) ; System . out . println ( 4 - in . nextLine ( ) . replace ( " + " , " " ) . length ( ) * 2 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] ss = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { ss [ i ] = s . substring ( i , i + 1 ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { if ( ss [ i ] . equals ( ss [ i + 1 ] ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Bad \" ); \n return; " ) ; System . out . println ( " Bad " ) ; return ; } } System . out . println ( " Good " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String numM = scan . next ( ) ; int origin = Integer . parseInt ( numM ) ; int startNum = 0 ; for ( int i = 0 ; i < numM . length ( ) ; i ++ ) { startNum = startNum + Integer . parseInt ( String . valueOf ( numM . charAt ( i ) ) ) ; } if ( origin % startNum == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int len = s . length ( ) ; int [ ] A = new int [ len ] ; int [ ] B = new int [ len ] ; int i ; for ( i = 0 ; i < len ; i ++ ) { A [ i ] = i % 2 ; B [ i ] = ( i + 1 ) % 2 ; } int tempA = 0 ; int tempB = 0 ; int intS ; for ( i = 0 ; i < len ; i ++ ) { System . out . println ( " [LOG] Block: intS = Integer.parseInt(s.substring(i, i + 1)); \n if (intS != A[i]) \n tempA++; \n if (intS != B[i]) \n tempB++; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = 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 == A && tax10 == B ) { result = i ; break ; } } System . out . println ( result ) ; } public static int getTax ( int base , int rate ) { System . out . println ( " [LOG] Block: return base * rate / 100; " ) ; return base * rate / 100 ; } } +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 Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( i % 2 == 0 ) { if ( ch == 'L' ) return false ; } else { System . out . println ( " [LOG] Block: if (ch == 'R') \n return false; " ) ; if ( ch == 'R' ) return false ; } } return true ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . lang . Math ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int a = 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 == a && k2 == b ) { System . out . println ( " [LOG] Block: System.out.println(i); \n return; " ) ; System . out . println ( i ) ; return ; } } System . out . println ( " -1 " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int N ; int M ; int X ; int i ; int a = 0 ; int b = 0 ; int [ ] A = new int [ 99 ] ; Scanner sc = new Scanner ( System . in ) ; N = 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 ( " [LOG] Block: System.out.println(b); " ) ; System . out . println ( b ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; solve ( N , X , T ) ; } private static void solve ( int n , int x , int t ) { if ( x == 1 || n == 1 ) System . out . println ( n * t ) ; else { System . out . println ( " [LOG] Block: int r = (n + x - 1) / x; \n System.out.println(r * t); " ) ; int r = ( n + x - 1 ) / x ; System . out . println ( r * t ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; for ( int b = 1 ; b > 0 ; b ++ ) { String r = scan . next ( ) ; int tot = 0 ; if ( r . equals ( " 0 " ) ) { break ; } for ( int a = 1 ; a <= r . length ( ) ; a ++ ) { System . out . println ( " [LOG] Block: String k = r.substring(a - 1, a); \n int K = Integer.parseInt(k); \n tot = tot + K; " ) ; String k = r . substring ( a - 1 , a ) ; int K = Integer . parseInt ( k ) ; tot = tot + K ; } System . out . println ( tot ) ; } } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < 26 ; i ++ ) { if ( C . equals ( slist [ i ] ) ) { System . out . println ( " [LOG] Block: C = slist[i + 1]; \n System.out.println(C); \n break; " ) ; C = slist [ i + 1 ] ; System . out . println ( C ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n sc.close(); \n System.out.println((n + 1) / 2 * 1.0 / n); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( ( n + 1 ) / 2 * 1.0 / n ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int teki = sc . nextInt ( ) ; int waza = sc . nextInt ( ) ; long ret = 0 ; int [ ] hoge = new int [ teki ] ; if ( teki <= waza ) { System . out . println ( 0 ) ; return ; } for ( int i = 0 ; i < teki ; i ++ ) { hoge [ i ] = sc . nextInt ( ) ; } Arrays . sort ( hoge ) ; for ( int i = 0 ; i < teki - waza ; i ++ ) { System . out . println ( " [LOG] Block: ret += hoge[i]; " ) ; ret += hoge [ i ] ; } System . out . print ( ret ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ac = 0 ; int wa = 0 ; int tle = 0 ; int re = 0 ; for ( int i = 0 ; i < N + 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 " ) ) { System . out . println ( " [LOG] Block: 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int m = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( m == - 1 && f == - 1 && r == - 1 ) { break ; } if ( m == - 1 || f == - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } else { int S = m + 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 ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } } } } } +import java . io . StringReader ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num = 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 / num ; if ( ( pointSum % num ) > ( ( double ) num / 2 ) ) { middle ++ ; } long sum = 0 ; for ( Integer u : users ) { System . out . println ( " [LOG] Block: sum += Math.pow(u - middle, 2); " ) ; sum += Math . pow ( u - middle , 2 ) ; } System . out . println ( sum ) ; } } +import java . util . * ; class Main { 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 ans = 1 ; a += b ; while ( a >= 10 ) { System . out . println ( " [LOG] Block: ans++; \n a /= 10; " ) ; ans ++ ; a /= 10 ; } return ans ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] tmp = s . toCharArray ( ) ; for ( int i = 0 ; i < tmp . length ; i ++ ) { int j = n ; while ( j > 0 ) { if ( tmp [ i ] == 'Z' ) { tmp [ i ] = 'A' ; } else { tmp [ i ] = ( char ) ( tmp [ i ] + 1 ) ; } j -- ; } } for ( char c : tmp ) { System . out . println ( " [LOG] Block: System.out.print(c); " ) ; System . out . print ( c ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n int A = s.nextInt(), B = s.nextInt(), C = s.nextInt(); \n int temp = A; \n A = B; \n B = temp; \n temp = A; \n A = C; \n C = temp; \n System.out.println(A + \" \" + B + \" \" + C); " ) ; Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) , B = s . nextInt ( ) , C = s . nextInt ( ) ; int temp = A ; A = B ; B = temp ; temp = A ; A = C ; C = temp ; System . out . println ( A + " " + B + " " + C ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n sc.close(); \n char[] c = s.toCharArray(); \n int ans = 0; \n for (int i = 0; i < 3; i++) if (c[i] == '1') \n ans = ans + 1; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; char [ ] c = s . toCharArray ( ) ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) if ( c [ i ] == '1' ) ans = ans + 1 ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String answer = \" Heisei \" ; \n int year, month, day; \n year = Integer.parseInt(s.substring(0, 4)); \n month = Integer.parseInt(s.substring(5, 7)); \n if (year > 2019) \n answer = \" TBD \" ; \n if (year == 2019 && month >= 5) \n answer = \" TBD \" ; \n System.out.println(answer); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String answer = " Heisei " ; int year , month , day ; year = Integer . parseInt ( s . substring ( 0 , 4 ) ) ; month = Integer . parseInt ( s . substring ( 5 , 7 ) ) ; if ( year > 2019 ) answer = " TBD " ; if ( year == 2019 && month >= 5 ) answer = " TBD " ; System . out . println ( answer ) ; } } +import java . util . * ; class Main { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int n = sc . nextInt ( ) ; Set < Long > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long a = sc . nextInt ( ) ; if ( set . contains ( a ) ) { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); \n return; " ) ; System . out . println ( " NO " ) ; return ; } set . add ( a ) ; } System . out . println ( " YES " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int count = 0 ; Arrays . sort ( array ) ; int a = array [ n / 2 - 1 ] ; int b = array [ n / 2 ] ; if ( a == b ) { System . out . println ( 0 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b - a); " ) ; System . out . println ( b - a ) ; } } } +import java . util . * ; import java . util . InputMismatchException ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k ; if ( a == b ) { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } else if ( a < 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } else if ( b > 1000000000 ) { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } else { k = ( b + a ) / 2 ; if ( ( k * 2 ) != ( a + b ) ) { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } else { System . out . println ( k ) ; } } } catch ( InputMismatchException e ) { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String taro , hanako , str ; int st = 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 ) st += 3 ; else { System . out . println ( " [LOG] Block: st++; \n sh++; " ) ; st ++ ; sh ++ ; } } System . out . println ( st + " " + sh ) ; } } +import java . lang . reflect . Array ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int xx = x / 2 ; int ans = 0 ; for ( int i = 1 ; i <= x ; i ++ ) { for ( int j = 2 ; j <= x + 1 ; j ++ ) { if ( Math . pow ( i , j ) > ans && Math . pow ( i , j ) <= x ) { System . out . println ( " [LOG] Block: ans = (int) Math.pow(i, j); " ) ; ans = ( int ) Math . pow ( i , j ) ; } } } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = Integer.parseInt(sc.next()); \n PrintWriter out = new PrintWriter(System.out); \n out.print((int) (A + Math.pow(A, 2) + Math.pow(A, 3))); \n out.flush(); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; out . print ( ( int ) ( A + Math . pow ( A , 2 ) + Math . pow ( A , 3 ) ) ) ; out . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int [ ] arr = new int [ x ] ; for ( int i = 0 ; i < x ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int [ ] dp = new int [ x ] ; if ( x == 1 ) System . out . println ( arr [ 0 ] ) ; for ( int i = 1 ; i < x ; i ++ ) { int abs1 = Math . abs ( arr [ i ] - arr [ i - 1 ] ) ; if ( i == 1 ) { int abs = abs1 ; dp [ i ] = abs ; } else { System . out . println ( " [LOG] Block: dp[i] = Math.min(abs1 + dp[i - 1], Math.abs(arr[i] - arr[i - 2]) + dp[i - 2]); " ) ; dp [ i ] = Math . min ( abs1 + dp [ i - 1 ] , Math . abs ( arr [ i ] - arr [ i - 2 ] ) + dp [ i - 2 ] ) ; } } System . out . println ( dp [ x - 1 ] ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; int count = 1 ; for ( int i = N - 1 ; i > 0 ; i -- ) { if ( A [ i ] != A [ i - 1 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String c = scan . next ( ) , str = " " ; for ( int i = 0 ; i < c . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: str = c.substring(i, i + 1) + str; " ) ; str = c . substring ( i , i + 1 ) + str ; } System . out . println ( str ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; while ( a > 0 || c > 0 ) { System . out . println ( " [LOG] Block: c -= b; \n if (c <= 0) \n break; \n a -= d; " ) ; c -= b ; if ( c <= 0 ) break ; a -= d ; } if ( a > 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; import static java . lang . Integer . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int n = parseInt ( sc . next ( ) ) ; String [ ] s = new String [ n ] ; for ( i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) ; } sc . close ( ) ; String [ ] s2 ; for ( i = 0 ; i < n ; i ++ ) { s2 = s [ i ] . split ( " " ) ; Arrays . sort ( s2 ) ; s [ i ] = String . join ( " " , s2 ) ; } HashMap < String , Integer > c = new HashMap < > ( ) ; for ( i = 0 ; i < n ; i ++ ) { if ( c . containsKey ( s [ i ] ) ) { c . put ( s [ i ] , c . get ( s [ i ] ) + 1 ) ; } else { c . put ( s [ i ] , 1 ) ; } } long ans = 0 ; for ( Integer ii : c . values ( ) ) { System . out . println ( " [LOG] Block: ans += (long) ii * (ii - 1) / 2; " ) ; ans += ( long ) ii * ( ii - 1 ) / 2 ; } out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; int mid = 0 ; int max = 0 ; int min = 100000 ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = sc . nextInt ( ) ; mid += d [ i ] ; if ( d [ i ] > max ) { max = d [ i ] ; } if ( d [ i ] < min ) { System . out . println ( " [LOG] Block: min = d[i]; " ) ; min = d [ i ] ; } } int [ ] e = d ; Arrays . sort ( e ) ; mid = e [ N / 2 - 1 ] ; int count = 0 ; System . out . println ( e [ N / 2 ] - e [ N / 2 - 1 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long n = Long . parseLong ( scanner . nextLine ( ) ) ; char [ ] ans = scanner . nextLine ( ) . toCharArray ( ) ; int a = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < n - 2 && ans [ i ] == 'A' ) { if ( ans [ i + 1 ] == 'B' ) { if ( ans [ i + 2 ] == 'C' ) { System . out . println ( " [LOG] Block: a++; \n i += 2; " ) ; a ++ ; i += 2 ; } } } } System . out . println ( a ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { 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 ( ) { System . out . println ( " [LOG] Block: int[] x = new int[in.length()]; \n for (int i = 0; i < in.length(); i++) x[i] = in.charAt(i) - '0'; \n System.out.println(Arrays.stream(x).parallel().sum()); " ) ; int [ ] x = new int [ in . length ( ) ] ; for ( int i = 0 ; i < in . length ( ) ; i ++ ) x [ i ] = in . charAt ( i ) - '0' ; System . out . println ( Arrays . stream ( x ) . parallel ( ) . sum ( ) ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA_147 solver = new TaskA_147 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA_147 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: int a = in.nextInt(); \n int b = in.nextInt(); \n int c = in.nextInt(); \n out.println(a + b + c >= 22 ? \" bust \" : \" win \" ); " ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; out . println ( a + b + c >= 22 ? " bust " : " win " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int check = 1 ; if ( n != 1 ) { for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( h [ i ] > h [ i + 1 ] ) h [ i ] -- ; if ( h [ i ] > h [ i + 1 ] ) { System . out . println ( " [LOG] Block: check = 0; \n break; " ) ; check = 0 ; break ; } } } System . out . println ( ( check == 1 ) ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( true ) { if ( prime ( n ) ) { break ; } n ++ ; } System . out . println ( n ) ; sc . close ( ) ; } private boolean prime ( int n ) { if ( n == 0 || n == 1 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } if ( n == 2 ) return true ; if ( n % 2 == 0 ) return false ; for ( int i = 3 ; i * i <= n ; i += 2 ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = getInt ( sc ) ; int [ ] d = getIntArray ( sc ) ; Arrays . sort ( d ) ; int ARCMax = d [ n / 2 - 1 ] ; int ABCMin = d [ n / 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 ++ ) { System . out . println ( " [LOG] Block: intArray[i] = Integer.parseInt(strArray[i]); " ) ; intArray [ i ] = Integer . parseInt ( strArray [ i ] ) ; } return intArray ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int cnt = 0 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: cnt++; \n n = (n / l); " ) ; cnt ++ ; n = ( n / l ) ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int n = Integer.parseInt(scanner.next()); \n System.out.println(n * n * n); " ) ; Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . next ( ) ) ; System . out . println ( n * n * n ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < Integer > visited = new HashSet < > ( ) ; int cnt = 0 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: n--; \n int num = sc.nextInt(); \n if (visited.contains(num)) \n continue; \n visited.add(num); \n cnt++; " ) ; n -- ; int num = sc . nextInt ( ) ; if ( visited . contains ( num ) ) continue ; visited . add ( num ) ; cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = Integer.parseInt(sc.nextLine()); \n String line = sc.nextLine(); \n String[] line1 = line.split( \" \" ); \n int[] ary = new int[n]; \n for (int i = 0; i < n; i++) ary[i] = Integer.parseInt(line1[i]); \n int[] ary1 = new int[n]; \n for (int i = 0; i < n; i++) ary1[ary[i] - 1] = i + 1; \n for (int i = 0; i < n; i++) System.out.print(ary1[i] + \" \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; String line = sc . nextLine ( ) ; String [ ] line1 = line . split ( " " ) ; int [ ] ary = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ary [ i ] = Integer . parseInt ( line1 [ i ] ) ; int [ ] ary1 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ary1 [ ary [ i ] - 1 ] = i + 1 ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( ary1 [ i ] + " " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] data = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { data [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { while ( data [ i ] % 2 == 0 ) { System . out . println ( " [LOG] Block: sum++; \n data[i] /= 2; " ) ; sum ++ ; data [ i ] /= 2 ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] . equals ( S ) ) { if ( i == 6 ) { System . out . println ( 7 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(7 - (i + 1)); " ) ; System . out . println ( 7 - ( i + 1 ) ) ; } } } } } +import java . io . ByteArrayInputStream ; import java . util . Scanner ; public class Main { private static boolean strcmp ( String s , int pos , String other ) { if ( pos >= other . length ( ) ) { int len = other . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( s . charAt ( pos - i - 1 ) != other . charAt ( len - 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 ( " [LOG] Block: System.out.println( \" NO \" ); \n return; " ) ; System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int intA = sc.nextInt(); \n int intB = sc.nextInt(); \n double dbF; \n dbF = (double) intA / (double) intB; \n String f2 = String.format( \" %.5f \" , dbF); \n System.out.println(intA / intB + \" \" + intA % intB + \" \" + f2); " ) ; Scanner sc = new Scanner ( System . in ) ; int intA = sc . nextInt ( ) ; int intB = sc . nextInt ( ) ; double dbF ; dbF = ( double ) intA / ( double ) intB ; String f2 = String . format ( " %.5f " , dbF ) ; System . out . println ( intA / intB + " " + intA % intB + " " + f2 ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = Integer . parseInt ( sc . next ( ) ) ; int W = Integer . parseInt ( sc . next ( ) ) ; while ( H != 0 && W != 0 ) { if ( H > 300 || W > 300 ) break ; for ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; H = Integer . parseInt ( sc . next ( ) ) ; W = Integer . parseInt ( sc . next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int [ ] n = new int [ 5 ] ; int count = 0 ; int temp = 0 ; for ( int i = A ; 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 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int d = 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 ( d = a ; d <= b ; d ++ ) { if ( c % d == 0 ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . io . * ; import java . util . * ; public class Main { 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 ds = 0 ; for ( char c : cs ) { System . out . println ( " [LOG] Block: ds += c; " ) ; ds += c ; } ds -= cs . length * '0' ; System . out . println ( ds % 9 == 0 ? " Yes " : " No " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; int [ ] array = new int [ t ] ; int [ ] copy = new int [ t ] ; for ( int count = 0 ; count < t ; count ++ ) { int n = scan . nextInt ( ) ; array [ count ] = n ; copy [ count ] = n ; } scan . close ( ) ; Arrays . sort ( copy ) ; int counter = 0 ; for ( int count = 0 ; count < t ; count ++ ) { if ( array [ count ] != copy [ count ] ) { counter ++ ; } } if ( counter < 3 ) { System . out . println ( " [LOG] Block: System.out.println( \" YES \" ); " ) ; System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n System.out.println(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5) ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; System . out . println ( s . charAt ( 2 ) == s . charAt ( 3 ) && s . charAt ( 4 ) == s . charAt ( 5 ) ? " Yes " : " No " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long ans , 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 ( ) ; } ans = a [ 0 ] [ 0 ] ; for ( i = 0 ; i < t ; i ++ ) ans = ans + a [ i ] [ 1 ] ; max = ans ; for ( i = 1 ; i < t ; i ++ ) { System . out . println ( " [LOG] Block: ans = ans - a[i - 1][1] + a[i][0]; \n if (ans > max) \n max = ans; " ) ; ans = ans - a [ i - 1 ] [ 1 ] + a [ i ] [ 0 ] ; if ( ans > max ) max = ans ; } System . out . println ( max ) ; } } +import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int d = scanner . nextInt ( ) ; int n = scanner . nextInt ( ) ; if ( n == 100 ) { System . out . println ( " [LOG] Block: n++; " ) ; n ++ ; } System . out . println ( ( int ) Math . pow ( 100 , d ) * n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = null ; try { s = new Scanner ( System . in ) ; String line = s . nextLine ( ) ; System . out . println ( powBy3 ( Integer . parseInt ( line ) ) ) ; } finally { if ( s != null ) { s . close ( ) ; } } } private static int powBy3 ( int i ) { System . out . println ( " [LOG] Block: return i * i * i; " ) ; return i * i * i ; } } +import java . util . Scanner ; class Main { 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 sum = 0 ; for ( char c : s . toCharArray ( ) ) { System . out . println ( " [LOG] Block: sum += c - '0'; " ) ; sum += c - '0' ; } System . out . println ( sum ) ; } } } +import java . io . * ; class Main { 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 i = 0 , p = 0 ; i < cmd . length ; i ++ ) { if ( cmd [ i ] . equals ( " + " ) ) { p -- ; S [ p - 1 ] += S [ p ] ; } else if ( cmd [ i ] . equals ( " - " ) ) { p -- ; S [ p - 1 ] -= S [ p ] ; } else if ( cmd [ i ] . equals ( " * " ) ) { p -- ; S [ p - 1 ] *= S [ p ] ; } else { S [ p ] = Integer . parseInt ( " " + cmd [ i ] ) ; p ++ ; } } System . out . println ( S [ 0 ] ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: System.out.println( \" Exception : \" + e); " ) ; System . out . println ( " Exception : " + e ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 3000 ] ; int [ ] num2 = new int [ 3000 ] ; for ( int i = 0 ; i < 3000 ; i ++ ) { String line = sc . nextLine ( ) ; String [ ] ss = line . split ( " " ) ; num [ i ] = Integer . parseInt ( ss [ 0 ] ) ; num2 [ i ] = Integer . parseInt ( ss [ 1 ] ) ; if ( num [ i ] == 0 && num2 [ i ] == 0 ) { break ; } } for ( int i = 0 ; i < num . length ; i ++ ) { if ( num [ i ] == 0 && num2 [ i ] == 0 ) { break ; } if ( num [ i ] < num2 [ i ] ) { System . out . println ( " [LOG] Block: System.out.println(num[i] + \" \" + num2[i]); " ) ; System . out . println ( num [ i ] + " " + num2 [ i ] ) ; } if ( num [ i ] > num2 [ i ] ) { System . out . println ( num2 [ i ] + " " + num [ i ] ) ; } if ( num [ i ] == num2 [ i ] ) { System . out . println ( " [LOG] Block: System.out.println(num[i] + \" \" + num2[i]); " ) ; System . out . println ( num [ i ] + " " + num2 [ i ] ) ; } } } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n ; n = sc . nextInt ( ) ; if ( n % 10 == 3 ) { System . out . println ( " bon " ) ; } else if ( ( n % 10 == 0 ) || ( n % 10 == 1 ) || ( n % 10 == 6 ) || ( n % 10 == 8 ) ) { System . out . println ( " pon " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" hon \" ); " ) ; System . out . println ( " hon " ) ; } } } +import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int 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 ++ ) { System . out . println ( " [LOG] Block: L[i] = sc.nextInt(); \n R[i] = sc.nextInt(); \n maxL = Math.max(maxL, L[i]); \n minR = Math.min(minR, R[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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; double d = 0.0 ; int coin = 0 ; int calc = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { System . out . println ( " [LOG] Block: calc = i; \n coin = 0; \n for (; calc < K; coin++) calc *= 2; \n d += (1.0 / N) * Math.pow((1.0 / 2), coin); " ) ; calc = i ; coin = 0 ; for ( ; calc < K ; coin ++ ) calc *= 2 ; d += ( 1.0 / N ) * Math . pow ( ( 1.0 / 2 ) , coin ) ; } System . out . println ( d ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); \n int d = in.nextInt(); \n int t = in.nextInt(); \n int s = in.nextInt(); \n if (t * s < d) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int d = in . nextInt ( ) ; int t = in . nextInt ( ) ; int s = in . nextInt ( ) ; if ( t * s < d ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; long [ ] b = new long [ a ] ; long MAX = ( long ) Math . pow ( 10 , 18 ) ; long result = 1 ; for ( int i = 0 ; i < a ; i ++ ) { b [ i ] = sc . nextLong ( ) ; if ( b [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } for ( int i = 0 ; i < a ; i ++ ) { if ( MAX / result < b [ i ] ) { System . out . println ( - 1 ) ; return ; } else { System . out . println ( " [LOG] Block: result *= b[i]; " ) ; result *= b [ i ] ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] k = new int [ N ] ; Boolean allZero = false ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { k [ i ] = sc . nextInt ( ) ; } while ( ! allZero ) { allZero = true ; int now = 0 ; Boolean isZero = true ; while ( now < N ) { if ( k [ now ] > 0 ) { k [ now ] -= 1 ; isZero = false ; allZero = false ; } else if ( k [ now ] <= 0 && isZero ) { } else { count ++ ; isZero = true ; } now ++ ; } if ( ! isZero ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } sc . close ( ) ; System . out . println ( count ) ; } } +import java . util . HashMap ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] k = new int [ n ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; 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 == n ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] point = new int [ n ] ; Arrays . fill ( point , k - q ) ; for ( int i = 0 ; i < q ; i ++ ) { point [ Integer . parseInt ( sc . next ( ) ) - 1 ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { if ( point [ i ] >= 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int number = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (number > h[i]) \n ans += number - h[i]; \n number = h[i]; " ) ; if ( number > h [ i ] ) ans += number - h [ i ] ; number = h [ i ] ; } ans += number ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n String str = scanner.nextLine(); \n System.out.println((str.equals( \" ABC \" )) ? \" ARC \" : \" ABC \" ); " ) ; Scanner scanner = new Scanner ( System . in ) ; String str = scanner . nextLine ( ) ; System . out . println ( ( str . equals ( " ABC " ) ) ? " ARC " : " ABC " ) ; } } +import java . util . * ; public class Main { 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 i = 0 ; i < 26 ; i ++ ) { alpha [ i ] = str . charAt ( i ) ; } int [ ] count = new int [ 26 ] ; for ( int i = 0 ; i < w . length ( ) ; i ++ ) { for ( int j = 0 ; j < 26 ; j ++ ) { if ( w . charAt ( i ) == alpha [ j ] ) count [ j ] ++ ; } } for ( int i = 0 ; i < 26 ; i ++ ) { if ( count [ i ] % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; import java . io . * ; import java . math . * ; class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int k = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; for ( int i = a ; i <= b ; i ++ ) { if ( i % k == 0 ) { sum = 1 ; } } if ( sum == 1 ) { System . out . println ( " OK " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NG \" ); " ) ; System . out . println ( " NG " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] b = new int [ n ] ; int [ ] f = new int [ n ] ; int [ ] r = new int [ n ] ; int [ ] v = new int [ n ] ; int [ ] [ ] [ ] num = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" #################### \" ); " ) ; System . out . println ( " #################### " ) ; } } scan . close ( ) ; } } +import java . util . * ; class Main { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int n = sc . nextInt ( ) ; if ( n % 2 == 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } String s = sc . next ( ) ; int l = ( int ) ( n / 2 ) ; for ( int i = 0 ; i < l ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( l + i ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , 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 ++ ) { System . out . println ( " [LOG] Block: min = Math.min(min, 2 * c * i + Math.max(0, x - i) * a + Math.max(0, y - i) * b); " ) ; min = Math . min ( min , 2 * c * i + Math . max ( 0 , x - i ) * a + Math . max ( 0 , y - i ) * b ) ; } System . out . println ( min ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ m ] ; int s = 0 ; int v = - 1 ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = sc.nextInt(); \n s += a[i]; " ) ; a [ i ] = sc . nextInt ( ) ; s += a [ i ] ; } if ( n > s ) v = n - s ; else if ( n == s ) v = 0 ; else v = - 1 ; System . out . println ( v ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] L = new int [ M ] ; int [ ] R = new int [ M ] ; int max = N + 1 ; int min = 0 ; for ( int i = 0 ; i < M ; i ++ ) { System . out . println ( " [LOG] Block: L[i] = sc.nextInt(); \n R[i] = sc.nextInt(); \n min = Math.max(min, L[i]); \n max = Math.min(max, R[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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; boolean val = true ; if ( s . length ( ) % 2 != 0 ) val = false ; else { for ( int i = 0 ; i < n / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i + n / 2 ) ) { System . out . println ( " [LOG] Block: val = false; \n break; " ) ; val = false ; break ; } } } System . out . println ( val ? " Yes " : " No " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strArr = br . readLine ( ) . split ( " " ) ; long a = Long . valueOf ( strArr [ 0 ] ) ; long b = Long . valueOf ( strArr [ 1 ] ) ; System . out . println ( gcd ( a , b ) ) ; } private static long gcd ( long a , long b ) { System . out . println ( " [LOG] Block: long r = a % b; \n if (r == 0) \n return b; \n else \n return gcd(b, a % b); " ) ; long r = a % b ; if ( r == 0 ) return b ; else return gcd ( b , a % b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( k <= a + b ) { if ( k >= a ) { System . out . println ( a ) ; } else { System . out . println ( k ) ; } } else { System . out . println ( " [LOG] Block: System.out.println(a - (k - a - b)); " ) ; System . out . println ( a - ( k - a - b ) ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long K = sc . nextLong ( ) ; int i = 0 ; while ( i < S . length ( ) && S . charAt ( i ) == '1' ) { i ++ ; } if ( i == S . length ( ) || K <= i ) { System . out . println ( 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(S.charAt(i)); " ) ; System . out . println ( S . charAt ( i ) ) ; } } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { int [ ] arr = new int [ 5 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i ++ ) { System . out . println ( " [LOG] Block: arr[i] = sc.nextInt(); \n if (arr[i] == 0) \n System.out.println(i + 1); " ) ; arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] == 0 ) System . out . println ( i + 1 ) ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int N = scanner . nextInt ( ) ; int count = 0 ; boolean flg = true ; List < Integer > numList = new ArrayList < > ( ) ; scanner . nextLine ( ) ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } numList = nextNumList ; count ++ ; } System . out . println ( count ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int seven = 0 ; int five = 0 ; while ( sc . hasNext ( ) ) { int num = sc . nextInt ( ) ; if ( num == 7 ) { seven ++ ; } else if ( num == 5 ) { five ++ ; } } if ( seven == 1 && five == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n System.out.println( \" 123 \" .replace(sc.next(), \" \" ).replace(sc.next(), \" \" )); " ) ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " 123 " . replace ( sc . next ( ) , " " ) . replace ( sc . next ( ) , " " ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] != i + 1 ) c ++ ; } if ( c > 2 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" YES \" ); " ) ; System . out . println ( " YES " ) ; } } } +import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { 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 m = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int hi = Integer.parseInt(br.readLine()); \n sb.append(sb.substring(0, hi)); \n sb.delete(0, hi); " ) ; int hi = Integer . parseInt ( br . readLine ( ) ) ; sb . append ( sb . substring ( 0 , hi ) ) ; sb . delete ( 0 , hi ) ; } System . out . println ( sb . toString ( ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner scn = new Scanner(System.in); \n double w = scn.nextDouble(); \n double h = scn.nextDouble(); \n double x = scn.nextDouble(); \n double y = scn.nextDouble(); \n double ans = w * h / 2; \n int check = 0; \n if (x == w / 2 && y == h / 2) \n check = 1; \n System.out.println(ans + \" \" + check); " ) ; Scanner scn = new Scanner ( System . in ) ; double w = scn . nextDouble ( ) ; double h = scn . nextDouble ( ) ; double x = scn . nextDouble ( ) ; double y = scn . nextDouble ( ) ; double ans = w * h / 2 ; int check = 0 ; if ( x == w / 2 && y == h / 2 ) check = 1 ; System . out . println ( ans + " " + check ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; String S = sc . next ( ) ; int [ ] cnt = new int [ N + 1 ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) { cnt [ i + 1 ] = cnt [ i ] + ( S . substring ( i , i + 2 ) . equals ( " AC " ) ? 1 : 0 ) ; } for ( int i = 0 ; i < Q ; i ++ ) { System . out . println ( " [LOG] Block: int L = sc.nextInt(); \n int R = sc.nextInt(); \n System.out.println(cnt[R - 1] - cnt[L - 1]); " ) ; int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; System . out . println ( cnt [ R - 1 ] - cnt [ L - 1 ] ) ; } sc . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int num = 0 ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int res = a / b ; if ( res * b < a ) { System . out . println ( " [LOG] Block: ++res; " ) ; ++ res ; } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int inputNumber = 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 ( inputNumber == tmp ) { System . out . println ( " [LOG] Block: result = \" Yes \" ; " ) ; result = " Yes " ; } } } System . out . println ( result ) ; } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] omkar ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st = new StringTokenizer(infile.readLine()); \n String input = st.nextToken(); \n if (input.charAt(2) == input.charAt(3) && input.charAt(4) == input.charAt(5)) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; String input = st . nextToken ( ) ; if ( input . charAt ( 2 ) == input . charAt ( 3 ) && input . charAt ( 4 ) == input . charAt ( 5 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { int r , 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 ++ ) { r = n ; l = 0 ; m = n / 2 ; while ( true ) { if ( s [ m ] == t [ j ] ) { count ++ ; break ; } if ( m == l ) { break ; } if ( s [ m ] > t [ j ] ) { r = m ; m = ( r + l ) / 2 ; } if ( s [ m ] < t [ j ] ) { System . out . println ( " [LOG] Block: l = m + 1; \n m = (r + l) / 2; " ) ; l = m + 1 ; m = ( r + l ) / 2 ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int ptr = 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 [ ptr ++ ] = 2 ; prime [ ptr ++ ] = 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 [ ptr ++ ] = n ; if ( n >= st ) { System . out . println ( " [LOG] Block: min = n; \n break; " ) ; min = n ; break ; } } } if ( st == 2 ) min = 2 ; if ( st == 3 ) min = 3 ; System . out . println ( min ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { switch ( sc . nextInt ( ) ) { case 5 : count5 ++ ; break ; case 7 : count7 ++ ; break ; } } if ( count5 == 2 && count7 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n int d = a / b; \n int r = a % b; \n double f = ((double) a / (double) b); \n System.out.print(d + \" \" + r + \" \" ); \n System.out.printf( \" %.5f \" , f); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int d = a / b ; int r = a % b ; double f = ( ( double ) a / ( double ) b ) ; System . out . print ( d + " " + r + " " ) ; System . out . printf ( " %.5f " , f ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int min = n + 1 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] < min ) { System . out . println ( " [LOG] Block: min = p[i]; \n ans++; " ) ; min = p [ i ] ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 1_000_000_000 ; int max = 1 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int tmp = sc.nextInt(); \n if (tmp < min) \n min = tmp; \n if (tmp > max) \n max = tmp; " ) ; int tmp = sc . nextInt ( ) ; if ( tmp < min ) min = tmp ; if ( tmp > max ) max = tmp ; } System . out . println ( max - min ) ; sc . close ( ) ; } } +import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; class Main { 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 n = 1 ; int x = 1 ; int kumi = 0 ; while ( n != 0 || x != 0 ) { n = scan . nextInt ( ) ; x = scan . nextInt ( ) ; NN . add ( n ) ; 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 ) ) { System . out . println ( " [LOG] Block: kumi += 1; " ) ; kumi += 1 ; } } } } } System . out . println ( kumi / 6 ) ; } } } +import java . util . Scanner ; class Main { 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 i = 0 ; i < 3 ; ++ i ) { System . out . println ( " [LOG] Block: if (n[i] == '1') \n n[i] = '9'; \n else if (n[i] == '9') \n n[i] = '1'; " ) ; if ( n [ i ] == '1' ) n [ i ] = '9' ; else if ( n [ i ] == '9' ) n [ i ] = '1' ; } System . out . print ( n ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int N = Integer . parseInt ( reader . readLine ( ) ) ; String [ ] array = reader . readLine ( ) . split ( " " ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = Integer . parseInt ( array [ i ] ) ; } boolean ret = true ; for ( int i = N - 1 ; i > 0 ; i -- ) { if ( H [ i ] <= H [ i - 1 ] - 2 ) { ret = false ; break ; } if ( H [ i ] == H [ i - 1 ] - 1 ) { System . out . println ( " [LOG] Block: H[i - 1]--; " ) ; H [ i - 1 ] -- ; } } System . out . println ( ret ? " Yes " : " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; 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 ] ) { System . out . println ( " [LOG] Block: max = H[i]; \n ans++; " ) ; max = H [ i ] ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int n = Integer . parseInt ( line ) ; int [ ] a = new int [ n ] ; int k = 0 ; int count = 1 ; boolean fin = false ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ k ] != 2 && ! fin ) { count ++ ; k = a [ k ] - 1 ; } else { fin = true ; } } if ( fin ) { System . out . println ( count ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String key = in . next ( ) . toLowerCase ( ) ; int count = 0 ; while ( true ) { System . out . println ( " [LOG] Block: String input = in.next(); \n if (input.equals( \" END_OF_TEXT \" )) \n break; \n if (input.equalsIgnoreCase(key)) \n count++; " ) ; String input = in . next ( ) ; if ( input . equals ( " END_OF_TEXT " ) ) break ; if ( input . equalsIgnoreCase ( key ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= n ; 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 ) { System . out . println ( " [LOG] Block: sum += num % 10; \n num /= 10; " ) ; sum += num % 10 ; num /= 10 ; } return sum ; } } +import java . time . LocalDate ; import java . time . format . DateTimeFormatter ; import java . time . format . DateTimeParseException ; import java . util . Scanner ; public class Main { 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 diff = date . compareTo ( today ) ; if ( diff <= 0 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } catch ( DateTimeParseException e ) { System . out . println ( " [LOG] Block: System.out.println( \" 入力値がyyyy/mm/dd形式ではありません\");"); System.out.println (" 入 力 値 が yyy/mm / dd形 式 ではありません " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] array = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { array [ i ] = scan . nextInt ( ) ; } int [ ] result = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { result [ array [ i ] ] = i ; } for ( int i = 1 ; i <= n ; i ++ ) { if ( i != n ) { System . out . print ( result [ i ] + " " ) ; } else { System . out . println ( " [LOG] Block: System.out.print(result[i]); " ) ; System . out . print ( result [ i ] ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { String s = in . next ( ) ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; int ans = 1 ; for ( int i = 0 ; i < N ; i ++ ) { S [ i ] = sc . next ( ) ; } Arrays . sort ( S ) ; for ( int i = 1 ; i < N ; i ++ ) { if ( ! S [ i - 1 ] . equals ( S [ i ] ) ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . print ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int num1 = sc.nextInt(); \n int num2 = sc.nextInt(); \n int num3 = sc.nextInt(); \n System.out.println(num3); \n System.out.println(num1); \n System.out.println(num2); " ) ; Scanner sc = new Scanner ( System . in ) ; int num1 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int num3 = sc . nextInt ( ) ; System . out . println ( num3 ) ; System . out . println ( num1 ) ; System . out . println ( num2 ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( br . readLine ( ) ) ; String [ ] Bstr = br . readLine ( ) . split ( " " ) ; int [ ] B = new int [ N - 1 ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) { B [ i ] = Integer . parseInt ( Bstr [ i ] ) ; } int [ ] A = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( i == 0 ) { A [ i ] = B [ i ] ; } else { System . out . println ( " [LOG] Block: A[i] = Math.min(A[i], B[i]); " ) ; A [ i ] = Math . min ( A [ i ] , B [ i ] ) ; } sum += A [ i ] ; A [ i + 1 ] = B [ i ] ; if ( i == N - 2 ) sum += A [ N - 1 ] ; } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { String [ ] lines = getStdin ( ) ; String str = lines [ 0 ] ; long num = Long . parseLong ( str ) ; long sum = 100 ; int count = 0 ; while ( sum < num ) { 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 ( ) ) { System . out . println ( " [LOG] Block: lines.add(scanner.nextLine()); " ) ; lines . add ( scanner . nextLine ( ) ) ; } return lines . toArray ( new String [ lines . size ( ) ] ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; int a = Integer . parseInt ( s1 ) ; String s2 = sc . next ( ) ; int b = Integer . parseInt ( s2 ) ; double p = Math . pow ( 10 , 9 ) ; if ( 1 <= a && a <= p ) { if ( 1 <= b && b <= p ) { System . out . println ( " [LOG] Block: int d = a / b; \n int r = a % b; \n double f = (double) a / (double) b; \n System.out.println(d + \" \" + r + \" \" + String.format( \" %1$3f \" , f)); " ) ; int d = a / b ; int r = a % b ; double f = ( double ) a / ( double ) b ; System . out . println ( d + " " + r + " " + String . format ( " %1$3f " , f ) ) ; } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] parts = br . readLine ( ) . split ( " " ) ; int H = Integer . parseInt ( parts [ 0 ] ) ; int A = Integer . parseInt ( parts [ 1 ] ) ; int a = H % A ; if ( a == 0 ) { System . out . println ( H / A ) ; } else { System . out . println ( " [LOG] Block: System.out.println(H / A + 1); " ) ; System . out . println ( H / A + 1 ) ; } } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: Scanner S = new Scanner(System.in); \n String Str = S.nextLine(); \n int SI = Integer.parseInt(Str); \n int seconds = SI % 60; \n int hour = SI / 3600; \n int minute = SI / 60 - hour * 60; \n System.out.println(hour + \" : \" + minute + \" : \" + seconds); " ) ; Scanner S = new Scanner ( System . in ) ; String Str = S . nextLine ( ) ; int SI = Integer . parseInt ( Str ) ; int seconds = SI % 60 ; int hour = SI / 3600 ; int minute = SI / 60 - hour * 60 ; System . out . println ( hour + " : " + minute + " : " + seconds ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int d = scanner.nextInt(); \n int t = scanner.nextInt(); \n int s = scanner.nextInt(); \n System.out.print(t * s >= d ? \" Yes \" : \" No \" ); " ) ; Scanner scanner = new Scanner ( System . in ) ; int d = scanner . nextInt ( ) ; int t = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; System . out . print ( t * s >= d ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: a[i] /= 2; \n x++; " ) ; a [ i ] /= 2 ; x ++ ; } } } System . out . println ( x ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] g ) { Scanner S = new Scanner ( System . in ) ; for ( int i = S . nextInt ( ) , j , x , y , z , a [ ] = new int [ 3 ] ; i -- > 0 ; System . out . println ( a [ 2 ] * a [ 2 ] == a [ 1 ] * a [ 1 ] + a [ 0 ] * a [ 0 ] ? " YES " : " NO " ) ) { System . out . println ( " [LOG] Block: for (j = 0; j < 3; ) a[j++] = S.nextInt(); \n Arrays.sort(a); " ) ; for ( j = 0 ; j < 3 ; ) a [ j ++ ] = S . nextInt ( ) ; Arrays . sort ( a ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int a = in.nextInt(); \n int b = in.nextInt(); \n int ans = a * b; \n System.out.print(ans); " ) ; Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int ans = a * b ; System . out . print ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) a [ i ] = sc . nextInt ( ) ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: b[i] = a[(i + 2) % 3]; \n System.out.print(b[i] + \" \" ); " ) ; b [ i ] = a [ ( i + 2 ) % 3 ] ; System . out . print ( b [ i ] + " " ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int n = 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 [ n ] ; for ( int i = 0 ; i < q ; i ++ ) { a [ i ] = Integer . parseInt ( in . readLine ( ) ) ; count [ a [ i ] - 1 ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (k - (q - count[i]) <= 0) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; if ( k - ( q - count [ i ] ) <= 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; import java . lang . Math ; public class Main { 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 { System . out . println ( " [LOG] Block: result = a + b; " ) ; result = a + b ; } System . out . println ( result ) ; } } +public class Main { public static void main ( String [ ] args ) { java . util . Scanner cin = new java . util . Scanner ( System . in ) ; int n ; for ( n = cin . nextInt ( ) ; n != 0 ; -- n ) { System . out . println ( " [LOG] Block: int[] a = { cin.nextInt(), cin.nextInt(), cin.nextInt() } ; \n java.util.Arrays.sort(a); \n System.out.println(a[0] * a[0] + a[1] * a[1] == a[2] * a[2] ? \" YES \" : \" NO \" ); " ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str = br . readLine ( ) ; String [ ] strArr = str . split ( " " ) ; int n = Integer . parseInt ( strArr [ 0 ] ) ; int m = Integer . parseInt ( strArr [ 1 ] ) ; String [ ] [ ] a = new String [ n ] [ m ] ; String [ ] b = new String [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 ) { System . out . println ( " [LOG] Block: br.close(); " ) ; br . close ( ) ; } } catch ( IOException ioe ) { } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; int [ ] c = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { ans += Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 1 ; i < n ; i ++ ) { c [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( a [ i ] + 1 == a [ i + 1 ] ) { System . out . println ( " [LOG] Block: ans += c[a[i]]; " ) ; ans += c [ a [ i ] ] ; } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n int b = sc.nextInt(); \n if (a == 0 && b == 0) \n break; \n System.out.println( \" \" + Math.min(a, b) + \" \" + Math.max(a, b)); " ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == 0 && b == 0 ) break ; System . out . println ( " " + Math . min ( a , b ) + " " + Math . max ( a , b ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; long x = 1 ; long n = 0 ; while ( true ) { n = a * x ; if ( n % b == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } x ++ ; } System . out . println ( n ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: bobSum += nums[i]; \n isAliceTurn = true; " ) ; bobSum += nums [ i ] ; isAliceTurn = true ; } } System . out . println ( aliceSum - bobSum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int taxi = sc . nextInt ( ) ; int train , ans ; train = n * a ; if ( train >= taxi ) { System . out . println ( taxi ) ; } else { System . out . println ( " [LOG] Block: System.out.println(train); " ) ; System . out . println ( train ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int 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 ( " [LOG] Block: System.out.println(-1); \n return; " ) ; System . out . println ( - 1 ) ; return ; } a [ c - 1 ] = 0 ; } System . out . println ( d ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; int [ ] A1 = new int [ N + 1 ] , A2 = new int [ N + 1 ] ; for ( int i = 1 ; i < N + 1 ; i ++ ) { A1 [ i ] = A1 [ i - 1 ] + scn . nextInt ( ) ; } for ( int i = 1 ; i < N + 1 ; i ++ ) { A2 [ i ] = A2 [ i - 1 ] + scn . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: ans = Math.max(ans, A1[i + 1] - A1[0] + A2[N] - A2[i]); " ) ; ans = Math . max ( ans , A1 [ i + 1 ] - A1 [ 0 ] + A2 [ N ] - A2 [ i ] ) ; } System . out . println ( ans ) ; } } +import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { map . put ( sc . nextInt ( ) , i + 1 ) ; } for ( int i = 1 ; i <= n ; i ++ ) { if ( i != 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } System . out . print ( map . get ( i ) ) ; } sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; sc . close ( ) ; long p = 1 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p % 5 == 0 || p % 3 == 0 ) { p ++ ; continue ; } else { System . out . println ( " [LOG] Block: sum += p; \n p++; " ) ; sum += p ; p ++ ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = 1 , b = 1 ; while ( a != 0 && b != 0 ) { a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; if ( a == 0 && b == 0 ) { break ; } for ( int i = 1 ; i <= a ; i ++ ) { for ( int j = 1 ; j <= b ; j ++ ) { if ( i == 1 && j != b ) { System . out . print ( " # " ) ; } else if ( i == a && j != b ) { System . out . print ( " # " ) ; } else if ( j == b ) { System . out . println ( " # " ) ; } else if ( j == 1 ) { System . out . print ( " # " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" . \" ); " ) ; System . out . print ( " . " ) ; } } } System . out . println ( " " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int x = scanner . nextInt ( ) ; int ans = 0 ; if ( x == 0 ) { ans = 1 ; } System . out . println ( ans ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { 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 count = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < count ; i ++ ) { System . out . println ( " [LOG] Block: int indexNum = Integer.parseInt(br.readLine()); \n sb.append(sb.substring(0, indexNum)); \n sb.delete(0, indexNum); " ) ; 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 Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int abc = sc.nextInt(); \n int a = abc / 100; \n int b = (abc - a * 100) / 10; \n int c = (abc - a * 100 - b * 10) / 1; \n System.out.println(a + b + c); " ) ; Scanner sc = new Scanner ( System . in ) ; int abc = sc . nextInt ( ) ; int a = abc / 100 ; int b = ( abc - a * 100 ) / 10 ; int c = ( abc - a * 100 - b * 10 ) / 1 ; System . out . println ( a + b + c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 3 == 0 || Integer . toString ( i ) . contains ( " 3 " ) ) { if ( 0 < i ) { System . out . print ( " " + i ) ; } else { System . out . println ( " [LOG] Block: System.out.print(i); " ) ; System . out . print ( i ) ; } } } System . out . println ( ) ; } } +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 Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ; while ( t -- > 0 ) { String [ ] s = sc . next ( ) . split ( " S " ) ; int max = 0 ; for ( String w : s ) { System . out . println ( " [LOG] Block: max = Math.max(w.length(), max); " ) ; max = Math . max ( w . length ( ) , max ) ; } pw . println ( max ) ; } pw . close ( ) ; } } +import java . io . * ; import java . util . * ; public class Main { 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 count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '+' ) count ++ ; else count -- ; } out . println ( count ) ; out . flush ( ) ; out . close ( ) ; } static class Scanner { 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 { System . out . println ( " [LOG] Block: return br.ready(); " ) ; return br . ready ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = 0 ; int ans = 0 ; for ( int i = 1 ; i < 6 ; i ++ ) { num = scan . nextInt ( ) ; if ( num == 0 ) { System . out . println ( " [LOG] Block: ans = i; " ) ; ans = i ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long L = scanner . nextLong ( ) ; long R = scanner . nextLong ( ) ; if ( R - L >= 2018L ) { System . out . println ( 0 ) ; return ; } long m1 = L % 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 ) { System . out . println ( " [LOG] Block: long current = ((i % 2019L) * (j) % 2019L) % 2019L; \n ans = Math.min(ans, current); " ) ; long current = ( ( i % 2019L ) * ( j ) % 2019L ) % 2019L ; ans = Math . min ( ans , current ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextInt ( ) ; long r = sc . nextInt ( ) ; long min = l * ( l + 1 ) % 2019 ; if ( ( l % 2019 == 0 ) || ( r % 2019 == 0 ) ) { System . out . println ( 0 ) ; } else if ( ( l / 2019 ) != ( r / 2019 ) ) { System . out . println ( 0 ) ; } else if ( ( l / 2019 ) == ( r / 2019 ) ) { for ( long i = l ; i < r ; i ++ ) { for ( long j = i + 1 ; j < r + 1 ; j ++ ) { System . out . println ( " [LOG] Block: min = Math.min(min, i * j % 2019); " ) ; min = Math . min ( min , i * j % 2019 ) ; } } System . out . println ( min ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int [ ] b = new int [ n + 1 ] ; b [ 0 ] = 1 ; int i = 1 ; int ans = - 1 ; while ( i <= n ) { b [ i ] = a [ b [ i - 1 ] ] ; if ( b [ i ] == 2 ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } i ++ ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int 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 < N ; i ++ ) { int det = 0 ; for ( int j = 0 ; j < M ; j ++ ) { det += B [ j ] * sc . nextInt ( ) ; } det += C ; if ( det > 0 ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int K = Integer.parseInt(sc.next()); \n String S = sc.next(); \n if (S.length() > K) \n S = S.substring(0, K) + \" ... \" ; \n System.out.println(S); " ) ; Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; if ( S . length ( ) > K ) S = S . substring ( 0 , K ) + " ... " ; System . out . println ( S ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ABC = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { ABC [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ABC ) ; boolean flg = false ; if ( ABC [ 0 ] == 5 ) { if ( ABC [ 1 ] == 5 ) { if ( ABC [ 2 ] == 7 ) { flg = true ; } } } if ( flg ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { for ( int k = 1 ; k <= n ; 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 ) { System . out . println ( " [LOG] Block: a = b; \n b = temp; " ) ; a = b ; b = temp ; } return b ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static String S , T ; static int result = 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 ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner as = new Scanner(System.in); \n double r, t, s; \n r = as.nextDouble(); \n s = 3.141592653589 * r * r; \n t = 2.0 * 3.141592653589 * r; \n BigDecimal ros = new BigDecimal(s); \n BigDecimal rot = new BigDecimal(t); \n ros = ros.setScale(6, BigDecimal.ROUND_HALF_UP); \n rot = rot.setScale(6, BigDecimal.ROUND_HALF_UP); \n System.out.println(ros + \" \" + rot); " ) ; Scanner as = new Scanner ( System . in ) ; double r , t , s ; r = as . nextDouble ( ) ; s = 3.141592653589 * r * r ; t = 2.0 * 3.141592653589 * r ; 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 . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = Long.parseLong(sc.next()); \n long b = Long.parseLong(sc.next()); \n long c = Long.parseLong(sc.next()); \n long d = Long.parseLong(sc.next()); \n sc.close(); \n long mlta = Math.max(a * c, a * d); \n long mltb = Math.max(b * c, b * d); \n long result = Math.max(mlta, mltb); \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = 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 ( a * c , a * d ) ; long mltb = Math . max ( b * c , b * d ) ; long result = Math . max ( mlta , mltb ) ; System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; while ( true ) { int n = cin . nextInt ( ) , x = cin . nextInt ( ) ; int res = 0 ; 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 ++ ) { System . out . println ( " [LOG] Block: if (i + j + k == x) \n res++; " ) ; if ( i + j + k == x ) res ++ ; } } } System . out . println ( res ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String ring = sc . nextLine ( ) ; String p = sc . nextLine ( ) ; ring += ring ; if ( ring . contains ( p ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = 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 < N ; i ++ ) { K = sc . nextInt ( ) ; for ( int j = 0 ; j < K ; j ++ ) { A = sc . nextInt ( ) ; m [ A ] ++ ; } } for ( int i = 0 ; i <= M ; i ++ ) { System . out . println ( " [LOG] Block: if (m[i] == N) \n ans++; " ) ; if ( m [ i ] == N ) ans ++ ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; int m = x . nextInt ( ) ; int f = x . nextInt ( ) ; int r = x . nextInt ( ) ; int go = m + f ; while ( m != - 1 || f != - 1 || r != - 1 ) { if ( m == - 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 ( " [LOG] Block: System.out.println( \" D \" ); " ) ; System . out . println ( " D " ) ; } m = x . nextInt ( ) ; f = x . nextInt ( ) ; r = x . nextInt ( ) ; go = m + f ; } } } +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 Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; Integer [ ] mountains = new Integer [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { mountains [ i ] = sc . nextInt ( ) ; } Arrays . sort ( mountains , Collections . reverseOrder ( ) ) ; StringBuilder sb = new StringBuilder ( " " ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: sb.append(mountains[i]); \n sb.append(' \n '); " ) ; sb . append ( mountains [ i ] ) ; sb . append ( '\n' ) ; } System . out . print ( sb ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int loop = sc . nextInt ( ) ; int [ ] array = new int [ loop ] ; long count = 0 ; for ( int i = 0 ; i < loop ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < ( loop - 1 ) ; i ++ ) { int temp = array [ i ] ; int next = array [ i + 1 ] ; if ( next < temp ) { System . out . println ( " [LOG] Block: count += (temp - next); \n array[i + 1] = temp; " ) ; count += ( temp - next ) ; array [ i + 1 ] = temp ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: arr[right++]--; " ) ; arr [ right ++ ] -- ; } count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = gcd ( a , b ) ; long d = a * b / c ; System . out . println ( c + " " + d ) ; } sc . close ( ) ; } public long gcd ( long a , long b ) { if ( b == 0 ) { return a ; } else { return gcd ( b , a % b ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( tmpArray [ 0 ] ) ; int b = Integer . parseInt ( tmpArray [ 1 ] ) ; if ( a == 0 && b == 0 ) { break ; } for ( int i = 0 ; i < a ; i ++ ) { for ( int j = 0 ; j < b ; j ++ ) { if ( i != 0 && i != a - 1 && j != 0 && j != b - 1 ) { System . out . print ( " . " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int sweet = N ; if ( N % 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; String result = " No " ; if ( String . valueOf ( S . charAt ( 2 ) ) . equals ( String . valueOf ( S . charAt ( 3 ) ) ) && ( String . valueOf ( S . charAt ( 4 ) ) . equals ( String . valueOf ( S . charAt ( 5 ) ) ) ) ) { System . out . println ( " [LOG] Block: result = \" Yes \" ; " ) ; result = " Yes " ; } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; String patt = ob . next ( ) ; int result = 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 { System . out . println ( " [LOG] Block: break; " ) ; break ; } } result = Math . max ( result , temp ) ; } System . out . println ( result ) ; ob . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long N = sc.nextLong(); \n long min = (long) 999999999999.0; \n for (long i = 1; i <= Math.sqrt(N); i++) if (N % i == 0 && min > (i - 1) + (N / i) - 1) \n min = (i - 1) + (N / i) - 1; \n System.out.println(min); " ) ; Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long min = ( long ) 999999999999.0 ; for ( long i = 1 ; i <= Math . sqrt ( N ) ; i ++ ) if ( N % i == 0 && min > ( i - 1 ) + ( N / i ) - 1 ) min = ( i - 1 ) + ( N / i ) - 1 ; System . out . println ( min ) ; } } +import java . util . * ; class Main { 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 result = 0 ; if ( s1 . equals ( t1 ) ) { result += 1 ; } else { System . out . println ( " [LOG] Block: result += 0; " ) ; result += 0 ; } if ( s2 . equals ( t2 ) ) { result += 1 ; } else { System . out . println ( " [LOG] Block: result += 0; " ) ; result += 0 ; } if ( s3 . equals ( t3 ) ) { result += 1 ; } else { System . out . println ( " [LOG] Block: result += 0; " ) ; result += 0 ; } System . out . println ( result ) ; } } +import java . util . * ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n System.out.println(a + a * a + a * a * a); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; System . out . println ( a + a * a + a * a * a ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = scan.nextInt(); \n sum += a[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 . Scanner ; public class Main { static boolean [ ] prime ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; prime = new boolean [ 100000001 ] ; int count = 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 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long k = sc . nextLong ( ) ; int ans = 0 ; for ( int i = 0 ; i < k ; i ++ ) { if ( s . charAt ( i ) == '1' ) { if ( i + 1 == k ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } else { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( s . charAt ( ans ) ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ w ] ; 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 < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(a[i]); " ) ; System . out . println ( a [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; Set < Integer > set = new HashSet < > ( ) ; int past = s ; 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 ( " [LOG] Block: System.out.println(i); \n return; " ) ; System . out . println ( i ) ; return ; } set . add ( cur ) ; past = cur ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= 9 ; i ++ ) { for ( int j = 1 ; j <= 9 ; j ++ ) { if ( i * j == n ) { count = 200 ; } else { count ++ ; } } } if ( count >= 200 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; 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 < N ; i ++ ) { int sum = C ; for ( int j = 0 ; j < M ; j ++ ) { System . out . println ( " [LOG] Block: sum += B[j] * sc.nextInt(); " ) ; sum += B [ j ] * sc . nextInt ( ) ; } if ( sum > 0 ) num ++ ; } System . out . println ( num ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long [ ] mo = new long [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { mo [ i ] = in . nextInt ( ) ; } long sum = 0 ; long yu = 0 ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: sum += yu; " ) ; sum += yu ; } } System . out . print ( sum ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int A = scn . nextInt ( ) ; int B = scn . nextInt ( ) ; int K = scn . nextInt ( ) ; ArrayList < Integer > hits = new ArrayList < Integer > ( ) ; int cnt = 0 ; for ( int i = 1 ; i <= 100 ; i ++ ) { System . out . println ( " [LOG] Block: if (A % i == 0 && B % i == 0) \n hits.add(i); " ) ; if ( A % i == 0 && B % i == 0 ) hits . add ( i ) ; } System . out . println ( hits . get ( hits . size ( ) - K ) ) ; scn . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; String postal = sc . next ( ) ; String [ ] decomp = new String [ 3 ] ; decomp [ 0 ] = postal . substring ( 0 , x ) ; decomp [ 1 ] = postal . substring ( x , x + 1 ) ; decomp [ 2 ] = postal . substring ( x + 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } else { if ( array [ 0 ] != '-' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean f = 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 ( " [LOG] Block: System.out.println(ans[i]); " ) ; System . out . println ( ans [ i ] ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int t = scan.nextInt(); \n int y = scan.nextInt(); \n int m = t * y; \n int n = 2 * t + 2 * y; \n System.out.println(m + \" \" + n); " ) ; Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int m = t * y ; int n = 2 * t + 2 * y ; System . out . println ( m + " " + n ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int count = 0 ; int a = 1 , b ; if ( x >= 3 && x <= 10000 ) { for ( ; count < x ; count ++ ) { b = a / 10 ; if ( a % 3 == 0 ) { sb . append ( " " ) ; sb . append ( a ) ; } else { b = a ; while ( b != 0 ) { if ( b % 10 == 3 ) { System . out . println ( " [LOG] Block: sb.append( \" \" ); \n sb.append(a); \n break; " ) ; sb . append ( " " ) ; sb . append ( a ) ; break ; } b /= 10 ; } } a ++ ; } } System . out . println ( sb ) ; } } +import java . util . * ; import java . io . * ; import static java . lang . Character . isUpperCase ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int R = in.nextInt(); \n System.out.println(2 * 3.14 * R); " ) ; Scanner in = new Scanner ( System . in ) ; int R = in . nextInt ( ) ; System . out . println ( 2 * 3.14 * R ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] h = new int [ N ] ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int a = 0 ; int b = 0 ; L : while ( a <= N - 1 && b <= N - 1 ) { if ( h [ a ] == 0 ) { a ++ ; continue ; } b = a ; while ( b <= N - 1 ) { if ( h [ b ] != 0 && b != N - 1 ) { b ++ ; continue ; } else { for ( int i = a ; i <= b ; i ++ ) { h [ i ] -- ; if ( h [ i ] < 0 ) { System . out . println ( " [LOG] Block: h[i] = 0; " ) ; h [ i ] = 0 ; } } } count ++ ; continue L ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean f = true ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] chars = new int [ 256 ] ; for ( int i = 0 ; i < 256 ; i ++ ) chars [ i ] = 0 ; while ( scan . hasNextLine ( ) ) { String line = scan . nextLine ( ) ; for ( int i = 0 ; i < line . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: char ch = Character.toLowerCase(line.charAt(i)); \n if (ch >= 'a' && ch <= 'z') \n chars[ch]++; " ) ; char ch = Character . toLowerCase ( line . charAt ( i ) ) ; if ( ch >= 'a' && ch <= 'z' ) chars [ ch ] ++ ; } } for ( char ch = 'a' ; ch <= 'z' ; ch ++ ) System . out . println ( ch + " : " + chars [ ch ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int base = 1 ; for ( int i = 0 ; i < D ; i ++ ) { base *= 100 ; } if ( N % 100 == 0 ) { System . out . println ( base * ( N + 1 ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(base * N); " ) ; System . out . println ( base * N ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int A = scan.nextInt(); \n int B = scan.nextInt(); \n int C = 0; \n C = A * B; \n System.out.println(C); " ) ; Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = 0 ; C = A * B ; System . out . println ( C ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int number_n , i , j , count = 0 ; number_n = Integer . parseInt ( sc . next ( ) ) ; int [ ] height = new int [ number_n ] ; for ( i = 0 ; i < number_n ; i ++ ) { height [ i ] = Integer . parseInt ( sc . next ( ) ) ; for ( j = 0 ; j < i ; j ++ ) { if ( height [ j ] > height [ i ] ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } if ( j == i ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { static final Scanner stdin = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( stdin . hasNext ( ) ) { int a = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; int comp_val = a - b ; int num , aval , m , n , ans1 ; if ( comp_val > 0 ) { for ( int i = 0 ; i <= a ; i ++ ) { aval = a - i ; if ( a % aval == 0 && b % aval == 0 ) { System . out . println ( " [LOG] Block: m = a / aval; \n n = b / aval; \n ans1 = m * n * aval; \n System.out.println(aval + \" \" + ans1); \n break; " ) ; m = a / 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 ( a % aval == 0 && b % aval == 0 ) { System . out . println ( " [LOG] Block: m = a / aval; \n n = b / aval; \n ans1 = m * n * aval; \n System.out.println(aval + \" \" + ans1); \n break; " ) ; m = a / aval ; n = b / aval ; ans1 = m * n * aval ; System . out . println ( aval + " " + ans1 ) ; break ; } } } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int x = 0 ; int count = 0 ; int y = 0 ; int z = 0 ; Set < Integer > al = new HashSet < > ( ) ; for ( int i = 0 ; i <= k ; i ++ ) { al . add ( i ) ; } for ( int i = 0 ; i <= k ; i ++ ) { for ( int j = 0 ; j <= k ; j ++ ) { if ( al . contains ( s - i - j ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] A = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 ++ ) { System . out . println ( " [LOG] Block: c[i] += (a[i][j] * b[j]); " ) ; c [ i ] += ( a [ i ] [ j ] * b [ j ] ) ; } } return c ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] values = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i ++ ) { values [ i ] = Integer . parseInt ( input . readLine ( ) ) ; } int k = Integer . parseInt ( input . readLine ( ) ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = i + 1 ; j < 5 ; j ++ ) { if ( Math . abs ( values [ i ] - values [ j ] ) > k ) { System . out . println ( " [LOG] Block: System.out.println( \" :( \" ); \n return; " ) ; System . out . println ( " :( " ) ; return ; } } } System . out . println ( " Yay! " ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { PrintWriter out = new PrintWriter ( System . out ) ; FastScanner fs = new FastScanner ( ) ; long a = fs . nextLong ( ) ; double b = fs . nextDouble ( ) ; BigDecimal bg1 = BigDecimal . valueOf ( a ) ; BigDecimal bg2 = BigDecimal . valueOf ( b ) ; out . println ( bg1 . multiply ( bg2 ) . setScale ( 0 , RoundingMode . DOWN ) ) ; out . close ( ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(next()); " ) ; return Double . parseDouble ( next ( ) ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char c ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { c = str . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) c = Character . toLowerCase ( c ) ; else if ( Character . isLowerCase ( c ) ) c = Character . toUpperCase ( c ) ; System . out . print ( c ) ; } System . out . println ( ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: System.out.println( \" Exception : \" + e); " ) ; System . out . println ( " Exception : " + e ) ; } } } +import java . util . Scanner ; public class Main { void run ( ) { Scanner s = new Scanner ( System . in ) ; String W = s . next ( ) ; int count = 0 ; while ( true ) { String T = s . next ( ) ; if ( T . equals ( " END_OF_TEXT " ) ) break ; if ( W . compareToIgnoreCase ( T ) == 0 ) { count ++ ; } } System . out . println ( count ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String s1 = s.substring(2, 3); \n String s2 = s.substring(3, 4); \n String s3 = s.substring(4, 5); \n String s4 = s.substring(5, 6); \n if (s1.equals(s2) && s3.equals(s4)) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String s1 = s . substring ( 2 , 3 ) ; String s2 = s . substring ( 3 , 4 ) ; String s3 = s . substring ( 4 , 5 ) ; String s4 = s . substring ( 5 , 6 ) ; if ( s1 . equals ( s2 ) && s3 . equals ( s4 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n System.out.println((B + A - 3) / (A - 1)); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( ( B + A - 3 ) / ( A - 1 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . equals ( " 5 5 7 " ) || s . equals ( " 5 7 5 " ) || s . equals ( " 7 5 5 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int length, side, area, circum; \n length = sc.nextInt(); \n side = sc.nextInt(); \n area = length * side; \n circum = (length + side) * 2; \n System.out.println(area + \" \" + circum); " ) ; Scanner sc = new Scanner ( System . in ) ; int length , side , area , circum ; length = sc . nextInt ( ) ; side = sc . nextInt ( ) ; area = length * side ; circum = ( length + side ) * 2 ; System . out . println ( area + " " + circum ) ; } } +import java . util . Scanner ; public class Main { 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 ( k == 0 ) { System . out . println ( a + " " + b ) ; return ; } if ( a >= k ) { System . out . println ( a - k + " " + b ) ; return ; } k -= a ; if ( b >= k ) { System . out . println ( " [LOG] Block: System.out.println( \" 0 \" + (b - k)); \n return; " ) ; System . out . println ( " 0 " + ( b - k ) ) ; return ; } System . out . println ( " 0 0 " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String token = sc . next ( ) ; String [ ] strArray = token . split ( " " ) ; int result = 0 ; if ( strArray [ 0 ] . equals ( " 1 " ) ) { result ++ ; } if ( strArray [ 1 ] . equals ( " 1 " ) ) { System . out . println ( " [LOG] Block: result += 1; " ) ; result += 1 ; } if ( strArray [ 2 ] . equals ( " 1 " ) ) { System . out . println ( " [LOG] Block: result += 1; " ) ; result += 1 ; } System . out . println ( result ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int standard = 1 ; while ( true ) { int target = standard * 2 ; if ( target <= n ) { standard = target ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( standard ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long N = scan . nextLong ( ) ; long moveCnt = ( long ) Math . pow ( 10 , 18 ) ; for ( long i = 1 ; i * i <= N ; i ++ ) { if ( N % i != 0 ) continue ; long j = N / i ; if ( moveCnt > i + j - 2 ) { System . out . println ( " [LOG] Block: moveCnt = i + j - 2; " ) ; moveCnt = i + j - 2 ; } } System . out . println ( moveCnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; String end = T . substring ( S . length ( ) , S . length ( ) + 1 ) ; if ( T . equals ( S + end ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] str = line . split ( " " ) ; String [ ] num = sc . nextLine ( ) . split ( " " ) ; String strU = sc . nextLine ( ) ; String strS = str [ 0 ] ; String strT = str [ 1 ] ; int numA = Integer . parseInt ( num [ 0 ] ) ; int numB = Integer . parseInt ( num [ 1 ] ) ; if ( strU . equals ( strS ) ) { numA -= 1 ; } else { System . out . println ( " [LOG] Block: numB -= 1; " ) ; numB -= 1 ; } System . out . println ( numA + " " + numB ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numK = sc . nextInt ( ) ; int numX = sc . nextInt ( ) ; int initNum = numX - numK + 1 ; String retStr = " " + initNum ; for ( int i = initNum + 1 ; i < numX + numK ; i ++ ) { System . out . println ( " [LOG] Block: retStr = retStr + \" \" + i; " ) ; retStr = retStr + " " + i ; } System . out . println ( retStr ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 11 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: int num = sc.nextInt(); \n nums[num]++; " ) ; int num = sc . nextInt ( ) ; nums [ num ] ++ ; } if ( nums [ 5 ] == 2 && nums [ 7 ] == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = 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 ++ ) { System . out . println ( " [LOG] Block: int ABpizza = i; \n int Apizza = Math.max(0, x - (i / 2)); \n int Bpizza = Math.max(0, y - (i / 2)); \n ans = Math.min(ans, (ABpizza * AB) + (Apizza * A) + (Bpizza * B)); " ) ; 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 * A ) + ( Bpizza * B ) ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n String uppercase = \" ABCDEFGHIJKLMNOPQRSTUVWXYZ \" ; \n String lowercase = \" abcdefghijklmnopqrstuvwxyz \" ; \n String alpha = scanner.nextLine(); \n if (uppercase.contains(alpha)) \n System.out.println( \" A \" ); \n else \n System.out.println( \" a \" ); " ) ; Scanner scanner = new Scanner ( System . in ) ; String uppercase = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; String lowercase = " abcdefghijklmnopqrstuvwxyz " ; String alpha = scanner . nextLine ( ) ; if ( uppercase . contains ( alpha ) ) System . out . println ( " A " ) ; else System . out . println ( " a " ) ; } } +import java . util . * ; class Main { Scanner sc = new Scanner ( System . in ) ; void main ( ) { int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] [ ] x = new int [ r + 1 ] [ c + 1 ] ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { x [ i ] [ j ] = sc . nextInt ( ) ; x [ i ] [ c ] += x [ i ] [ j ] ; } } for ( int i = 0 ; i < r ; i ++ ) for ( int j = 0 ; j < c + 1 ; j ++ ) x [ r ] [ j ] += x [ i ] [ j ] ; for ( int i = 0 ; i < r + 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 ) { System . out . println ( " [LOG] Block: new Main().main(); " ) ; new Main ( ) . main ( ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > array = new ArrayList < Integer > ( ) ; long ans = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( ! ( i % 3 == 0 || i % 5 == 0 ) ) { array . add ( i ) ; } } for ( int i = 0 ; i < array . size ( ) ; i ++ ) { System . out . println ( " [LOG] Block: ans += array.get(i); " ) ; ans += array . get ( i ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = Integer.parseInt(sc.next()); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n int c = Math.min(n * a, b); \n System.out.println(c); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Math . min ( n * a , b ) ; System . out . println ( c ) ; } } +import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) h [ i ] = scan . nextInt ( ) ; int [ ] dp = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) dp [ i ] = Integer . MAX_VALUE ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 0 ; i < n ; 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 [ n - 1 ] ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 buf ; for ( int i = 0 ; i < data . length / 2 ; i ++ ) { System . out . println ( " [LOG] Block: buf = data[i]; \n data[i] = data[data.length - 1 - i]; \n data[data.length - 1 - i] = buf; " ) ; buf = data [ i ] ; data [ i ] = data [ data . length - 1 - i ] ; data [ data . length - 1 - i ] = buf ; } System . out . println ( data ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = scanner . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n - 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 ] ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; int h = Integer . parseInt ( line [ 0 ] ) ; int n = Integer . parseInt ( line [ 1 ] ) ; line = br . readLine ( ) . split ( " " ) ; br . close ( ) ; boolean flg = false ; for ( String s : line ) { if ( ( h -= Integer . parseInt ( s ) ) <= 0 ) { flg = true ; break ; } } if ( flg ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +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 Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String K = sc . next ( ) ; int k = 101 ; if ( K . length ( ) <= 3 ) k = 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 { System . out . println ( " [LOG] Block: if (k <= index0 + 1) \n System.out.println(1); \n else \n System.out.println(S.charAt(index0 + 1)); " ) ; if ( k <= index0 + 1 ) System . out . println ( 1 ) ; else System . out . println ( S . charAt ( index0 + 1 ) ) ; } } } +import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int W = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; double area = ( double ) W * H / 2 ; int flag = 0 ; if ( x * 2 == W && y * 2 == H ) { System . out . println ( " [LOG] Block: flag = 1; " ) ; flag = 1 ; } System . out . println ( area + " " + flag ) ; } } +import java . util . Scanner ; public class Main { private int a ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int a = 0 ; if ( N % 2 == 1 ) { a = ( N / 2 ) + 1 ; } else { System . out . println ( " [LOG] Block: a = (N / 2); " ) ; a = ( N / 2 ) ; } System . out . print ( a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; String answer = " " ; final int num = scan . nextInt ( ) ; int len = scan . nextInt ( ) ; String [ ] words = new String [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { words [ i ] = scan . next ( ) ; } for ( int i = 1 ; i < num ; 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 < num ; i ++ ) { System . out . println ( " [LOG] Block: answer = answer.concat(words[i]); " ) ; answer = answer . concat ( words [ i ] ) ; } System . out . println ( answer ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { 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 SolveB { } class Edge { } void solveA ( Scanner sc ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n System.out.println(Math.max(c - (a - b), 0)); " ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( c - ( a - b ) , 0 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 3 == 0 || Integer . toString ( i ) . indexOf ( " 3 " ) >= 0 ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d \" , i); " ) ; System . out . printf ( " %d " , i ) ; } } System . out . println ( " " ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { static int [ ] subTreeSize ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n long k = sc.nextLong(); \n k--; \n int idx = 0; \n for (; idx < s.length() && s.charAt(idx) == '1'; idx++) ; \n char ans = k < idx ? '1' : s.charAt(idx); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long k = sc . nextLong ( ) ; k -- ; int idx = 0 ; for ( ; idx < s . length ( ) && s . charAt ( idx ) == '1' ; idx ++ ) ; char ans = k < idx ? '1' : s . charAt ( idx ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] A ; A = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; ++ i ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - 1 ; ++ i ) { for ( int j = 0 ; j < n - 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 , n ) ; System . out . println ( count ) ; } public static void print ( int [ ] A , int n ) { for ( int i = 0 ; i < n ; ++ i ) { System . out . print ( A [ i ] ) ; if ( i < n - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; } } +import java . util . * ; import java . math . * ; import java . io . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int ans = 3928237 ; for ( int i = 0 ; i < 5 ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < 5 ; j ++ ) { if ( i != j ) { sum += a [ j ] ; if ( a [ j ] % 10 != 0 ) { sum += 10 - a [ j ] % 10 ; } } else { System . out . println ( " [LOG] Block: sum += a[j]; " ) ; sum += a [ j ] ; } } ans = Math . min ( ans , sum ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] ary = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ary [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { System . out . println ( " [LOG] Block: ans += ary[i] * ary[j]; " ) ; ans += ary [ i ] * ary [ j ] ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int judge = 0 ; while ( X >= 0 && Y >= 0 ) { if ( Y / 4 == X && Y % 4 == 0 ) { judge = 1 ; break ; } X = X - 1 ; Y = Y - 2 ; } if ( judge == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { 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 f ; do { f = false ; for ( int i = 0 ; i < m . length ; i ++ ) { b = m [ i ] ; st = str . toString ( ) ; if ( st . endsWith ( b ) ) { System . out . println ( " [LOG] Block: str.delete(str.length() - b.length(), str.length()); \n f = true; \n break; " ) ; str . delete ( str . length ( ) - b . length ( ) , str . length ( ) ) ; f = true ; break ; } } } while ( f ) ; System . out . println ( ( str . toString ( ) . equals ( " " ) ) ? " YES " : " NO " ) ; } } +import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int N = gi ( ) ; int M = gi ( ) ; int a = ( int ) Math . ceil ( ( double ) ( M - 1 ) / ( double ) ( N - 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 ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(scanner.next()); " ) ; return Double . parseDouble ( scanner . next ( ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sanka = sc . nextInt ( ) ; int point = sc . nextInt ( ) ; int seikai = sc . nextInt ( ) ; int [ ] array = new int [ sanka ] ; for ( int i = 0 ; i < sanka ; i ++ ) { array [ i ] = point - seikai ; } for ( int i = 0 ; i < seikai ; i ++ ) { array [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < sanka ; i ++ ) { if ( array [ i ] <= 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } } +import java . util . * ; import java . io . * ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int L = fs . nextInt ( ) ; double y = ( double ) L / 3 ; BigDecimal x = BigDecimal . valueOf ( y ) ; BigDecimal ans = x . multiply ( x ) ; ans = ans . multiply ( x ) ; System . out . printf ( " %.12f " , ans ) ; } static class FastScanner { 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 ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(next()); " ) ; return Double . parseDouble ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int p = Integer.parseInt(sc.next()); \n int q = Integer.parseInt(sc.next()); \n int r = Integer.parseInt(sc.next()); \n int result = Math.min(Math.min(p + q, q + r), p + r); \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; int p = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int r = Integer . parseInt ( sc . next ( ) ) ; int result = Math . min ( Math . min ( p + q , q + r ) , p + r ) ; System . out . println ( result ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 100 ] ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) array [ i ] = sc . nextInt ( ) ; doInsertionSort ( array , n ) ; printArray ( array , n ) ; } public static void doInsertionSort ( int [ ] array , int n ) { for ( int i = 1 ; i < n ; i ++ ) { printArray ( array , n ) ; 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 n ) { for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (i != 0) \n System.out.print( \" \" ); \n System.out.print(array[i]); " ) ; if ( i != 0 ) System . out . print ( " " ) ; System . out . print ( array [ i ] ) ; } System . out . print ( " \n " ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int M = 2 * D + 1 ; System . out . println ( ( N + M - 1 ) / M ) ; } void tr ( Object ... objects ) { System . out . println ( " [LOG] Block: System.out.println(Arrays.deepToString(objects)); " ) ; System . out . println ( Arrays . deepToString ( objects ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int check = 0; \n double rectangle, width, height, point_x, point_y, max_area = 0.0; \n Scanner sc = new Scanner(System.in); \n width = Double.parseDouble(sc.next()); \n height = Double.parseDouble(sc.next()); \n point_x = Double.parseDouble(sc.next()); \n point_y = Double.parseDouble(sc.next()); \n rectangle = height * width; \n max_area = rectangle / 2.0; \n if (point_x == width / 2.0 && point_y == height / 2.0) \n check = 1; \n System.out.println(max_area + \" \" + check); " ) ; int check = 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 ) check = 1 ; System . out . println ( max_area + " " + check ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int ans = -1; \n if ((a < 10) && (b < 10)) \n ans = (a * b); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = - 1 ; if ( ( a < 10 ) && ( b < 10 ) ) ans = ( a * b ) ; System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { FastReader s = new FastReader ( ) ; int n = s . nextInt ( ) ; long sum = 0 ; int max = Integer . MIN_VALUE ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; 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 FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; long sum = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { sum += s . charAt ( i ) - '0' ; } if ( sum % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +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 Main { static final int MOD = 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 ++ ) { System . out . println ( " [LOG] Block: switch(s[index]) { \n case '0': \n ans += \" 0 \" ; \n break; \n case '1': \n ans += \" 1 \" ; \n break; \n case 'B': \n ans = ans.substring(0, Math.max(0, ans.length() - 1)); \n break; \n } " ) ; 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 . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { list . add ( Integer . parseInt ( sc . next ( ) ) ) ; } sc . close ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( list . get ( i ) == 0 ) { System . out . println ( " [LOG] Block: int ans = i + 1; \n System.out.println(ans); \n return; " ) ; int ans = i + 1 ; System . out . println ( ans ) ; return ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int ANS = 0 ; if ( D == 0 ) { if ( N != 100 ) { ANS = N ; } else { ANS = N + 1 ; } } else if ( D == 1 ) { if ( N != 100 ) { ANS = N * 100 ; } else { ANS = ( N + 1 ) * 100 ; } } else { if ( N != 100 ) { ANS = N * 10000 ; } else { System . out . println ( " [LOG] Block: ANS = (N + 1) * 10000; " ) ; ANS = ( N + 1 ) * 10000 ; } } System . out . println ( ANS ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int max ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i ; j < N ; 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 < N ; i ++ ) { if ( i % 2 == 0 ) { A = A + a [ i ] ; } if ( i % 2 != 0 ) { System . out . println ( " [LOG] Block: B = B + a[i]; " ) ; B = B + a [ i ] ; } } int point = Math . abs ( A - B ) ; System . out . println ( point ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 3 == 0 || i % 5 == 0 ) { continue ; } else { System . out . println ( " [LOG] Block: ans = ans + i; " ) ; ans = ans + i ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] li = new int [ n ] ; for ( int i = 1 ; i <= n ; i ++ ) { li [ sc . nextInt ( ) - 1 ] = i ; } int i = 0 ; for ( int k : li ) { if ( i != n - 1 ) { System . out . print ( li [ i ] + " " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(li[i]); " ) ; System . out . println ( li [ i ] ) ; } i ++ ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; char [ ] c = str . toCharArray ( ) ; for ( int i = 0 ; i < c . length ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < c . length ; j ++ ) { if ( c [ i ] == c [ j ] ) { count ++ ; } } if ( count % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; String s = in . readLine ( ) ; int n = Integer . parseInt ( s ) ; s = in . readLine ( ) ; String [ ] as = s . split ( " " ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( as [ i ] ) ; } output ( a ) ; insertionSort ( a , n ) ; } private static void insertionSort ( int [ ] a , int n ) { for ( int i = 1 ; i < n ; 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 . println ( " [LOG] Block: System.out.print(a[i] + \" \" ); " ) ; System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ a . length - 1 ] ) ; } } +import java . util . * ; class Main { int max ( int a , int b ) { if ( a < b ) return b ; else return a ; } int min ( int a , int b ) { if ( a > b ) return b ; else return a ; } Main ( ) { Scanner sc = new Scanner ( System . in ) ; int a , c , d ; a = sc . nextInt ( ) ; d = - 1000000000 ; c = sc . nextInt ( ) ; for ( int i = 0 ; i < a - 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 ) { System . out . println ( " [LOG] Block: new Main(); " ) ; new Main ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; for ( int i = x - k + 1 ; i <= x + k - 1 ; i ++ ) { System . out . print ( i ) ; if ( i < x + k - 1 ) { System . out . print ( " " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" \" ); " ) ; System . out . println ( " " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; if ( n < 105 ) { n = 0 ; } else if ( n < 135 ) { n = 1 ; } else if ( n < 165 ) { n = 2 ; } else if ( n < 189 ) { n = 3 ; } else if ( n < 195 ) { n = 4 ; } else { System . out . println ( " [LOG] Block: n = 5; " ) ; n = 5 ; } System . out . println ( n ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int wk = 0 ; int ans = 0 ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 2 ; i <= N ; 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 <= N ; i ++ ) { if ( map . containsKey ( i ) ) { System . out . println ( map . get ( i ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] tmpArray = br . readLine ( ) . split ( " " ) ; int [ ] input = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { input [ n - i - 1 ] = Integer . parseInt ( tmpArray [ i ] ) ; } System . out . print ( input [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" \" + input[i]); " ) ; System . out . print ( " " + input [ i ] ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { static void putArray ( int [ ] array ) { System . out . print ( array [ 0 ] ) ; for ( int i = 1 ; i < array . length ; i ++ ) { System . out . print ( " " + array [ i ] ) ; } 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 i = 0 ; i < array . length ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } putArray ( array ) ; for ( int i = 1 ; i < array . length ; i ++ ) { int v = array [ i ] ; int j = i - 1 ; while ( j >= 0 && array [ j ] > v ) { System . out . println ( " [LOG] Block: array[j + 1] = array[j]; \n j--; " ) ; array [ j + 1 ] = array [ j ] ; j -- ; } array [ j + 1 ] = v ; putArray ( array ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int total = sc.nextInt(); \n int happy500 = 0; \n int happy5 = 0; \n happy500 = total / 500 * 1000; \n happy5 = (total % 500) / 5 * 5; \n System.out.println(happy500 + happy5); " ) ; Scanner sc = new Scanner ( System . in ) ; int total = sc . nextInt ( ) ; int happy500 = 0 ; int happy5 = 0 ; happy500 = total / 500 * 1000 ; happy5 = ( total % 500 ) / 5 * 5 ; System . out . println ( happy500 + happy5 ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = 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 ) ) ) { System . out . println ( " [LOG] Block: nothing.add(i); " ) ; nothing . add ( i ) ; } } alList . removeAll ( nothing ) ; } System . out . println ( alList . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] b = new int [ a ] ; 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 ) { System . out . println ( " [LOG] Block: ans = tmp; " ) ; ans = tmp ; } } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] t = new int [ n ] [ 3 ] ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n long value1 = scan.nextLong(); \n long value2 = (long) (scan.nextDouble() * 100 + 0.001); \n long sum = value1 * value2 / 100; \n scan.close(); \n System.out.println(sum); " ) ; Scanner scan = new Scanner ( System . in ) ; long value1 = scan . nextLong ( ) ; long value2 = ( long ) ( scan . nextDouble ( ) * 100 + 0.001 ) ; long sum = value1 * value2 / 100 ; scan . close ( ) ; System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; 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 ++ ) { System . out . println ( " [LOG] Block: if (array[i] >= max) \n count++; \n max = Math.max(max, array[i]); " ) ; if ( array [ i ] >= max ) count ++ ; max = Math . max ( max , array [ i ] ) ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . next ( ) ) ; int breakCount = 0 ; int kIndex = 1 ; for ( int i = 0 ; i < N ; i ++ ) { int num = Integer . parseInt ( scanner . next ( ) ) ; if ( kIndex != num ) { breakCount ++ ; } else { kIndex ++ ; } } scanner . close ( ) ; if ( breakCount == N ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(breakCount); " ) ; System . out . println ( breakCount ) ; } } } +import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int x; \n x = in.nextInt(); \n System.out.println(x * x * x); " ) ; Scanner in = new Scanner ( System . in ) ; int x ; x = in . nextInt ( ) ; System . out . println ( x * x * x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; int counter = 0 ; for ( int i = 0 ; i < h . length ; i ++ ) { h [ i ] = sc . nextInt ( ) ; if ( h [ i ] >= k ) { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } System . out . println ( counter ) ; sc . close ( ) ; } } +import java . math . BigDecimal ; import java . math . MathContext ; import java . math . RoundingMode ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int A = 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 ) { System . out . println ( " [LOG] Block: kakudo *= -1; " ) ; kakudo *= - 1 ; } double dC = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( kakudo ) ) ; double result = Math . sqrt ( dC ) ; System . out . print ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; int [ ] Hmax = new int [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( H [ i ] >= Hmax [ i ] ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { System . out . println ( " [LOG] Block: list.add(scan.nextInt()); " ) ; 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: x[i] = sc.nextInt(); \n y[x[i]] = i + 1; " ) ; x [ i ] = sc . nextInt ( ) ; y [ x [ i ] ] = i + 1 ; } for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( y [ i ] + " " ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < you . length ; i ++ ) { if ( s . equals ( you [ i ] ) ) { System . out . print ( 7 - i ) ; 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 ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(scanner.next()); " ) ; return Double . parseDouble ( scanner . next ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int ans = 1 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" APPROVED \" ); " ) ; System . out . println ( " APPROVED " ) ; } sc . close ( ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N ; int M ; int temp ; int sum = 0 ; int P ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; int i ; for ( i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; CF_Reader in = new CF_Reader ( ) ; long yen = in . nextLong ( ) ; long rem = yen % 500 ; long total = ( yen - rem ) * 2 ; total += ( rem - ( rem % 5 ) ) ; out . println ( total ) ; out . close ( ) ; } static class CF_Reader { BufferedReader br ; StringTokenizer st ; public CF_Reader ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } long 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 { System . out . println ( " [LOG] Block: return br.readLine().trim(); " ) ; return br . readLine ( ) . trim ( ) ; } } } +import java . awt . * ; import java . awt . geom . * ; import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n int b = sc.nextInt(); \n if (a == 0 && b == 0) \n break; \n System.out.println((a < b) ? (a + \" \" + b) : (b + \" \" + a)); " ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == 0 && b == 0 ) break ; System . out . println ( ( a < b ) ? ( a + " " + b ) : ( b + " " + a ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int X; \n Scanner sc = new Scanner(System.in); \n X = sc.nextInt(); \n System.out.println((X / 500) * 1000 + (X % 500) / 5 * 5); " ) ; int X ; Scanner sc = new Scanner ( System . in ) ; X = sc . nextInt ( ) ; System . out . println ( ( X / 500 ) * 1000 + ( X % 500 ) / 5 * 5 ) ; } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(is); \n int H = scan.nextInt(); \n int A = scan.nextInt(); \n int ans = (int) Math.ceil((double) H / A); \n os.println(ans); " ) ; Scanner scan = new Scanner ( is ) ; int H = scan . nextInt ( ) ; int A = scan . nextInt ( ) ; int ans = ( int ) Math . ceil ( ( double ) H / A ) ; os . println ( ans ) ; } } +import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; int l = S . length ( ) ; loop : for ( int i = 0 ; i < l ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { if ( S . charAt ( ( j + i ) % l ) != T . charAt ( j ) ) { break ; } else { if ( j == l - 1 ) { System . out . println ( " Yes " ) ; break loop ; } } } if ( i == l - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . 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 { System . out . println ( " [LOG] Block: FastReader s = new FastReader(); \n String n = s.next(); \n int p = (int) n.charAt(0); \n p++; \n System.out.println((char) p); " ) ; FastReader s = new FastReader ( ) ; String n = s . next ( ) ; int p = ( int ) n . charAt ( 0 ) ; p ++ ; System . out . println ( ( char ) p ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String re = " " ; for ( int i = line . length ( ) ; i > 0 ; i -- ) { System . out . println ( " [LOG] Block: re += line.charAt(i - 1); " ) ; re += line . charAt ( i - 1 ) ; } System . out . println ( re ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); \n String nb = buf.readLine(); \n int x = Integer.parseInt(nb); \n System.out.println((int) Math.pow(x, 3)); " ) ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word ; int count = 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 ) ) { count ++ ; } else { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] D = new int [ N ] [ 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 . println ( " [LOG] Block: System.out.print( \" Yes \" ); \n return; " ) ; System . out . print ( " Yes " ) ; return ; } } System . out . print ( " No " ) ; } } +import java . util . * ; import static java . lang . System . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cnt = 0 ; int plug = 1 ; for ( ; ; ) { System . out . println ( " [LOG] Block: if (plug >= b) \n break; \n plug = plug + a - 1; \n cnt++; " ) ; if ( plug >= b ) break ; plug = plug + a - 1 ; cnt ++ ; } out . println ( cnt ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; class Main { public static void main ( String [ ] args ) throws IOException { int d , 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 ] ) ; d = getD ( a , b ) ; r = getR ( a , b ) ; f = getF ( a , b ) ; System . out . printf ( " %d %d %.5f " , d , 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 ) { System . out . println ( " [LOG] Block: return a / b; " ) ; return a / b ; } } +import java . util . * ; import java . lang . Double ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; String a = reader . nextLine ( ) ; if ( a . equals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" ABC \" ); " ) ; System . out . println ( " ABC " ) ; } } } +import java . util . * ; class XCubic { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String ... args ) { System . out . println ( " [LOG] Block: XCubic.main(); " ) ; XCubic . main ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] v = new int [ n ] ; int [ ] c = new int [ n ] ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { v [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < n ; j ++ ) { c [ j ] = sc . nextInt ( ) ; a [ j ] = v [ j ] - c [ j ] ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= 0 ) { System . out . println ( " [LOG] Block: ans += a[i]; " ) ; ans += a [ i ] ; } } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int 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 [ n ] ; for ( int i = 0 ; i < q ; i ++ ) { int ans = a [ i ] - 1 ; point [ ans ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { if ( k - q + point [ i ] > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) b [ i ] = sc . nextInt ( ) ; int c = 0 , s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > b [ i ] ) { System . out . println ( " [LOG] Block: c = c + a[i]; \n s = s + b[i]; " ) ; c = c + a [ i ] ; s = s + b [ i ] ; } } System . out . println ( c - s ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { 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 a = Integer . parseInt ( st . nextToken ( ) ) ; String op = st . nextToken ( ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int ans = 0 ; if ( op . equals ( " + " ) ) { ans = a + b ; System . out . println ( ans ) ; } else if ( op . equals ( " - " ) ) { ans = a - b ; System . out . println ( ans ) ; } else if ( op . equals ( " * " ) ) { ans = a * b ; System . out . println ( ans ) ; } else if ( op . equals ( " / " ) ) { ans = a / b ; System . out . println ( ans ) ; } else if ( op . equals ( " ? " ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } } +import java . math . BigDecimal ; import java . math . MathContext ; import java . math . RoundingMode ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal L = new BigDecimal(sc.nextLine()); \n BigDecimal div = new BigDecimal(3.0); \n MathContext mc = new MathContext(10, RoundingMode.HALF_UP); \n BigDecimal cutNum = L.divide(div, mc); \n System.out.println(cutNum.multiply(cutNum).multiply(cutNum)); " ) ; 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 . Scanner ; class Main { public void fun ( ) { Scanner sc = new Scanner ( System . in ) ; int h = 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 ) { h = h - a [ i ] ; i ++ ; } if ( h <= 0 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } public static void main ( String [ ] arr ) { System . out . println ( " [LOG] Block: Main m = new Main(); \n m.fun(); " ) ; Main m = new Main ( ) ; m . fun ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] arg ) { Scanner in = new Scanner ( System . in ) ; String input = in . nextLine ( ) ; while ( ! input . equals ( " - " ) ) { String tmp = in . nextLine ( ) ; int h_cnt = Integer . parseInt ( tmp ) ; StringBuffer sb = new StringBuffer ( input ) ; for ( int i = 0 ; i < h_cnt ; i ++ ) { System . out . println ( " [LOG] Block: tmp = in.nextLine(); \n int h_pos = Integer.parseInt(tmp); \n String del_str = sb.substring(0, h_pos); \n sb = sb.delete(0, h_pos); \n sb.append(del_str); " ) ; 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 ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] iro = new int [ 8 ] ; int tourist = 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 { tourist ++ ; } } int clr = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { if ( iro [ i ] > 0 ) { System . out . println ( " [LOG] Block: clr++; " ) ; clr ++ ; } } System . out . println ( Math . max ( 1 , clr ) + " " + ( clr + tourist ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int point_now = 1 ; while ( cnt <= N ) { point_now = a [ point_now ] ; if ( point_now == 2 ) { System . out . println ( " [LOG] Block: System.out.print(cnt); \n return; " ) ; System . out . print ( cnt ) ; return ; } cnt ++ ; } System . out . println ( - 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int c = 0 ; int x , y , z , w ; for ( int i = A ; i <= B ; i ++ ) { x = i / 10000 ; y = i % 10 ; z = i / 1000 - x * 10 ; w = ( i % 100 - y ) / 10 ; if ( x == y && z == w ) { System . out . println ( " [LOG] Block: c++; " ) ; c ++ ; } } System . out . println ( c ) ; sc . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int count = 1 , x = 1 ; while ( x > 0 ) { x = scanner . nextInt ( ) ; if ( x == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . println ( " Case " + count + " : " + x ) ; count ++ ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { boolean j = 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 ) j = false ; if ( strArray [ a ] . equals ( " - " ) ) { for ( int i = 0 ; i < strArray . length ; i ++ ) { if ( i != a ) { if ( ! ( strArray [ i ] . equals ( " - " ) ) ) { System . out . println ( " [LOG] Block: int x = Integer.parseInt(strArray[i]); \n if (x >= 10 && x < 0) \n j = false; " ) ; int x = Integer . parseInt ( strArray [ i ] ) ; if ( x >= 10 && x < 0 ) j = false ; } else j = false ; } } } else j = false ; if ( j ) System . out . println ( " Yes " ) ; else if ( ! j ) System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a % k == 0 || b % k == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); \n return; " ) ; System . out . println ( " OK " ) ; return ; } int rem = a % k ; int temp = a - rem ; temp += k ; for ( int i = temp ; i < b ; i += k ) { if ( temp > a ) { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); \n return; " ) ; System . out . println ( " OK " ) ; return ; } } System . out . println ( " NG " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextLong ( ) ; long r = scanner . nextLong ( ) ; scanner . close ( ) ; int count = 0 ; while ( n >= r ) { System . out . println ( " [LOG] Block: count += 1; \n n = n / r; " ) ; count += 1 ; n = n / r ; } System . out . println ( count + 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; int Size = input . length ( ) ; String [ ] n = new String [ 30 ] ; for ( int i = 0 ; i < Size ; i ++ ) { n [ i ] = input . substring ( i , i + 1 ) ; } for ( int i = ( Size - 1 ) ; i > - 1 ; i -- ) { System . out . println ( " [LOG] Block: if (i == 0) \n System.out.println(n[i]); \n else \n System.out.print(n[i]); " ) ; if ( i == 0 ) System . out . println ( n [ i ] ) ; else System . out . print ( n [ i ] ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int a; \n int b; \n Scanner sc = new Scanner(System.in); \n a = sc.nextInt(); \n b = sc.nextInt(); \n int area = a * b; \n int syu = 2 * (a + b); \n System.out.println(area + \" \" + syu); " ) ; int a ; int b ; Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int area = a * b ; int syu = 2 * ( a + b ) ; System . out . println ( area + " " + syu ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a , b ; ArrayList < String > str = new ArrayList < String > ( ) ; String [ ] result ; while ( s . hasNext ( ) ) { System . out . println ( " [LOG] Block: a = s.nextInt(); \n b = s.nextInt(); \n System.out.println(String.valueOf(a + b).length()); " ) ; a = s . nextInt ( ) ; b = s . nextInt ( ) ; System . out . println ( String . valueOf ( a + b ) . length ( ) ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String S = in . next ( ) ; if ( S . charAt ( 0 ) == 'A' && S . charAt ( 1 ) == 'A' && S . charAt ( 2 ) == 'A' ) { System . out . println ( " [LOG] Block: out.println( \" No \" ); \n return; " ) ; out . println ( " No " ) ; return ; } if ( S . charAt ( 0 ) == 'B' && S . charAt ( 1 ) == 'B' && S . charAt ( 2 ) == 'B' ) { System . out . println ( " [LOG] Block: out.println( \" No \" ); \n return; " ) ; out . println ( " No " ) ; return ; } out . println ( " Yes " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Set < Integer > set = new HashSet ( ) ; int a = getInput ( ) ; do { set . add ( a ) ; a = f ( a ) ; } while ( ! set . contains ( a ) ) ; 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 . out . println ( " [LOG] Block: System.err.println(e.getMessage()); " ) ; System . err . println ( e . getMessage ( ) ) ; } return ret ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < String , Integer > s = new HashMap < String , Integer > ( ) ; char [ ] c ; String ds ; long ans = 0 ; int tmp ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: c = sc.next().toCharArray(); \n Arrays.sort(c); \n ds = String.valueOf(c); \n tmp = s.getOrDefault(ds, 0); \n ans += tmp; \n s.put(ds, tmp + 1); " ) ; 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 . 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 1 ; String w = " " ; Map < String , Integer > map = new HashMap < > ( ) ; List < String > strArr = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(str); " ) ; System . out . println ( str ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int alpha = 0 ; int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { for ( int k = 1 ; k <= N ; k ++ ) { alpha = gcd ( i , j ) ; sum += gcd ( alpha , k ) ; } } } System . out . println ( sum ) ; } public static int fac ( int N ) { if ( N == 1 ) { return 1 ; } else { return fac ( N - 1 ) * N ; } } public static int pow ( int N ) { return N * N * N ; } public static int gcd ( int a , int b ) { int c = a % b ; if ( c == 0 ) { return b ; } else { System . out . println ( " [LOG] Block: return gcd(b, c); " ) ; return gcd ( b , c ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] c = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; for ( int i = 0 ; i < c . length ; i ++ ) { char a = c [ i ] ; if ( i % 2 == 0 ) { if ( ! ( a == 'R' || a == 'U' || a == 'D' ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } else { if ( ! ( a == 'L' || a == 'U' || a == 'D' ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( Y % 2 == 1 ) { System . out . println ( " No " ) ; } else { int y = Y / 2 ; if ( y - X < 0 ) { System . out . println ( " No " ) ; } else if ( y - 2 * X > 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } } +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 Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int g = 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 ) == g ) { System . out . println ( " [LOG] Block: x = true; " ) ; x = true ; } } } if ( x ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( line [ i ] ) ; } insertionSort ( a , n ) ; } } 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 ++ ) { System . out . println ( " [LOG] Block: line.append(a[i] + \" \" ); " ) ; line . append ( a [ i ] + " " ) ; } System . out . println ( line . append ( a [ a . length - 1 ] ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int[] A; \n A = new int[N]; \n for (int i = 0; i < N; i++) A[i] = sc.nextInt(); \n Arrays.sort(A); \n boolean ans = true; \n for (int i = 0; i < N - 1; i++) if (A[i] == A[i + 1]) \n ans = false; \n System.out.println(ans ? \" YES \" : \" NO \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A ; A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = sc . nextInt ( ) ; Arrays . sort ( A ) ; boolean ans = true ; for ( int i = 0 ; i < N - 1 ; i ++ ) if ( A [ i ] == A [ i + 1 ] ) ans = false ; System . out . println ( ans ? " YES " : " NO " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static final int MAX = 200000 ; public static void main ( String [ ] args ) throws IOException { int [ ] Nums = new int [ MAX ] ; 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 ++ ) { System . out . println ( " [LOG] Block: max = Math.max(max, Nums[i] - min); \n min = Math.min(min, Nums[i]); " ) ; max = Math . max ( max , Nums [ i ] - min ) ; min = Math . min ( min , Nums [ i ] ) ; } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { int x ; int ans ; public void shori ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; ans = x * x * x ; System . out . println ( ans ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Main obj = new Main(); \n obj.shori(); " ) ; Main obj = new Main ( ) ; obj . shori ( ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; boolean [ ] [ ] cards = new boolean [ 4 ] [ 13 ] ; for ( int i = 0 ; i < num ; 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 . println ( " [LOG] Block: System.out.print( \" D \" ); " ) ; System . out . print ( " D " ) ; } System . out . println ( " " + ( j + 1 ) ) ; } } } } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { long X = 0 ; int i = 0 ; long n = 100 ; double k = 0 ; BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; X = Long . parseLong ( r . readLine ( ) ) ; do { System . out . println ( " [LOG] Block: i++; \n k = Math.ceil((double) (n / 100)); \n n += (long) k; " ) ; i ++ ; k = Math . ceil ( ( double ) ( n / 100 ) ) ; n += ( long ) k ; } while ( n < X ) ; System . out . println ( i ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] [ ] bill = new int [ 4 ] [ 3 ] [ 10 ] ; int b ; int f ; int r ; int v = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" #################### \" ); " ) ; System . out . println ( " #################### " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String input = stdIn . nextLine ( ) ; String [ ] a = input . split ( " " ) ; int x = Integer . parseInt ( a [ 0 ] ) ; int y = Integer . parseInt ( a [ 1 ] ) ; if ( x > 0 && x < 101 && y > 0 && y < 101 ) { int ans = y - x * 2 ; if ( ans == 0 ) { System . out . println ( " Yes " ) ; } else if ( ans > 0 && ( ans % 2 ) == 0 ) { for ( int i = 0 ; i < x ; i ++ ) { ans = ans - 2 ; if ( ans == 0 ) { System . out . println ( " Yes " ) ; break ; } } if ( ans != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { @ SuppressWarnings ( " deprecation " ) public static void main ( String [ ] args ) throws FileNotFoundException { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int M = sc.nextInt(); \n System.out.println(N * (N - 1) / 2 + M * (M - 1) / 2); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; System . out . println ( N * ( N - 1 ) / 2 + M * ( M - 1 ) / 2 ) ; } } +import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = " " ; while ( sc . hasNext ( ) ) { int count = 0 ; s = sc . nextLine ( ) ; if ( s . equalsIgnoreCase ( " ssr " ) || s . equalsIgnoreCase ( " srs " ) || s . equalsIgnoreCase ( " rss " ) || s . equalsIgnoreCase ( " rsr " ) ) { count = 1 ; } else if ( s . equalsIgnoreCase ( " rrs " ) || s . equalsIgnoreCase ( " srr " ) ) { count = 2 ; } else if ( s . equalsIgnoreCase ( " rrr " ) ) { System . out . println ( " [LOG] Block: count = 3; " ) ; count = 3 ; } else count = 0 ; System . out . println ( count ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] arr = new int [ N ] ; Arrays . fill ( arr , 0 ) ; for ( int i = 0 ; i < 2 * M ; i ++ ) { int a = sc . nextInt ( ) ; for ( int j = 1 ; j <= N ; j ++ ) { if ( a == j ) { arr [ j - 1 ] ++ ; } } } for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(arr[i]); " ) ; System . out . println ( arr [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) { int x = 1 ; int j = i ; while ( j < k ) { System . out . println ( " [LOG] Block: x *= 2; \n j *= 2; " ) ; x *= 2 ; j *= 2 ; } x *= n ; ans += ( double ) 1 / ( double ) x ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; import java . util . TreeSet ; public class Main { public static void main ( String [ ] args ) { TreeSet < Integer > numerosUtiles = new TreeSet < > ( ) ; Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] numbers = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { numbers [ i ] = in . nextInt ( ) ; } for ( int i = 1 ; i < ( n - 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 ) ) { System . out . println ( " [LOG] Block: numerosUtiles.add(b); " ) ; numerosUtiles . add ( b ) ; } } System . out . println ( numerosUtiles . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; if ( str . charAt ( 0 ) != 'A' ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } else { int Ccount = 0 ; int i ; int length = str . length ( ) ; for ( i = 2 ; i < length - 1 ; i ++ ) { if ( str . charAt ( i ) == 'C' ) { Ccount ++ ; } if ( Ccount > 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } } if ( Ccount == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; 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 ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } } } } System . out . println ( " AC " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; int viewableCnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; for ( int j = ( i - 1 ) ; j >= 0 ; j -- ) { if ( h [ i ] < h [ j ] ) { break ; } else if ( j == 0 ) { System . out . println ( " [LOG] Block: viewableCnt++; " ) ; viewableCnt ++ ; } } } System . out . println ( viewableCnt + 1 ) ; sc . close ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BMaximumDifference solver = new BMaximumDifference ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BMaximumDifference { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int min = Integer . MAX_VALUE , max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int a = in.nextInt(); \n min = Math.min(min, a); \n max = Math.max(max, a); " ) ; int a = in . nextInt ( ) ; min = Math . min ( min , a ) ; max = Math . max ( max , a ) ; } out . println ( max - min ) ; } } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; while ( s > 0 ) { String a = sc . next ( ) ; if ( map . containsKey ( a ) ) { map . put ( a , map . get ( a ) + 1 ) ; } else { System . out . println ( " [LOG] Block: map.put(a, 1); " ) ; map . put ( a , 1 ) ; } s -- ; } 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 . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n HashMap<String, String> map = new HashMap<>(); \n map.put( \" ARC \" , \" ABC \" ); \n map.put( \" ABC \" , \" ARC \" ); \n System.out.println(map.get(s)); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; HashMap < String , String > map = new HashMap < > ( ) ; map . put ( " ARC " , " ABC " ) ; map . put ( " ABC " , " ARC " ) ; System . out . println ( map . get ( s ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; int a = 1000 ; int i = 2 ; while ( a < p ) { System . out . println ( " [LOG] Block: a = 1000 * i; \n i++; " ) ; a = 1000 * i ; i ++ ; } System . out . println ( a - p ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int digit = sc . nextInt ( ) ; if ( min > digit ) { System . out . println ( " [LOG] Block: min = digit; \n ans++; " ) ; min = digit ; ans ++ ; } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; String str2 = scan . nextLine ( ) ; String c = str2 . substring ( 0 , str . length ( ) ) ; if ( str . equals ( c ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: String x; \n Scanner n = new Scanner(System.in); \n x = n.next(); \n if (x.equals( \" Sunny \" )) \n System.out.print( \" Cloudy \" ); \n else if (x.equals( \" Cloudy \" )) \n System.out.print( \" Rainy \" ); \n else if (x.equals( \" Rainy \" )) \n System.out.print( \" Sunny \" ); " ) ; String x ; Scanner n = new Scanner ( System . in ) ; x = n . next ( ) ; if ( x . equals ( " Sunny " ) ) System . out . print ( " Cloudy " ) ; else if ( x . equals ( " Cloudy " ) ) System . out . print ( " Rainy " ) ; else if ( x . equals ( " Rainy " ) ) System . out . print ( " Sunny " ) ; } } +import java . util . Scanner ; import java . util . Arrays ; class Main { 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 n = m . length ; for ( int i = 0 ; i < n / 2 ; i ++ ) { int tmp = m [ i ] ; m [ i ] = m [ n - i - 1 ] ; m [ n - i - 1 ] = tmp ; } } private static final void output ( int [ ] m , int n ) { for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( m [ i ] ) ; } } private static final void input ( int [ ] m , int n ) { Scanner cin = new Scanner ( System . in ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: m[i] = cin.nextInt(); " ) ; m [ i ] = cin . nextInt ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; String f = sc . next ( ) ; if ( a % 2 == 0 ) { if ( f . substring ( 0 , a / 2 ) . equals ( f . substring ( a / 2 , a ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int t = a [ n - 1 ] ; int max = 0 , cnt = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( t <= a [ i ] ) { cnt ++ ; max = Math . max ( max , cnt ) ; } else { System . out . println ( " [LOG] Block: cnt = 0; " ) ; cnt = 0 ; } t = a [ i ] ; } System . out . println ( max ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { int n ; int i , j ; int v ; Scanner scan = new Scanner ( System . in ) ; String str = new String ( ) ; n = scan . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) A [ i ] = scan . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) { v = A [ i ] ; j = i - 1 ; while ( j >= 0 && A [ j ] > v ) { System . out . println ( " [LOG] Block: A[j + 1] = A[j]; \n j--; " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int length = sc . nextInt ( ) ; int lowPos = sc . nextInt ( ) ; String str = sc . next ( ) ; String [ ] ary = str . split ( " " , 0 ) ; for ( int i = 0 ; i < length ; i ++ ) { System . out . println ( " [LOG] Block: if (i == lowPos - 1) \n ary[i] = ary[i].toLowerCase(); \n System.out.print(ary[i]); " ) ; if ( i == lowPos - 1 ) ary [ i ] = ary [ i ] . toLowerCase ( ) ; System . out . print ( ary [ i ] ) ; } } } +import java . util . Scanner ; class Main { public static final String SEVEN = " 7 " ; public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int inputN = scan . nextInt ( ) ; scan . close ( ) ; String numN = String . valueOf ( inputN ) ; 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 ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { 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 { System . out . println ( " [LOG] Block: printWriter.println( \" ABC \" ); " ) ; printWriter . println ( " ABC " ) ; } printWriter . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] str = new String [ 3 ] ; int [ ] count = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; ++ i ) { str [ i ] = sc . next ( ) ; count [ i ] = str [ i ] . length ( ) ; } int i = 0 ; while ( true ) { if ( count [ i ] == 0 && i == 0 ) { System . out . println ( " A " ) ; return ; } else if ( count [ i ] == 0 && i == 1 ) { System . out . println ( " B " ) ; return ; } else if ( count [ i ] == 0 && i == 2 ) { System . out . println ( " C " ) ; return ; } if ( str [ i ] . charAt ( str [ i ] . length ( ) - count [ i ] ) == 'a' ) { count [ i ] -- ; i = 0 ; } else if ( str [ i ] . charAt ( str [ i ] . length ( ) - count [ i ] ) == 'b' ) { count [ i ] -- ; i = 1 ; } else if ( str [ i ] . charAt ( str [ i ] . length ( ) - count [ i ] ) == 'c' ) { System . out . println ( " [LOG] Block: count[i]--; \n i = 2; " ) ; count [ i ] -- ; i = 2 ; } } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = 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 [ n ] ; for ( int i = 0 ; i < q ; i ++ ) { int c = as [ i ] ; cp [ c ] ++ ; } int [ ] dp = new int [ n ] ; Arrays . fill ( dp , k ) ; long [ ] sum = new long [ n ] ; long all = Arrays . stream ( cp ) . sum ( ) ; for ( int i = 0 ; i < n ; i ++ ) { sum [ i ] = all - cp [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { if ( k > sum [ i ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int Aval , Bval ; for ( int i = 1 ; i <= 1000 ; i ++ ) { Aval = ( int ) ( i * 0.08 ) ; Bval = ( int ) ( i * 0.1 ) ; if ( A == Aval && B == Bval ) { System . out . println ( " [LOG] Block: System.out.println(i); \n System.exit(0); " ) ; System . out . println ( i ) ; System . exit ( 0 ) ; } } System . out . println ( - 1 ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int t = a - b ; if ( c - t <= 0 ) { System . out . println ( " 0 " ) ; } if ( t < c ) { System . out . println ( " [LOG] Block: System.out.println(c - t); " ) ; System . out . println ( c - t ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 1 ; while ( true ) { System . out . println ( " [LOG] Block: if (n / (int) (Math.pow(k, count)) == 0) \n break; \n count++; " ) ; if ( n / ( int ) ( Math . pow ( k , count ) ) == 0 ) break ; count ++ ; } System . out . println ( " " + count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long c = n / (a + b); \n long d = n % (a + b); \n long e = Math.min(a, d); \n System.out.println(c * a + e); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = n / ( a + b ) ; long d = n % ( a + b ) ; long e = Math . min ( a , d ) ; System . out . println ( c * a + e ) ; } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n Set<Integer> set = new HashSet<>(); \n for (int i = 0; i < 3; i++) set.add(sc.nextInt()); \n System.out.println(set.size() == 2 ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) set . add ( sc . nextInt ( ) ) ; System . out . println ( set . size ( ) == 2 ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int ans = 0 ; int b = K - A ; int c = K - A - B ; if ( A == 0 && C == 0 ) { System . out . println ( " 0 " ) ; } else if ( K >= A && c < 1 ) { System . out . println ( A ) ; } else if ( K >= A && c >= 1 ) { System . out . println ( A + ( c * - 1 ) ) ; } else if ( K < A ) { System . out . println ( " [LOG] Block: System.out.println(K); " ) ; System . out . println ( K ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); \n String[] str = in.readLine().split( \" \" ); \n int h = Integer.parseInt(str[0]); \n int a = Integer.parseInt(str[1]); \n System.out.println((h + a - 1) / a); " ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int h = Integer . parseInt ( str [ 0 ] ) ; int a = Integer . parseInt ( str [ 1 ] ) ; System . out . println ( ( h + a - 1 ) / a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int num = Integer . parseInt ( stdin . nextLine ( ) ) ; boolean boo = true ; int [ ] seq = new int [ num ] ; if ( num <= 100 ) { for ( int i = 0 ; i < num ; i ++ ) { seq [ i ] = stdin . nextInt ( ) ; if ( seq [ i ] >= 0 && seq [ i ] <= 1000 ) { continue ; } else { boo = false ; break ; } } } if ( boo == true ) { for ( int j = num ; j > 0 ; j -- ) { if ( j != 1 ) { System . out . print ( seq [ j - 1 ] + " " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(seq[j - 1]); " ) ; System . out . println ( seq [ j - 1 ] ) ; } } } stdin . close ( ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { new ABC133 ( ) . c ( ) ; } } class ABC133 { void c ( ) { long L , R ; long M = 2019L ; Scanner in = new Scanner ( System . in ) ; L = in . nextLong ( ) ; R = in . nextLong ( ) ; int ans = 2018 ; long maxI = ( long ) Math . min ( R , L + M ) ; for ( long i = L ; i <= maxI ; ++ i ) { long maxJ = ( long ) Math . min ( R , i + 1L + M ) ; for ( long j = i + 1 ; j <= maxJ ; ++ j ) { System . out . println ( " [LOG] Block: ans = (int) Math.min(ans, i * j % M); " ) ; ans = ( int ) Math . min ( ans , i * j % M ) ; } } System . out . println ( ans ) ; in . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; int left = Math . max ( X - ( K - 1 ) , - 1000000 ) ; int right = Math . min ( X + ( K - 1 ) , 1000000 ) ; for ( int i = left ; i <= right ; i ++ ) { System . out . println ( " [LOG] Block: sb.append(i); \n sb.append( \" \" ); " ) ; sb . append ( i ) ; sb . append ( " " ) ; } System . out . println ( sb . toString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; if ( A >= 10 || B >= 10 ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(A * B); " ) ; System . out . println ( A * B ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] ary = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { ary [ i ] = sc . nextInt ( ) ; } boolean flag = true ; int numSwap = 0 ; while ( flag ) { flag = false ; for ( int i = N - 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 < N ; i ++ ) { System . out . print ( ary [ i ] ) ; if ( i < N - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( " " ) ; System . out . println ( numSwap ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double W = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; double y = sc . nextDouble ( ) ; System . out . printf ( " %.6f " , W * H / 2 ) ; if ( x == W / 2 && y == H / 2 ) { System . out . println ( 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( max < l [ i ] ) { max = l [ i ] ; } sum += l [ i ] ; } if ( sum - 2 * max > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; while ( ( A - 1 ) * ( ans - 1 ) + A < B ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . math . BigInteger ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] arg = sc . nextLine ( ) . split ( " " ) ; int n = Integer . parseInt ( arg [ 0 ] ) ; String d = arg [ 1 ] ; int count = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; List < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int d = sc . nextInt ( ) ; a . add ( d ) ; } Collections . sort ( a ) ; int price = 0 ; for ( int j = 0 ; j < K ; j ++ ) { System . out . println ( " [LOG] Block: price += a.get(j); " ) ; price += a . get ( j ) ; } System . out . println ( price ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n if (a <= 5) \n System.out.println( \" 0 \" ); \n else if (a <= 12) \n System.out.println(b / 2); \n else \n System.out.println(b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; if ( a <= 5 ) System . out . println ( " 0 " ) ; else if ( a <= 12 ) System . out . println ( b / 2 ) ; else System . out . println ( b ) ; } } +import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; String [ ] inputs = input . split ( " " ) ; int P = Integer . parseInt ( inputs [ 0 ] ) ; int Q = Integer . parseInt ( inputs [ 1 ] ) ; int R = Integer . parseInt ( inputs [ 2 ] ) ; int min1 = Math . min ( P , Q ) ; int max1 = Math . max ( P , Q ) ; if ( max1 <= R ) { System . out . println ( min1 + max1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(min1 + R); " ) ; System . out . println ( min1 + R ) ; } scanner . close ( ) ; } } +import java . lang . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int kari = n + 1 ; int keta = 1 ; while ( ( int ) ( kari / 10 ) != 0 ) { keta ++ ; kari = ( int ) ( kari / 10 ) ; } if ( keta == 1 ) { System . out . println ( n ) ; } else if ( keta == 2 ) { System . out . println ( 9 ) ; } else if ( keta == 3 ) { System . out . println ( ( 10 + n - 100 ) ) ; } else if ( keta == 4 ) { System . out . println ( 909 ) ; } else if ( keta == 5 ) { System . out . println ( ( 910 + n - 10000 ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(90909); " ) ; System . out . println ( 90909 ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < Integer , Boolean > map = new HashMap < > ( ) ; String ans = " YES " ; for ( int i = 0 ; i < n ; i ++ ) { int num = sc . nextInt ( ) ; if ( map . get ( num ) == null ) { map . put ( num , true ) ; } else { System . out . println ( " [LOG] Block: ans = \" NO \" ; \n break; " ) ; ans = " NO " ; break ; } } System . out . println ( ans ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] arg ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String keyword = br . readLine ( ) ; int cnt = 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 ) ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int num = Integer . parseInt ( a + b ) ; for ( int i = 1 ; i < 400 ; i ++ ) { if ( i * i == num ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n System.exit(0); " ) ; System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; long [ ] dp = new long [ n + 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 <= n ; i ++ ) { if ( dp [ i ] >= 0 ) { dp [ i ] = ( dp [ i - 1 ] + dp [ i - 2 ] ) % 1000000007 ; } else { System . out . println ( " [LOG] Block: dp[i] = 0; " ) ; dp [ i ] = 0 ; } } System . out . println ( dp [ n ] ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] r = new int [ 2 * m ] ; int [ ] rr = new int [ n + 1 ] ; for ( int i = 0 ; i < 2 * m ; i ++ ) { r [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < n + 1 ; i ++ ) { rr [ i ] = 0 ; } for ( int i = 0 ; i < 2 * m ; i ++ ) { rr [ r [ i ] ] ++ ; } for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(rr[i]); " ) ; System . out . println ( rr [ i ] ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String str1 = scan.next(); \n String str2 = scan.next(); \n int a = Integer.parseInt(str1); \n int b = Integer.parseInt(str2); \n System.out.println(a * b + \" \" + (a * 2 + b * 2)); " ) ; Scanner scan = new Scanner ( System . in ) ; String str1 = scan . next ( ) ; String str2 = scan . next ( ) ; int a = Integer . parseInt ( str1 ) ; int b = Integer . parseInt ( str2 ) ; System . out . println ( a * b + " " + ( a * 2 + b * 2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long val = log2 ( n ) ; long dd = ( long ) Math . pow ( 2 , val + 1 ) ; System . out . println ( ( long ) dd - 1 ) ; } public static int log2 ( long x ) { System . out . println ( " [LOG] Block: return (int) (Math.log(x) / Math.log(2)); " ) ; return ( int ) ( Math . log ( x ) / Math . log ( 2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N , k = 0 ; int [ ] A = new int [ 100 ] ; Scanner stdIn = new Scanner ( System . in ) ; N = stdIn . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = stdIn . nextInt ( ) ; } k = bubbleSort ( N , A ) ; trace ( N , A , k ) ; } public static void trace ( int N , int [ ] A , int k ) { for ( int i = 0 ; i < N ; i ++ ) { if ( i > 0 ) System . out . print ( " " ) ; System . out . print ( A [ i ] ) ; } System . out . println ( ) ; System . out . println ( k ) ; } public static int bubbleSort ( int N , int [ ] A ) { int k = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = N - 1 ; j > i ; j -- ) { if ( A [ j ] < A [ j - 1 ] ) { System . out . println ( " [LOG] Block: int tmp = A[j - 1]; \n A[j - 1] = A[j]; \n A[j] = tmp; \n k++; " ) ; int tmp = A [ j - 1 ] ; A [ j - 1 ] = A [ j ] ; A [ j ] = tmp ; k ++ ; } } } return k ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; if ( k >= s . length ) { for ( int i = 0 ; i < s . length ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(s[i]); " ) ; System . out . print ( s [ i ] ) ; } } else { for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(s[i]); " ) ; System . out . print ( s [ i ] ) ; } System . out . print ( " ... " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( ( sc . next ( ) ) ) ; long [ ] aArr = new long [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { aArr [ i ] = Long . parseLong ( sc . next ( ) ) ; } long [ ] bArr = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { bArr [ i ] = Long . parseLong ( sc . next ( ) ) ; } sc . close ( ) ; long ans = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: long beated = Math.min(aArr[i + 1], bArr[i]); \n ans += beated; \n aArr[i + 1] -= beated; \n bArr[i] -= beated; \n beated = Math.min(aArr[i], bArr[i]); \n ans += beated; \n aArr[i] -= beated; " ) ; 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 . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] length = new int [ n ] ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n Set<String> set = new HashSet<>(); \n set.add(scanner.next()); \n set.add(scanner.next()); \n set.add(scanner.next()); \n System.out.println(set.size() == 2 ? \" Yes \" : \" No \" ); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . next ( ) . split ( " " ) ; for ( int i = 0 ; i < s . length ; i ++ ) { System . out . println ( " [LOG] Block: if (s[i].equals( \" 1 \" )) \n s[i] = \" 9 \" ; \n else if (s[i].equals( \" 9 \" )) \n s[i] = \" 1 \" ; \n System.out.print(s[i]); " ) ; if ( s [ i ] . equals ( " 1 " ) ) s [ i ] = " 9 " ; else if ( s [ i ] . equals ( " 9 " ) ) s [ i ] = " 1 " ; System . out . print ( s [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String [ ] ar = a . split ( " " ) ; for ( String s : ar ) { if ( s . equals ( " 1 " ) ) { System . out . print ( 9 ) ; } else { System . out . println ( " [LOG] Block: System.out.print(1); " ) ; System . out . print ( 1 ) ; } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = " " ; try { x = in . readLine ( ) ; } catch ( NumberFormatException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } String [ ] ab = x . split ( " " ) ; int a = Integer . parseInt ( ab [ 0 ] ) ; int b = Integer . parseInt ( ab [ 1 ] ) ; if ( a < b ) System . out . println ( " a < b " ) ; if ( a > b ) System . out . println ( " a > b " ) ; if ( a == b ) System . out . println ( " a == 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 Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { String S = in . next ( ) ; int count = 0 ; for ( int i = 0 ; i < S . length ( ) / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) - 1 - i ) ) { count ++ ; } } out . println ( count ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: throw new RuntimeException(e); " ) ; throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: X -= A[i]; " ) ; X -= A [ i ] ; } System . out . println ( N + X / A [ 0 ] ) ; } } +import java . math . BigInteger ; import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int L = in.nextInt(); \n double side = (double) L / 3; \n System.out.println(side * side * side); " ) ; Scanner in = new Scanner ( System . in ) ; int L = in . nextInt ( ) ; double side = ( double ) L / 3 ; System . out . println ( side * side * side ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int res = 0 ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } list . sort ( Comparator . naturalOrder ( ) ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: res += list.get(i); " ) ; res += list . get ( i ) ; } System . out . println ( res ) ; sc . close ( ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n long a = stdIn.nextLong(); \n double b = stdIn.nextDouble(); \n BigDecimal bd1 = BigDecimal.valueOf(a); \n BigDecimal bd2 = BigDecimal.valueOf(b); \n BigDecimal ans = bd1.multiply(bd2).setScale(0, BigDecimal.ROUND_DOWN); \n System.out.println(ans); " ) ; Scanner stdIn = new Scanner ( System . in ) ; long a = stdIn . nextLong ( ) ; double b = stdIn . nextDouble ( ) ; BigDecimal bd1 = BigDecimal . valueOf ( a ) ; BigDecimal bd2 = BigDecimal . valueOf ( b ) ; BigDecimal ans = bd1 . multiply ( bd2 ) . setScale ( 0 , BigDecimal . ROUND_DOWN ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] ar = new int [ n ] ; int ans = 0 ; int pre = 0 ; int cur ; for ( int i = 0 ; i < n ; i ++ ) { int curr = scan . nextInt ( ) ; if ( pre > curr ) { System . out . println ( " [LOG] Block: ans += pre - curr; " ) ; ans += pre - curr ; } pre = curr ; } ans += pre ; System . out . println ( ans ) ; } } +import java . util . * ; class Main { 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 i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: arr[i] = Integer.parseInt(aaa[i]); " ) ; arr [ i ] = Integer . parseInt ( aaa [ i ] ) ; } Arrays . sort ( arr ) ; System . out . println ( arr [ 2 ] - arr [ 0 ] ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static boolean isPalindrome ( int n ) { String s = " " + n ; String a = " " ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { a += s . charAt ( i ) ; } 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 i = a ; i <= b ; i ++ ) { System . out . println ( " [LOG] Block: if (isPalindrome(i)) \n count++; " ) ; if ( isPalindrome ( i ) ) count ++ ; } System . out . println ( count ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int d = sc.nextInt(); \n int t = sc.nextInt(); \n int s = sc.nextInt(); \n int r = s * t - d; \n System.out.println(r >= 0 ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int r = s * t - d ; System . out . println ( r >= 0 ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int T = in . nextInt ( ) ; int A = in . nextInt ( ) ; int [ ] h = new int [ N ] ; double [ ] t = new double [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( min > t [ i ] ) { System . out . println ( " [LOG] Block: min = t[i]; \n minn = i; " ) ; min = t [ i ] ; minn = i ; } } System . out . println ( minn + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int 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 ( " [LOG] Block: System.out.println(o); " ) ; System . out . println ( o ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a , b , c ; String [ ] arange = null ; try { arange = in . readLine ( ) . split ( " " , 0 ) ; } catch ( Exception e ) { } a = Integer . parseInt ( arange [ 0 ] ) ; b = Integer . parseInt ( arange [ 1 ] ) ; c = Integer . parseInt ( arange [ 2 ] ) ; if ( a <= b && a <= c ) { if ( b < c ) System . out . println ( a + " " + b + " " + c ) ; else System . out . println ( a + " " + c + " " + b ) ; } else if ( b <= a && b <= c ) { if ( a < c ) System . out . println ( b + " " + a + " " + c ) ; else System . out . println ( b + " " + c + " " + a ) ; } else { System . out . println ( " [LOG] Block: if (a < b) \n System.out.println(c + \" \" + a + \" \" + b); \n else \n System.out.println(c + \" \" + b + \" \" + a); " ) ; if ( a < b ) System . out . println ( c + " " + a + " " + b ) ; else System . out . println ( c + " " + b + " " + a ) ; } } } +import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; while ( true ) { if ( BigInteger . valueOf ( x ) . isProbablePrime ( 100 ) ) { System . out . println ( " [LOG] Block: System.out.println(x); \n return; " ) ; System . out . println ( x ) ; return ; } x ++ ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.next(); \n StringBuilder sb = new StringBuilder(S); \n String ans = S.replace( \" eraser \" , \" \" ).replace( \" erase \" , \" \" ).replace( \" dreamer \" , \" \" ).replace( \" dream \" , \" \" ); \n System.out.println(ans.equals( \" \" ) ? \" YES \" : \" NO \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; StringBuilder sb = new StringBuilder ( S ) ; String ans = S . replace ( " eraser " , " " ) . replace ( " erase " , " " ) . replace ( " dreamer " , " " ) . replace ( " dream " , " " ) ; System . out . println ( ans . equals ( " " ) ? " YES " : " NO " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int [ ] q = new int [ n ] ; int replaceCnt = 0 ; String result = " YES " ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; q [ i ] = p [ i ] ; } Arrays . sort ( q ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] != q [ i ] ) { replaceCnt ++ ; if ( replaceCnt > 2 ) { System . out . println ( " [LOG] Block: result = \" NO \" ; \n break; " ) ; result = " NO " ; break ; } } } System . out . println ( result ) ; sc . close ( ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; long result = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: map.put(sch, 0); " ) ; map . put ( sch , 0 ) ; } } System . out . println ( result ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str = in . nextLine ( ) ; char c ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: c = str.charAt(i); \n if (Character.isUpperCase(c)) \n System.out.print(Character.toLowerCase(c)); \n else \n System.out.print(Character.toUpperCase(c)); " ) ; c = str . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) System . out . print ( Character . toLowerCase ( c ) ) ; else System . out . print ( Character . toUpperCase ( c ) ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String W = scan . next ( ) ; String end = " END_OF_TEXT " ; int tmp = 0 ; for ( ; ; ) { String T = scan . next ( ) ; if ( T . equals ( end ) ) { break ; } else if ( T . equalsIgnoreCase ( W ) ) { System . out . println ( " [LOG] Block: tmp++; " ) ; tmp ++ ; } } System . out . println ( tmp ) ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) { A [ sc . nextInt ( ) - 1 ] ++ ; } for ( int a : A ) { System . out . println ( " [LOG] Block: System.out.println(a); " ) ; System . out . println ( a ) ; } sc . close ( ) ; } } +import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] mochi = new Integer [ N ] ; int ans = 1 ; for ( int i = 0 ; i < N ; i ++ ) { mochi [ i ] = sc . nextInt ( ) ; } Arrays . sort ( mochi , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( i != N - 1 ) { if ( mochi [ i ] > mochi [ i + 1 ] ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; if ( s . compareTo ( " ABC " ) == 0 ) { System . out . println ( " ARC " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" ABC \" ); " ) ; System . out . println ( " ABC " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; int cnt = 0 ; if ( n >= 2 ) { cnt += n * ( n - 1 ) / 2 ; } if ( m >= 2 ) { System . out . println ( " [LOG] Block: cnt += m * (m - 1) / 2; " ) ; cnt += m * ( m - 1 ) / 2 ; } System . out . println ( cnt ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; Map < String , Long > counts = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; ++ 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 ( ) ) { System . out . println ( " [LOG] Block: pairs += (count * (count - 1L) / 2); " ) ; pairs += ( count * ( count - 1L ) / 2 ) ; } System . out . println ( pairs ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n double r = scanner.nextDouble(); \n System.out.println(String.format( \" %.5f \" , Math.pow(r, (double) 2) * Math.PI) + \" \" + String.format( \" %.5f \" , r * (double) 2 * Math.PI)); " ) ; Scanner scanner = new Scanner ( System . in ) ; double r = scanner . nextDouble ( ) ; System . out . println ( String . format ( " %.5f " , Math . pow ( r , ( double ) 2 ) * Math . PI ) + " " + String . format ( " %.5f " , r * ( double ) 2 * Math . PI ) ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); \n String str = buf.readLine(); \n String[] ra = str.split( \" \" ); \n int x = Integer.parseInt(ra[0]); \n int y = Integer.parseInt(ra[1]); \n int d, r; \n String f = String.format( \" %.5f \" , (double) x / (double) y); \n d = x / y; \n y = x % y; \n System.out.printf(d + \" \" + y + \" \" + f); " ) ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = buf . readLine ( ) ; String [ ] ra = str . split ( " " ) ; int x = Integer . parseInt ( ra [ 0 ] ) ; int y = Integer . parseInt ( ra [ 1 ] ) ; int d , r ; String f = String . format ( " %.5f " , ( double ) x / ( double ) y ) ; d = x / y ; y = x % y ; System . out . printf ( d + " " + y + " " + f ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; 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 < n ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; int i = 0 ; int X ; int hantei = 0 ; int ans = 0 ; while ( hantei == 0 ) { X = x + i ; for ( int j = 2 ; j <= X ; j ++ ) { if ( X % j == 0 ) { if ( j == X ) { hantei = 1 ; ans = X ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } i ++ ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] r = new int [ n ] ; int ans ; for ( int i = 0 ; i < n ; i ++ ) { r [ i ] = scan . nextInt ( ) ; } int maxv = r [ 1 ] - r [ 0 ] ; int minv = r [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: maxv = Math.max(maxv, r[i] - minv); \n minv = Math.min(minv, r[i]); " ) ; maxv = Math . max ( maxv , r [ i ] - minv ) ; minv = Math . min ( minv , r [ i ] ) ; } System . out . println ( maxv ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] sp ; int max = 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 { System . out . println ( " [LOG] Block: if (max < num) \n max = num; \n num = 0; " ) ; if ( max < num ) max = num ; num = 0 ; } } if ( max < num ) max = num ; System . out . println ( max ) ; } } +import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int result = 0 ; for ( int i = 1 ; i <= n ; i = i + 2 ) { int count = 0 ; for ( int j = 1 ; j <= i ; j ++ ) { if ( i % j == 0 ) { count ++ ; } if ( count == 8 ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int min = 10001 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(min); " ) ; System . out . println ( min ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] parts = br . readLine ( ) . split ( " " ) ; long N = 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 ++ ) { System . out . println ( " [LOG] Block: sum += H[i]; " ) ; sum += H [ i ] ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] argv ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; int h = 0 , m = 0 , s = 0 ; while ( true ) { if ( num - 3600 >= 0 ) { num = num - 3600 ; h ++ ; } else if ( num - 60 >= 0 ) { num = num - 60 ; m ++ ; } else { System . out . println ( " [LOG] Block: if (num == 0) \n break; \n s++; \n num--; " ) ; if ( num == 0 ) break ; s ++ ; num -- ; } } System . out . println ( h + " : " + m + " : " + s ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String s = scan.next(); \n int total = 0; \n total += s.charAt(0) == '1' ? 1 : 0; \n total += s.charAt(1) == '1' ? 1 : 0; \n total += s.charAt(2) == '1' ? 1 : 0; \n System.out.println(total); " ) ; Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int total = 0 ; total += s . charAt ( 0 ) == '1' ? 1 : 0 ; total += s . charAt ( 1 ) == '1' ? 1 : 0 ; total += s . charAt ( 2 ) == '1' ? 1 : 0 ; System . out . println ( total ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int size = scan . nextInt ( ) ; int [ ] arr = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) arr [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < size ; i ++ ) { System . out . println ( " [LOG] Block: int tmp = arr[i], j = i; \n for (; 0 < j && tmp <= arr[j - 1]; j--) arr[j] = arr[j - 1]; \n arr[j] = tmp; \n for (j = 0; j < size; j++) System.out.print((j == 0 ? \" \" : \" \" ) + arr[j]); \n System.out.println(); " ) ; 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 < size ; j ++ ) System . out . print ( ( j == 0 ? " " : " " ) + arr [ j ] ) ; System . out . println ( ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BPapersPlease solver = new BPapersPlease ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BPapersPlease { public void solve ( int testNumber , Scanner in , PrintWriter out ) { boolean f = 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 ) { System . out . println ( " [LOG] Block: f = f && (a[i] % 3 == 0 || a[i] % 5 == 0); " ) ; f = f && ( a [ i ] % 3 == 0 || a [ i ] % 5 == 0 ) ; } } out . println ( f ? " APPROVED " : " DENIED " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line1 = sc . nextLine ( ) ; int n = Integer . parseInt ( line1 ) ; String line2 = sc . nextLine ( ) ; String [ ] kari = line2 . split ( " " ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = Integer . parseInt ( kari [ i ] ) ; } System . out . println ( line2 ) ; int v = 0 ; int j = 0 ; for ( int i = 1 ; i < n ; 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 < n - 1 ; k ++ ) { System . out . println ( " [LOG] Block: System.out.print(A[k]); \n System.out.print( \" \" ); " ) ; System . out . print ( A [ k ] ) ; System . out . print ( " " ) ; } System . out . println ( A [ n - 1 ] ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] param = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { param [ i ] = sc . nextInt ( ) ; } Arrays . sort ( param ) ; int alice = 0 ; int bob = 0 ; if ( n % 2 == 0 ) { for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { System . out . println ( " [LOG] Block: bob += param[i]; " ) ; bob += param [ i ] ; } else { alice += param [ i ] ; } } } else { for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { alice += param [ i ] ; } else { System . out . println ( " [LOG] Block: bob += param[i]; " ) ; bob += param [ i ] ; } } } int total = alice - bob ; System . out . println ( total ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int n = scan.nextInt(); \n switch(n % 10) { \n case 2: \n System.out.println( \" hon \" ); \n break; \n case 4: \n System.out.println( \" hon \" ); \n break; \n case 5: \n System.out.println( \" hon \" ); \n break; \n case 7: \n System.out.println( \" hon \" ); \n break; \n case 9: \n System.out.println( \" hon \" ); \n break; \n case 0: \n System.out.println( \" pon \" ); \n break; \n case 1: \n System.out.println( \" pon \" ); \n break; \n case 6: \n System.out.println( \" pon \" ); \n break; \n case 8: \n System.out.println( \" pon \" ); \n break; \n case 3: \n System.out.println( \" bon \" ); \n break; \n default: \n break; \n } " ) ; Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; switch ( n % 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 . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; Iroha solver = new Iroha ( ) ; System . out . println ( solver . anotherSolve ( input ) ) ; } static class Iroha { public String anotherSolve ( String input ) { List < Integer > inputList = new ArrayList < Integer > ( ) ; int five = 0 ; int seven = 0 ; for ( String s : input . split ( " " ) ) { if ( Integer . parseInt ( s ) == 5 ) { five ++ ; } else if ( Integer . parseInt ( s ) == 7 ) { seven ++ ; } } if ( five == 2 && seven == 1 ) { return " YES " ; } else { System . out . println ( " [LOG] Block: return \" NO \" ; " ) ; return " NO " ; } } } } +import java . util . Scanner ; public class Main { static long max = 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n if (a > 0 && a <= 9 && b > 0 && b <= 9) \n System.out.println(a * b); \n else \n System.out.println( \" -1 \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a > 0 && a <= 9 && b > 0 && b <= 9 ) System . out . println ( a * b ) ; else System . out . println ( " -1 " ) ; } } +import java . util . * ; class Main { 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 set = sc . nextInt ( ) ; int [ ] triangle = new int [ 3 ] ; for ( int cnt = 0 ; cnt < set ; 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 ++ ) { System . out . println ( " [LOG] Block: min = i; \n for (int j = i + 1; j < data.length; j++) if (data[min] > data[j]) \n min = j; \n tmp = data[i]; \n data[i] = data[min]; \n data[min] = tmp; " ) ; 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 . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . nextLine ( ) ) ; String line = scanner . nextLine ( ) ; String [ ] split = line . split ( " " ) ; List < Integer > intList = new ArrayList < Integer > ( ) ; for ( String s : split ) { intList . add ( Integer . parseInt ( s ) ) ; } int cnt = 1 ; int min = intList . get ( 0 ) ; for ( int i = 1 ; i < intList . size ( ) ; i ++ ) { int target = intList . get ( i ) ; if ( target <= min ) { System . out . println ( " [LOG] Block: cnt++; \n min = target; " ) ; cnt ++ ; min = target ; } } int result = cnt ; System . out . println ( result ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { for ( int j = i ; j < t . length ( ) ; j ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) == t.charAt(j)) \n c++; \n break; " ) ; if ( s . charAt ( i ) == t . charAt ( j ) ) c ++ ; break ; } } System . out . print ( c ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n int t = scan.nextInt(); \n System.out.println(b * (t / a)); \n scan.close(); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int t = scan . nextInt ( ) ; System . out . println ( b * ( t / a ) ) ; scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int p ; String S ; int [ ] AC = new int [ N ] ; int [ ] WA = new int [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: clear = clear + AC[i]; " ) ; clear = clear + AC [ i ] ; } System . out . print ( clear + " " + penalty ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int x = sc.nextInt(); \n int larger = x / 500; \n int smaller = x - larger * 500; \n int yens = smaller / 5; \n System.out.println((larger * 1000) + (yens * 5)); " ) ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int larger = x / 500 ; int smaller = x - larger * 500 ; int yens = smaller / 5 ; System . out . println ( ( larger * 1000 ) + ( yens * 5 ) ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( buf . readLine ( ) ) ; String [ ] str ; int tarou = 0 ; int hanako = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: tarou++; \n hanako++; " ) ; tarou ++ ; hanako ++ ; } } System . out . println ( tarou + " " + hanako ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long A = sc.nextLong(); \n long B = sc.nextLong(); \n long K = sc.nextLong(); \n long result1 = Math.max(0, A - K); \n long result2 = Math.max(0, Math.min(A + B - K, B)); \n System.out.println(result1 + \" \" + result2); " ) ; Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; long result1 = Math . max ( 0 , A - K ) ; long result2 = Math . max ( 0 , Math . min ( A + B - K , B ) ) ; System . out . println ( result1 + " " + result2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; long sum = 0 ; for ( int a = 1 ; a <= k ; a ++ ) { for ( int b = 1 ; b <= k ; b ++ ) { int sur_1 = gcd ( a , b ) ; for ( int c = 1 ; c <= k ; 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 ) { System . out . println ( " [LOG] Block: return small; " ) ; return small ; } surplus = gcd ( small , surplus ) ; return surplus ; } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; sc . close ( ) ; R = Math . min ( L + 2019 , R ) ; int ans = Integer . MAX_VALUE ; for ( int x = L ; 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 ) { System . out . println ( " [LOG] Block: new Main()._main(args); " ) ; new Main ( ) . _main ( args ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal a = sc.nextBigDecimal(); \n BigDecimal b = sc.nextBigDecimal(); \n BigDecimal c = b.multiply(a); \n long d = c.longValue(); \n System.out.println(d); " ) ; Scanner sc = new Scanner ( System . in ) ; BigDecimal a = sc . nextBigDecimal ( ) ; BigDecimal b = sc . nextBigDecimal ( ) ; BigDecimal c = b . multiply ( a ) ; long d = c . longValue ( ) ; System . out . println ( d ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; for ( int i = 1 ; i <= K ; i ++ ) { if ( K - A == 0 ) { System . out . println ( A * 1 ) ; return ; } if ( K - A < 0 ) { System . out . println ( K * 1 ) ; return ; } if ( ( K - A ) - B <= 0 ) { System . out . println ( A * 1 + B * 0 ) ; return ; } if ( ( K - A ) - B > 0 ) { System . out . println ( " [LOG] Block: System.out.println(A * 1 + B * 0 + (((K - A) - B) * (-1))); \n return; " ) ; System . out . println ( A * 1 + B * 0 + ( ( ( K - A ) - B ) * ( - 1 ) ) ) ; return ; } } } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int s = 0 ; String n = sc . next ( ) ; for ( char ch : n . toCharArray ( ) ) { s += ch - '0' ; s %= 9 ; } if ( s == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; List < Integer > numList = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: numList.remove(i.intValue()); " ) ; numList . remove ( i . intValue ( ) ) ; } System . out . println ( numList . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long N = scanner . nextLong ( ) ; scanner . nextLine ( ) ; String S = scanner . nextLine ( ) ; long ans = 0 ; char prev = ',' ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: char cur = S.charAt(i); \n if (prev != cur) \n ans++; \n prev = cur; " ) ; char cur = S . charAt ( i ) ; if ( prev != cur ) ans ++ ; prev = cur ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int numA = scanner . nextInt ( ) ; int numB = scanner . nextInt ( ) ; int numC = scanner . nextInt ( ) ; int ans = 0 ; for ( int val = numA ; val <= numB ; val ++ ) { System . out . println ( " [LOG] Block: if (numC % val == 0) \n ans++; " ) ; if ( numC % val == 0 ) ans ++ ; } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] D = new int [ K ] ; int [ ] A = new int [ N + 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 ) { System . out . println ( " [LOG] Block: A[sunuke]++; \n count++; " ) ; A [ sunuke ] ++ ; count ++ ; } } } sc . close ( ) ; System . out . println ( N - count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int i = 0 ; int taro_count = 0 ; int hana_count = 0 ; for ( i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: taro_count += 3; " ) ; taro_count += 3 ; } } System . out . println ( taro_count + " " + hana_count ) ; } } +import java . util . Scanner ; public class Main { public static int gcd ( int a , int b , int c ) { int smallest = Math . min ( a , Math . min ( b , c ) ) ; for ( int i = smallest ; 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 ++ ) { System . out . println ( " [LOG] Block: total += gcd(i, j, k); " ) ; total += gcd ( i , j , k ) ; } } } System . out . println ( total ) ; } } +import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; long out = a ; long a1 = a ; long b1 = b ; while ( ! ( out % a == 0 && out % b == 0 ) ) { out = a1 > b1 ? a1 : b1 ; if ( a1 < out ) { a1 += a ; } if ( b1 < out ) { System . out . println ( " [LOG] Block: b1 += b; " ) ; b1 += b ; } } System . out . println ( out ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; while ( 0 < c && 0 < a ) { c -= b ; if ( c <= 0 ) { break ; } a -= d ; } if ( 0 < a ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { static int modAns = ( 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 ) { System . out . println ( " [LOG] Block: return n % 2 == 0 ? n / 2 : n * 3 + 1; " ) ; return n % 2 == 0 ? n / 2 : n * 3 + 1 ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int [ ] x ; Main ( Scanner sc ) { this . sc = sc ; this . x = new int [ 5 ] ; } private int solve ( ) { int answer = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; if ( x [ i ] == 0 ) { answer = i + 1 ; } } return answer ; } public void show ( int answer ) { System . out . println ( " [LOG] Block: System.out.println(answer); " ) ; System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final int MOD = 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 ] ) % MOD ; if ( i + 2 < a . length && a [ i + 2 ] != - 1 ) { System . out . println ( " [LOG] Block: a[i + 2] = (a[i] + a[i + 2]) % MOD; " ) ; a [ i + 2 ] = ( a [ i ] + a [ i + 2 ] ) % MOD ; } } System . out . println ( a [ N ] % MOD ) ; } } +import java . lang . Math ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; double interest = 100 ; int year = 0 ; while ( interest < n ) { year += 1 ; interest *= 1.01 ; interest = Math . floor ( interest ) ; if ( interest >= n ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( year ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: list.add(sc.nextInt()); " ) ; list . add ( sc . nextInt ( ) ) ; } List < Integer > listB = new ArrayList < Integer > ( new HashSet < > ( list ) ) ; System . out . print ( listB . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sp = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int [ ] point = new int [ n ] ; 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String S = sc . nextLine ( ) ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( Character . isUpperCase ( S . charAt ( i ) ) ) { System . out . print ( Character . toLowerCase ( S . charAt ( i ) ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(Character.toUpperCase(S.charAt(i))); " ) ; System . out . print ( Character . toUpperCase ( S . charAt ( i ) ) ) ; } } System . out . println ( " " ) ; } } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; int counter = 0 ; int [ ] [ ] result = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { result [ i ] [ 0 ] = sc . nextInt ( ) ; result [ i ] [ 1 ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(( \" No \" )); " ) ; System . out . println ( ( " No " ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) h [ i ] = sc . nextInt ( ) ; int [ ] dp = new int [ n + 1 ] ; dp [ 1 ] = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { dp [ i ] = 1000000000 ; for ( int j = i - 1 ; j >= 1 && ( i - j ) <= k ; j -- ) { System . out . println ( " [LOG] Block: dp[i] = Math.min(dp[i], dp[j] + Math.abs(h[i] - h[j])); " ) ; dp [ i ] = Math . min ( dp [ i ] , dp [ j ] + Math . abs ( h [ i ] - h [ j ] ) ) ; } } System . out . println ( dp [ n ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a , b , c ; while ( true ) { a = input . nextInt ( ) ; b = input . nextInt ( ) ; c = input . nextInt ( ) ; if ( a == - 1 && b == - 1 && c == - 1 ) break ; else { if ( a == - 1 || b == - 1 ) System . out . println ( " F " ) ; else if ( a + b < 30 ) System . out . println ( " F " ) ; else if ( a + b < 50 ) { if ( c == - 1 ) { System . out . println ( " D " ) ; } else { System . out . println ( " [LOG] Block: if (c >= 50) \n System.out.println( \" C \" ); \n else \n System.out.println( \" D \" ); " ) ; if ( c >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; } } else if ( a + b < 65 ) System . out . println ( " C " ) ; else if ( a + b < 80 ) System . out . println ( " B " ) ; else if ( a + b >= 80 ) System . out . println ( " A " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String input = sc.nextLine(); \n String[] nums = input.split( \" \" ); \n int N = Integer.parseInt(nums[0]); \n int A = Integer.parseInt(nums[1]); \n int B = Integer.parseInt(nums[2]); \n System.out.println(N * A < B ? N * A : B); " ) ; Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; String [ ] nums = input . split ( " " ) ; int N = Integer . parseInt ( nums [ 0 ] ) ; int A = Integer . parseInt ( nums [ 1 ] ) ; int B = Integer . parseInt ( nums [ 2 ] ) ; System . out . println ( N * A < B ? N * A : B ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String str = sc.nextLine(); \n String s1 = str.substring(0); \n char c1 = str.charAt(0); \n char c2 = str.charAt(1); \n char c3 = str.charAt(2); \n if (c1 == c2 && c2 == c3) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; String s1 = str . substring ( 0 ) ; char c1 = str . charAt ( 0 ) ; char c2 = str . charAt ( 1 ) ; char c3 = str . charAt ( 2 ) ; if ( c1 == c2 && c2 == c3 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int X = keyboard . nextInt ( ) ; int Y = keyboard . nextInt ( ) ; int turu = 2 ; int kame = 4 ; String ans = " No " ; for ( int i = 0 ; i < X + 1 ; i ++ ) { if ( i * turu + ( X - i ) * kame == Y ) { System . out . println ( " [LOG] Block: ans = \" Yes \" ; " ) ; ans = " Yes " ; } } System . out . println ( ans ) ; keyboard . close ( ) ; } } +import java . util . * ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: BigDecimal A, B; \n Scanner sc = new Scanner(System.in); \n A = sc.nextBigDecimal(); \n B = new BigDecimal(2).multiply(A).multiply(new BigDecimal(3.14159265359)); \n System.out.println(B); " ) ; 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 . Scanner ; public class Main { 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 ( ) ; } 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: a[i] /= 2; " ) ; a [ i ] /= 2 ; } count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String s = sc . next ( ) ; int [ ] pos = new int [ n ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'C' ) { pos [ i ] = 1 ; } } int [ ] num = new int [ n ] ; num [ 0 ] = pos [ 0 ] ; for ( int i = 1 ; i < n - 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 { System . out . println ( " [LOG] Block: min = num[l - 1 - 1]; " ) ; min = num [ l - 1 - 1 ] ; } int ans = max - min ; System . out . println ( ans ) ; } sc . close ( ) ; } } +import java . util . * ; class Main { 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 ( ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( nums [ i - 1 ] < nums [ i ] ) nums [ i ] -- ; else if ( nums [ i - 1 ] > nums [ i ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { boolean ans = 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] d = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; int count = 0 ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (d[i] == d[i - 1]) \n count++; " ) ; if ( d [ i ] == d [ i - 1 ] ) count ++ ; } System . out . println ( n - count ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; double result = 100000 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: result *= 1.05; \n result = Math.ceil(result / 1000) * 1000; " ) ; result *= 1.05 ; result = Math . ceil ( result / 1000 ) * 1000 ; } System . out . println ( ( int ) result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 0 && y == 0 ) { break ; } else if ( x < y ) { System . out . print ( x + " " ) ; System . out . println ( y ) ; } else { System . out . println ( " [LOG] Block: System.out.print(y + \" \" ); \n System.out.println(x); " ) ; System . out . print ( y + " " ) ; System . out . println ( x ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n String s = sc.next(); \n Boolean ans = true; \n String[] strings = s.split( \" - \" ); \n if (strings.length != 2) \n ans = false; \n else if (strings[0].length() != a) \n ans = false; \n else if (strings[1].length() != b) \n ans = false; \n if (ans) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); \n sc.close(); \n return; " ) ; Scanner sc = new Scanner ( System . in ) ; int a = 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 ( ) != a ) 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] v = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { v [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( " [LOG] Block: int c = sc.nextInt(); \n sum = (v[i] > c) ? sum + v[i] - c : sum; " ) ; int c = sc . nextInt ( ) ; sum = ( v [ i ] > c ) ? sum + v [ i ] - c : sum ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( sc . hasNext ( ) ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( digit ( a , b ) ) ; } } private static int digit ( int a , int b ) { System . out . println ( " [LOG] Block: int dg = Integer.toString(a + b).length(); \n return dg; " ) ; int dg = Integer . toString ( a + b ) . length ( ) ; return dg ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int migi = S % 100 ; int hidari = ( S - 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 ( " [LOG] Block: System.out.println( \" YYMM \" ); " ) ; System . out . println ( " YYMM " ) ; } } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int result = 0; \n result += n / 100; \n result = result * 111; \n System.out.println(n <= result ? result : result == 999 ? result + 112 : result + 111); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int result = 0 ; result += n / 100 ; result = result * 111 ; System . out . println ( n <= result ? result : result == 999 ? result + 112 : result + 111 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int ans = 0 ; String [ ] s = sc . next ( ) . split ( " " ) ; for ( String i : s ) { if ( i . equals ( " + " ) ) { ans ++ ; } else { System . out . println ( " [LOG] Block: ans--; " ) ; ans -- ; } } System . out . println ( ans ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int 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 ++ ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String W = scn . nextLine ( ) ; int count = 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] queue = new int [ n ] [ m ] ; int [ ] vector = new int [ m ] ; int [ ] vectorAns = new int [ n ] ; 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 ( " [LOG] Block: System.out.println(data); " ) ; System . out . println ( data ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " No " ; int c = 0 ; int d = 0 ; while ( 4 * c + 7 * d <= n ) { while ( 4 * c + 7 * d <= n ) { if ( 4 * c + 7 * d == n ) { System . out . println ( " [LOG] Block: ans = \" Yes \" ; \n break; " ) ; ans = " Yes " ; break ; } else d ++ ; } c ++ ; d = 0 ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long A = scan . nextInt ( ) ; long B = scan . nextInt ( ) ; long gcd = GCD ( A , B ) ; long lcm = LCM ( A , 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 ) { System . out . println ( " [LOG] Block: return a * b / gcd; " ) ; return a * b / gcd ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double N = sc.nextDouble(); \n System.out.println((int) Math.ceil(N / 2)); " ) ; Scanner sc = new Scanner ( System . in ) ; double N = sc . nextDouble ( ) ; System . out . println ( ( int ) Math . ceil ( N / 2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int 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 ( N - sum >= 0 ) { System . out . print ( ( N - sum ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(-1); " ) ; System . out . print ( - 1 ) ; } } } +import java . util . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long L = sc . nextLong ( ) ; long R = sc . nextLong ( ) ; long ans = Long . MAX_VALUE ; loop : for ( long i = L ; i <= R ; i ++ ) { for ( long j = i + 1 ; j <= R ; j ++ ) { ans = Math . min ( ans , ( i * j ) % 2019 ) ; if ( ans == 0 ) { System . out . println ( " [LOG] Block: break loop; " ) ; break loop ; } } } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strArray = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( strArray [ 0 ] ) ; int b = Integer . parseInt ( strArray [ 1 ] ) ; System . out . println ( getGCD ( a , b ) ) ; } public static int getGCD ( int a , int b ) { if ( a == b ) return a ; else if ( a < b ) { System . out . println ( " [LOG] Block: return getGCD(a, b - a); " ) ; return getGCD ( a , b - a ) ; } else return getGCD ( a - b , a ) ; } } +import java . util . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = Integer . parseInt ( sc . next ( ) ) ; final int K = Integer . parseInt ( sc . next ( ) ) ; int result = 0 ; int [ ] pricelist = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { pricelist [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( pricelist ) ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: result = result + pricelist[i]; " ) ; result = result + pricelist [ i ] ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { 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 n = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(suits[i] + \" \" + ranks[j]); " ) ; System . out . println ( suits [ i ] + " " + ranks [ j ] ) ; } } } scan . close ( ) ; } } +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 Main { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ans = new int [ n ] ; 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 < n ; i ++ ) { out . println ( ans [ i ] ) ; } out . flush ( ) ; } static class Pair { int a , b ; public Pair ( int a , int b ) { System . out . println ( " [LOG] Block: this.a = a; \n this.b = b; " ) ; this . a = a ; this . b = b ; } } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long N = Long . parseLong ( reader . readLine ( ) ) ; System . out . println ( calc ( 1 , N ) - calc ( 3 , N ) - calc ( 5 , N ) + calc ( 15 , N ) ) ; return ; } static long calc ( long n , long N ) { System . out . println ( " [LOG] Block: return (n + N / n * n) * (N / n) / 2; " ) ; return ( n + N / n * n ) * ( N / n ) / 2 ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int sum = 0 ; if ( d <= a ) { System . out . println ( d ) ; return ; } sum = a ; d -= a ; if ( d <= b ) { System . out . println ( " [LOG] Block: System.out.println(sum); \n return; " ) ; System . out . println ( sum ) ; return ; } d -= b ; sum -= d ; System . out . println ( sum ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String ans = " " ; for ( int i = 0 ; i < line . length ( ) ; i ++ ) { String str = line . substring ( i , i + 1 ) ; if ( str . equals ( str . toUpperCase ( ) ) ) { ans += str . toLowerCase ( ) ; } else { System . out . println ( " [LOG] Block: ans += str.toUpperCase(); " ) ; ans += str . toUpperCase ( ) ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ary = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ary [ i ] = sc . nextInt ( ) ; sum += ary [ i ] ; } sc . close ( ) ; int m2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ary [ i ] * ( 4 * m ) >= sum ) { System . out . println ( " [LOG] Block: m2++; " ) ; m2 ++ ; } } System . out . println ( m2 >= m ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int [ ] hairetu = new int [ b ] ; for ( int i = 0 ; i < hairetu . length ; i ++ ) { int c = sc . nextInt ( ) ; hairetu [ i ] = c ; } int count = 0 ; int champ = hairetu [ 0 ] ; for ( int k = 0 ; k < hairetu . length ; k ++ ) { if ( champ >= hairetu [ k ] ) { System . out . println ( " [LOG] Block: champ = hairetu[k]; \n count++; " ) ; champ = hairetu [ k ] ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int day = 0 ; for ( int i = 0 ; i < M ; i ++ ) { day += scan . nextInt ( ) ; } if ( day > N ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(N - day); " ) ; System . out . println ( N - day ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; if ( s . equals ( t . substring ( 0 , s . length ( ) ) ) && ( t . length ( ) - s . length ( ) == 1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] ar = scanner . nextLine ( ) . split ( " " ) ; for ( int i = 0 ; i < ar . length ; i ++ ) { if ( Integer . parseInt ( ar [ i ] ) == 0 ) { System . out . println ( " [LOG] Block: System.out.println(i + 1); " ) ; System . out . println ( i + 1 ) ; } } } } +import java . util . Scanner ; public class Main { static int N ; static int [ ] a ; private static void init ( ) { Scanner scanner = new Scanner ( System . in ) ; N = scanner . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) a [ i ] = scanner . nextInt ( ) ; scanner . close ( ) ; } private static boolean check ( ) { boolean ok = true ; for ( int i = 0 ; i < N ; 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 < N ; j ++ ) { a [ j ] = a [ j ] / 2 ; } } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; boolean b = false ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = i ; j < 10 ; j ++ ) { if ( i * j == a ) { b = true ; } } } if ( b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { boolean sw = 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 ( sw == 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 ) { System . out . println ( " [LOG] Block: answer = a.size(); \n sw = true; " ) ; answer = a . size ( ) ; sw = true ; } } } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public long getTotalHeightOfStools ( int n , int [ ] arr ) { long total = 0 ; int prevHeight = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( prevHeight > arr [ i ] ) { total += prevHeight - arr [ i ] ; arr [ i ] = prevHeight ; } prevHeight = arr [ i ] ; } return total ; } 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 ++ ) { System . out . println ( " [LOG] Block: arr[i] = scanner.nextInt(); " ) ; arr [ i ] = scanner . nextInt ( ) ; } long answer = solution . getTotalHeightOfStools ( n , arr ) ; System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] list = { sc . next ( ) , sc . next ( ) , sc . next ( ) } ; int five_count = 0 ; int seven_count = 0 ; for ( String l : list ) { System . out . println ( " [LOG] Block: if (l.equals( \" 5 \" )) \n five_count++; \n else if (l.equals( \" 7 \" )) \n seven_count++; " ) ; if ( l . equals ( " 5 " ) ) five_count ++ ; else if ( l . equals ( " 7 " ) ) seven_count ++ ; } if ( five_count == 2 && seven_count == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int z = 0 ; if ( n % 2 == 0 ) { z = n / 2 ; } else { System . out . println ( " [LOG] Block: z = n / 2 + 1; " ) ; z = n / 2 + 1 ; } System . out . print ( z ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i <= N ; i ++ ) { for ( int m = 0 ; m <= N - i ; m ++ ) { int n = N - i - m ; if ( i * 10000 + m * 5000 + n * 1000 == Y ) { System . out . println ( " [LOG] Block: System.out.println(i + \" \" + m + \" \" + n); \n return; " ) ; System . out . println ( i + " " + m + " " + n ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sumA = 0 ; int sumB = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = n - 1 ; i >= 0 ; i -= 2 ) { sumA += a [ i ] ; } for ( int i = n - 2 ; i >= 0 ; i -= 2 ) { System . out . println ( " [LOG] Block: sumB += a[i]; " ) ; sumB += a [ i ] ; } System . out . println ( sumA - sumB ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n float d = in.nextFloat(), t = in.nextFloat(), s = in.nextFloat(); \n if ((d / s) <= t) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner in = new Scanner ( System . in ) ; float d = in . nextFloat ( ) , t = in . nextFloat ( ) , s = in . nextFloat ( ) ; if ( ( d / s ) <= t ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; list . add ( A [ i ] ) ; } Collections . sort ( list ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] == list . get ( N - 1 ) ) { System . out . println ( list . get ( N - 2 ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(list.get(N - 1)); " ) ; System . out . println ( list . get ( N - 1 ) ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int x = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i <= a ; 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 ) { System . out . println ( " [LOG] Block: count++; \n break; " ) ; count ++ ; break ; } } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; String N = scanner . next ( ) ; if ( N . length ( ) <= K ) { System . out . println ( N ) ; } else { System . out . println ( " [LOG] Block: System.out.println(N.substring(0, K) + \" ... \" ); " ) ; System . out . println ( N . substring ( 0 , K ) + " ... " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String U = sc . next ( ) ; if ( U . equals ( S ) ) { System . out . printf ( " %d %d " , A - 1 , B ) ; } else { System . out . println ( " [LOG] Block: System.out.printf( \" %d %d \" , A, B - 1); " ) ; System . out . printf ( " %d %d " , A , B - 1 ) ; } } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= 3 ; i ++ ) { System . out . println ( " [LOG] Block: int b = (int) Math.pow(x, i); \n sum = sum + b; " ) ; int b = ( int ) Math . pow ( x , i ) ; sum = sum + b ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) { break ; } for ( int x = 0 ; x < H ; x ++ ) { for ( int y = 0 ; y < W ; y ++ ) { if ( x == 0 || y == 0 || x == H - 1 || y == W - 1 ) { System . out . print ( " # " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" . \" ); " ) ; System . out . print ( " . " ) ; } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n char ch = scan.next().charAt(0); \n System.out.println(++ch); " ) ; Scanner scan = new Scanner ( System . in ) ; char ch = scan . next ( ) . charAt ( 0 ) ; System . out . println ( ++ ch ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str1 = sc . nextLine ( ) ; String str2 = sc . nextLine ( ) ; boolean flag = false ; for ( int i = 0 ; i < str1 . length ( ) ; ++ i ) { System . out . println ( " [LOG] Block: String sufStr = str1.substring(str1.length() - i, str1.length()); \n String preStr = str1.substring(0, str1.length() - i); \n String compareStr = sufStr + preStr; \n if (compareStr.equals(str2)) \n flag = true; " ) ; 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 ) ) flag = true ; } if ( flag ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: String s1 = String.valueOf(s.charAt(i)); \n String s2 = String.valueOf(t.charAt(i)); \n ans += s1; \n ans += s2; " ) ; 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 . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] S = new int [ n ] ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: C++; " ) ; C ++ ; } } System . out . println ( C ) ; } } } +import java . io . * ; import java . util . * ; public class Main { 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 i = 0 ; i < strings . length ; i ++ ) { if ( str . equals ( strings [ i ] ) ) { return 7 - i ; } } return - 1 ; } private static BufferedReader createBufferedReader ( ) { System . out . println ( " [LOG] Block: InputStreamReader isr = new InputStreamReader(System.in); \n return new BufferedReader(isr); " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; return new BufferedReader ( isr ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; sc . close ( ) ; String [ ] S = s . split ( " " ) ; int a = Integer . parseInt ( S [ 0 ] ) ; int b = Integer . parseInt ( S [ 1 ] ) ; int count = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( a > b ) { count += a ; a -- ; } else { System . out . println ( " [LOG] Block: count += b; \n b--; " ) ; count += b ; b -- ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int x = cin . nextInt ( ) ; int res = sol ( x ) ; System . out . println ( res ) ; } private static int sol ( int x ) { System . out . println ( " [LOG] Block: return (x * x * x); " ) ; return ( x * x * x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int numa = 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 ( numa > 0 ) { numa = numa - numd ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n break; " ) ; System . out . println ( " No " ) ; break ; } } } scan . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int[] n; \n n = new int[3]; \n int min, mid, max; \n Scanner scan = new Scanner(System.in); \n n[0] = scan.nextInt(); \n n[1] = scan.nextInt(); \n n[2] = scan.nextInt(); \n mid = n[0] + n[1] + n[2]; \n min = (n[1] < n[2]) ? n[1] : n[2]; \n min = (n[0] < min) ? n[0] : min; \n max = (n[1] < n[2]) ? n[2] : n[1]; \n max = (n[0] < max) ? max : n[0]; \n mid = mid - (min + max); \n System.out.println(min + \" \" + mid + \" \" + max); \n scan.close(); " ) ; int [ ] n ; n = new int [ 3 ] ; int min , 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 ] ; min = ( n [ 1 ] < n [ 2 ] ) ? n [ 1 ] : n [ 2 ] ; min = ( n [ 0 ] < min ) ? n [ 0 ] : min ; max = ( n [ 1 ] < n [ 2 ] ) ? n [ 2 ] : n [ 1 ] ; max = ( n [ 0 ] < max ) ? max : n [ 0 ] ; mid = mid - ( min + max ) ; System . out . println ( min + " " + mid + " " + max ) ; scan . close ( ) ; } } +import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; long [ ] arr = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = sc . nextLong ( ) ; } Arrays . sort ( arr ) ; long total = 0 ; for ( int j = 0 ; j < N - K ; j ++ ) { System . out . println ( " [LOG] Block: total += arr[j]; " ) ; total += arr [ j ] ; } System . out . println ( total ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long W = sc . nextLong ( ) ; long H = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; double ans = ( W * H ) / 2.0 ; int can = 0 ; if ( x * 2 == W && y * 2 == H ) { System . out . println ( " [LOG] Block: can = 1; " ) ; can = 1 ; } System . out . println ( ans + " " + can ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; int i = 0 ; for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = j + 1 ; k < S . length ( ) ; k ++ ) { if ( S . charAt ( j ) == S . charAt ( k ) ) { i ++ ; } } } if ( i == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int A1 = scanner.nextInt(); \n int A2 = scanner.nextInt(); \n int A3 = scanner.nextInt(); \n scanner.close(); \n int[] A = { A1, A2, A3 } ; \n Arrays.sort(A); \n System.out.println(A[2] - A[0]); " ) ; Scanner scanner = new Scanner ( System . in ) ; int A1 = scanner . nextInt ( ) ; int A2 = scanner . nextInt ( ) ; int A3 = scanner . nextInt ( ) ; scanner . close ( ) ; int [ ] A = { A1 , A2 , A3 } ; Arrays . sort ( A ) ; System . out . println ( A [ 2 ] - A [ 0 ] ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { System . out . println ( " [LOG] Block: String[] str2 = str.split( \" \" ); \n int a = Integer.parseInt(str2[0]); \n int b = Integer.parseInt(str2[1]); \n int digits = Integer.toString(a + b).length(); \n System.out.println(digits); " ) ; String [ ] str2 = str . split ( " " ) ; int a = Integer . parseInt ( str2 [ 0 ] ) ; int b = Integer . parseInt ( str2 [ 1 ] ) ; int digits = Integer . toString ( a + b ) . length ( ) ; System . out . println ( digits ) ; } } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String a = sc.next(); \n if (a.equals( \" Sunny \" )) \n System.out.println( \" Cloudy \" ); \n else if (a.equals( \" Cloudy \" )) \n System.out.println( \" Rainy \" ); \n else if (a.equals( \" Rainy \" )) \n System.out.println( \" Sunny \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; if ( a . equals ( " Sunny " ) ) System . out . println ( " Cloudy " ) ; else if ( a . equals ( " Cloudy " ) ) System . out . println ( " Rainy " ) ; else if ( a . equals ( " Rainy " ) ) System . out . println ( " Sunny " ) ; } } +import java . util . * ; import java . io . * ; public class Main { static StringTokenizer st ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) throws IOException { int input = nextInt ( ) ; HashSet < String > kinds = new HashSet < > ( ) ; for ( int x = 0 ; x < input ; 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 { System . out . println ( " [LOG] Block: while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine().trim()); \n return st.nextToken(); " ) ; while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] a = new int [ 2 ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ 0 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { a [ 1 ] [ i ] = sc . nextInt ( ) ; } int max = 0 ; int first = 0 ; for ( int i = 0 ; i < n ; i ++ ) { first += a [ 0 ] [ i ] ; int second = 0 ; for ( int j = i ; j < n ; j ++ ) { System . out . println ( " [LOG] Block: second += a[1][j]; " ) ; second += a [ 1 ] [ j ] ; } max = Math . max ( max , first + second ) ; } System . out . println ( max ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = 0 ; int i = 1 ; while ( i <= b ) { if ( ( long ) a * i % b == 0 ) { c = ( long ) a * i ; break ; } else { System . out . println ( " [LOG] Block: i++; " ) ; i ++ ; } } System . out . println ( c ) ; sc . close ( ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int a = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int b = Integer . parseInt ( s . substring ( 2 ) ) ; String ans = " NA " ; if ( ( a >= 1 && a <= 12 ) && ( b >= 1 && b <= 12 ) ) { ans = " AMBIGUOUS " ; } else if ( a >= 1 && a <= 12 ) { ans = " MMYY " ; } else if ( b >= 1 && b <= 12 ) { System . out . println ( " [LOG] Block: ans = \" YYMM \" ; " ) ; ans = " YYMM " ; } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { private static int prime ( int a ) { if ( a == 2 || a == 3 ) return 1 ; for ( int i = 2 ; i < Math . sqrt ( a ) + 1 ; i ++ ) { if ( a % i == 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 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } System . out . println ( store ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String y = sc . next ( ) ; String j = sc . next ( ) ; int result = 0 ; for ( int i = 0 ; i < y . length ( ) ; i ++ ) { if ( y . charAt ( i ) == j . charAt ( i ) ) { System . out . println ( " [LOG] Block: result += 1; " ) ; result += 1 ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; String T = scan . next ( ) ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) != T . charAt ( i ) ) { System . out . println ( " No " ) ; break ; } else if ( ( i == S . length ( ) - 1 ) && ( S . length ( ) == T . length ( ) - 1 ) ) { System . out . println ( " Yes " ) ; } else if ( S . length ( ) == T . length ( ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { static int chocoAmount ; 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 ( " [LOG] Block: System.out.println(N); " ) ; System . out . println ( N ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String n = String . valueOf ( N ) ; char [ ] a = n . toCharArray ( ) ; char b = a [ 0 ] ; char [ ] c = { b , b , b } ; int ans = Integer . parseInt ( String . valueOf ( c ) ) ; if ( ans >= N ) { System . out . println ( ans ) ; } else { System . out . println ( " [LOG] Block: ans += 111; \n System.out.println(ans); " ) ; ans += 111 ; System . out . println ( ans ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String t = scanner . next ( ) ; int tLength = t . length ( ) ; String T = t . substring ( 0 , tLength - 1 ) ; if ( s . equals ( T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scanner . close ( ) ; } } +import java . util . * ; import java . util . stream . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; List < Integer > numList = new ArrayList < > ( ) ; while ( sc . hasNextInt ( ) ) { System . out . println ( " [LOG] Block: numList.add(sc.nextInt()); " ) ; numList . add ( sc . nextInt ( ) ) ; } System . out . println ( new HashSet < > ( numList ) . size ( ) ) ; } } +import java . util . * ; import static java . lang . Math . ceil ; class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int health = 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 >= health ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n sc.nextInt(); \n sc.nextInt(); \n sc.nextInt(); \n int e = sc.nextInt(); \n int k = sc.nextInt(); \n String s = (e - a <= k) ? \" Yay! \" : \" :( \" ; \n System.out.println(s); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = ( e - a <= k ) ? " Yay! " : " :( " ; System . out . println ( s ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; boolean flag = false ; if ( A == B && B != C ) { flag = true ; } if ( B == C && C != A ) { flag = true ; } if ( A == C && B != A ) { flag = true ; } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . text . DecimalFormat ; import java . util . Scanner ; public class Main { static DecimalFormat df = new DecimalFormat ( " 0.0000000000000000000 " ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n String op = sc.next(); \n int b = sc.nextInt(); \n if (op.equals( \" ? \" )) \n break; \n if (op.equals( \" + \" )) \n System.out.println(a + b); \n else if (op.equals( \" - \" )) \n System.out.println(a - b); \n else if (op.equals( \" * \" )) \n System.out.println(a * b); \n else \n System.out.println(a / b); " ) ; int a = sc . nextInt ( ) ; String op = sc . next ( ) ; int b = sc . nextInt ( ) ; if ( op . equals ( " ? " ) ) break ; if ( op . equals ( " + " ) ) System . out . println ( a + b ) ; else if ( op . equals ( " - " ) ) System . out . println ( a - b ) ; else if ( op . equals ( " * " ) ) System . out . println ( a * b ) ; else System . out . println ( a / b ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int z = 0 ; int o = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '0' ) { z ++ ; } else { System . out . println ( " [LOG] Block: o++; " ) ; o ++ ; } } int r = Math . min ( z , o ) * 2 ; System . out . print ( r ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int taro_score = 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 ) { taro_score += 3 ; } else if ( taro_card . compareTo ( hanako_card ) == 0 ) { taro_score += 1 ; hanako_score += 1 ; } else { System . out . println ( " [LOG] Block: hanako_score += 3; " ) ; hanako_score += 3 ; } } System . out . println ( taro_score + " " + hanako_score ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; sc . close ( ) ; int result = 0 ; for ( int i = 0 ; i < D ; i ++ ) { if ( A > 0 ) { result += 1 ; A -= 1 ; } else if ( B > 0 ) { B -= 1 ; } else { System . out . println ( " [LOG] Block: result -= 1; \n C -= 1; " ) ; result -= 1 ; C -= 1 ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { 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 tmp = a . charAt ( 0 ) ; a . deleteCharAt ( 0 ) ; Main . nextTurn ( tmp ) ; } public static void nextTurn ( char card ) { if ( card == 'a' ) { if ( a . length ( ) == 0 ) { System . out . println ( " A " ) ; return ; } char tmp = a . charAt ( 0 ) ; a . deleteCharAt ( 0 ) ; Main . nextTurn ( tmp ) ; } else if ( card == 'b' ) { if ( b . length ( ) == 0 ) { System . out . println ( " B " ) ; return ; } char tmp = b . charAt ( 0 ) ; b . deleteCharAt ( 0 ) ; Main . nextTurn ( tmp ) ; } else if ( card == 'c' ) { if ( c . length ( ) == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" C \" ); \n return; " ) ; System . out . println ( " C " ) ; return ; } char tmp = c . charAt ( 0 ) ; c . deleteCharAt ( 0 ) ; Main . nextTurn ( tmp ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = a ; int ans = 1 ; while ( sum < b ) { System . out . println ( " [LOG] Block: ans++; \n sum += a - 1; " ) ; ans ++ ; sum += a - 1 ; } if ( b == 1 ) ans = 0 ; System . out . print ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n char[] c = br.readLine().toCharArray(); \n System.out.println(++c[0]); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] c = br . readLine ( ) . toCharArray ( ) ; System . out . println ( ++ c [ 0 ] ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int a ; int [ ] order = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a = scanner . nextInt ( ) ; order [ a - 1 ] = i + 1 ; } for ( int syusseki : order ) { System . out . println ( " [LOG] Block: System.out.println(syusseki); " ) ; System . out . println ( syusseki ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String str = sc.next(); \n str = str.replace( \" 1 \" , \" * \" ).replace( \" 9 \" , \" 1 \" ).replace( \" * \" , \" 9 \" ); \n System.out.println(str); " ) ; Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; str = str . replace ( " 1 " , " * " ) . replace ( " 9 " , " 1 " ) . replace ( " * " , " 9 " ) ; System . out . println ( str ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= N ; 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 ( " [LOG] Block: System.out.println(o); " ) ; System . out . println ( o ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] C = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; int n = C . length ; int st = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( C [ i ] == 'A' ) { st = i ; break ; } } int gl = 0 ; for ( int i = n - 1 ; i >= 0 ; -- i ) { if ( C [ i ] == 'Z' ) { System . out . println ( " [LOG] Block: gl = i; \n break; " ) ; gl = i ; break ; } } System . out . println ( gl - st + 1 ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int a , b , c ; a = cin . nextInt ( ) ; b = cin . nextInt ( ) ; c = cin . nextInt ( ) ; int res = serch_divisor_number ( a , b , c ) ; System . out . println ( res ) ; } private static int serch_divisor_number ( int a , int b , int c ) { int m = 0 ; for ( int i = a ; i <= b ; i ++ ) { System . out . println ( " [LOG] Block: if (c % i == 0) \n m++; " ) ; if ( c % i == 0 ) m ++ ; } return ( m ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k ; k = in . nextInt ( ) ; int a , b , i , num ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; num = a ; for ( i = num ; i <= b ; i ++ , num ++ ) { if ( i % k == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); \n System.exit(0); " ) ; System . out . println ( " OK " ) ; System . exit ( 0 ) ; } } System . out . println ( " NG " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] str = line . split ( " " ) ; int x = Integer . parseInt ( str [ 0 ] ) ; int y = Integer . parseInt ( str [ 1 ] ) ; int z = x * y ; if ( z % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Odd \" ); " ) ; System . out . println ( " Odd " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String S = input . next ( ) ; long K = 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 ) ; K -= ( long ) Math . pow ( n , days ) ; if ( K <= 0 ) { System . out . println ( " [LOG] Block: System.out.println(c); \n return; " ) ; System . out . println ( c ) ; return ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double h = sc.nextDouble(); \n double r = h * 2 * 3.14; \n System.out.println(r); " ) ; Scanner sc = new Scanner ( System . in ) ; double h = sc . nextDouble ( ) ; double r = h * 2 * 3.14 ; System . out . println ( r ) ; } } +import java . util . Scanner ; public class Main { public static void select_Sort ( int n , int [ ] A ) { int min = 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 ) { min = A [ j ] ; mini = j ; } if ( min > A [ j ] ) { min = 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 ++ ) { System . out . println ( " [LOG] Block: A[i] = scan.nextInt(); " ) ; A [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; select_Sort ( n , A ) ; return ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int max = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( h [ i ] > max ) { max = h [ i ] ; } else if ( max - h [ i ] > 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int [ ] a = new int [ N ] ; int count = 0 ; int v = 1 ; int flg = 0 ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { v = a [ v - 1 ] ; count ++ ; if ( v == 2 ) { System . out . println ( count ) ; count = 0 ; break ; } } if ( count == N ) { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double T = sc . nextDouble ( ) ; int A = sc . nextInt ( ) ; double [ ] H = new double [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } double tmp = 2000000000 ; double ans = 2000000000 ; int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { tmp = T - H [ i ] * 0.006 ; if ( Math . abs ( tmp - A ) < ans ) { System . out . println ( " [LOG] Block: ans = Math.abs(tmp - A); \n res = i; " ) ; ans = Math . abs ( tmp - A ) ; res = i ; } } System . out . println ( res + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double r = sc.nextDouble(); \n double A = (double) r * r * Math.PI; \n double L = (double) r * 2 * Math.PI; \n System.out.println(String.format( \" %f \" , A) + \" \" + String.format( \" %f \" , L)); " ) ; Scanner sc = new Scanner ( System . in ) ; double r = sc . nextDouble ( ) ; double A = ( double ) r * r * Math . PI ; double L = ( double ) r * 2 * Math . PI ; System . out . println ( String . format ( " %f " , A ) + " " + String . format ( " %f " , L ) ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int max = 0 ; int ans = 0 ; int cnt = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int j = i ; while ( j % 2 == 0 ) { j /= 2 ; cnt ++ ; } if ( cnt >= max ) { System . out . println ( " [LOG] Block: max = cnt; \n ans = i; " ) ; max = cnt ; ans = i ; } cnt = 0 ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { HashMap < Integer , Integer > h = new HashMap < > ( ) ; int count = 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; int aIndex = 1 ; int bIndex = 0 ; int cIndex = 0 ; char tmp = a . charAt ( 0 ) ; while ( true ) { switch ( tmp ) { case 'a' : if ( a . length ( ) == aIndex ) { System . out . println ( " A " ) ; System . exit ( 0 ) ; } tmp = a . charAt ( aIndex ++ ) ; 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 ( " [LOG] Block: System.out.println( \" C \" ); \n System.exit(0); " ) ; System . out . println ( " C " ) ; System . exit ( 0 ) ; } tmp = c . charAt ( cIndex ++ ) ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n ArrayList<Long> List = new ArrayList<>(); \n long N = sc.nextLong(); \n long K = sc.nextLong(); \n for (int i = 0; i < N; i++) List.add(sc.nextLong()); \n Collections.sort(List, Collections.reverseOrder()); \n long sum = 0; \n for (long i = K; i < List.size(); i++) sum += List.get((int) i); \n System.out.println(sum); " ) ; Scanner sc = new Scanner ( System . in ) ; ArrayList < Long > List = new ArrayList < > ( ) ; long N = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; for ( int i = 0 ; i < N ; 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 . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { System . out . println ( " [LOG] Block: String[] strArr = br.readLine().split( \" \" ); \n long[] arr = new long[2]; \n arr[0] = Long.parseLong(strArr[0]); \n arr[1] = Long.parseLong(strArr[1]); \n if (arr[0] == 0 && arr[1] == 0) \n break; \n Arrays.sort(arr); \n System.out.printf( \" %d %d%n \" , arr[0], arr[1]); " ) ; 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; double a = sc . nextInt ( ) ; double min = 1000000 ; int ans = 0 ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { double data = t - h [ i ] * 0.006 ; min = Math . min ( min , Math . abs ( a - data ) ) ; if ( min == Math . abs ( a - data ) ) { System . out . println ( " [LOG] Block: ans = i + 1; " ) ; ans = i + 1 ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n long a = scan.nextLong(); \n long b = scan.nextLong(); \n long x = scan.nextLong(); \n long y = scan.nextLong(); \n long c = a * x; \n long d = a * y; \n long e = b * x; \n long f = b * y; \n long res = Math.max(Math.max(c, e), Math.max(d, f)); \n System.out.println(res); " ) ; Scanner scan = new Scanner ( System . in ) ; long a = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long x = scan . nextLong ( ) ; long y = scan . nextLong ( ) ; long c = a * x ; long d = a * 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 . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N / 10 == 0 ) { System . out . println ( N % 10 ) ; } else if ( N / 100 == 0 ) { System . out . println ( 9 ) ; } else if ( N / 1000 == 0 ) { System . out . println ( N % 1000 - 99 + 9 ) ; } else if ( N / 10000 == 0 ) { System . out . println ( 909 ) ; } else if ( N / 100000 == 0 ) { System . out . println ( N % 100000 - 9999 + 900 + 9 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(90909); " ) ; System . out . println ( 90909 ) ; } } } +import java . util . Scanner ; public class Main { public static int getGcd ( int a , int b ) { if ( a == b ) return b ; int bigger = Math . max ( a , b ) ; int smaller = Math . min ( a , b ) ; int modded = bigger % smaller ; if ( modded == 0 ) return smaller ; return getGcd ( smaller , bigger % smaller ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n int a = s.nextInt(); \n int b = s.nextInt(); \n int result = getGcd(a, b); \n System.out.println(result); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int first2 = Integer . parseInt ( S . substring ( 0 , 2 ) ) ; int last2 = Integer . parseInt ( S . substring ( 2 , 4 ) ) ; String result = " " ; if ( 1 <= first2 && first2 <= 12 ) { if ( 1 <= last2 && last2 <= 12 ) { result = " AMBIGUOUS " ; } else { result = " MMYY " ; } } else { if ( 1 <= last2 && last2 <= 12 ) { result = " YYMM " ; } else { System . out . println ( " [LOG] Block: result = \" NA \" ; " ) ; result = " NA " ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner inputscan = new Scanner ( System . in ) ; int W = 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 <= W && Vertical1 >= 0 && Vertical2 <= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String [ ] x = s . nextLine ( ) . split ( " " ) ; int a = 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 ) a / d ; if ( a % 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; import java . math . * ; import java . util . * ; public class Main { static final long MOD = 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 FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long h = sc.nextLong(); \n long n = (int) (Math.log(h) / Math.log(2)) + 1; \n long ans = (long) Math.pow(2, n) - 1; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; long h = sc . nextLong ( ) ; long n = ( int ) ( Math . log ( h ) / Math . log ( 2 ) ) + 1 ; long ans = ( long ) Math . pow ( 2 , n ) - 1 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String S = stdIn . next ( ) ; if ( S . equals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" ABC \" ); " ) ; System . out . println ( " ABC " ) ; } stdIn . close ( ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int max = 0 ; for ( int i = 0 ; n > i ; i ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } for ( int i = 0 ; n - 1 > i ; i ++ ) { for ( int j = i + 1 ; n > j ; j ++ ) { System . out . println ( " [LOG] Block: int b = Math.abs(list.get(i) - list.get(j)); \n if (b > max) \n max = b; " ) ; int b = Math . abs ( list . get ( i ) - list . get ( j ) ) ; if ( b > max ) max = b ; } } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int A = in.nextInt(); \n int B = in.nextInt(); \n int C = in.nextInt(); \n int K = in.nextInt(); \n int sum = A + B + C; \n int max = Math.max(A, Math.max(B, C)); \n sum += -max + (max << K); \n System.out.println(sum); " ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; int K = in . nextInt ( ) ; int sum = A + B + C ; int max = Math . max ( A , Math . max ( B , C ) ) ; sum += - max + ( max << K ) ; System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int ans = 1 ; int count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int divi = i ; int roop = 0 ; while ( divi % 2 == 0 ) { divi = divi / 2 ; roop ++ ; } if ( count < roop ) { System . out . println ( " [LOG] Block: count = roop; \n ans = i; " ) ; count = roop ; ans = i ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; int i , j , flag = 0 ; for ( i = 0 ; i < w . length ( ) ; i ++ ) { int cnt = 0 ; for ( j = 0 ; j < w . length ( ) ; j ++ ) { if ( w . charAt ( i ) == w . charAt ( j ) ) { cnt ++ ; } } if ( cnt % 2 != 0 ) { System . out . println ( " [LOG] Block: flag = 1; \n System.out.println( \" No \" ); \n break; " ) ; flag = 1 ; System . out . println ( " No " ) ; break ; } } if ( flag == 0 ) System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String ans = " " ; if ( S . equals ( " ABC " ) ) { ans = " ARC " ; } else { System . out . println ( " [LOG] Block: ans = \" ABC \" ; " ) ; ans = " ABC " ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] h = new int [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( h [ i ] == 0 ) { if ( lastValue == 0 ) { index = i + 1 ; continue ; } for ( int j = index ; j < i ; j ++ ) { System . out . println ( " [LOG] Block: h[j] -= min; " ) ; h [ j ] -= min ; } count += min ; min = 100 ; index = i + 1 ; lastValue = 0 ; } else if ( i == N - 1 ) { min = ( min < h [ i ] ) ? min : h [ i ] ; for ( int j = index ; j <= i ; j ++ ) { System . out . println ( " [LOG] Block: h[j] -= min; " ) ; 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 ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; String s = scanner . next ( ) ; System . out . println ( rotN ( n , s ) ) ; } private static String rotN ( int n , String s ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { sb . append ( rot ( n , s . charAt ( i ) ) ) ; } return sb . toString ( ) ; } private static char rot ( int n , char ch ) { System . out . println ( " [LOG] Block: int code = (int) ch - 'A'; \n return (char) (((code + n) % 26) + 'A'); " ) ; int code = ( int ) ch - 'A' ; return ( char ) ( ( ( code + n ) % 26 ) + 'A' ) ; } } +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 Main { public static void main ( String [ ] args ) { execute16_4 ( ) ; } private static void execute16_4 ( ) { try ( Scanner sc = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int s = sc.nextInt(); \n System.out.println(s + s * s + s * s * s); " ) ; int s = sc . nextInt ( ) ; System . out . println ( s + s * s + s * s * s ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int C = sc.nextInt(); \n String ans = \" No \" ; \n if (A == B && B != C) \n ans = \" Yes \" ; \n if (A == C && A != B) \n ans = \" Yes \" ; \n if (B == C && A != B) \n ans = \" Yes \" ; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; String ans = " No " ; if ( A == B && B != C ) ans = " Yes " ; if ( A == C && A != B ) ans = " Yes " ; if ( B == C && A != B ) ans = " Yes " ; System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Map < String , Integer > count = new HashMap < > ( ) ; int n = in . nextInt ( ) ; long res = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: char[] chars = text.toCharArray(); \n Arrays.sort(chars); \n return new String(chars); " ) ; char [ ] chars = text . toCharArray ( ) ; Arrays . sort ( chars ) ; return new String ( chars ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B121 solver = new B121 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B121 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int m = Integer . parseInt ( in . next ( ) + in . next ( ) ) ; for ( int i = 1 ; i < 10000 ; i ++ ) { if ( m == i * i ) { System . out . println ( " [LOG] Block: out.println( \" Yes \" ); \n return; " ) ; out . println ( " Yes " ) ; return ; } } out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { int a = sc . nextInt ( ) ; map . put ( i , a ) ; A [ i ] = a ; } sc . close ( ) ; Arrays . sort ( A ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: int except = map.get(i); \n System.out.println(A[N - 1] == except ? A[N - 2] : A[N - 1]); " ) ; int except = map . get ( i ) ; System . out . println ( A [ N - 1 ] == except ? A [ N - 2 ] : A [ N - 1 ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int number = sc . nextInt ( ) ; int [ ] b = new int [ number - 1 ] ; int sum = 0 ; for ( int i = 0 ; i < number - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } sum += b [ 0 ] ; for ( int j = 0 ; j < number - 2 ; j ++ ) { if ( b [ j ] >= b [ j + 1 ] ) { sum += b [ j + 1 ] ; } else { System . out . println ( " [LOG] Block: sum += b[j]; " ) ; sum += b [ j ] ; } } sum += b [ number - 2 ] ; System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int w = Integer . parseInt ( scanner . nextLine ( ) ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] z = new int [ w ] ; 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 < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(z[i]); " ) ; System . out . println ( z [ i ] ) ; } } } +import java . io . * ; import java . util . * ; public class Main { 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 Solver { public void solve ( String S ) { for ( int i = 0 ; i < 3 ; i ++ ) { if ( S . charAt ( i ) == S . charAt ( i + 1 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Bad \" ); \n return; " ) ; System . out . println ( " Bad " ) ; return ; } } System . out . println ( " Good " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int value ; int rowTotal ; int [ ] colTotal = new int [ c ] ; for ( int i = 0 ; i < r ; 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 . println ( " [LOG] Block: System.out.print(colTotal[i] + \" \" ); \n rowTotal += colTotal[i]; " ) ; System . out . print ( colTotal [ i ] + " " ) ; rowTotal += colTotal [ i ] ; } System . out . println ( rowTotal ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int ans = Integer . MIN_VALUE ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: int input = sc.nextInt(); \n ans = Math.max(input - min, ans); \n min = Math.min(input, min); " ) ; int input = sc . nextInt ( ) ; ans = Math . max ( input - min , ans ) ; min = Math . min ( input , min ) ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; sc . close ( ) ; char [ ] array = s . toCharArray ( ) ; String ans = " No " ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( i % 2 == 0 && ( array [ i ] == 'R' || array [ i ] == 'U' || array [ i ] == 'D' ) ) { ans = " Yes " ; } else if ( i % 2 == 1 && ( array [ i ] == 'L' || array [ i ] == 'U' || array [ i ] == 'D' ) ) { ans = " Yes " ; } else { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 h = Integer . parseInt ( arrStr [ 0 ] ) ; int w = Integer . parseInt ( arrStr [ 1 ] ) ; if ( h == 0 && w == 0 ) { break ; } boolean iKisu = false ; for ( int i = 0 ; i < h ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int d = sc.nextInt(); \n System.out.println(Math.max(Math.min(b, d) - Math.max(a, c), 0)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . min ( b , d ) - Math . max ( a , c ) , 0 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = 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 ( " [LOG] Block: System.out.println(cost2); " ) ; System . out . println ( cost2 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; int X = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int a = 0 ; a <= A ; a ++ ) { for ( int b = 0 ; b <= B ; b ++ ) { for ( int c = 0 ; c <= C ; c ++ ) { if ( a * 500 + b * 100 + c * 50 == X ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int count1 = 0 ; int count2 = 0 ; if ( n >= 2 ) { count1 = ( n * ( n - 1 ) ) / 2 ; } if ( m >= 2 ) { System . out . println ( " [LOG] Block: count2 = (m * (m - 1)) / 2; " ) ; count2 = ( m * ( m - 1 ) ) / 2 ; } System . out . println ( count1 + count2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; sc . close ( ) ; for ( int i = 1 ; i <= n ; i += 2 ) { if ( numYaku8 ( i ) ) ans += 1 ; } System . out . println ( ans ) ; } private static boolean numYaku8 ( int n ) { int yaku = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: if (n % i == 0) \n yaku += 1; " ) ; if ( n % i == 0 ) yaku += 1 ; } if ( yaku == 8 ) return true ; return false ; } } +import java . math . BigInteger ; import java . util . * ; public class Main { 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 ( " [LOG] Block: System.out.println(a); " ) ; System . out . println ( a ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int H = 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 ++ ) { System . out . println ( " [LOG] Block: sum += A[i]; " ) ; sum += A [ i ] ; } System . out . println ( H > sum ? " No " : " Yes " ) ; } } +import java . util . Scanner ; public class Main { static String a ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int count = 0 ; IN : for ( int i = 0 ; i < n ; i ++ ) { int x = stdIn . nextInt ( ) ; for ( int j = 2 ; j * j <= x ; j ++ ) { System . out . println ( " [LOG] Block: if (x % j == 0) \n continue IN; " ) ; if ( x % j == 0 ) continue IN ; } count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String s = scan.next(); \n s = s.replaceAll( \" 0 \" , \" \" ); \n System.out.print(s.length()); " ) ; Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; s = s . replaceAll ( " 0 " , " " ) ; System . out . print ( s . length ( ) ) ; } } +import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num1 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int hour = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; double degOfMin = min * 6 ; double degOfHour = hour * 30 + degOfMin / 12 ; double deg = Math . abs ( degOfHour - degOfMin ) ; if ( deg > 180 ) { System . out . println ( " [LOG] Block: deg = 360 - deg; " ) ; deg = 360 - deg ; } double rad = Math . toRadians ( deg ) ; double num3 = ( num1 * num1 ) + ( num2 * num2 ) - ( 2 * num1 * num2 * Math . cos ( rad ) ) ; System . out . print ( Math . sqrt ( num3 ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . exec ( ) ; } private void exec ( ) { Scanner scan = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { switch ( scan . nextInt ( ) ) { case 5 : count5 ++ ; break ; case 7 : count7 ++ ; break ; default : } } if ( count5 == 2 && count7 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result [ ] = new int [ 1000000 ] , i = 0 ; while ( true ) { result [ i ] = sc . nextInt ( ) ; if ( result [ i ] == 0 ) break ; i ++ ; } for ( int j = 0 ; j < i ; j ++ ) { System . out . println ( " [LOG] Block: System.out.println( \" Case \" + (j + 1) + \" : \" + result[j]); " ) ; System . out . println ( " Case " + ( j + 1 ) + " : " + result [ j ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; boolean zero = false ; if ( L - R >= 2019 ) zero = true ; for ( int i = L ; i < R ; i ++ ) { if ( i % 2019 == 0 ) { zero = true ; break ; } } L = L % 2019 ; R = R % 2019 ; int min = 2017 * 2018 ; if ( ! zero ) { for ( int i = L ; i < R ; i ++ ) { for ( int k = i + 1 ; k <= R ; k ++ ) { System . out . println ( " [LOG] Block: if (min > (i * k) % 2019) \n min = (i * k) % 2019; " ) ; if ( min > ( i * k ) % 2019 ) min = ( i * k ) % 2019 ; } } } if ( zero ) System . out . println ( 0 ) ; else System . out . println ( min ) ; } } +import java . io . BufferedInputStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + 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 ) { System . out . println ( " [LOG] Block: return Integer.valueOf(sc.nextLine()); " ) ; return Integer . valueOf ( sc . nextLine ( ) ) ; } } +import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int Y = Integer . parseInt ( sc . next ( ) ) ; int k = 0 ; PrintWriter out = new PrintWriter ( System . out ) ; for ( int i = 0 ; i <= N ; i ++ ) { for ( int j = 0 ; j <= N - i ; j ++ ) { k = N - i - j ; if ( 10000 * i + 5000 * j + 1000 * k == Y ) { System . out . println ( " [LOG] Block: out.println(i + \" \" + j + \" \" + k); \n sc.close(); \n out.flush(); \n return; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] button = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { button [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; int nextButton = 1 ; boolean success = false ; for ( int j = 0 ; j < n ; j ++ ) { count ++ ; nextButton = button [ nextButton ] ; if ( nextButton == 2 ) { success = true ; break ; } } if ( ! success ) { System . out . println ( " [LOG] Block: count = -1; " ) ; count = - 1 ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String input = sc . next ( ) ; if ( N % 2 == 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < N / 2 ; i ++ ) { if ( input . charAt ( i ) != input . charAt ( N / 2 + i ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; import java . util . Date ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , m , n ; while ( sc . hasNext ( ) ) { a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; m = a ; n = b ; if ( m < n ) { c = n ; n = m ; m = c ; } while ( true ) { System . out . println ( " [LOG] Block: if (n == 0) \n break; \n c = n; \n n = m % n; \n m = c; " ) ; if ( n == 0 ) break ; c = n ; n = m % n ; m = c ; } System . out . printf ( " %d %d \n " , m , a / m * b ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] country = new int [ sc . nextInt ( ) ] ; int M = sc . nextInt ( ) ; for ( int i = 0 ; i < M ; 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 ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long x = sc.nextLong(); \n long k = sc.nextLong(); \n boolean flag = true; \n long d = 0; \n x = x % k; \n d = Math.min(x, Math.abs(x - k)); \n System.out.println(d); " ) ; Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; boolean flag = true ; long d = 0 ; x = x % k ; d = Math . min ( x , Math . abs ( x - k ) ) ; System . out . println ( d ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int a = scanner . nextInt ( ) ; final int b = scanner . nextInt ( ) ; final int value = Integer . parseInt ( Integer . toString ( a ) + Integer . toString ( b ) ) ; final int lowerSqrt = ( int ) Math . sqrt ( value ) ; if ( value % lowerSqrt == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c0 = 0 ; int c1 = 0 ; int c2 = 0 ; int c3 = 0 ; for ( int i = 0 ; i < n + 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 " ) ) { System . out . println ( " [LOG] Block: ++c3; " ) ; ++ 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( n % 2 == 1 ) { System . out . println ( " No " ) ; return ; } String ss = s . substring ( n / 2 , n ) ; s = s . substring ( 0 , n / 2 ) ; if ( s . equals ( ss ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] a = sc . next ( ) . toCharArray ( ) ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( a [ i ] == '1' ) { System . out . println ( " [LOG] Block: ans += 1; " ) ; ans += 1 ; } } System . out . print ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; 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 < N ; i ++ ) { if ( 0 < A [ i ] + K - Q ) { out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: out.println( \" No \" ); " ) ; out . println ( " No " ) ; } } out . flush ( ) ; } } +import java . util . * ; import java . util . regex . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) , n = sc . nextInt ( ) , a , b , z ; int [ ] amida = new int [ w ] ; for ( int i = 0 ; i < w ; i ++ ) amida [ i ] = i + 1 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: String s = sc.next(); \n Pattern pattern = Pattern.compile( \" \\ D \" ); \n String[] splitStr = pattern.split(s); \n a = Integer.parseInt(splitStr[0]); \n b = Integer.parseInt(splitStr[1]); \n z = amida[a - 1]; \n amida[a - 1] = amida[b - 1]; \n amida[b - 1] = z; " ) ; 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 < w ; i ++ ) System . out . println ( amida [ i ] ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long h = sc . nextLong ( ) ; HashMap < Long , Long > map = new HashMap < > ( ) ; long res = dfs ( h , map ) ; System . out . println ( res ) ; } public static long dfs ( long h , HashMap < Long , Long > map ) { System . out . println ( " [LOG] Block: long ans = 1; \n if (h <= 1) \n return ans; \n if (map.get(h) != null) \n return map.get(h); \n long cur = dfs(h / 2, map); \n ans += 2 * cur; \n map.put(h, ans); \n return ans; " ) ; long ans = 1 ; if ( h <= 1 ) return ans ; if ( map . get ( h ) != null ) return map . get ( h ) ; long cur = dfs ( h / 2 , map ) ; ans += 2 * cur ; map . put ( h , ans ) ; return ans ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] [ ] rooms = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { rooms [ i ] [ j ] [ k ] = 0 ; } } } int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { 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 i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { System . out . print ( " " + rooms [ i ] [ j ] [ k ] ) ; } System . out . println ( " " ) ; } if ( i < 3 ) { System . out . println ( " [LOG] Block: System.out.println( \" #################### \" ); " ) ; System . out . println ( " #################### " ) ; } } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) ; long ans = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( ( i % 3 ) == 0 || ( i % 5 ) == 0 ) { ans += 0 ; } else { System . out . println ( " [LOG] Block: ans += i; " ) ; ans += i ; } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { new Solver ( ) . run ( ) ; } } class Solver { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int top1 = 0 ; int idx1 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; if ( top1 < A [ i ] ) { top1 = A [ i ] ; idx1 = i ; } } int top2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i != idx1 && top2 < A [ i ] ) { top2 = A [ i ] ; } } long max = Integer . MIN_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] == top1 ) { System . out . println ( top2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(top1); " ) ; System . out . println ( top1 ) ; } } return ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int x = sc.nextInt(); \n int y = sc.nextInt(); \n int t = (y - 2 * x) / 2; \n int c = x - t; \n if (t < 0 || c < 0 || y % 2 == 1) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int t = ( y - 2 * x ) / 2 ; int c = x - t ; if ( t < 0 || c < 0 || y % 2 == 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } +public class Main { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] x = new int [ n ] ; double sum = 0 ; int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextInt ( ) ; sum += x [ i ] ; } double val = sum / n ; val = Math . round ( val ) ; int avg = ( int ) val ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int num = avg - x[i]; \n num = num * num; \n total += num; " ) ; int num = avg - x [ i ] ; num = num * num ; total += num ; } System . out . println ( total ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N + 2 ] ; long [ ] B = new long [ N + 1 ] ; long cnt = 0 ; long wk = 0 ; long wk2 = 0 ; for ( int i = 0 ; i < N + 1 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: A[i + 1] = wk2; \n cnt = cnt + wk; " ) ; A [ i + 1 ] = wk2 ; cnt = cnt + wk ; } } } System . out . print ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N + 1 ] ; int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) B [ i ] = sc . nextInt ( ) ; long res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: int d = Math.min(A[i], B[i]); \n res += d; \n A[i] -= d; \n B[i] -= d; \n d = Math.min(B[i], A[i + 1]); \n res += d; \n A[i + 1] -= d; " ) ; 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 . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; String SA = keyboard . nextLine ( ) ; String SB = keyboard . nextLine ( ) ; String SC = keyboard . nextLine ( ) ; String input = SA . substring ( 0 , 1 ) ; keyboard . close ( ) ; System . out . print ( solve ( SA , 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 { System . out . println ( " [LOG] Block: return \" C \" ; " ) ; return " C " ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; String yvgubhij = s . nextLine ( ) ; HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < a ; i ++ ) { System . out . println ( " [LOG] Block: String b = s.nextLine(); \n set.add(b); " ) ; String b = s . nextLine ( ) ; set . add ( b ) ; } System . out . println ( set . size ( ) ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int S = sc.nextInt(); \n int W = sc.nextInt(); \n if (W >= S) \n System.out.println( \" unsafe \" ); \n else \n System.out.println( \" safe \" ); " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int a = std . nextInt ( ) ; int b = std . nextInt ( ) ; if ( a >= 13 ) { System . out . println ( b ) ; } else if ( a <= 5 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b / 2); " ) ; System . out . println ( b / 2 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; int length = S . length ( ) ; int count = 0 ; for ( int i = 0 ; i < length / 2 ; i ++ ) { System . out . println ( " [LOG] Block: if (S.charAt(i) != S.charAt(length - 1 - i)) \n count++; " ) ; if ( S . charAt ( i ) != S . charAt ( length - 1 - i ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; Arrays . sort ( a ) ; int check = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( i != j ) { if ( a [ i ] == a [ j ] ) { check = 1 ; break ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } if ( check == 1 ) break ; } System . out . println ( ( check == 1 ) ? " NO " : " YES " ) ; } } +import java . io . IOException ; import java . util . Arrays ; import java . util . OptionalLong ; import java . util . Scanner ; import java . util . stream . LongStream ; class Main { public static void main ( String [ ] args ) throws IOException { Scanner scane = new Scanner ( System . in ) ; int n = scane . nextInt ( ) ; long [ ] nums = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: nums[i] = scane.nextInt(); " ) ; 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n int L = s.nextInt(); \n System.out.println((double) L * L * L / 27); \n s.close(); " ) ; Scanner s = new Scanner ( System . in ) ; int L = s . nextInt ( ) ; System . out . println ( ( double ) L * L * L / 27 ) ; s . close ( ) ; } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String d = sc.nextLine(); \n System.out.println( \" 2018 \" + d.substring(4)); " ) ; Scanner sc = new Scanner ( System . in ) ; String d = sc . nextLine ( ) ; System . out . println ( " 2018 " + d . substring ( 4 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int min = 10000000 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] < min ) { System . out . println ( " [LOG] Block: count++; \n min = p[i]; " ) ; count ++ ; min = p [ i ] ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; P [ 0 ] = sc . nextInt ( ) ; int error = 0 ; boolean asc = true ; boolean once = true ; for ( int i = 1 ; i < N ; i ++ ) { P [ i ] = sc . nextInt ( ) ; if ( once && ! asc && error - 1 == P [ i - 1 ] ) { asc = true ; once = false ; } else if ( P [ i ] < P [ i - 1 ] ) { System . out . println ( " [LOG] Block: error = P[i - 1]; \n asc = false; " ) ; 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 Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { System . out . println ( " [LOG] Block: String in = br.readLine(); \n System.out.println(in.equals( \" Sunny \" ) ? \" Cloudy \" : in.equals( \" Cloudy \" ) ? \" Rainy \" : \" Sunny \" ); " ) ; String in = br . readLine ( ) ; System . out . println ( in . equals ( " Sunny " ) ? " Cloudy " : in . equals ( " Cloudy " ) ? " Rainy " : " Sunny " ) ; } } } +import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( String . valueOf ( i ) . length ( ) == 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } else if ( String . valueOf ( i ) . length ( ) % 2 != 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( count ) ; out . flush ( ) ; sc . close ( ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; List < Long > a = new ArrayList < Long > ( ) ; int fe = - 1 ; int count = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: count++; \n j /= 2; " ) ; count ++ ; j /= 2 ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } if ( n == 2 ) { System . out . println ( Math . abs ( h [ 0 ] - h [ 1 ] ) ) ; return ; } int [ ] cost = new int [ n ] ; cost [ 0 ] = 0 ; cost [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: cost[i] = Math.min(cost[i - 2] + Math.abs(h[i] - h[i - 2]), cost[i - 1] + Math.abs(h[i] - h[i - 1])); " ) ; 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 [ n - 1 ] ) ; } } +class Main { public static void main ( String [ ] args ) throws java . io . IOException { System . out . println ( " [LOG] Block: java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); \n int x = Integer.parseInt(br.readLine()); \n System.out.println((int) Math.pow(x, 3)); " ) ; java . io . BufferedReader br = new java . io . BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 100000 ] , y = new int [ 100000 ] ; int i = 0 , a ; while ( true ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; if ( x [ i ] == 0 && y [ i ] == 0 ) break ; if ( x [ i ] > y [ i ] ) { a = x [ i ] ; x [ i ] = y [ i ] ; y [ i ] = a ; } i ++ ; } for ( int j = 0 ; j < i ; j ++ ) { System . out . println ( " [LOG] Block: System.out.println(x[j] + \" \" + y[j]); " ) ; System . out . println ( x [ j ] + " " + y [ j ] ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; String [ ] a = new String [ n ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = input . readLine ( ) ; } Arrays . sort ( a ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: out.append(a[i]); " ) ; out . append ( a [ i ] ) ; } System . out . println ( out ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner input = new Scanner(System.in); \n int N = input.nextInt(); \n int M = input.nextInt(); \n int cnt = 0; \n System.out.println(N * (N - 1) / 2 + M * (M - 1) / 2); " ) ; Scanner input = new Scanner ( System . in ) ; int N = input . nextInt ( ) ; int M = input . nextInt ( ) ; int cnt = 0 ; System . out . println ( N * ( N - 1 ) / 2 + M * ( M - 1 ) / 2 ) ; } } +import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int N = sc.nextInt(); \n int[] a = new int[100]; \n for (int i = 0; i < N; i++) a[i] = sc.nextInt(); \n Arrays.sort(a); \n int Alice = 0; \n int Bob = 0; \n for (int i = 99; i > 99 - N; i--) if (i % 2 == 1) \n Alice += a[i]; \n else \n Bob += a[i]; \n System.out.println(Alice - Bob); " ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ 100 ] ; for ( int i = 0 ; i < N ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; int Alice = 0 ; int Bob = 0 ; for ( int i = 99 ; i > 99 - N ; i -- ) if ( i % 2 == 1 ) Alice += a [ i ] ; else Bob += a [ i ] ; System . out . println ( Alice - Bob ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int h = sc.nextInt(); \n int n = sc.nextInt(); \n int sum = 0; \n for (int i = 0; i < n; i++) sum += Integer.parseInt(sc.next()); \n System.out.println(h > sum ? \" No \" : \" Yes \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += Integer . parseInt ( sc . next ( ) ) ; System . out . println ( h > sum ? " No " : " Yes " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int X = Integer . parseInt ( sc . next ( ) ) ; int [ ] M = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { M [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( M ) ; int sum = 0 ; int cnt = N ; for ( int i = 0 ; i < N ; i ++ ) { sum += M [ i ] ; } if ( X - sum >= M [ 0 ] ) { do { System . out . println ( " [LOG] Block: sum += M[0]; \n cnt++; " ) ; sum += M [ 0 ] ; cnt ++ ; } while ( X - sum >= M [ 0 ] ) ; } System . out . println ( cnt ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; BigDecimal [ ] an = new BigDecimal [ n ] ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String t = scan . next ( ) ; int ans = 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 ) ) { System . out . println ( " [LOG] Block: diff++; " ) ; diff ++ ; } } ans = Math . min ( ans , diff ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner S = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: int x = S.nextInt(); \n int y = S.nextInt(); \n if (x == 0 && y == 0) \n break; \n if (x < y) \n System.out.printf( \" %d %d \n \" , x, y); \n else \n System.out.printf( \" %d %d \n \" , y, x); " ) ; int x = S . nextInt ( ) ; int y = S . nextInt ( ) ; if ( x == 0 && y == 0 ) break ; if ( x < y ) System . out . printf ( " %d %d \n " , x , y ) ; else System . out . printf ( " %d %d \n " , y , x ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long w = sc . nextInt ( ) ; long h = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; long area = w * h ; int multi ; if ( w / 2.0 == x && h / 2.0 == y ) { multi = 1 ; } else { System . out . println ( " [LOG] Block: multi = 0; " ) ; multi = 0 ; } System . out . println ( area / 2.0 ) ; System . out . println ( multi ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws Exception { int [ ] antenna = new int [ 5 ] ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < antenna . length ; i ++ ) { antenna [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } int k = Integer . parseInt ( br . readLine ( ) ) ; if ( antenna [ 4 ] - antenna [ 0 ] > k ) { System . out . println ( " :( " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yay! \" ); " ) ; System . out . println ( " Yay! " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int n = N ; 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 ( N % s == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , T = sc . nextInt ( ) ; int [ ] c = new int [ n ] ; int [ ] t = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = sc . nextInt ( ) ; t [ i ] = sc . nextInt ( ) ; } int ans = INF ; boolean exist = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( t [ i ] <= T ) { System . out . println ( " [LOG] Block: exist = true; \n ans = Math.min(ans, c[i]); " ) ; 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 . io . * ; public class Main { public static void main ( String ... args ) throws IOException { final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; final StringBuilder sb = new StringBuilder ( ) ; while ( true ) { System . out . println ( " [LOG] Block: final String line = br.readLine(); \n final int index = line.indexOf( \" \" ); \n final int x = Integer.parseInt(line.substring(0, index)); \n final int y = Integer.parseInt(line.substring(index + 1, line.length())); \n if (x == 0 && y == 0) \n break; \n sb.append(x < y ? x + \" \" + y : y + \" \" + x).append( \" \n \" ); " ) ; final String line = br . readLine ( ) ; final int index = line . indexOf ( " " ) ; final int x = Integer . parseInt ( line . substring ( 0 , index ) ) ; final int y = Integer . parseInt ( line . substring ( index + 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 . Scanner ; public class Main { static char [ ] k = { '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 k = 0 ; while ( true ) { String T = stdIn . next ( ) ; if ( T . equals ( " END_OF_TEXT " ) ) { break ; } T = T . toLowerCase ( ) ; if ( T . equals ( W ) ) { System . out . println ( " [LOG] Block: k++; " ) ; k ++ ; } } System . out . println ( k ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; sc . close ( ) ; int maiX = 0 , maiY = 0 , maiZ = 0 ; int kaiX = - 1 , kaiY = - 1 , kaiZ = - 1 ; for ( maiX = 0 ; maiX <= N ; maiX ++ ) { if ( kaiX != - 1 ) { break ; } if ( maiX * 10000 > Y ) { break ; } for ( maiZ = 0 ; maiX + maiZ <= N ; maiZ ++ ) { maiY = N - ( maiX + maiZ ) ; if ( maiX * 10000 + maiY * 5000 + maiZ * 1000 == Y ) { System . out . println ( " [LOG] Block: kaiX = maiX; \n kaiY = maiY; \n kaiZ = maiZ; \n break; " ) ; kaiX = maiX ; kaiY = maiY ; kaiZ = maiZ ; break ; } } } System . out . println ( kaiX + " " + kaiY + " " + kaiZ ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int 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 < N ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < k && i < n ; i ++ ) { System . out . println ( " [LOG] Block: sum += arr[i]; " ) ; sum += arr [ i ] ; } System . out . println ( sum ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long L ; try ( Scanner sc = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: L = sc.nextLong(); " ) ; L = sc . nextLong ( ) ; } double c = ( double ) L / 3 ; double M = c * c * c ; System . out . println ( String . format ( " %.8f " , M ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n ; n = in . nextInt ( ) ; SortedMap < String , Integer > poll = new TreeMap < String , Integer > ( ) ; int maxvote = 0 ; for ( long i = 0 ; i < n ; 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 ( ) ) { System . out . println ( " [LOG] Block: if (poll.get(candidate) == maxvote) \n System.out.println(candidate); " ) ; if ( poll . get ( candidate ) == maxvote ) System . out . println ( candidate ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; int [ ] a = new int [ n ] ; 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 ] ) { System . out . println ( " [LOG] Block: count = count + 1; " ) ; count = count + 1 ; } } System . out . println ( count ) ; } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n System.out.println(A * B); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( A * B ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] str = br.readLine().split( \" \" ); \n int h = Integer.parseInt(str[0]); \n int a = Integer.parseInt(str[1]); \n br.close(); \n System.out.println((h + a - 1) / a); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int h = Integer . parseInt ( str [ 0 ] ) ; int a = Integer . parseInt ( str [ 1 ] ) ; br . close ( ) ; System . out . println ( ( h + a - 1 ) / a ) ; } } +import java . util . * ; public class Main { public static int n ; public static int [ ] arr ; public static int [ ] dp ; public static int minCost ( int pos ) { if ( pos >= n - 1 ) return 0 ; if ( dp [ pos ] != - 1 ) return dp [ pos ] ; int onestep = Integer . MAX_VALUE ; int twostep = Integer . MAX_VALUE ; if ( pos + 1 < n ) { onestep = Math . abs ( arr [ pos ] - arr [ pos + 1 ] ) + minCost ( pos + 1 ) ; } if ( pos + 2 < n ) { twostep = Math . abs ( arr [ pos ] - arr [ pos + 2 ] ) + minCost ( pos + 2 ) ; } return dp [ pos ] = Math . min ( onestep , twostep ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n n = in.nextInt(); \n arr = new int[n]; \n dp = new int[n]; \n for (int i = 0; i < n; i++) arr[i] = in.nextInt(); \n Arrays.fill(dp, -1); \n System.out.println(minCost(0)); " ) ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; arr = new int [ n ] ; dp = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextInt ( ) ; Arrays . fill ( dp , - 1 ) ; System . out . println ( minCost ( 0 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; String S = scanner . next ( ) ; String [ ] S1 = S . split ( " " ) ; if ( K >= S1 . length ) { for ( int j = 0 ; j < S1 . length ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print(S1[j]); " ) ; System . out . print ( S1 [ j ] ) ; } } else { for ( int j = 0 ; j < K ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print(S1[j]); " ) ; System . out . print ( S1 [ j ] ) ; } System . out . println ( " ... " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] best = { 0 , 0 , 0 } ; for ( int i = 0 ; i < 10 ; i ++ ) { 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 ( " [LOG] Block: System.out.println(h); " ) ; System . out . println ( h ) ; } } } +import java . util . * ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double n = sc.nextInt(); \n double tmp = Math.ceil(n / 2); \n double ans = tmp / n; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; double n = sc . nextInt ( ) ; double tmp = Math . ceil ( n / 2 ) ; double ans = tmp / n ; System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; br . readLine ( ) ; int count = 0 ; String str ; while ( ( str = br . readLine ( ) ) != null ) { if ( isPrime ( Long . valueOf ( str ) ) ) count ++ ; } System . out . println ( count ) ; } private static boolean isPrime ( long n ) { System . out . println ( " [LOG] Block: if (n < 2) \n return false; \n else if (n == 2) \n return true; \n if (n % 2 == 0) \n return false; \n for (long i = 3; i <= n / i; i += 2) if (n % i == 0) \n return false; \n return true; " ) ; 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 . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextLong ( ) ; long money = 100 ; int year = 0 ; while ( money < X ) { System . out . println ( " [LOG] Block: money *= 1.01; \n year++; " ) ; money *= 1.01 ; year ++ ; } System . out . println ( year ) ; } } +import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n double r = scan.nextDouble(); \n double area = r * r * Math.PI; \n double circumference = 2 * r * Math.PI; \n System.out.printf( \" %f %f \n \" , area, circumference); " ) ; Scanner scan = new Scanner ( System . in ) ; double r = scan . nextDouble ( ) ; double area = r * r * Math . PI ; double circumference = 2 * r * Math . PI ; System . out . printf ( " %f %f \n " , area , circumference ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str ; String [ ] arr ; int i ; int j ; while ( ( str = br . readLine ( ) ) != null ) { arr = str . split ( " " ) ; i = Integer . parseInt ( arr [ 0 ] ) ; j = Integer . parseInt ( arr [ 1 ] ) ; if ( i == 0 && j == 0 ) { break ; } if ( i <= j ) System . out . println ( str ) ; else { System . out . println ( arr [ 1 ] + " " + arr [ 0 ] ) ; } } br . close ( ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 N = 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 ) { System . out . println ( " [LOG] Block: str = null; \n System.out.println(e); " ) ; str = null ; System . out . println ( e ) ; } return str ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; while ( ( a % 2 ) == 0 ) { System . out . println ( " [LOG] Block: cnt++; \n a /= 2; " ) ; cnt ++ ; a /= 2 ; } } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int M = sc.nextInt(); \n int gugu = N * (N - 1) / 2; \n int kiki = M * (M - 1) / 2; \n System.out.println(gugu + kiki); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int gugu = N * ( N - 1 ) / 2 ; int kiki = M * ( M - 1 ) / 2 ; System . out . println ( gugu + kiki ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int tasu = A + B; \n int hiku = A - B; \n int kakeru = A * B; \n System.out.println(Math.max(kakeru, Math.max(tasu, hiku))); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int tasu = A + B ; int hiku = A - B ; int kakeru = A * B ; System . out . println ( Math . max ( kakeru , Math . max ( tasu , hiku ) ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { int total = 0 ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: total += a[i][j] * b[j]; " ) ; total += a [ i ] [ j ] * b [ j ] ; } System . out . println ( total ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; double prob = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) { int points = i ; double diff = 1.0 / n ; while ( points < k ) { System . out . println ( " [LOG] Block: diff *= 0.5; \n points *= 2; " ) ; diff *= 0.5 ; points *= 2 ; } prob += diff ; } System . out . println ( prob ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String C = sc . next ( ) ; int count = 1 ; for ( int i = 1 ; i < C . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (!C.substring(i - 1, i).equals(C.substring(i, i + 1))) \n count++; " ) ; if ( ! C . substring ( i - 1 , i ) . equals ( C . substring ( i , i + 1 ) ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long [ ] line = new long [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { line [ i ] = sc . nextLong ( ) ; } long max = Long . MIN_VALUE ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 2 ; j < 4 ; j ++ ) { System . out . println ( " [LOG] Block: max = Math.max(max, line[i] * line[j]); " ) ; max = Math . max ( max , line [ i ] * line [ j ] ) ; } } System . out . println ( max ) ; sc . close ( ) ; } } +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 Main { static String a ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int count = 0 ; IN : for ( int i = 0 ; i < n ; i ++ ) { int x = stdIn . nextInt ( ) ; for ( int j = 2 ; j * j <= x ; j ++ ) { System . out . println ( " [LOG] Block: if (x % j == 0) \n continue IN; " ) ; if ( x % j == 0 ) continue IN ; } count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int n = in . nextInt ( ) ; if ( n == 0 ) break ; int [ ] numbers = new int [ n ] ; long double_sum = 0 ; long sum_double = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: numbers[i] = in.nextInt(); \n double_sum += numbers[i]; " ) ; numbers [ i ] = in . nextInt ( ) ; double_sum += numbers [ i ] ; } double_sum = double_sum * double_sum ; for ( int i = 0 ; i < n ; i ++ ) sum_double += ( numbers [ i ] * numbers [ i ] ) ; double sd = Math . sqrt ( ( sum_double - double_sum / ( double ) n ) / ( double ) n ) ; System . out . printf ( " %5.8f " , sd ) ; System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n sc.useDelimiter( \" \\ s \" ); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int d = a / b; \n int r = a % b; \n double A = a; \n double B = b; \n double f = A / B; \n System.out.println(d + \" \" + r + \" \" + String.format( \" %.5f \" , f)); " ) ; Scanner sc = new Scanner ( System . in ) ; sc . useDelimiter ( " \\ s " ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int d = a / b ; int r = a % b ; double A = a ; double B = b ; double f = A / B ; System . out . println ( d + " " + r + " " + String . format ( " %.5f " , f ) ) ; } } +import java . util . Scanner ; public class Main { void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } if ( isOK ( p ) ) { System . out . println ( " YES " ) ; return ; } for ( int i = 0 ; i <= N - 2 ; i ++ ) { for ( int j = i + 1 ; j <= N - 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 ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; long sum = 0 ; for ( long i = 1 ; i < N + 1 ; i ++ ) { if ( ! ( i % 3 == 0 || i % 5 == 0 ) ) { System . out . println ( " [LOG] Block: sum = sum + i; " ) ; sum = sum + i ; } } System . out . println ( sum ) ; } } +import java . io . PrintStream ; import java . util . Scanner ; public class Main { static final PrintStream out = System . out ; static Scanner sc = new Scanner ( System . in ) ; static final long Mod = 1000_000_007L ; public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; System . exit ( 0 ) ; } void solve ( ) { 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 ( ) { System . out . println ( " [LOG] Block: return sc.next(); " ) ; return sc . next ( ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] inputs = new long [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { inputs [ i ] = sc . nextLong ( ) ; } Arrays . sort ( inputs ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(inputs[i] + ((i != 2) ? \" \" : \" \" )); " ) ; System . out . print ( inputs [ i ] + ( ( i != 2 ) ? " " : " " ) ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n Integer int1 = scanner.nextInt(); \n Integer int2 = scanner.nextInt(); \n int result = int1 * int2; \n System.out.println(result); " ) ; Scanner scanner = new Scanner ( System . in ) ; Integer int1 = scanner . nextInt ( ) ; Integer int2 = scanner . nextInt ( ) ; int result = int1 * int2 ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextLong ( ) ; long a = scanner . nextLong ( ) ; long b = scanner . nextLong ( ) ; if ( a == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" 0 \" ); \n return; " ) ; System . out . println ( " 0 " ) ; return ; } long d = a + b ; long q = n / d ; long r = n % d ; long blue = ( q * a ) + ( a < r ? a : r ) ; System . out . println ( blue ) ; } } +import java . math . BigInteger ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { int n , i , j , m , k , p , q , o , l , s , tt = 1 ; Double x , y , z ; int [ ] ar , br ; char ch ; BigInteger an , su , u , v ; String a , b = " " , c = " " , d ; Scanner sc = new Scanner ( System . in ) ; Scanner scc = new Scanner ( System . in ) ; ar = new int [ 200001 ] ; br = new int [ 200001 ] ; n = sc . nextInt ( ) ; 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 ) { System . out . println ( " [LOG] Block: p++; \n q += br[o]; " ) ; p ++ ; q += br [ o ] ; } ar [ o ] = 1 ; } } System . out . println ( p + " " + q ) ; } } +public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: String S = new java.util.Scanner(System.in).nextLine(); \n switch(S) { \n case \" SSS \" : \n System.out.println( \" 0 \" ); \n break; \n case \" SSR \" : \n case \" SRS \" : \n case \" RSS \" : \n case \" RSR \" : \n System.out.println( \" 1 \" ); \n break; \n case \" SRR \" : \n case \" RRS \" : \n System.out.println( \" 2 \" ); \n break; \n case \" RRR \" : \n System.out.println( \" 3 \" ); \n } " ) ; String S = new java . util . Scanner ( System . in ) . nextLine ( ) ; switch ( S ) { 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 . io . * ; import java . util . * ; class Main { 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 n = Integer . parseInt ( buf [ 0 ] ) ; int m = Integer . parseInt ( buf [ 1 ] ) ; ArrayList < Integer > matrix = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; 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 < n ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(answer.get(i)); " ) ; System . out . println ( answer . get ( i ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] numbers = new int [ 3 ] ; for ( int i = 0 ; i < numbers . length ; i ++ ) { String input = scan . next ( ) ; numbers [ i ] = Integer . parseInt ( input ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { int point = i ; for ( int j = point ; j < 3 ; j ++ ) { if ( numbers [ point ] > numbers [ j ] ) { System . out . println ( " [LOG] Block: point = j; " ) ; point = j ; } } int tmp = numbers [ point ] ; numbers [ point ] = numbers [ i ] ; numbers [ i ] = tmp ; } System . out . println ( numbers [ 0 ] + " " + numbers [ 1 ] + " " + numbers [ 2 ] ) ; } } +import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { void solve ( Scanner in , PrintWriter out ) { int t = in . nextInt ( ) ; int cpt = 0 ; for ( int i = 0 ; i < t ; ++ 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 ) ) { System . out . println ( " [LOG] Block: new Main().solve(in, out); " ) ; new Main ( ) . solve ( in , out ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String ans = sc . next ( ) ; int sum = 0 ; if ( ans . equals ( s ) ) { sum = a - 1 ; System . out . println ( sum + " " + b ) ; } if ( ans . equals ( t ) ) { System . out . println ( " [LOG] Block: sum = b - 1; \n System.out.println(a + \" \" + sum); " ) ; sum = b - 1 ; System . out . println ( a + " " + sum ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; String [ ] inputs = input . split ( " " ) ; int n = Integer . parseInt ( inputs [ 0 ] ) ; int x = Integer . parseInt ( inputs [ 1 ] ) ; String lineStr = scanner . nextLine ( ) ; String [ ] lines = lineStr . split ( " " ) ; int [ ] line = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { line [ i ] = Integer . parseInt ( lines [ i ] ) ; } int answer = 1 ; int distance = 0 ; for ( int i = 0 ; i < n ; i ++ ) { distance = distance + line [ i ] ; if ( distance > x ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } answer ++ ; } System . out . println ( answer ) ; scanner . close ( ) ; } } +import java . util . Scanner ; class Main { private static String toString ( int [ ] numbers ) { StringBuilder ans = new StringBuilder ( ) . append ( numbers [ 0 ] ) ; for ( int x = 1 ; x < numbers . length ; x ++ ) ans . append ( " " ) . append ( numbers [ x ] ) ; 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 ) { System . out . println ( " [LOG] Block: int temp = A[i]; \n A[i] = A[mini]; \n A[mini] = temp; \n count++; " ) ; int temp = A [ i ] ; A [ i ] = A [ mini ] ; A [ mini ] = temp ; count ++ ; } } System . out . println ( toString ( A ) ) ; System . out . println ( count ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) A . add ( sc . nextInt ( ) ) ; ArrayList < Integer > output = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) output . add ( 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { int AIndex = A . get ( i ) - 1 ; output . set ( AIndex , i + 1 ) ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(output.get(i) + \" \" ); " ) ; System . out . print ( output . get ( i ) + " " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int taro = 0 ; int hanako = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: taro++; \n hanako++; " ) ; taro ++ ; hanako ++ ; } } System . out . println ( taro + " " + hanako ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { int LOWER_LIMIT = - 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 - LOWER_LIMIT + 1 < K ) { start = LOWER_LIMIT ; 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 ++ ) { System . out . println ( " [LOG] Block: out.println(i); " ) ; out . println ( i ) ; } } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int count = 0 ; for ( int i = a ; i <= b ; i ++ ) { for ( int j = c ; j <= d ; j ++ ) { if ( i == j ) { count ++ ; break ; } } } if ( count > 0 ) { System . out . println ( " [LOG] Block: count--; " ) ; count -- ; } System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , n ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( line [ i ] ) ; } Arrays . sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += arr [ i ] ; } if ( arr [ n - 1 ] < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String s = scan . next ( ) ; String t = scan . next ( ) ; String ans = " " ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: ans = ans.concat(s.substring(i, i + 1)).concat(t.substring(i, i + 1)); " ) ; ans = ans . concat ( s . substring ( i , i + 1 ) ) . concat ( t . substring ( i , i + 1 ) ) ; } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int N = in.nextInt(); \n System.out.println(Math.min(N * in.nextInt(), in.nextInt())); " ) ; Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; System . out . println ( Math . min ( N * in . nextInt ( ) , in . nextInt ( ) ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; for ( int i = n ; i <= 999 ; i ++ ) { String s = String . valueOf ( i ) ; if ( ( s . charAt ( 0 ) == s . charAt ( 1 ) ) && ( s . charAt ( 1 ) == s . charAt ( 2 ) ) ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n ; while ( ( n = scan . nextInt ( ) ) != 0 ) { int [ ] s = new int [ n ] ; double m = 0 ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = scan . nextInt ( ) ; m += s [ i ] ; } m /= n ; double sum = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { System . out . println ( " [LOG] Block: sum += (s[i] - m) * (s[i] - m); " ) ; sum += ( s [ i ] - m ) * ( s [ i ] - m ) ; } System . out . println ( Math . sqrt ( sum / n ) ) ; } } } +import java . util . Scanner ; import java . util . regex . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = 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 ( N == nums [ i ] [ j ] ) { x = true ; break yy ; } } } if ( x ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int s = sc.nextInt(); \n System.out.println(s / 3600 + \" : \" + s % 3600 / 60 + \" : \" + s % 3600 % 60); " ) ; Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; System . out . println ( s / 3600 + " : " + s % 3600 / 60 + " : " + s % 3600 % 60 ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int x = in . nextInt ( ) ; int t = in . nextInt ( ) ; System . out . println ( ( int ) Math . ceil ( 1.0 * n / x ) * t ) ; } } class scan { 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 ) { System . out . println ( " [LOG] Block: throw new RuntimeException(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 ) { System . out . println ( " [LOG] Block: throw new RuntimeException(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 ) { System . out . println ( " [LOG] Block: throw new RuntimeException(e); " ) ; throw new RuntimeException ( e ) ; } } return token . nextToken ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int elements = sc . nextInt ( ) ; int [ ] value = new int [ elements ] ; for ( int i = 0 ; i < elements ; 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 { System . out . println ( " [LOG] Block: if (result < now) \n result = now; \n now = 0; " ) ; if ( result < now ) result = now ; now = 0 ; } } if ( result < now ) result = now ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; sc . nextLine ( ) ; String str = sc . nextLine ( ) ; if ( str . length ( ) <= K ) { System . out . println ( " [LOG] Block: System.out.println(str); \n return; " ) ; System . out . println ( str ) ; return ; } String str2 = str . substring ( 0 , K ) + " ... " ; System . out . println ( str2 ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; if ( S . equals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } if ( S . equals ( " ARC " ) ) { System . out . println ( " [LOG] Block: System.out.println( \" ABC \" ); " ) ; System . out . println ( " ABC " ) ; } } } +import java . util . * ; public class Main { 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 res = 0 ; for ( int i = 1 ; i < a . length ; i ++ ) { System . out . println ( " [LOG] Block: res += a[i] - a[i - 1]; " ) ; res += a [ i ] - a [ i - 1 ] ; } System . out . println ( res ) ; } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] hi ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st = new StringTokenizer(infile.readLine()); \n int N = Integer.parseInt(st.nextToken()); \n int X = Integer.parseInt(st.nextToken()); \n int T = Integer.parseInt(st.nextToken()); \n int time = N / X; \n time *= T; \n if (N % X > 0) \n time += T; \n System.out.println(time); " ) ; BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int X = Integer . parseInt ( st . nextToken ( ) ) ; int T = Integer . parseInt ( st . nextToken ( ) ) ; int time = N / X ; time *= T ; if ( N % X > 0 ) time += T ; System . out . println ( time ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int X = sc.nextInt(); \n int Y = sc.nextInt(); \n if (X != 1 && Y != 1) \n System.out.println(1); \n else if (X != 2 && Y != 2) \n System.out.println(2); \n else \n System.out.println(3); " ) ; Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( X != 1 && Y != 1 ) System . out . println ( 1 ) ; else if ( X != 2 && Y != 2 ) System . out . println ( 2 ) ; else System . out . println ( 3 ) ; } } +import java . util . * ; public class Main { 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 c = x . charAt ( 0 ) ; if ( c == '+' || c == '-' || c == '*' ) { int second = stack . pop ( ) ; int first = stack . pop ( ) ; if ( c == '+' ) { first += second ; } else if ( c == '-' ) { first -= second ; } else { first *= second ; } stack . push ( first ) ; } else { System . out . println ( " [LOG] Block: stack.push(Integer.parseInt(x)); " ) ; stack . push ( Integer . parseInt ( x ) ) ; } } System . out . println ( stack . pop ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int digitNum = ( int ) Math . log10 ( N ) + 1 ; int ans = 0 ; if ( digitNum == 6 ) { ans = 9 + 900 + 90000 ; } else if ( digitNum == 5 ) { ans = 9 + 900 + N - 10000 + 1 ; } else if ( digitNum == 4 ) { ans = 9 + 900 ; } else if ( digitNum == 3 ) { ans = 9 + N - 100 + 1 ; } else if ( digitNum == 2 ) { ans = 9 ; } else if ( digitNum == 1 ) { System . out . println ( " [LOG] Block: ans = N; " ) ; ans = N ; } System . out . println ( " " + ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] a ) { Scanner c = new Scanner ( System . in ) ; String s = c . next ( ) ; String t = c . next ( ) ; int b = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) != t.charAt(i)) \n b++; " ) ; if ( s . charAt ( i ) != t . charAt ( i ) ) b ++ ; } System . out . println ( b ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; 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 ) { System . out . println ( " [LOG] Block: result = \" No \" ; \n break; " ) ; result = " No " ; break ; } else { cantReducedAnyMore = true ; } } else if ( diff < - 1 ) { System . out . println ( " [LOG] Block: result = \" No \" ; \n break; " ) ; result = " No " ; break ; } previous = current ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long n = in . nextInt ( ) ; long sum = 0 ; for ( long i = 0 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: if (i % 3 != 0 && i % 5 != 0) \n sum += i; " ) ; if ( i % 3 != 0 && i % 5 != 0 ) sum += i ; } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { 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 ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } for ( int i = 0 ; i < S . length ( ) ; i ++ ) { String U = S . substring ( i , S . length ( ) ) + S . substring ( 0 , i ) ; if ( T . equals ( U ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int h = sc.nextInt(); \n int a = sc.nextInt(); \n int num = h / a; \n int amari = h % a; \n System.out.println(amari == 0 ? num : num + 1); " ) ; Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int num = h / a ; int amari = h % a ; System . out . println ( amari == 0 ? num : num + 1 ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String line = br.readLine(); \n line = line.trim(); \n String[] readLineArray = line.split( \" [ \\ s+] \" ); \n double r = Double.parseDouble(readLineArray[0]); \n double S = Math.PI * r * r; \n double L = 2 * Math.PI * r; \n System.out.printf( \" %.5f %.5f \" , S, L); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; line = line . trim ( ) ; String [ ] readLineArray = line . split ( " [ \\ s+] " ) ; double r = Double . parseDouble ( readLineArray [ 0 ] ) ; double S = Math . PI * r * r ; double L = 2 * Math . PI * r ; System . out . printf ( " %.5f %.5f " , S , L ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double a = sc.nextDouble(); \n double b = sc.nextDouble(); \n double h = sc.nextDouble(); \n double m = sc.nextDouble(); \n final double PI = Math.PI; \n double ht = ((h * 60 + m) / 720) * 2 * PI; \n double mt = (m / 60) * 2 * PI; \n double hx = a * Math.cos(ht); \n double hy = a * Math.sin(ht); \n double mx = b * Math.cos(mt); \n double my = b * Math.sin(mt); \n double dx = hx - mx; \n double dy = hy - my; \n double ans = Math.sqrt(dx * dx + dy * dy); \n System.out.printf( \" %.10f \" , ans); " ) ; Scanner sc = new Scanner ( System . in ) ; double a = 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 = a * Math . cos ( ht ) ; double hy = a * 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; int zone = scan . nextInt ( ) ; int pos = 0 ; int count = 1 ; for ( int i = 0 ; i < num ; i ++ ) { pos += scan . nextInt ( ) ; if ( pos <= zone ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String str = sc . next ( ) ; if ( n % 2 == 1 ) { System . out . println ( " No " ) ; return ; } else { System . out . println ( " [LOG] Block: String s_1 = str.substring(0, n / 2); \n String s_2 = str.substring(n / 2, n); \n if (s_1.equals(s_2)) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; String s_1 = str . substring ( 0 , n / 2 ) ; String s_2 = str . substring ( n / 2 , n ) ; if ( s_1 . equals ( s_2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BBounding solver = new BBounding ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BBounding { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long n = in . nextLong ( ) , x = in . nextLong ( ) ; long count = 1 , sum = 0 ; for ( long i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: long y = in.nextLong(); \n sum += y; \n if (sum <= x) \n count++; " ) ; long y = in . nextLong ( ) ; sum += y ; if ( sum <= x ) count ++ ; } out . println ( count ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] str ) { Scanner s = new Scanner ( System . in ) ; String s1 = s . next ( ) ; String s2 = s . next ( ) ; int n = s2 . length ( ) ; int i = 0 ; String res = s2 . substring ( i , n - 1 ) ; if ( res . equals ( s1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; List < Integer > H = new ArrayList < Integer > ( ) ; List < Integer > W = new ArrayList < Integer > ( ) ; int lastH = 0 ; int lastW = 0 ; do { lastH = stdIn . nextInt ( ) ; lastW = stdIn . nextInt ( ) ; H . add ( lastH ) ; W . add ( lastW ) ; } while ( lastH != 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 . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; boolean big = false ; for ( int i = 1 ; i < n . length ( ) ; i ++ ) { if ( n . charAt ( i ) > n . charAt ( 0 ) ) { big = true ; break ; } } String ans = " " ; if ( big ) { for ( int i = 0 ; i < n . length ( ) ; i ++ ) { ans += ( char ) ( n . charAt ( 0 ) + 1 ) ; } } else { for ( int i = 0 ; i < n . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: ans += n.charAt(0); " ) ; ans += n . charAt ( 0 ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int slen = s . length ; char [ ] t = sc . next ( ) . toCharArray ( ) ; int tlen = t . length ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < slen - tlen + 1 ; i ++ ) { int cnt = 0 ; for ( int j = 0 ; j < tlen ; j ++ ) { System . out . println ( " [LOG] Block: if (s[i + j] != t[j]) \n cnt++; " ) ; if ( s [ i + j ] != t [ j ] ) cnt ++ ; } if ( cnt < ans ) ans = cnt ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] array = new int [ 2 ] [ n ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { array [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] ans = new int [ 2 ] [ n ] ; ans [ 0 ] [ 0 ] = array [ 0 ] [ 0 ] ; for ( int i = 0 ; i < n - 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: ans[1][i] = Math.max(ans[0][i], ans[1][i - 1]) + array[1][i]; " ) ; ans [ 1 ] [ i ] = Math . max ( ans [ 0 ] [ i ] , ans [ 1 ] [ i - 1 ] ) + array [ 1 ] [ i ] ; } System . out . println ( ans [ 1 ] [ n - 1 ] ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AWeatherPrediction solver = new AWeatherPrediction ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AWeatherPrediction { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String x = in . next ( ) ; if ( x . compareTo ( " Sunny " ) == 0 ) { out . println ( " Cloudy " ) ; } else if ( x . compareTo ( " Cloudy " ) == 0 ) { out . println ( " Rainy " ) ; } else { out . println ( " Sunny " ) ; } } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: throw new RuntimeException(e); " ) ; throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n System.out.println(Math.max(Math.max(a, b), c) - Math.min(Math.min(a, b), c)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; } } +import java . util . Scanner ; public class Main { void run ( ) { Scanner scan = new Scanner ( System . in ) ; double r = scan . nextDouble ( ) ; System . out . printf ( " %f %f \n " , r * r * Math . PI , 2 * Math . PI * r ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { HashMap < String , String > map = new HashMap < String , String > ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String str = sc . nextLine ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: map.put(sc.nextLine(), \" \" ); " ) ; map . put ( sc . nextLine ( ) , " " ) ; } sc . close ( ) ; System . out . println ( map . size ( ) ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { for ( int j = 0 ; j < c . length ; j ++ ) { c [ j ] = s . charAt ( ( j + i ) % c . length ) ; } if ( String . valueOf ( c ) . equals ( t ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n sc.close(); \n return; " ) ; System . out . println ( " Yes " ) ; sc . close ( ) ; return ; } } System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; boolean ok = true ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i == a && s . charAt ( a ) != '-' ) { ok = false ; } if ( i != a && s . charAt ( i ) == '-' ) { ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n System.out.println(Math.max(Math.max(a + b, a - b), a * b)); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( Math . max ( Math . max ( a + b , a - b ) , a * b ) ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int total = 0 ; for ( int i = 1 ; i <= n ; 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 ) { System . out . println ( " [LOG] Block: total += i; " ) ; total += i ; } } System . out . println ( total ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n if (s.contains( \" 7 \" )) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . contains ( " 7 " ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { 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 num1 = Integer . parseInt ( result [ 0 ] ) ; int num2 = Integer . parseInt ( result [ 1 ] ) ; int num3 = Integer . parseInt ( result [ 2 ] ) ; if ( num1 < num2 ) { if ( num2 < num3 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N + 1 ] ; long [ ] B = new long [ N ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] > B [ i ] ) { sum += B [ i ] ; } else { System . out . println ( " [LOG] Block: sum += A[i]; \n long temp = A[i + 1]; \n A[i + 1] -= B[i] - A[i]; \n A[i + 1] = Math.max(A[i + 1], 0); \n sum += temp - A[i + 1]; " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; long total = 0 ; for ( int a = 1 ; a < k + 1 ; a ++ ) { for ( int b = 1 ; b < k + 1 ; b ++ ) { for ( int c = 1 ; c < k + 1 ; c ++ ) { total += gcd ( gcd ( a , b ) , c ) ; } } } System . out . println ( total ) ; } static int gcd ( int p , int q ) { System . out . println ( " [LOG] Block: if (p % q == 0) \n return q; \n return gcd(q, p % q); " ) ; if ( p % q == 0 ) return q ; return gcd ( q , p % q ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = a * b ; int d = a + b ; int e = a - b ; if ( c >= d && c >= e ) { System . out . println ( c ) ; } else if ( d >= c && d >= e ) { System . out . println ( d ) ; } else { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; String text = std . next ( ) ; String first = text . substring ( 0 , 2 ) ; String last = text . 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 ) { System . out . println ( " [LOG] Block: return val >= 1 && val <= 12; " ) ; return val >= 1 && val <= 12 ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int min = b ; int max = b ; long sum = b ; for ( int i = 0 ; i < a - 1 ; i ++ ) { int c = in . nextInt ( ) ; if ( min > c ) { min = c ; } if ( max < c ) { System . out . println ( " [LOG] Block: max = c; " ) ; max = c ; } sum += c ; } System . out . println ( min + " " + max + " " + sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int l = Integer.parseInt(scanner.next()); \n double x; \n x = (double) l / 3.0; \n System.out.println(Math.pow(x, 3)); " ) ; Scanner scanner = new Scanner ( System . in ) ; int l = Integer . parseInt ( scanner . next ( ) ) ; double x ; x = ( double ) l / 3.0 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } +import java . util . Scanner ; public class Main { static int [ ] [ ] p ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String[] wd = { \" SUN \" , \" MON \" , \" TUE \" , \" WED \" , \" THU \" , \" FRI \" , \" SAT \" } ; \n int i = 0; \n while (!wd[i].equals(s)) i += 1; \n int ans = 7 - i; \n System.out.println(ans); \n return; " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] wd = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; int i = 0 ; while ( ! wd [ i ] . equals ( s ) ) i += 1 ; int ans = 7 - i ; System . out . println ( ans ) ; return ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] vote = new String [ N ] ; int i = 0 ; while ( i < N ) { vote [ i ] = sc . next ( ) ; i ++ ; } Arrays . sort ( vote ) ; int maxCounter = 0 ; int [ ] a = new int [ N ] ; String [ ] b = new String [ N ] ; int j = 0 ; a [ 0 ] = 1 ; b [ 0 ] = vote [ 0 ] ; for ( i = 1 ; i < N ; 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 < N ; i ++ ) { if ( a [ i ] == maxCounter ) { System . out . println ( " [LOG] Block: System.out.println(b[i]); " ) ; System . out . println ( b [ i ] ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long year = 0 ; double kingaku = 100 ; do { System . out . println ( " [LOG] Block: kingaku = kingaku * 1.01; \n kingaku = Math.floor(kingaku); \n year++; " ) ; kingaku = kingaku * 1.01 ; kingaku = Math . floor ( kingaku ) ; year ++ ; } while ( kingaku < x ) ; System . out . println ( year ) ; } } +import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int val = 0 ; if ( N != 0 ) { System . out . println ( " [LOG] Block: val = (N / 500) * 1000; \n val += (N % 500) / 5 * 5; " ) ; val = ( N / 500 ) * 1000 ; val += ( N % 500 ) / 5 * 5 ; } System . out . println ( val ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n System.out.println((b - 1 + a - 2) / (a - 1)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( ( b - 1 + a - 2 ) / ( a - 1 ) ) ; } } +import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( a > b ) { ans += a ; a -- ; } else { ans += b ; b -- ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sn = new Scanner ( System . in ) ; long n = sn . nextLong ( ) ; long sum = 0 ; for ( long i = 1 ; i <= n ; i ++ ) { if ( ( i % 3 ) == 0 || ( i % 5 ) == 0 || ( i % 15 ) == 0 ) { } else { System . out . println ( " [LOG] Block: sum += i; " ) ; sum += i ; } } System . out . print ( sum ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; sc . nextLine ( ) ; final List < Integer > ls = new ArrayList < > ( ) ; int max = - 1 ; int maxId = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { final int l = sc . nextInt ( ) ; ls . add ( l ) ; if ( l > max ) { max = l ; maxId = i ; } } int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i == maxId ) { continue ; } sum += ls . get ( i ) ; } if ( max < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int H = sc.nextInt(); \n int A = sc.nextInt(); \n int hitNum = (int) Math.ceil((double) H / A); \n System.out.print(hitNum); " ) ; Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int hitNum = ( int ) Math . ceil ( ( double ) H / A ) ; System . out . print ( hitNum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int k = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; if ( a % k == 0 || b % k == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); " ) ; System . out . println ( " OK " ) ; } else { if ( b / k - a / k == 0 ) { System . out . println ( " NG " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); " ) ; System . out . println ( " OK " ) ; } } } } +import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { try ( Scanner sc = new Scanner ( System . in ) ) { int n = 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 ++ ) { System . out . println ( " [LOG] Block: list.add(Integer.parseInt(b[i])); " ) ; list . add ( Integer . parseInt ( b [ i ] ) ) ; } Collections . sort ( list ) ; System . out . println ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = 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 >= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = 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 ( h <= attack ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scn = new Scanner(System.in); \n int l = scn.nextInt(); \n float temp = (float) l / 3; \n BigDecimal b1 = new BigDecimal(temp); \n b1 = b1.multiply(new BigDecimal(temp)); \n b1 = b1.multiply(new BigDecimal(temp)); \n System.out.println(b1); " ) ; Scanner scn = new Scanner ( System . in ) ; int l = scn . nextInt ( ) ; float temp = ( float ) l / 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int sum = N / 1000 ; if ( N % 1000 == 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( " [LOG] Block: sum += 1; \n int goukei = (1000 * sum) - N; \n System.out.println(goukei); " ) ; sum += 1 ; int goukei = ( 1000 * sum ) - N ; System . out . println ( goukei ) ; } } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i , 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 ( i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; s = s + a [ i ] ; } 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int N ; int [ ] [ ] D ; Main ( Scanner sc ) { this . sc = sc ; this . N = sc . nextInt ( ) ; this . D = new int [ N ] [ 2 ] ; for ( int i = 0 ; i < N ; 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 < N - 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 ( " [LOG] Block: System.out.println(answer); " ) ; System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = 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 < n ; 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 . println ( " [LOG] Block: System.out.print(words[ans[i]]); " ) ; System . out . print ( words [ ans [ i ] ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int K = 0 ; int check = 0 ; if ( ( A + B ) % 2 == 0 ) { K = ( Math . abs ( A ) + Math . abs ( B ) ) / 2 ; check ++ ; } if ( check == 0 ) { System . out . println ( " IMPOSSIBLE " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(K); " ) ; System . out . println ( K ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long C = sc . nextLong ( ) ; long D = sc . nextLong ( ) ; System . out . println ( count ( B , C , D ) - count ( A - 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 ) { System . out . println ( " [LOG] Block: return x - x / c - x / d + x / lcm(c, d); " ) ; return x - x / c - x / d + x / lcm ( c , d ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( ( s . charAt ( 0 ) == s . charAt ( 1 ) ) || ( s . charAt ( 1 ) == s . charAt ( 2 ) ) || ( s . charAt ( 2 ) == s . charAt ( 3 ) ) ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Good \" ); " ) ; System . out . println ( " Good " ) ; } } } +import java . util . * ; class Main { 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 i = 0 ; i < 4 ; i ++ ) { if ( map . containsKey ( s [ i ] ) ) { map . put ( s [ i ] , map . get ( s [ i ] ) + 1 ) ; } else { map . put ( s [ i ] , 1 ) ; } } String ans = " Yes " ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( map . get ( s [ i ] ) == 2 ) { continue ; } else { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } System . out . println ( ans ) ; } } +import java . util . * ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double L = sc.nextDouble(); \n double a = L / 3; \n double b = a * a * a; \n System.out.println(BigDecimal.valueOf(a * a * a).toPlainString()); " ) ; Scanner sc = new Scanner ( System . in ) ; double L = sc . nextDouble ( ) ; double a = L / 3 ; double b = a * a * a ; System . out . println ( BigDecimal . valueOf ( a * a * a ) . toPlainString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; long [ ] dp = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; dp [ i ] = 9223372036854775807l ; } dp [ 0 ] = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int m = 1 ; m < k + 1 ; m ++ ) { System . out . println ( " [LOG] Block: if (i >= m) \n dp[i] = Math.min(dp[i], dp[i - m] + Math.abs(h[i] - h[i - m])); " ) ; if ( i >= m ) dp [ i ] = Math . min ( dp [ i ] , dp [ i - m ] + Math . abs ( h [ i ] - h [ i - m ] ) ) ; } } System . out . println ( dp [ n - 1 ] ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; final Solver solver = new Solver ( ) ; solver . solve ( N , S ) ; } } class Solver { public void solve ( int N , String S ) { int ans = 0 ; int cur = 'A' ; for ( int i = 0 ; i < N ; i ++ ) { char c = S . charAt ( i ) ; if ( cur == c ) { cur ++ ; if ( cur > 'C' ) { ans ++ ; cur = 'A' ; } } else { System . out . println ( " [LOG] Block: cur = (c == 'A') ? 'B' : 'A'; " ) ; cur = ( c == 'A' ) ? 'B' : 'A' ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; char [ ] c = S . toCharArray ( ) ; int ans = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( c [ i ] == '+' ) { ans ++ ; } else { System . out . println ( " [LOG] Block: ans--; " ) ; ans -- ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { 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 ans = 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 ] ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int n = scanner . nextInt ( ) ; Point currentPoint = new Point ( 0 , 0 ) ; for ( int i = 0 ; i < n ; 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 Point { int x ; int y ; Point ( final int x , final int y ) { System . out . println ( " [LOG] Block: this.x = x; \n this.y = y; " ) ; this . x = x ; this . y = y ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; String t = sb . append ( s ) . 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int n = a . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = a . nextInt ( ) ; } int flag = 1 ; int count = 0 ; while ( flag == 1 ) { flag = 0 ; for ( int i = n - 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 < n ; i ++ ) { System . out . print ( A [ i ] ) ; if ( i < n - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String W = sc . next ( ) . toLowerCase ( ) ; String T ; int count = 0 ; while ( ! ( T = sc . next ( ) ) . equals ( " END_OF_TEXT " ) ) { if ( T . toLowerCase ( ) . equals ( W ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } sc . close ( ) ; System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < W ; i ++ ) { System . out . println ( " [LOG] Block: System.out.printf( \" # \" ); " ) ; System . out . printf ( " # " ) ; } System . out . printf ( " %n " ) ; for ( int i = 0 ; i < H - 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 . println ( " [LOG] Block: System.out.printf( \" # \" ); " ) ; System . out . printf ( " # " ) ; } System . out . printf ( " %n%n " ) ; } } } +import java . util . Scanner ; public class Main { 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 nn = Integer . parseInt ( n ) ; int xx = Integer . parseInt ( x ) ; int tt = Integer . parseInt ( t ) ; int times ; if ( nn % xx == 0 ) { times = nn / xx ; } else { System . out . println ( " [LOG] Block: times = (nn / xx) + 1; " ) ; times = ( nn / xx ) + 1 ; } int answer = tt * times ; System . out . println ( answer ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } double c = 0 ; Arrays . sort ( A ) ; c = ( A [ 0 ] + A [ 1 ] ) / 2.0 ; for ( int i = 2 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: c = (c + A[i]) / 2.0; " ) ; c = ( c + A [ i ] ) / 2.0 ; } System . out . println ( c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; char [ ] ca = str . toCharArray ( ) ; for ( int i = 0 ; i < ca . length ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(ca[ca.length - 1 - i]); " ) ; System . out . print ( ca [ ca . length - 1 - i ] ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long H = sc . nextLong ( ) ; int i = 0 ; for ( i = 1 ; H > 1 ; i ++ ) { System . out . println ( " [LOG] Block: H = H / 2; " ) ; H = H / 2 ; } System . out . println ( ( long ) ( Math . pow ( 2 , i - 1 ) + Math . pow ( 2 , i - 1 ) - 1 ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; if ( A [ 0 ] == A [ 1 ] && A [ 1 ] == 5 && A [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int index = - 1 ; String [ ] ss = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ; for ( int i = 0 ; i < ss . length ; i ++ ) { if ( ss [ i ] . equals ( s ) ) { System . out . println ( " [LOG] Block: index = i; " ) ; index = i ; } } System . out . println ( 7 - index ) ; } } +import java . util . * ; import java . text . * ; public class Main { 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 result = formatDate2 . after ( formatDate ) ; if ( ! result ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Heisei \" ); " ) ; System . out . println ( " Heisei " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flg = true ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( a % 2 == 0 ) { if ( ! ( a % 3 == 0 || a % 5 == 0 ) ) { System . out . println ( " [LOG] Block: flg = false; " ) ; flg = false ; } } } System . out . println ( flg ? " APPROVED " : " DENIED " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String word = sc . next ( ) ; char [ ] wordStr = word . toCharArray ( ) ; if ( wordStr [ 2 ] != wordStr [ 3 ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } if ( wordStr [ 4 ] != wordStr [ 5 ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] line1 = line . split ( " " ) ; int n = Integer . parseInt ( line1 [ 0 ] ) ; int k = Integer . parseInt ( line1 [ 1 ] ) ; int q = Integer . parseInt ( line1 [ 2 ] ) ; int [ ] ary = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ary [ i ] = k - q ; for ( int i = 0 ; i < q ; i ++ ) { int a = sc . nextInt ( ) ; ary [ a - 1 ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (ary[i] <= 0) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; if ( ary [ i ] <= 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; sc . close ( ) ; if ( Y % 2 == 1 ) { System . out . println ( " No " ) ; return ; } double ans = Y / 2 - X ; if ( ans < 0 || ans > X || ans % 1 != 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = 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 < n ; i ++ ) { value = input . readLine ( ) ; if ( set . contains ( value ) || lastChar != value . charAt ( 0 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } set . add ( value ) ; lastChar = value . charAt ( value . length ( ) - 1 ) ; } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; 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 i = 0 ; i < 4 ; i ++ ) { System . out . println ( " [LOG] Block: String keyword = keywords[i]; \n String ts = s.replaceAll(keyword, \" \" ); \n if (s.length() > ts.length()) \n queue.add(ts); " ) ; String keyword = keywords [ i ] ; String ts = s . replaceAll ( keyword , " " ) ; if ( s . length ( ) > ts . length ( ) ) queue . add ( ts ) ; } } System . out . println ( " NO " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long cnt = n / (a + b) * a; \n n %= (a + b); \n cnt += Math.min(a, n); \n System.out.println(cnt); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long cnt = n / ( a + b ) * a ; n %= ( a + b ) ; cnt += Math . min ( a , n ) ; System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { ( new Main ( ) ) . execute ( ) ; } public void execute ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] p = new int [ N + 1 ] ; int ngPos = 0 ; int ngNum = 0 ; int changeCount = 0 ; boolean ok = true ; for ( int i = 1 ; i <= N ; 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: char ss = s.charAt(i); \n char tt = t.charAt(i); \n if (ss != tt) \n count++; " ) ; char ss = s . charAt ( i ) ; char tt = t . charAt ( i ) ; if ( ss != tt ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int m = sc.nextInt(); \n sc.close(); \n int answer = 0; \n answer += (n * (n - 1)) / 2; \n answer += (m * (m - 1)) / 2; \n System.out.println(answer); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; int answer = 0 ; answer += ( n * ( n - 1 ) ) / 2 ; answer += ( m * ( m - 1 ) ) / 2 ; System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double w = sc.nextDouble(); \n double h = sc.nextDouble(); \n double x = sc.nextDouble(); \n double y = sc.nextDouble(); \n System.out.print(h * w / 2.0); \n System.out.print( \" \" ); \n if (x == w / 2.0 && y == h / 2.0) \n System.out.print(1); \n else \n System.out.print(0); " ) ; Scanner sc = new Scanner ( System . in ) ; double w = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; double y = sc . nextDouble ( ) ; System . out . print ( h * w / 2.0 ) ; System . out . print ( " " ) ; if ( x == w / 2.0 && y == h / 2.0 ) System . out . print ( 1 ) ; else System . out . print ( 0 ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a < 10 && b < 10 ) { System . out . println ( a * b ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static int eukleides ( int a , int b ) { if ( b % a == 0 ) { return a ; } int mod = b % a ; return eukleides ( mod , 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 ( " [LOG] Block: System.out.println(i); \n break; " ) ; System . out . println ( i ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { char c = s [ i ] ; if ( i % 2 == 0 ) { if ( c == '0' ) a ++ ; else b ++ ; } else { System . out . println ( " [LOG] Block: if (c == '1') \n a++; \n else \n b++; " ) ; if ( c == '1' ) a ++ ; else b ++ ; } } System . out . println ( Math . min ( a , b ) ) ; } } +import java . util . StringTokenizer ; public class Main { 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 p = Integer . parseInt ( st . nextToken ( ) ) + Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( ( int ) Math . log10 ( p ) + 1 ) ; s = in . readLine ( ) ; } } catch ( Exception ex ) { System . out . println ( " [LOG] Block: System.exit(0); " ) ; System . exit ( 0 ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long c = sc.nextLong(); \n long d = sc.nextLong(); \n long ans1 = Math.max(a, b) * Math.max(c, d); \n long ans2 = Math.min(a, b) * Math.max(c, d); \n long ans3 = Math.max(a, b) * Math.min(c, d); \n long ans4 = Math.min(a, b) * Math.min(c, d); \n long ans = Math.max(ans1, Math.max(ans2, Math.max(ans3, ans4))); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long ans1 = Math . max ( a , b ) * Math . max ( c , d ) ; long ans2 = Math . min ( a , b ) * Math . max ( c , d ) ; long ans3 = Math . max ( a , b ) * Math . min ( c , d ) ; long ans4 = Math . min ( a , b ) * Math . min ( c , d ) ; long ans = Math . max ( ans1 , Math . max ( ans2 , Math . max ( ans3 , ans4 ) ) ) ; System . out . println ( ans ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] x ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n short a = sc.nextShort(); \n System.out.println(a + a * a + a * a * a); " ) ; Scanner sc = new Scanner ( System . in ) ; short a = sc . nextShort ( ) ; System . out . println ( a + a * a + a * a * a ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AStationAndBus solver = new AStationAndBus ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AStationAndBus { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String x = in . next ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( x . charAt ( i ) != x . charAt ( ( i + 1 ) % 3 ) ) { out . println ( " Yes " ) ; return ; } } out . println ( " No " ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: throw new RuntimeException(e); " ) ; throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } } } +import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n String[] a = new String[n]; \n for (int i = 0; i < n; i++) a[i] = sc.next(); \n Set<String> s = new HashSet<>(); \n for (String x : a) s.add(x); \n System.out.println(s.size()); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] a = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . next ( ) ; Set < String > s = new HashSet < > ( ) ; for ( String x : a ) s . add ( x ) ; System . out . println ( s . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; String S = scan . next ( ) ; int x = S . length ( ) ; if ( x > K ) { String ans = S . substring ( 0 , K ) ; System . out . println ( ans + " ... " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(S); " ) ; System . out . println ( S ) ; } } } +import java . util . Scanner ; public class Main { static boolean solve ( int d , int t , int s ) { if ( s * t >= d ) return true ; else return false ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n int d, t, s; \n d = stdIn.nextInt(); \n t = stdIn.nextInt(); \n s = stdIn.nextInt(); \n boolean result = solve(d, t, s); \n if (result) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); \n stdIn.close(); " ) ; Scanner stdIn = new Scanner ( System . in ) ; int d , t , s ; d = stdIn . nextInt ( ) ; t = stdIn . nextInt ( ) ; s = stdIn . nextInt ( ) ; boolean result = solve ( d , t , s ) ; if ( result ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; stdIn . close ( ) ; } } +import java . util . Scanner ; public class Main { static int count = 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 , count ) - 1 ) ; } public static void test ( long hp ) { System . out . println ( " [LOG] Block: hp = hp / 2; \n if (hp == 0) \n return; \n count++; \n test(hp); " ) ; hp = hp / 2 ; if ( hp == 0 ) return ; count ++ ; test ( hp ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long x = scan . nextInt ( ) ; long y = scan . nextInt ( ) ; scan . close ( ) ; if ( x < y ) { long tmp = y ; y = x ; x = tmp ; } long ans = ( x * y ) / gcd ( x , y ) ; System . out . println ( ans ) ; } static long gcd ( long x , long y ) { System . out . println ( " [LOG] Block: if (x % y == 0) \n return y; \n else \n return gcd(y, x % y); " ) ; if ( x % y == 0 ) return y ; else return gcd ( y , x % y ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner input = new Scanner(System.in); \n int x = input.nextInt(); \n int h = (x / 500) * 1000; \n int f = ((x % 500) / 5) * 5; \n System.out.println(h + f); " ) ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; int h = ( x / 500 ) * 1000 ; int f = ( ( x % 500 ) / 5 ) * 5 ; System . out . println ( h + f ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n double n = scanner.nextDouble(); \n System.out.println(String.format( \" %.6f \" , Math.pow(n / 3, 3))); " ) ; Scanner scanner = new Scanner ( System . in ) ; double n = scanner . nextDouble ( ) ; System . out . println ( String . format ( " %.6f " , Math . pow ( n / 3 , 3 ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; String answer = " " ; String input = scan . next ( ) ; int len = input . length ( ) ; for ( int i = 0 ; i < len ; 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 ) { System . out . println ( " [LOG] Block: answer = answer.substring(0, answer.length() - 1); " ) ; answer = answer . substring ( 0 , answer . length ( ) - 1 ) ; } break ; } } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n double R = scan.nextDouble(); \n scan.close(); \n System.out.println(2 * R * Math.PI); " ) ; Scanner scan = new Scanner ( System . in ) ; double R = scan . nextDouble ( ) ; scan . close ( ) ; System . out . println ( 2 * R * Math . PI ) ; } } +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 Main { 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 min = 0 ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: min += P[i]; " ) ; min += P [ i ] ; } System . out . println ( min ) ; } } +import java . util . * ; import java . io . * ; class Main { static int n , 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 ( ) , " " ) ; n = Integer . parseInt ( tok . nextToken ( ) ) ; k = Integer . parseInt ( tok . nextToken ( ) ) ; arr = new int [ n ] ; tok = new StringTokenizer ( br . readLine ( ) , " " ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( tok . nextToken ( ) ) ; } dp = new long [ n ] ; 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 < n ; i ++ ) { long temp = Integer . MAX_VALUE ; for ( int j = i - k ; j < i ; j ++ ) { if ( j >= 0 ) { System . out . println ( " [LOG] Block: temp = Math.min(temp, dp[j] + Math.abs(arr[i] - arr[j])); " ) ; temp = Math . min ( temp , dp [ j ] + Math . abs ( arr [ i ] - arr [ j ] ) ) ; } } dp [ i ] = temp ; } return dp [ dp . length - 1 ] ; } } +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 Main { static String a ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; } show ( a , n ) ; insertionSort ( a , n ) ; } static void show ( int [ ] a , int n ) { System . out . print ( a [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { System . out . print ( " " + a [ i ] ) ; } System . out . println ( ) ; } static void insertionSort ( int [ ] a , int n ) { for ( int i = 1 ; i < n ; i ++ ) { int v = a [ i ] ; int j = i - 1 ; while ( j >= 0 && a [ j ] > v ) { System . out . println ( " [LOG] Block: a[j + 1] = a[j]; \n j--; " ) ; a [ j + 1 ] = a [ j ] ; j -- ; } a [ j + 1 ] = v ; show ( a , n ) ; } } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; HashMap < String , Long > map = new HashMap < > ( ) ; for ( int i = 0 ; i < a ; 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 ( ) ) { System . out . println ( " [LOG] Block: count = count + (l * (l - 1) / 2); " ) ; count = count + ( l * ( l - 1 ) / 2 ) ; } System . out . print ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { long a = sc . nextLong ( ) ; long a1 = a ; long b = sc . nextLong ( ) ; long b1 = b ; long i ; if ( a > b ) { for ( ; ; ) { if ( a1 % b == 0 ) { break ; } a1 += a ; } if ( a % b == 0 ) { System . out . println ( b + " " + a1 ) ; } else { for ( i = b / 2 ; i > 0 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { break ; } } System . out . println ( i + " " + a1 ) ; } } else if ( a < b ) { for ( ; ; ) { if ( b1 % a == 0 ) { break ; } b1 += b ; } if ( b % a == 0 ) { System . out . println ( a + " " + b1 ) ; } else { for ( i = a / 2 ; i > 0 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { break ; } } System . out . println ( i + " " + b1 ) ; } } else { System . out . println ( " [LOG] Block: System.out.println(b + \" \" + b1); " ) ; System . out . println ( b + " " + b1 ) ; } } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AHarmonyABC135 solver = new AHarmonyABC135 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AHarmonyABC135 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: int a = in.nextInt(); \n int b = in.nextInt(); \n if (a == b) \n out.println(0); \n else if ((a + b) % 2 == 1) \n out.println( \" IMPOSSIBLE \" ); \n else \n out.println((a + b) / 2); " ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; if ( a == b ) out . println ( 0 ) ; else if ( ( a + b ) % 2 == 1 ) out . println ( " IMPOSSIBLE " ) ; else out . println ( ( a + b ) / 2 ) ; } } } +import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int count = 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 ( ) ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; long K = 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 >= K ) { int cnt1 = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( num [ i ] == 1 ) { cnt1 ++ ; } else { break ; } } if ( cnt1 >= K ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } } long cnt = 1 ; int ans = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( num [ i ] != 1 ) { System . out . println ( " [LOG] Block: ans = num[i]; \n break; " ) ; ans = num [ i ] ; break ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , hozon ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a > b ) { hozon = a ; a = b ; b = hozon ; } if ( b > c ) { hozon = b ; b = c ; c = hozon ; } if ( a > b ) { hozon = a ; a = b ; b = hozon ; } System . out . println ( a + " " + b + " " + c ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Main obj = new Main(); \n obj.solve(); " ) ; Main obj = new Main ( ) ; obj . solve ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int [ ] dp = new int [ n ] ; for ( int i = 0 ; i < n ; 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 [ n - 1 ] ) ; } } public static int mindp ( int a , int b ) { if ( a > b ) { System . out . println ( " [LOG] Block: a = b; " ) ; a = b ; } return a ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . lang . Exception ; import java . lang . Integer ; import java . lang . System ; public class Main { public static void main ( String [ ] a ) throws Exception { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int week ; double total ; while ( ( s = r . readLine ( ) ) != null ) { week = Integer . parseInt ( s ) ; total = 100000 ; for ( int i = 0 ; i < week ; i ++ ) { System . out . println ( " [LOG] Block: total *= 1.05; \n total /= 1000; \n total = Math.ceil(total) * 1000; " ) ; total *= 1.05 ; total /= 1000 ; total = Math . ceil ( total ) * 1000 ; } System . out . printf ( " %.0f \n " , total ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] w = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } int min = 1000000000 ; for ( int i = 0 ; i < n ; i ++ ) { int s1 = 0 ; int s2 = 0 ; for ( int j = 0 ; j <= i ; j ++ ) { s1 += w [ j ] ; } for ( int k = i + 1 ; k <= n - 1 ; k ++ ) { s2 += w [ k ] ; } int minTemp = Math . abs ( s1 - s2 ) ; if ( minTemp < min ) { System . out . println ( " [LOG] Block: min = minTemp; " ) ; min = minTemp ; } } System . out . println ( min ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long x = Integer . parseInt ( sc . next ( ) ) ; long y = Integer . parseInt ( sc . next ( ) ) ; if ( Math . sqrt ( x * x + y * y ) <= d ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long H = Long . parseLong ( s . next ( ) ) ; System . out . println ( atack ( H ) ) ; } static long atack ( long h ) { if ( h == 1 ) { System . out . println ( " [LOG] Block: return 1; " ) ; return 1 ; } return atack ( h / 2 ) * 2 + 1 ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String [ ] oneline = line . split ( " " ) ; int [ ] data = { 0 , 0 } ; for ( int i = 0 ; i < oneline . length ; i ++ ) { System . out . println ( " [LOG] Block: data[i] = Integer.parseInt(oneline[i]); " ) ; data [ i ] = Integer . parseInt ( oneline [ i ] ) ; } int area = data [ 0 ] * data [ 1 ] ; int length = 2 * ( data [ 0 ] + data [ 1 ] ) ; System . out . println ( area + " " + length ) ; } } +import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int N = gi ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = gi ( ) ; } int max = 0 ; int t = 0 ; for ( int i = 0 ; i < N ; 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 ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(scanner.next()); " ) ; return Double . parseDouble ( scanner . next ( ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; long n = sc . nextLong ( ) ; int m = sc . nextInt ( ) ; long sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) sum += sc . nextLong ( ) ; System . out . println ( ( sum <= n ) ? n - sum : " -1 " ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int N = Integer . parseInt ( str [ 0 ] ) ; int M = Integer . parseInt ( str [ 1 ] ) ; 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 . println ( " [LOG] Block: System.out.print(0); " ) ; System . out . print ( 0 ) ; } } } +import java . util . Scanner ; public class Main { static int N ; static int [ ] w ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; N = scanner . nextInt ( ) ; w = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { w [ i ] = scanner . nextInt ( ) ; } scanner . close ( ) ; int ans = Integer . MAX_VALUE ; int s1 = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { int s2 = 0 ; for ( int j = N - 1 ; i + 1 <= j ; j -- ) { System . out . println ( " [LOG] Block: s2 += w[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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; int result = 0 ; for ( int i = 2 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: result = s.charAt(i) == 'C' && s.charAt(i - 1) == 'B' && s.charAt(i - 2) == 'A' ? result + 1 : result; " ) ; 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 . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] str2 = str . 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 . out . println ( " [LOG] Block: System.err.println(e.toString()); " ) ; System . err . println ( e . toString ( ) ) ; } } } +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 Main { 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 x = Integer . parseInt ( line ) ; StringTokenizer tokens ; for ( int i = 0 ; i < x ; 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 ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } } } +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 Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int x = in . nextInt ( ) ; int r = solve ( x ) ; System . out . println ( r ) ; } private static int solve ( int x ) { if ( x == 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 ) { System . out . println ( " [LOG] Block: s[sm] = i; \n sm++; \n if (i >= x) \n return i; " ) ; s [ sm ] = i ; sm ++ ; if ( i >= x ) return i ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int n = scan . nextInt ( ) ; if ( n == 0 ) { break ; } double [ ] s = new double [ n ] ; int i = 0 ; double sum = 0 ; double sumHensa = 0 ; double ans = 0 ; for ( i = 0 ; i < n ; i ++ ) { s [ i ] = scan . nextDouble ( ) ; sum += s [ i ] ; } double average = ( double ) sum / n ; for ( i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: sumHensa += (s[i] - average) * (s[i] - average); " ) ; sumHensa += ( s [ i ] - average ) * ( s [ i ] - average ) ; } ans = Math . sqrt ( ( double ) sumHensa / n ) ; System . out . println ( ans ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; import java . util . Deque ; import java . util . ArrayDeque ; class Main { 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 a , b ; for ( int i = 0 ; i < line . length ; i ++ ) { System . out . println ( " [LOG] Block: switch(line[i]) { \n case \" + \" : \n a = stack.pollLast(); \n b = stack.pollLast(); \n stack.offer(b + a); \n break; \n case \" - \" : \n a = stack.pollLast(); \n b = stack.pollLast(); \n stack.offer(b - a); \n break; \n case \" * \" : \n a = stack.pollLast(); \n b = stack.pollLast(); \n stack.offer(b * a); \n break; \n default: \n stack.offer(Integer.parseInt(line[i])); \n break; \n } " ) ; switch ( line [ i ] ) { case " + " : a = stack . pollLast ( ) ; b = stack . pollLast ( ) ; stack . offer ( b + a ) ; break ; case " - " : a = stack . pollLast ( ) ; b = stack . pollLast ( ) ; stack . offer ( b - a ) ; break ; case " * " : a = stack . pollLast ( ) ; b = stack . pollLast ( ) ; stack . offer ( b * a ) ; break ; default : stack . offer ( Integer . parseInt ( line [ i ] ) ) ; break ; } } System . out . println ( stack . poll ( ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } long ans = 0 ; for ( int j = 0 ; j < n ; j ++ ) { System . out . println ( " [LOG] Block: int x = Math.min(a[j], b[j]); \n ans += x; \n b[j] -= x; \n int y = Math.min(a[j + 1], b[j]); \n ans += y; \n a[j + 1] -= y; " ) ; 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 . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; long sum = 0 , left = 0 ; int [ ] A = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; sum += A [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp >= A [ i ] ) { System . out . println ( " [LOG] Block: temp -= A[i]; \n if (A[i + 1] > temp) \n A[i + 1] -= temp; \n else \n A[i + 1] = 0; \n A[i] = 0; " ) ; 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 <= N ; i ++ ) left += A [ i ] ; System . out . println ( sum - left ) ; } } +import java . util . Scanner ; public class Main { public static String check ( int x , int y ) { return " " ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int count = 0 ; int vit = 0 ; while ( n -- != 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; public class Main { public static void main ( String [ ] arg ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; String [ ] spl = str . 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 ( " [LOG] Block: System.out.println( \" a < b \" ); " ) ; System . out . println ( " a < b " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; 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 ++ ) { System . out . println ( " [LOG] Block: hh += 0.5; \n mm += 6; " ) ; hh += 0.5 ; mm += 6 ; } hh = hh % 360 ; mm = mm % 360 ; rad = Math . abs ( hh - mm ) ; len = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( rad ) ) ) ; System . out . println ( len ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; int n = 0 ; for ( int i = Math . max ( a , b ) ; i >= 1 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { System . out . println ( " [LOG] Block: count++; \n n = i; \n if (count >= k) \n break; " ) ; count ++ ; n = i ; if ( count >= k ) break ; } } System . out . println ( n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] result = new int [ n ] ; for ( int i = 1 ; sc . hasNextInt ( ) ; i ++ ) { result [ sc . nextInt ( ) - 1 ] = i ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { sb . append ( result [ i ] ) ; if ( i != n ) { sb . append ( " " ) ; } else { System . out . println ( " [LOG] Block: sb.append( \" \n \" ); " ) ; sb . append ( " \n " ) ; } } System . out . println ( sb . toString ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = 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 ++ ) { H -= A [ i ] ; } if ( H <= 0 ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] s = new int [ n ] ; s [ 2 ] = n % 10 ; n /= 10 ; s [ 1 ] = n % 10 ; n /= 10 ; s [ 0 ] = n % 10 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] == 1 ) { s [ i ] = 9 ; } else { System . out . println ( " [LOG] Block: s[i] = 1; " ) ; s [ i ] = 1 ; } } int goal = 100 * s [ 0 ] + 10 * s [ 1 ] + s [ 2 ] ; System . out . println ( goal ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] A = new int [ M ] ; int left = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( sc . nextInt ( ) < X ) { System . out . println ( " [LOG] Block: left++; " ) ; left ++ ; } } System . out . println ( Math . min ( left , M - left ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String alpha = " abcdefghijklmnopqrstuvwxyz " ; String target = sc . next ( ) ; for ( int i = 0 ; i <= 24 ; i ++ ) { if ( String . valueOf ( alpha . charAt ( i ) ) . equals ( target ) ) { System . out . println ( " [LOG] Block: System.out.println(alpha.charAt(i + 1)); " ) ; System . out . println ( alpha . charAt ( i + 1 ) ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String day = sc.next(); \n int i = 0; \n switch(day) { \n case \" SUN \" : \n i = 7; \n break; \n case \" MON \" : \n i = 6; \n break; \n case \" TUE \" : \n i = 5; \n break; \n case \" WED \" : \n i = 4; \n break; \n case \" THU \" : \n i = 3; \n break; \n case \" FRI \" : \n i = 2; \n break; \n case \" SAT \" : \n i = 1; \n break; \n } \n System.out.println(i); " ) ; Scanner sc = new Scanner ( System . in ) ; String day = sc . next ( ) ; int i = 0 ; switch ( day ) { case " SUN " : i = 7 ; break ; case " MON " : i = 6 ; break ; case " TUE " : i = 5 ; break ; case " WED " : i = 4 ; break ; case " THU " : i = 3 ; break ; case " FRI " : i = 2 ; break ; case " SAT " : i = 1 ; break ; } System . out . println ( i ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = a ; i <= b ; i ++ ) { System . out . println ( " [LOG] Block: String as = Integer.toString(i); \n List<String> list = Arrays.asList(Integer.toString(i).split( \" \" )); \n Collections.reverse(list); \n String[] bs = (String[]) list.toArray(new String[list.size()]); \n String strb = String.join( \" \" , bs); \n if (as.equals(strb)) \n ans++; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; System . out . println ( sln ( k , s ) ) ; } public static String sln ( int k , String s ) { System . out . println ( " [LOG] Block: String res = s.substring(0, k - 1) + (s.charAt(k - 1) + \" \" ).toLowerCase() + s.substring(k); \n return res; " ) ; String res = s . substring ( 0 , k - 1 ) + ( s . charAt ( k - 1 ) + " " ) . toLowerCase ( ) + s . substring ( k ) ; return res ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int count = 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 ) { count ++ ; } else { if ( maxCount < count ) { System . out . println ( " [LOG] Block: maxCount = count; " ) ; maxCount = count ; } count = 0 ; } actual = siguiente ; } if ( maxCount < count ) { System . out . println ( " [LOG] Block: maxCount = count; " ) ; maxCount = count ; } System . out . println ( maxCount ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ! ( e - a > k ) ) { System . out . print ( " Yay! " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" :( \" ); " ) ; System . out . print ( " :( " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int A = 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 , A + 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 * A , nokori * C * 2 ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(price + Math.min(nokori * B, nokori * C * 2)); " ) ; System . out . println ( price + Math . min ( nokori * B , nokori * C * 2 ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) a [ i ] = sc . nextInt ( ) ; sc . close ( ) ; String [ ] ans = { " YES " , " NO " } ; int an = 0 ; Arrays . sort ( a ) ; int t = a [ 0 ] ; for ( int i = 1 ; i < n ; ++ i ) { if ( t == a [ i ] ) { System . out . println ( " [LOG] Block: an = 1; \n break; " ) ; an = 1 ; break ; } t = a [ i ] ; } System . out . println ( ans [ an ] ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) for ( int j = 0 ; j < 3 ; j ++ ) a [ i ] [ j ] = sc . nextInt ( ) ; int _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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int friends = sc . nextInt ( ) ; int height = sc . nextInt ( ) ; int [ ] fh = new int [ friends ] ; int count = 0 ; for ( int i = 0 ; i < friends ; i ++ ) { fh [ i ] = sc . nextInt ( ) ; if ( fh [ i ] >= height ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . * ; import java . util . * ; public class Main { static long mod = ( 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 Reader { 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 { System . out . println ( " [LOG] Block: return Double.parseDouble(next()); " ) ; return Double . parseDouble ( next ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int ans = solve ( S ) ; System . out . println ( ans ) ; } private static int solve ( String s ) { int ans = 0 ; char [ ] sn = s . toCharArray ( ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( sn [ i - 1 ] == sn [ i ] ) { System . out . println ( " [LOG] Block: ans++; \n sn[i] = sn[i] == '0' ? '1' : '0'; " ) ; ans ++ ; sn [ i ] = sn [ i ] == '0' ? '1' : '0' ; } } return ans ; } } +import java . util . Scanner ; public class Main { 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 cou = 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 ) ) ) { cou ++ ; } } } } if ( cou > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int end = l + n - 1 ; int sum ; if ( l >= 0 ) { sum = ( l + 1 + end ) * ( n - 1 ) / 2 ; } else if ( end > 0 ) { sum = ( l + end ) * n / 2 ; } else { System . out . println ( " [LOG] Block: sum = (l + end - 1) * (n - 1) / 2; " ) ; sum = ( l + end - 1 ) * ( n - 1 ) / 2 ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; import java . util . Map ; import java . util . TreeMap ; import java . util . Iterator ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; TreeMap < String , Integer > S = new TreeMap < String , Integer > ( ) ; String tmp ; int max = 1 ; int count ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(result); " ) ; System . out . println ( result ) ; } } } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] w = new String [ n ] ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { w [ i ] = sc . next ( ) ; set . add ( w [ i ] ) ; } for ( int i = 1 ; i < n ; i ++ ) { if ( w [ i ] . charAt ( 0 ) != w [ i - 1 ] . charAt ( w [ i - 1 ] . length ( ) - 1 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( ( set . size ( ) == n ) ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; String r = " " ; for ( char c : n . toCharArray ( ) ) { r += solve ( c ) ; } System . out . print ( r ) ; } static char solve ( char c ) { System . out . println ( " [LOG] Block: switch(c) { \n case '1': \n return '9'; \n case '9': \n return '1'; \n default: \n return c; \n } " ) ; switch ( c ) { case '1' : return '9' ; case '9' : return '1' ; default : return c ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int num = in . nextInt ( ) ; int Taro = 0 ; int Hanako = 0 ; while ( num != 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 { System . out . println ( " [LOG] Block: Taro += 1; \n Hanako += 1; " ) ; Taro += 1 ; Hanako += 1 ; } num -- ; } System . out . println ( Taro + " " + Hanako ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int sum = 0 ; sum = a / 2 ; if ( a % 2 == 0 ) { System . out . print ( a / 2 ) ; } else { System . out . println ( " [LOG] Block: sum = a / 2; \n System.out.print(sum + 1); " ) ; sum = a / 2 ; System . out . print ( sum + 1 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] num = new Integer [ N ] ; int alice = 0 ; int bob = 0 ; for ( int i = 0 ; i < N ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } Arrays . sort ( num ) ; for ( int i = N - 1 ; i != - 1 ; i -- ) { if ( i % 2 == 0 ) { alice += num [ i ] ; } else { System . out . println ( " [LOG] Block: bob += num[i]; " ) ; bob += num [ i ] ; } } System . out . println ( Math . abs ( alice - bob ) ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i == 3 ) { System . out . print ( 8 ) ; } else { System . out . println ( " [LOG] Block: System.out.print(s.charAt(i)); " ) ; System . out . print ( s . charAt ( i ) ) ; } } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int s = h / a ; if ( h % a != 0 ) { System . out . println ( " [LOG] Block: s++; " ) ; s ++ ; } System . out . println ( s ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] numList = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { numList [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int r = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: r += numList[i] * numList[j]; " ) ; r += numList [ i ] * numList [ j ] ; } } System . out . println ( r ) ; } } +import java . util . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; char [ ] b = new char [ 4 ] ; b [ 0 ] = a . charAt ( 0 ) ; b [ 1 ] = a . charAt ( 1 ) ; b [ 2 ] = a . charAt ( 2 ) ; b [ 3 ] = a . 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N + 1 ] ; int [ ] w = new int [ N + 1 ] ; int [ ] s = new int [ N + 1 ] ; int [ ] indice = new int [ N ] ; a [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int nr_breaks = 0 ; int cur = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( a [ i ] == cur ) { cur ++ ; } else { nr_breaks ++ ; } } if ( nr_breaks == N ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(nr_breaks); " ) ; System . out . println ( nr_breaks ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int sum = 0 ; for ( int j = 1 ; j <= N ; j ++ ) { if ( i % j == 0 ) { sum ++ ; } } if ( sum == 8 && i % 2 != 0 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main mainObj = new Main ( ) ; mainObj . exec ( ) ; } public void exec ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; if ( ! inRange ( a ) || ! inRange ( b ) ) { System . out . println ( - 1 ) ; return ; } System . out . println ( a * b ) ; } boolean inRange ( int a ) { if ( a >= 1 && a <= 9 ) { return true ; } else { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] order = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { order [ in . nextInt ( ) ] = i ; } for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(order[i] + \" \" ); " ) ; System . out . print ( order [ i ] + " " ) ; } in . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int r = 0 ; r < 3 ; r ++ ) { for ( int c = 0 ; c < 3 ; c ++ ) { C [ r ] [ c ] = in . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] a2 = new int [ 3 ] [ 3 ] ; a [ 0 ] = 0 ; for ( int c = 0 ; c < 3 ; c ++ ) { b [ c ] = C [ 0 ] [ c ] - a [ 0 ] ; } for ( int r = 0 ; r < 3 ; r ++ ) { for ( int c = 0 ; c < 3 ; c ++ ) { a2 [ r ] [ c ] = C [ r ] [ c ] - b [ c ] ; } } for ( int r = 0 ; r < 3 ; r ++ ) { for ( int c = 1 ; c < 3 ; c ++ ) { if ( a2 [ r ] [ c - 1 ] != a2 [ r ] [ c ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( a == 5 ) { five ++ ; } else if ( a == 7 ) { seven ++ ; } if ( b == 5 ) { five ++ ; } else if ( b == 7 ) { seven ++ ; } if ( c == 5 ) { five ++ ; } else if ( c == 7 ) { seven ++ ; } if ( five == 2 && seven == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int i ; String [ ] su = br . readLine ( ) . split ( " " ) ; StringBuilder outArray = new StringBuilder ( ) ; for ( i = n - 1 ; i > 0 ; i -- ) { System . out . println ( " [LOG] Block: System.out.print(su[i] + \" \" ); " ) ; System . out . print ( su [ i ] + " " ) ; } System . out . print ( su [ i ] + " \n " ) ; } } +import java . lang . Math ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sn = new Scanner(System.in); \n ArrayList<Integer> nums = new ArrayList<Integer>(); \n nums.add(sn.nextInt()); \n nums.add(sn.nextInt()); \n nums.add(sn.nextInt()); \n Collections.sort(nums); \n System.out.println(String.format( \" %d %d %d \" , nums.get(0), nums.get(1), nums.get(2))); " ) ; 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 ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] strArray = scan . nextLine ( ) . split ( " " ) ; int H = Integer . parseInt ( strArray [ 0 ] ) ; int A = Integer . parseInt ( strArray [ 1 ] ) ; int lastCount = 0 ; for ( int i = 1 ; H > 0 ; i ++ ) { System . out . println ( " [LOG] Block: H = H - A; \n lastCount = i; " ) ; H = H - A ; lastCount = i ; } System . out . println ( lastCount ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int ab = Math . min ( a + b , c * 2 ) ; int ans = Math . min ( x , y ) * ab ; if ( x > y ) { ans += ( x - y ) * Math . min ( a , c * 2 ) ; } else { System . out . println ( " [LOG] Block: ans += (y - x) * Math.min(b, c * 2); " ) ; ans += ( y - x ) * Math . min ( b , c * 2 ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { 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 H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < H ; i ++ ) { char p ; if ( i == 0 || i == H - 1 ) { p = '#' ; } else { p = '.' ; } for ( int j = 0 ; j < W ; j ++ ) { if ( j == W - 1 ) { lnJudge ( '#' , true ) ; } else if ( j == 0 ) { lnJudge ( '#' , false ) ; } else { System . out . println ( " [LOG] Block: lnJudge(p, false); " ) ; lnJudge ( p , false ) ; } } } System . out . println ( " " ) ; } sc . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int [ ] times = new int [ 3 ] ; times [ 0 ] = p + q ; times [ 1 ] = q + r ; times [ 2 ] = r + p ; int min = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( i == 0 ) { min = times [ 0 ] ; } else { System . out . println ( " [LOG] Block: min = Math.min(min, times[i]); " ) ; min = Math . min ( min , times [ i ] ) ; } } System . out . println ( min ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = 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 = a ; i < b ; i ++ ) { exits [ i ] = true ; } for ( int i = c ; i < d ; i ++ ) { if ( exits [ i ] ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; scanner . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = String . valueOf ( sc . nextInt ( ) ) ; String rn = " " ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: if (n.charAt(i) == '1') \n rn += \" 9 \" ; \n else \n rn += \" 1 \" ; " ) ; if ( n . charAt ( i ) == '1' ) rn += " 9 " ; else rn += " 1 " ; } System . out . println ( Integer . valueOf ( rn ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; for ( ; a <= b ; a ++ ) { if ( a % k == 0 ) { System . out . println ( " [LOG] Block: System.out.printf( \" OK \n \" ); \n return; " ) ; System . out . printf ( " OK \n " ) ; return ; } } System . out . printf ( " NG \n " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antennaArr = new int [ 5 ] ; for ( int i = 0 ; i < antennaArr . length ; i ++ ) { antennaArr [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean canConnect = true ; for ( int i = 0 ; i < antennaArr . length ; i ++ ) { for ( int j = 0 ; j < antennaArr . length ; j ++ ) { if ( i >= j ) { continue ; } if ( antennaArr [ j ] - antennaArr [ i ] > border ) { canConnect = false ; } } } if ( canConnect ) { System . out . println ( " Yay! " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" :( \" ); " ) ; System . out . println ( " :( " ) ; } } } +import java . util . Scanner ; public class Main { static int [ ] stack = new int [ 1000 ] ; static int counta = 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 ( ) { counta -- ; return stack [ counta + 1 ] ; } public static void push ( int i ) { System . out . println ( " [LOG] Block: counta++; \n stack[counta] = i; " ) ; counta ++ ; stack [ counta ] = i ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 3 ] ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: array[i] = sc.nextInt(); " ) ; array [ i ] = sc . nextInt ( ) ; } Arrays . sort ( array ) ; sum = array [ 0 ] + array [ 1 ] ; System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . io . IOException { System . out . println ( " [LOG] Block: int x, h, m, s; \n Scanner in = new Scanner(System.in); \n x = in.nextInt(); \n h = x / 3600; \n x = x % 3600; \n m = x / 60; \n s = x % 60; \n System.out.println(h + \" : \" + m + \" : \" + s); " ) ; int x , h , m , s ; Scanner in = new Scanner ( System . in ) ; x = in . nextInt ( ) ; h = x / 3600 ; x = x % 3600 ; m = x / 60 ; s = x % 60 ; System . out . println ( h + " : " + m + " : " + s ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String str = s . next ( ) ; char [ ] alphabet = new char [ 26 ] ; char c = 'a' ; for ( int i = 0 ; i < 26 ; i ++ ) { alphabet [ i ] = c ++ ; 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 ++ ) { System . out . println ( " [LOG] Block: if (str.charAt(i) == target) \n count++; " ) ; if ( str . charAt ( i ) == target ) count ++ ; } return count ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String S = stdIn . next ( ) ; char [ ] s = new char [ S . length ( ) ] ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: s[i] = S.charAt(i); " ) ; s [ i ] = S . charAt ( i ) ; } s [ 3 ] = '8' ; System . out . println ( s ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { try { long sum = 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 ] ) ; sum = sum + x ; if ( x < min ) { min = x ; } if ( x > max ) { max = x ; } } System . out . println ( min + " " + max + " " + sum ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.out.println( \" ???????????? \" ); " ) ; System . out . println ( " ???????????? " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String u = sc . next ( ) ; if ( s . equals ( u ) ) { System . out . println ( ( a - 1 ) + " " + b ) ; } else if ( t . contains ( u ) ) { System . out . println ( " [LOG] Block: System.out.println(a + \" \" + (b - 1)); " ) ; System . out . println ( a + " " + ( b - 1 ) ) ; } sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] array = br . readLine ( ) . split ( " " ) ; int x = Integer . parseInt ( array [ 0 ] ) ; int y = Integer . parseInt ( array [ 1 ] ) ; int z = y % 4 ; if ( ( z == 0 || z % 2 == 0 ) && 4 * x >= y && 2 * x <= y ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int numberCount = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sNumbers = br . readLine ( ) . split ( " " ) ; int [ ] numbers = new int [ numberCount ] ; for ( int i = 0 ; i < numberCount ; 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 ++ ) { System . out . println ( " [LOG] Block: sb.append(numbers[i]); \n sb.append( \" \" ); " ) ; sb . append ( numbers [ i ] ) ; sb . append ( " " ) ; } System . out . println ( sb . toString ( ) . trim ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int ans = a + a * a + (int) Math.pow(a, 3); \n System.out.println(ans); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int ans = a + a * a + ( int ) Math . pow ( a , 3 ) ; System . out . println ( ans ) ; sc . close ( ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n int n = Integer.parseInt(br.readLine()); \n if (n == 0) \n System.out.println( \" 1 \" ); \n else \n System.out.println( \" 0 \" ); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; if ( n == 0 ) System . out . println ( " 1 " ) ; else System . out . println ( " 0 " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] $ ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long f = n / 500, f2 = (n % 500) / 5; \n System.out.println(f * 1000 + f2 * 5); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long f = n / 500 , f2 = ( n % 500 ) / 5 ; System . out . println ( f * 1000 + f2 * 5 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 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 < x ) ps [ i ] = Math . abs ( x - istack ) * 2 ; else ps [ i ] = Math . abs ( x - istack ) * 2 + 1 ; } Arrays . sort ( ps ) ; ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (ps[i] == ans) \n ans++; \n else \n break; " ) ; if ( ps [ i ] == ans ) ans ++ ; else break ; } if ( ans % 2 == 0 ) x -= ans / 2 ; else x += ans / 2 ; System . out . println ( x ) ; } } +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 Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= n ; i += 2 ) { int count = 0 ; for ( int j = 1 ; j <= i ; j += 2 ) { if ( i % j == 0 ) { count ++ ; } } if ( count == 8 ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n % 2 == 0 ) { int [ ] d = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; int ans = d [ n / 2 ] - d [ n / 2 - 1 ] ; System . out . println ( ans ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . io . * ; import java . util . * ; public class Main { private void solve ( ) { int K = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; for ( int i = A ; i <= B ; ++ i ) { if ( i % K == 0 ) { out . println ( " OK " ) ; return ; } } out . println ( " NG " ) ; } private static PrintWriter out ; private static MyScanner sc ; private static class MyScanner { 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 ) { System . out . println ( " [LOG] Block: out = new PrintWriter(new BufferedOutputStream(System.out)); \n sc = new MyScanner(); \n new Main().solve(); \n out.close(); " ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; sc = new MyScanner ( ) ; new Main ( ) . solve ( ) ; out . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int max = Integer . MIN_VALUE ; int subMax = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( a [ i ] == max ) { System . out . println ( subMax ) ; } else { System . out . println ( " [LOG] Block: System.out.println(max); " ) ; System . out . println ( max ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int t = sc.nextInt(); \n System.out.println(t / a * b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; System . out . println ( t / a * b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { while ( true ) { int n = sc . nextInt ( ) ; int sum = 0 ; if ( n == 0 ) { break ; } int [ ] scores = new int [ n ] ; 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 / n ; for ( int i = 0 ; i < scores . length ; i ++ ) { System . out . println ( " [LOG] Block: double x = Math.pow((scores[i] - average), 2); \n y = x + y; " ) ; double x = Math . pow ( ( scores [ i ] - average ) , 2 ) ; y = x + y ; } variance = y / n ; System . out . println ( Math . sqrt ( variance ) ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n String N = in.next(); \n int res = 0; \n for (int i = 1; i <= Integer.parseInt(N); i++) if (String.valueOf(i).length() % 2 == 1) \n res++; \n System.out.println(res); " ) ; Scanner in = new Scanner ( System . in ) ; String N = in . next ( ) ; int res = 0 ; for ( int i = 1 ; i <= Integer . parseInt ( N ) ; i ++ ) if ( String . valueOf ( i ) . length ( ) % 2 == 1 ) res ++ ; System . out . println ( res ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int q = in . nextInt ( ) ; int [ ] poinst = new int [ n ] ; 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 { System . out . println ( " [LOG] Block: sb.append( \" No \" + System.lineSeparator()); " ) ; sb . append ( " No " + System . lineSeparator ( ) ) ; } } System . out . print ( sb . toString ( ) ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] len = new int [ n ] ; int sum = 0 ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp > max ) { System . out . println ( " [LOG] Block: max = temp; " ) ; max = temp ; } sum += temp ; } System . out . println ( max < sum - max ? " Yes " : " No " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] argv ) { Scanner sc = new Scanner ( System . in ) ; boolean flag = false ; for ( int i = 0 ; i < 2 ; i ++ ) { int x = sc . nextInt ( ) ; if ( ( x % 2 ) == 0 ) { flag = true ; } } sc . close ( ) ; if ( flag == true ) { System . out . println ( " Even " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Odd \" ); " ) ; System . out . println ( " Odd " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { int task1 , task2 , task3 ; int [ ] cost = new int [ 6 ] ; int ans = 1000 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; task1 = Integer . parseInt ( str [ 0 ] ) ; task2 = Integer . parseInt ( str [ 1 ] ) ; task3 = Integer . parseInt ( str [ 2 ] ) ; cost [ 0 ] = Math . abs ( task1 - task2 ) + Math . abs ( task2 - task3 ) ; cost [ 1 ] = Math . abs ( task1 - task3 ) + Math . abs ( task3 - task2 ) ; cost [ 2 ] = Math . abs ( task2 - task1 ) + Math . abs ( task1 - task3 ) ; cost [ 3 ] = Math . abs ( task2 - task3 ) + Math . abs ( task3 - task1 ) ; cost [ 4 ] = Math . abs ( task3 - task1 ) + Math . abs ( task1 - task2 ) ; cost [ 5 ] = Math . abs ( task3 - task2 ) + Math . abs ( task2 - task1 ) ; for ( int i = 0 ; i < 6 ; i ++ ) { if ( ans > cost [ i ] ) { System . out . println ( " [LOG] Block: ans = cost[i]; " ) ; ans = cost [ i ] ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int point = 0 ; int res = 1 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: point += Integer.parseInt(sc.next()); \n if (x < point) \n break; \n res++; " ) ; point += Integer . parseInt ( sc . next ( ) ) ; if ( x < point ) break ; res ++ ; } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; int sum = sc . nextInt ( ) ; int ct = 0 ; for ( int i = 0 ; i <= max ; i ++ ) { for ( int j = 0 ; j <= max ; j ++ ) { System . out . println ( " [LOG] Block: int tmp = sum - i - j; \n if (tmp <= max && tmp >= 0) \n ct++; " ) ; int tmp = sum - i - j ; if ( tmp <= max && tmp >= 0 ) ct ++ ; } } System . out . println ( ct ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int count = 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 " ) ) { count ++ ; } else { count = 0 ; } if ( maxCount < count ) { System . out . println ( " [LOG] Block: maxCount = count; " ) ; maxCount = count ; } } System . out . println ( maxCount ) ; } } +import java . util . * ; class Main { Scanner sc ; String s ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( ( i % 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 ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int A , B , C , D ; Scanner scan = new Scanner ( System . in ) ; A = scan . nextInt ( ) ; B = scan . nextInt ( ) ; C = scan . nextInt ( ) ; D = scan . nextInt ( ) ; while ( true ) { if ( A <= 0 || C <= 0 ) break ; C -= B ; if ( A <= 0 || C <= 0 ) break ; A -= D ; } if ( C <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int cnt = 0 ; while ( true ) { if ( a > k ) { cnt += k ; k = 0 ; break ; } else { cnt += a ; k -= a ; } if ( k <= 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } if ( b > k ) { k = 0 ; break ; } else { k -= b ; } if ( k <= 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } if ( c > k ) { cnt -= k ; k = 0 ; break ; } else { cnt -= c ; k -= c ; } if ( k <= 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( cnt ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner inData = new Scanner ( System . in ) ; int N = inData . nextInt ( ) ; int K = inData . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) P [ i ] = inData . nextInt ( ) ; Arrays . sort ( P ) ; int kin = 0 ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: kin += P[i]; " ) ; kin += P [ i ] ; } System . out . println ( kin ) ; inData . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ACs = new int [ n + 1 ] ; int [ ] WAs = new int [ n + 1 ] ; for ( int i = 0 ; i < n + 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 <= n ; i ++ ) { sumAC += ACs [ i ] ; if ( ACs [ i ] == 1 ) { System . out . println ( " [LOG] Block: sumWA += WAs[i]; " ) ; sumWA += WAs [ i ] ; } } System . out . println ( sumAC ) ; System . out . println ( sumWA ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; StringBuilder str = new StringBuilder ( ) ; int pointer = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { switch ( s . charAt ( i ) ) { case '0' : str . append ( '0' ) ; pointer ++ ; break ; case '1' : str . append ( '1' ) ; pointer ++ ; break ; case 'B' : if ( pointer == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } str . deleteCharAt ( pointer - 1 ) ; pointer -- ; break ; default : break ; } } System . out . println ( str . toString ( ) ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int ans = 0 ; for ( ; 0 < k ; k -- ) { if ( a > 0 ) { a -- ; ans ++ ; } else if ( b > 0 ) { b -- ; } else { System . out . println ( " [LOG] Block: ans--; " ) ; ans -- ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; for ( int i = 9 ; i >= 0 ; i -- ) { if ( num > i * 111 ) { System . out . println ( " [LOG] Block: System.out.println((i + 1) * 111); \n break; " ) ; System . out . println ( ( i + 1 ) * 111 ) ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int C = sc.nextInt(); \n int a = C % 500; \n int b = (a - (a % 5)); \n int c = (C - a) * 2; \n System.out.println(b + c); " ) ; Scanner sc = new Scanner ( System . in ) ; int C = sc . nextInt ( ) ; int a = C % 500 ; int b = ( a - ( a % 5 ) ) ; int c = ( C - a ) * 2 ; System . out . println ( b + c ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextLong ( ) ; long curr = a [ 0 ] ; long total = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] >= curr ) curr = a [ i ] ; else { System . out . println ( " [LOG] Block: total += (curr - a[i]); " ) ; total += ( curr - a [ i ] ) ; } } System . out . println ( total ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double L = sc.nextDouble(); \n sc.close(); \n double l = L / 3; \n System.out.println(Math.pow(l, 3)); " ) ; Scanner sc = new Scanner ( System . in ) ; double L = sc . nextDouble ( ) ; sc . close ( ) ; double l = L / 3 ; System . out . println ( Math . pow ( l , 3 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int row , col ; int [ ] matrix ; row = scanner . nextInt ( ) ; col = scanner . nextInt ( ) ; matrix = new int [ col ] ; int in , sum ; for ( int rowi = 0 ; rowi < row ; 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 ) { System . out . println ( " [LOG] Block: sum += i; \n System.out.print(i + \" \" ); " ) ; sum += i ; System . out . print ( i + " " ) ; } System . out . println ( sum ) ; scanner . close ( ) ; } } +import java . math . BigInteger ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { BigInteger MAX = new BigInteger ( " 1000000000000000000 " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; BigInteger [ ] s = new BigInteger [ n ] ; BigInteger ans = BigInteger . ONE ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . nextBigInteger ( ) ; if ( s [ i ] . compareTo ( BigInteger . ZERO ) == 0 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } } for ( int i = 0 ; i < n ; i ++ ) { ans = ans . multiply ( s [ i ] ) ; if ( ans . compareTo ( MAX ) == 1 ) { System . out . println ( " [LOG] Block: System.out.println(-1); \n System.exit(0); " ) ; System . out . println ( - 1 ) ; System . exit ( 0 ) ; } } System . out . println ( ans ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int cnt = Integer . parseInt ( br . readLine ( ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < cnt ; i ++ ) { if ( i == cnt - 1 ) { System . out . println ( str [ cnt - i - 1 ] ) ; } else { System . out . println ( " [LOG] Block: System.out.print(str[cnt - i - 1] + \" \" ); " ) ; System . out . print ( str [ cnt - i - 1 ] + " " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( d ) ; int [ ] a = new int [ N / 2 ] ; int [ ] b = new int [ N / 2 ] ; for ( int i = 0 ; i < N / 2 ; i ++ ) { a [ i ] = d [ i ] ; } int j = 0 ; for ( int i = N / 2 ; i < N ; i ++ ) { b [ j ] = d [ i ] ; j ++ ; } int count = 0 ; if ( a [ N / 2 - 1 ] < b [ 0 ] ) { System . out . println ( " [LOG] Block: count = b[0] - a[N / 2 - 1]; " ) ; count = b [ 0 ] - a [ N / 2 - 1 ] ; } System . out . println ( count ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; List < Integer > k = new ArrayList < > ( ) ; List < List < Integer > > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: correct.retainAll(a.get(i)); " ) ; correct . retainAll ( a . get ( i ) ) ; } System . out . println ( correct . size ( ) ) ; } } +import java . util . Scanner ; class Main { 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 tmp = 0 ; for ( int i = 0 ; i < input . length ( ) ; ++ i ) { System . out . println ( " [LOG] Block: char ch = input.charAt(i); \n tmp += Character.getNumericValue(ch); " ) ; char ch = input . charAt ( i ) ; tmp += Character . getNumericValue ( ch ) ; } System . out . println ( tmp ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 ; int t = 1 ; while ( n > 0 ) { if ( n % 10 == 1 ) { m += 9 * t ; } else if ( n % 10 == 9 ) { m += t ; } else { System . out . println ( " [LOG] Block: m += n % 10 * t; " ) ; m += n % 10 * t ; } n /= 10 ; t *= 10 ; } System . out . println ( m ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] tokens = in . nextLine ( ) . split ( " " ) ; in . close ( ) ; int A = 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 ( A > min ) { System . out . println ( " [LOG] Block: result -= 1; " ) ; result -= 1 ; } if ( B < max ) { System . out . println ( " [LOG] Block: result -= 1; " ) ; result -= 1 ; } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n double r = scan.nextInt(); \n System.out.println(2 * Math.PI * r); \n scan.close(); \n return; " ) ; Scanner scan = new Scanner ( System . in ) ; double r = scan . nextInt ( ) ; System . out . println ( 2 * Math . PI * r ) ; scan . close ( ) ; return ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int [ ] arr = new int [ 101010 ] ; int k ; int n ; int cnt = 0 ; n = reader . nextInt ( ) ; k = reader . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = reader . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] >= k ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } System . out . println ( cnt ) ; } } +import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; while ( ! ( line . equals ( " 0 0 " ) ) ) { String [ ] inputs = line . split ( " " ) ; int height = Integer . valueOf ( inputs [ 0 ] ) ; int width = Integer . valueOf ( inputs [ 1 ] ) ; StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < height ; i ++ ) { if ( i == 0 || i == height - 1 ) { for ( int j = 0 ; j < width ; j ++ ) result . append ( " # " ) ; } else { for ( int j = 0 ; j < width ; j ++ ) { System . out . println ( " [LOG] Block: if (j == 0 || j == width - 1) \n result.append( \" # \" ); \n else \n result.append( \" . \" ); " ) ; if ( j == 0 || j == width - 1 ) result . append ( " # " ) ; else result . append ( " . " ) ; } } result . append ( " \n " ) ; } System . out . println ( result ) ; line = br . readLine ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer n = Integer . valueOf ( sc . nextLine ( ) ) ; String vStr = sc . nextLine ( ) ; Map < Integer , Integer > vList = str2List ( vStr ) ; 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 ) { System . out . println ( " [LOG] Block: ret.put(key, Integer.valueOf(val)); \n key++; " ) ; ret . put ( key , Integer . valueOf ( val ) ) ; key ++ ; } return ret ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] a ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int debt = 100000 ; for ( int i = 0 ; i < n ; i ++ ) { debt += debt / 20 ; debt = up ( debt ) ; } System . out . println ( debt ) ; } static int up ( int money ) { System . out . println ( " [LOG] Block: money += 999; \n money -= money % 1000; \n return money; " ) ; money += 999 ; money -= money % 1000 ; return money ; } } +import java . util . Scanner ; class Main { 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 a = scan . nextInt ( ) ; for ( int d = 0 ; d < a ; d ++ ) { sum [ d ] = 0 ; } int b = scan . nextInt ( ) ; for ( int c = 0 ; c < a ; 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 < a ; c ++ ) { for ( int d = 0 ; d < b ; d ++ ) { sum [ c ] += h [ c ] [ d ] * m [ d ] ; } } for ( int c = 0 ; c < a ; c ++ ) { System . out . println ( " [LOG] Block: System.out.println(sum[c]); " ) ; System . out . println ( sum [ c ] ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan ; int A ; int B ; int C ; int K ; int Aa ; int Bb ; int Cc ; scan = new Scanner ( System . in ) ; A = scan . nextInt ( ) ; B = scan . nextInt ( ) ; C = scan . nextInt ( ) ; K = scan . nextInt ( ) ; if ( K >= A ) { Aa = A ; 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 ( " [LOG] Block: System.out.println(1 * K); " ) ; System . out . println ( 1 * K ) ; } } } +import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long A = sc.nextLong(); \n String b = sc.next(); \n long B = 0; \n B += b.charAt(0) - '0'; \n B *= 10; \n B += b.charAt(2) - '0'; \n B *= 10; \n B += b.charAt(3) - '0'; \n long res = (long) (A * B / 100); \n System.out.println(res); " ) ; Scanner sc = new Scanner ( System . in ) ; long A = 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 ) ( A * B / 100 ) ; System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scn = new Scanner(System.in); \n long a = scn.nextInt(); \n System.out.println((long) (a + Math.pow(a, 2) + Math.pow(a, 3))); " ) ; Scanner scn = new Scanner ( System . in ) ; long a = scn . nextInt ( ) ; System . out . println ( ( long ) ( a + Math . pow ( a , 2 ) + Math . pow ( a , 3 ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int result2 = N ; int result = 0 ; do { System . out . println ( " [LOG] Block: result2 = result2 / K; \n result++; " ) ; result2 = result2 / K ; result ++ ; } while ( result2 != 0 ) ; System . out . println ( result ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = br . readLine ( ) . toLowerCase ( ) ; int ans = 0 ; String line ; while ( ! ( ( line = br . readLine ( ) ) . equals ( " END_OF_TEXT " ) ) ) { line = line . toLowerCase ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; while ( st . hasMoreTokens ( ) ) { System . out . println ( " [LOG] Block: if (st.nextToken().equals(W)) \n ans++; " ) ; if ( st . nextToken ( ) . equals ( W ) ) ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int sum2 = 0 ; for ( int i = 1 ; i <= N ; 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 ; ) { System . out . println ( " [LOG] Block: sum += n % 10; \n n /= 10; " ) ; sum += n % 10 ; n /= 10 ; } return sum ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; map . put ( a [ i ] , i + 1 ) ; } Arrays . sort ( a ) ; StringBuilder ans = new StringBuilder ( ) ; for ( Integer i : a ) { System . out . println ( " [LOG] Block: ans.append(map.get(i)); \n ans.append( \" \" ); " ) ; ans . append ( map . get ( i ) ) ; ans . append ( " " ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int from = b - ( a - 1 ) ; int to = b + ( a - 1 ) ; for ( int i = from ; i <= to ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(i + \" \" ); " ) ; System . out . print ( i + " " ) ; } } } +import javax . swing . * ; import java . io . * ; import java . util . * ; import java . math . * ; import static java . util . Comparator . * ; public class Main { public static void main ( String [ ] args ) throws IOException { FastReader s = new FastReader ( ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int numOfSock = 1 ; int count = 0 ; while ( numOfSock < b ) { numOfSock -= 1 ; numOfSock += a ; count ++ ; } System . out . println ( count ) ; } } class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int divisor = 0 ; for ( int i = 0 ; i <= ( b - a ) ; i ++ ) { if ( c % ( a + i ) == 0 ) { System . out . println ( " [LOG] Block: divisor += 1; " ) ; divisor += 1 ; } } System . out . println ( divisor ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] hides ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n String str = s.next(); \n switch(str) { \n case \" MON \" : \n System.out.print( \" 6 \" ); \n break; \n case \" TUE \" : \n System.out.print( \" 5 \" ); \n break; \n case \" WED \" : \n System.out.print( \" 4 \" ); \n break; \n case \" THU \" : \n System.out.print( \" 3 \" ); \n break; \n case \" FRI \" : \n System.out.print( \" 2 \" ); \n break; \n case \" SAT \" : \n System.out.print( \" 1 \" ); \n break; \n case \" SUN \" : \n System.out.print( \" 7 \" ); \n break; \n } " ) ; Scanner s = new Scanner ( System . in ) ; String str = s . next ( ) ; switch ( str ) { 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 ; import java . util . Queue ; import java . util . ArrayDeque ; import java . util . Arrays ; public class Main { static int cnt = 0 ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextInt(); \n long b = sc.nextInt(); \n long c = sc.nextInt(); \n long d = sc.nextInt(); \n long max = -1000000000000000000l; \n long ac = a * c; \n long bc = b * c; \n long cd = b * d; \n long da = d * a; \n System.out.println(Math.max(Math.max(ac, bc), Math.max(cd, da))); " ) ; 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 . math . BigInteger ; import java . util . Scanner ; public class Main { private static long n ; private static String [ ] numeralSystem ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; BigInteger bigInteger = new BigInteger ( scanner . next ( ) ) ; n = 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 ( n > 26 ) { System . out . println ( " [LOG] Block: res = numeralSystem[(int) (n % 26)].concat(res); \n n--; \n n /= 26; " ) ; res = numeralSystem [ ( int ) ( n % 26 ) ] . concat ( res ) ; n -- ; n /= 26 ; } res = numeralSystem [ ( int ) n ] . concat ( res ) ; return res ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner obj = new Scanner ( System . in ) ; int n = obj . nextInt ( ) ; int m = obj . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = obj.nextInt(); " ) ; 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 . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ASheepAndWolves solver = new ASheepAndWolves ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ASheepAndWolves { public void solve ( int testNumber , FastReader in , PrintWriter out ) { out . println ( in . nextInt ( ) > in . nextInt ( ) ? " safe " : " unsafe " ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +public class Main { public static void main ( String [ ] args ) { int price = new java . util . Scanner ( System . in ) . nextInt ( ) ; int pay = 0 ; while ( pay < price ) { System . out . println ( " [LOG] Block: pay += 1000; " ) ; pay += 1000 ; } System . out . println ( pay - price ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { while ( true ) { int m = sc . nextInt ( ) , f = sc . nextInt ( ) , r = sc . nextInt ( ) ; if ( m == - 1 && f == - 1 && r == - 1 ) { break ; } if ( m == - 1 || f == - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } else if ( m + f >= 80 ) { System . out . println ( " A " ) ; } else if ( m + f >= 65 ) { System . out . println ( " B " ) ; } else if ( m + f >= 50 ) { System . out . println ( " C " ) ; } else if ( m + f >= 30 ) { if ( r >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } } } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader breader = getReader ( ) ; int [ ] ary = getAry ( breader ) ; while ( ary [ 0 ] != 0 || ary [ 1 ] != 0 ) { for ( int i = 0 ; i < ary [ 0 ] ; i ++ ) { 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 i = 0 ; i < nstr . length ; i ++ ) { System . out . println ( " [LOG] Block: n[i] = Integer.valueOf(nstr[i]); " ) ; n [ i ] = Integer . valueOf ( nstr [ i ] ) ; } return n ; } } +public class Main { public void run ( java . util . Scanner sc ) { int [ ] a ; int i , j ; a = new int [ sc . nextInt ( ) ] ; for ( i = 0 ; i < a . length ; ++ i ) a [ i ] = sc . nextInt ( ) ; for ( i = 0 ; i < a . length ; ++ i ) { final int t = a [ i ] ; for ( j = i - 1 ; j >= 0 ; -- j ) { if ( t < a [ j ] ) { a [ j + 1 ] = a [ j ] ; a [ j ] = t ; } } printArray ( a ) ; } } private void printArray ( int [ ] a ) { int i ; for ( i = 0 ; i < a . length ; ++ i ) { System . out . print ( a [ i ] ) ; if ( i + 1 < a . length ) System . out . print ( " " ) ; else System . out . println ( ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: (new Main()).run(new java.util.Scanner(System.in)); " ) ; ( new Main ( ) ) . run ( new java . util . Scanner ( System . in ) ) ; } } +import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { String [ ] tokens = in . readLine ( ) . split ( " " ) ; int N = 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 > N ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println((N - sum)); " ) ; System . out . println ( ( N - sum ) ) ; } } void calc ( ) { } void showResult ( ) { } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { String str = " " ; for ( int j = 0 ; j < p . length ( ) ; j ++ ) { int k = i + j ; if ( k >= s . length ( ) ) { k -= s . length ( ) ; } str += s . substring ( k , k + 1 ) ; } if ( p . equals ( str ) ) { System . out . println ( " [LOG] Block: out = \" Yes \" ; \n break; " ) ; out = " Yes " ; break ; } } System . out . println ( out ) ; } } +import java . util . * ; public class Main { 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 i = 0 ; i < in . length ; i ++ ) { char b01 = in [ i ] ; 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 i = 0 ; i < out . size ( ) ; i ++ ) { System . out . println ( " [LOG] Block: String s = out.get(i); \n kotae = kotae + s; " ) ; String s = out . get ( i ) ; kotae = kotae + s ; } System . out . println ( kotae ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; String alphabet = " abcdefghijklmnopqrstuvwxyz " ; String name = " " ; while ( n > 0 ) { System . out . println ( " [LOG] Block: n--; \n long remain = n % 26l; \n name = alphabet.charAt((int) remain) + name; \n n = n / 26l; " ) ; n -- ; long remain = n % 26l ; name = alphabet . charAt ( ( int ) remain ) + name ; n = n / 26l ; } System . out . println ( name ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; for ( int i = 3 ; i <= a ; i ++ ) { System . out . println ( " [LOG] Block: if (i % 3 == 0 || String.valueOf(i).contains( \" 3 \" )) \n System.out.print( \" \" + i); " ) ; if ( i % 3 == 0 || String . valueOf ( i ) . contains ( " 3 " ) ) System . out . print ( " " + i ) ; } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] v = new int [ 3 ] ; v [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; v [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; v [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; Arrays . sort ( v ) ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: v[2] *= 2; " ) ; v [ 2 ] *= 2 ; } System . out . println ( v [ 0 ] + v [ 1 ] + v [ 2 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; for ( int y = 0 ; y < n ; 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 < n ; y ++ ) { int ans = 0 ; for ( int x = 0 ; x < m ; x ++ ) { System . out . println ( " [LOG] Block: ans += a[y][x] * b[x]; " ) ; ans += a [ y ] [ x ] * b [ x ] ; } System . out . println ( ans ) ; } scanner . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int snack = sc . nextInt ( ) ; for ( int j = 0 ; j < snack ; j ++ ) { System . out . println ( " [LOG] Block: int people = sc.nextInt(); \n set.add(people); " ) ; int people = sc . nextInt ( ) ; set . add ( people ) ; } } System . out . println ( n - set . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long ans = 100 ; for ( long i = 1 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { ans = Math . min ( ans , getDigits ( N / i ) ) ; } } System . out . println ( ans ) ; sc . close ( ) ; } static int getDigits ( long x ) { int ans = 0 ; while ( x > 0 ) { System . out . println ( " [LOG] Block: x /= 10; \n ans++; " ) ; x /= 10 ; ans ++ ; } return ans ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] Args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int n = s . length ( ) ; int flag = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: if (i % 2 == 0 && s.charAt(i - 1) == 'R') \n flag = 1; \n if (i % 2 == 1 && s.charAt(i - 1) == 'L') \n flag = 1; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; String T = scanner . next ( ) ; int count = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (S.charAt(i) == T.charAt(i)) \n continue; \n count++; " ) ; if ( S . charAt ( i ) == T . charAt ( i ) ) continue ; count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { String s = scanner . nextLine ( ) ; int count = 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 ) ) { count ++ ; } } if ( count == 2 ) { count = 0 ; } else { System . out . println ( " No " ) ; flag = false ; break ; } } if ( flag ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; boolean isDistinct = true ; for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ i ] == arr [ i - 1 ] ) { System . out . println ( " [LOG] Block: isDistinct = false; \n break; " ) ; isDistinct = false ; break ; } } if ( isDistinct ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int count = 0 ; int tens = ( ( S / 10 ) - ( ( int ) ( S / 100 ) ) * 10 ) * 10 ; int ones = S % 10 ; if ( ( S / 100 ) <= 12 && ( S / 100 ) != 0 ) { count += 1 ; } if ( ( tens + ones ) <= 12 && ( tens + ones ) != 0 ) { System . out . println ( " [LOG] Block: count += 2; " ) ; 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ sc . nextInt ( ) - 1 ] = i + 1 ; } for ( int j = 0 ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print(A[j] + \" \" ); " ) ; System . out . print ( A [ j ] + " " ) ; } } } +import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { 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 c = s . charAt ( 0 ) ; dp [ 0 ] [ 0 ] = ( c == '1' ? 1 : 0 ) ; dp [ 1 ] [ 0 ] = ( c == '0' ? 1 : 0 ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: char x = s.charAt(i); \n dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1]; \n dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1]; " ) ; 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 . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner input = new Scanner(System.in); \n int x = input.nextInt(); \n String S = input.next(); \n if (S.length() <= x) \n System.out.println(S); \n else \n System.out.println(S.substring(0, x) + \" ... \" ); " ) ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; String S = input . next ( ) ; if ( S . length ( ) <= x ) System . out . println ( S ) ; else System . out . println ( S . substring ( 0 , x ) + " ... " ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { int a = 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 ( ) ) { System . out . println ( " [LOG] Block: String current = stringTokenizer.nextToken(); \n if (i == 0) \n a = Integer.parseInt(current); \n if (i == 1) \n b = Integer.parseInt(current); \n if (i == 2) \n c = Integer.parseInt(current); \n i++; " ) ; String current = stringTokenizer . nextToken ( ) ; if ( i == 0 ) a = Integer . parseInt ( current ) ; if ( i == 1 ) b = Integer . parseInt ( current ) ; if ( i == 2 ) c = Integer . parseInt ( current ) ; i ++ ; } if ( a < b && b < c ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n char c = sc.next().charAt(0); \n int d = c + 1; \n char ans = (char) d; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; char c = sc . next ( ) . charAt ( 0 ) ; int d = c + 1 ; char ans = ( char ) d ; System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n System.out.println(s.replaceAll( \" \\ - \" , \" \" ).length() - (4 - s.replaceAll( \" \\ - \" , \" \" ).length())); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; System . out . println ( s . replaceAll ( " \\ - " , " " ) . length ( ) - ( 4 - s . replaceAll ( " \\ - " , " " ) . length ( ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int [ ] result = getMax ( a , b , c ) ; a = result [ 0 ] ; b = result [ 1 ] ; c = result [ 2 ] ; } System . out . println ( a + b + c ) ; } private static int [ ] getMax ( int a , int b , int c ) { int [ ] newInput = new int [ ] { a , b , c } ; if ( a <= b && c <= b ) { newInput [ 1 ] = 2 * b ; } else if ( b <= a && c <= a ) { newInput [ 0 ] = 2 * a ; } else if ( a <= c && b <= c ) { System . out . println ( " [LOG] Block: newInput[2] = 2 * c; " ) ; newInput [ 2 ] = 2 * c ; } return newInput ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int sum = 0 ; for ( int i = 1 ; i < n + 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 ) { System . out . println ( " [LOG] Block: sum += i; " ) ; sum += i ; } break ; } } } System . out . println ( sum ) ; } } +import java . io . PrintWriter ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N - 1 ] ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = 100_000 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: B[i] = Integer.parseInt(sc.next()); \n if (B[i] < A[i]) \n A[i] = B[i]; \n if (B[i] < A[i + 1]) \n A[i + 1] = B[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 . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } double sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: sum += (1.0 / A[i]); " ) ; sum += ( 1.0 / A [ i ] ) ; } System . out . println ( 1.0 / sum ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a , b , c , d , e ; a = 2 ; b = sc . nextLong ( ) ; c = b ; d = b ; e = b ; while ( a <= n ) { b = sc . nextLong ( ) ; c = c + b ; if ( b > d ) { d = b ; } else if ( b < e ) { System . out . println ( " [LOG] Block: e = b; " ) ; e = b ; } a = a + 1 ; } System . out . println ( e + " " + d + " " + c ) ; } } +import java . io . * ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String fst = br . readLine ( ) ; int n = Integer . parseInt ( fst ) ; if ( n == 0 ) { break ; } String line = br . readLine ( ) ; String [ ] str = line . split ( " " ) ; double [ ] s = new double [ str . length ] ; for ( int j = 0 ; j < n ; j ++ ) { s [ j ] = Double . parseDouble ( str [ j ] ) ; } double sum = 0.0 ; for ( int j = 0 ; j < n ; j ++ ) { sum += s [ j ] ; } double num = n ; double avr = sum / num ; double a = 0.0 ; for ( int j = 0 ; j < n ; j ++ ) { System . out . println ( " [LOG] Block: a += (s[j] - avr) * (s[j] - avr); " ) ; a += ( s [ j ] - avr ) * ( s [ j ] - avr ) ; } a /= num ; a = Math . sqrt ( a ) ; System . out . printf ( " %.6f \n " , a ) ; } } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st = new StringTokenizer(br.readLine()); \n int D = Integer.parseInt(st.nextToken()); \n int T = Integer.parseInt(st.nextToken()); \n int S = Integer.parseInt(st.nextToken()); \n float tmp = (float) D / T; \n if (S >= tmp) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int D = Integer . parseInt ( st . nextToken ( ) ) ; int T = Integer . parseInt ( st . nextToken ( ) ) ; int S = Integer . parseInt ( st . nextToken ( ) ) ; float tmp = ( float ) D / T ; if ( S >= tmp ) 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 ; public class Main { 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 a = Integer . parseInt ( tmpArray [ 0 ] ) ; int b = Integer . parseInt ( tmpArray [ 1 ] ) ; if ( a == 0 && b == 0 ) { break ; } for ( int i = 0 ; i < a ; i ++ ) { for ( int j = 0 ; j < b ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; long A ; A = sc . nextLong ( ) ; long B ; B = sc . nextLong ( ) ; final Solver solver = new Solver ( ) ; solver . solve ( A , B ) ; } } class Solver { public void solve ( long A , long B ) { System . out . println ( A * B / lcd ( A , B ) ) ; } private long lcd ( long A , long B ) { if ( B == 0 ) { System . out . println ( " [LOG] Block: return A; " ) ; return A ; } return lcd ( B , A % B ) ; } } +import java . util . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int ans = 0 ; while ( h > 0 ) { System . out . println ( " [LOG] Block: h = h - a; \n ans++; " ) ; h = h - a ; ans ++ ; } System . out . println ( ans ) ; } } +import java . util . * ; class Main { static int mod = 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 { System . out . println ( " [LOG] Block: cnt = cnt - (L); " ) ; cnt = cnt - ( L ) ; } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = 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 ( " [LOG] Block: System.out.println(y + \" \" + x); " ) ; System . out . println ( y + " " + x ) ; } i ++ ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { int i = 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 ] ; i = j - 1 ; for ( int k = 0 ; k < A . length - 1 ; k ++ ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d \" , A[k]); " ) ; System . out . printf ( " %d " , A [ k ] ) ; } System . out . printf ( " %d \n " , A [ A . length - 1 ] ) ; while ( i >= 0 && A [ i ] > key ) { A [ i + 1 ] = A [ i ] ; i -- ; } A [ i + 1 ] = key ; } for ( int k = 0 ; k < A . length - 1 ; k ++ ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d \" , A[k]); " ) ; System . out . printf ( " %d " , A [ k ] ) ; } System . out . printf ( " %d \n " , A [ A . length - 1 ] ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int [ ] A = new int [ 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 ] ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Good \" ); " ) ; System . out . println ( " Good " ) ; } } } +import java . util . Scanner ; import java . math . BigInteger ; class Main { 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 ) { System . out . println ( " [LOG] Block: if (ans.compareTo(s) <= 0) \n ans = s; " ) ; if ( ans . compareTo ( s ) <= 0 ) ans = s ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; int idx ; for ( idx = 0 ; idx < n ; idx ++ ) { p [ idx ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 0 ; for ( idx = 1 ; idx < n - 1 ; idx ++ ) { if ( p [ idx ] <= p [ idx - 1 ] ) { if ( p [ idx ] > p [ idx + 1 ] ) { System . out . println ( " [LOG] Block: ++cnt; " ) ; ++ cnt ; } } else { if ( p [ idx ] <= p [ idx + 1 ] ) { System . out . println ( " [LOG] Block: ++cnt; " ) ; ++ cnt ; } } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 < n ; j ++ ) { int count = 0 ; for ( int k = 0 ; k < m ; k ++ ) { count += sc . nextInt ( ) * bList [ k ] ; } if ( count + c > 0 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = x ; 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 ( " [LOG] Block: System.out.println(i); \n return; " ) ; System . out . println ( i ) ; return ; } } } } } } +import java . util . * ; public class Main { public static int digit ( int x ) { int ans = 0 , tmp = x ; if ( x == 0 ) return 1 ; while ( tmp != 0 ) { tmp /= 10 ; ++ ans ; } return ans ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(), b = sc.nextInt(); \n sc.close(); \n String[] ans = { \" Yes \" , \" No \" } ; \n int an = 1, tmpa = a, tmpb = b; \n int d = digit(tmpb); \n tmpa *= (int) Math.pow(10, d); \n tmpa += tmpb; \n tmpb = (int) Math.sqrt(tmpa); \n if (tmpa == tmpb * tmpb) \n an = 0; \n System.out.println(ans[an]); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; sc . close ( ) ; String [ ] ans = { " 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 ( ans [ an ] ) ; } } +import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Map < String , Integer > m = new TreeMap < String , Integer > ( ) ; int max = 0 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(s.getKey()); " ) ; System . out . println ( s . getKey ( ) ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] array = { 1 , 2 , 3 } ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( ( array [ i ] == a ) || ( array [ i ] == b ) ) { array [ i ] = 0 ; } } for ( int i = 0 ; i < 3 ; i ++ ) { if ( array [ i ] != 0 ) { System . out . println ( " [LOG] Block: System.out.println(array[i]); \n return; " ) ; System . out . println ( array [ i ] ) ; return ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] a = new int [ 10000 ] ; int max = - 1000000 ; int min = 1000000 ; long sum = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: min = a[i]; " ) ; min = a [ i ] ; } } sum += a [ i ] ; } System . out . printf ( " %1$d %2$d %3$d \n " , min , max , sum ) ; } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { String s = sc . next ( ) ; if ( ! set . contains ( s ) ) { System . out . println ( " [LOG] Block: set.add(s); \n res++; " ) ; set . add ( s ) ; res ++ ; } } System . out . println ( res ) ; } } +import java . util . * ; class Main { Scanner sc ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A > 9 || B > 9 ) System . out . println ( - 1 ) ; else System . out . println ( A * B ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +class Main { public static void main ( String [ ] g ) throws Exception { System . out . println ( " [LOG] Block: double y = 1e5; \n int n = 0, i; \n for (; (i = System.in.read()) > 32; n = n * 10 + i - 48) ; \n for (i = 1000; n-- > 0; y += y % i > 0 ? i - y % i : 0) y *= 1.05; \n System.out.println((int) y); " ) ; double y = 1e5 ; int n = 0 , i ; for ( ; ( i = System . in . read ( ) ) > 32 ; n = n * 10 + i - 48 ) ; for ( i = 1000 ; n -- > 0 ; y += y % i > 0 ? i - y % i : 0 ) y *= 1.05 ; System . out . println ( ( int ) y ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Unstoppable solver = new Unstoppable ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class Unstoppable { public void solve ( InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int mul = a [ i ] * a [ j ] ; sum += mul ; } } out . println ( sum ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; 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 == a && k2 == b ) { bool = false ; System . out . println ( i ) ; break loop ; } } if ( bool ) { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; 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 [ n ] ; 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 < n ; i ++ ) { rightResult = rightResult + flag [ i ] ; } if ( leftResult < rightResult ) { System . out . println ( leftResult ) ; } else { System . out . println ( " [LOG] Block: System.out.println(rightResult); " ) ; System . out . println ( rightResult ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: String line = scanner.nextLine(); \n System.out.println( \" 2018/01/ \" + line.split( \" / \" )[2]); " ) ; String line = scanner . nextLine ( ) ; System . out . println ( " 2018/01/ " + line . split ( " / " ) [ 2 ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] list = new String [ N ] ; String ans = " No " ; for ( int i = 0 ; i < N ; i ++ ) { list [ i ] = sc . next ( ) ; } for ( int i = 1 ; i < N ; 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 { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } } for ( int i = 0 ; i < N ; i ++ ) { String a = list [ i ] ; for ( int j = i + 1 ; j < N ; j ++ ) { String b = list [ j ] ; if ( a . equals ( b ) ) { System . out . println ( " No " ) ; return ; } else { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: sum += a[i]; " ) ; sum += a [ i ] ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = Integer . parseInt ( sc . next ( ) ) ; long B = Integer . parseInt ( sc . next ( ) ) ; System . out . print ( A * B / gcd ( A , 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 { System . out . println ( " [LOG] Block: return gcd(max % min, min); " ) ; return gcd ( max % min , min ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n , x , x1 , x2 , x3 ; int counter ; while ( true ) { counter = 0 ; n = scanner . nextInt ( ) ; x = scanner . nextInt ( ) ; if ( n == 0 && x == 0 ) break ; for ( int i = 1 ; i <= n ; i ++ ) { x1 = x ; x1 -= i ; if ( x1 > 1 ) { for ( int j = i + 1 ; j <= n ; j ++ ) { x2 = x1 ; x2 -= j ; if ( x2 > 0 ) { for ( int k = j + 1 ; k <= n ; k ++ ) { System . out . println ( " [LOG] Block: x3 = x2; \n x3 -= k; \n if (x3 == 0) \n counter++; " ) ; x3 = x2 ; x3 -= k ; if ( x3 == 0 ) counter ++ ; } } } } } System . out . println ( counter ) ; } } } +import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] input = new int [ 10 ] ; Scanner s = new Scanner ( System . in ) ; for ( int i = 0 ; i < 10 ; i ++ ) { input [ i ] = s . nextInt ( ) ; } Arrays . sort ( input ) ; int i = input . length - 1 ; while ( i > input . length - 4 ) { System . out . println ( " [LOG] Block: System.out.println(input[i]); \n i--; " ) ; System . out . println ( input [ i ] ) ; i -- ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; Integer [ ] [ ] array = new Integer [ n ] [ m ] ; for ( int i = 0 ; m > i ; i ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } for ( int i = 0 ; n > i ; i ++ ) { for ( int j = 0 ; m > j ; j ++ ) { int a = sc . nextInt ( ) ; array [ i ] [ j ] = a ; } } int count = 0 ; for ( int i = 0 ; n > i ; i ++ ) { int keisan = 0 ; for ( int j = 0 ; m > j ; j ++ ) { System . out . println ( " [LOG] Block: keisan = keisan + list.get(j) * array[i][j]; " ) ; keisan = keisan + list . get ( j ) * array [ i ] [ j ] ; } if ( keisan + c > 0 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = 0 ; while ( x >= 5 ) { if ( x >= 500 ) { x -= 500 ; ans += 1000 ; } else { System . out . println ( " [LOG] Block: x -= 5; \n ans += 5; " ) ; x -= 5 ; ans += 5 ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; int max = 1 ; for ( int i = 2 ; i <= Math . sqrt ( N ) ; i ++ ) { int n = i ; for ( int j = 2 ; n * i <= N ; j ++ ) { System . out . println ( " [LOG] Block: n *= i; " ) ; n *= i ; } max = max < n ? n : max ; } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; if ( ( s . length ( ) == t . length ( ) ) && ( s + s ) . contains ( t ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) for ( int a = 1 ; a <= 9 ; a ++ ) { if ( i * a == N ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int i ; 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 ( i = 0 ; i < h ; i ++ ) { System . out . print ( " " ) ; for ( j = 0 ; j < w - 1 ; j ++ ) { if ( ( i % 2 != 0 && j % 2 == 0 ) ^ ( i % 2 == 0 && j % 2 != 0 ) ) { System . out . print ( " . " ) ; } else { System . out . print ( " # " ) ; } } if ( ( i % 2 != 0 && j % 2 == 0 ) ^ ( i % 2 == 0 && j % 2 != 0 ) ) { System . out . println ( " . " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" # \" ); " ) ; System . out . println ( " # " ) ; } } System . out . print ( " \n " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String p = sc . nextLine ( ) ; int sLen = s . length ( ) ; int pLen = p . length ( ) ; boolean ok = false ; for ( int i = 0 ; i < sLen ; i ++ ) { for ( int j = 0 ; j < pLen ; j ++ ) { if ( s . charAt ( ( i + j ) % sLen ) != p . charAt ( j ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } if ( j == pLen - 1 ) ok = true ; } if ( ok ) break ; } System . out . println ( ok ? " Yes " : " No " ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int i = 0 ; while ( i == 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 ( " [LOG] Block: System.out.println(integer); " ) ; System . out . println ( integer ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); \n String s = new String(in.readLine()); \n String[] ss = s.split( \" \" ); \n int a = Integer.parseInt(ss[0]); \n int b = Integer.parseInt(ss[1]); \n System.out.print(a * b); \n System.out.print( \" \" ); \n System.out.println(2 * a + 2 * b); " ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; String [ ] ss = s . split ( " " ) ; int a = Integer . parseInt ( ss [ 0 ] ) ; int b = Integer . parseInt ( ss [ 1 ] ) ; System . out . print ( a * b ) ; System . out . print ( " " ) ; System . out . println ( 2 * a + 2 * b ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = sc . nextBigDecimal ( ) ; BigDecimal b = sc . nextBigDecimal ( ) ; BigDecimal 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 ) { System . out . println ( " [LOG] Block: e = b.multiply(d); " ) ; e = b . multiply ( d ) ; } System . out . println ( e ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int k = sc.nextInt() - 1; \n StringBuilder sb = new StringBuilder(sc.next()); \n sb.setCharAt(k, (char) (sb.charAt(k) + 32)); \n System.out.println(sb.toString()); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int n = S . length ( ) ; int tmp = 0 ; String [ ] part = new String [ n * ( n + 1 ) / 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; 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 { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . text . DecimalFormat ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int jisin_nagasa = sc . nextInt ( ) ; int hunsin_nagasa = sc . nextInt ( ) ; int jikan = sc . nextInt ( ) ; int hun = sc . nextInt ( ) ; double jisin_kakudo = ( jikan * 60 + hun ) * 0.5 ; double hunsin_kakudo = hun * 6 ; double kakudo_sa = 0 ; if ( jisin_kakudo > hunsin_kakudo ) { kakudo_sa = jisin_kakudo - hunsin_kakudo ; } else { System . out . println ( " [LOG] Block: kakudo_sa = hunsin_kakudo - jisin_kakudo; " ) ; kakudo_sa = hunsin_kakudo - jisin_kakudo ; } double b = jisin_nagasa ; double c = hunsin_nagasa ; double e = kakudo_sa ; double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( c , 2 ) - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } +import java . util . * ; class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] argv ) { int n = scan . nextInt ( ) ; int n1 = n % 10 ; int n2 = ( n % 100 - n1 ) / 10 ; int n3 = ( n - n1 - n1 ) / 100 ; if ( n3 == 9 ) { n = 999 ; System . out . println ( n ) ; return ; } if ( n1 > n3 || n2 > n3 ) { System . out . println ( " [LOG] Block: n3 += 1; " ) ; n3 += 1 ; } n = n3 * 100 + n3 * 10 + n3 ; System . out . println ( n ) ; } } +import java . util . Scanner ; public class Main { 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 ( " [LOG] Block: System.out.println( \" WA \" ); " ) ; System . out . println ( " WA " ) ; } else { if ( ! lower . contains ( s . charAt ( 1 ) + " " ) ) { System . out . println ( " WA " ) ; return ; } int Ccount = 0 ; for ( int i = 2 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == 'C' ) { Ccount ++ ; } 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 ( Ccount == 1 ) { System . out . println ( " AC " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); " ) ; System . out . println ( " WA " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long w = 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 ) ( w * h ) / 2 ; int hukusu = 0 ; if ( ( double ) x == ( double ) w / 2.0 && ( double ) y == ( double ) h / 2.0 ) { System . out . println ( " [LOG] Block: hukusu = 1; " ) ; hukusu = 1 ; } System . out . println ( ans + " " + hukusu ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = A + B ; int c = ( A + 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 ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] b = new int [ m ] [ l ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { System . out . println ( " [LOG] Block: long cij = 0; \n for (int k = 0; k < m; k++) cij += a[i][k] * b[k][j]; \n System.out.print((j == 0) ? cij : \" \" + cij); " ) ; 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 . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int n = 1 ; int count = 0 ; if ( S . length ( ) % 2 == 0 ) { n = S . length ( ) ; } else { n = S . length ( ) - 1 ; } for ( int i = 0 ; i < n / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) - 1 - i ) ) { System . out . println ( " [LOG] Block: count++; " ) ; 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 ; import java . util . stream . Collectors ; public class Main { 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 ) { System . out . println ( " [LOG] Block: mylist.add(strinput); \n strinput = reader.readLine(); " ) ; mylist . add ( strinput ) ; strinput = reader . readLine ( ) ; } String [ ] arr01 = mylist . get ( 0 ) . split ( " " ) ; String [ ] arr02 = mylist . get ( 1 ) . split ( " " ) ; int n = 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; int [ ] array = new int [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } long min = 1000001 ; for ( int i = 0 ; i < count ; i ++ ) { if ( min > array [ i ] ) { min = array [ i ] ; } } long max = - 1000001 ; for ( int i = 0 ; i < count ; i ++ ) { if ( max < array [ i ] ) { max = array [ i ] ; } } long sum = 0 ; for ( int i = 0 ; i < count ; i ++ ) { System . out . println ( " [LOG] Block: sum += array[i]; " ) ; sum += array [ i ] ; } System . out . println ( min + " " + max + " " + sum ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int ac = 0 , wa = 0 , tle = 0 , re = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: st = new StringTokenizer(br.readLine()); \n String target = st.nextToken(); \n switch(target) { \n case \" AC \" : \n ac++; \n break; \n case \" WA \" : \n wa++; \n break; \n case \" TLE \" : \n tle++; \n break; \n case \" RE \" : \n re++; \n break; \n } " ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] string = br . readLine ( ) . split ( " " ) ; int [ ] Progression = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { Progression [ i ] = Integer . parseInt ( string [ i ] ) ; } for ( int k = 0 ; k < n ; k ++ ) { System . out . print ( Progression [ k ] ) ; if ( k < n - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; int v ; for ( int i = 1 ; i < n ; 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 < n ; k ++ ) { System . out . print ( Progression [ k ] ) ; if ( k < n - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; int prev = 0 ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int b = sc . nextInt ( ) ; if ( prev >= b ) { c ++ ; max = Math . max ( c , max ) ; } else { System . out . println ( " [LOG] Block: c = 0; " ) ; c = 0 ; } prev = b ; } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int min = x - k + 1 ; int max = x + k - 1 ; for ( int i = min ; i <= max ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(i + \" \" ); " ) ; System . out . print ( i + " " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = 0 ; int [ ] d = new int [ a ] ; int [ ] e = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { d [ i ] = sc . nextInt ( ) ; d [ i ] -- ; e [ d [ i ] ] = i + 1 ; } for ( int i = 0 ; i < a ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(e[i] + \" \" ); " ) ; System . out . print ( e [ i ] + " " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n System.out.println(a > 9 || b > 9 ? \" -1 \" : a * b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( a > 9 || b > 9 ? " -1 " : a * b ) ; } } +import java . util . Scanner ; public class Main { private final static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; long K = sc . nextInt ( ) ; long Q = sc . nextInt ( ) ; long [ ] array = new long [ N ] ; for ( int i = 0 ; i < Q ; i ++ ) { array [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < N ; i ++ ) { if ( ( K + array [ i ] - Q ) > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int [ ] check = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int res = 0 ; while ( ! Arrays . equals ( arr , check ) ) { int l = 0 ; int min = Integer . MAX_VALUE ; while ( l < n && arr [ l ] == 0 ) { l ++ ; } int cp = l ; while ( l < n && arr [ l ] != 0 ) { min = Math . min ( min , arr [ l ] ) ; l ++ ; } for ( int i = cp ; i < l ; i ++ ) { System . out . println ( " [LOG] Block: arr[i] -= min; " ) ; arr [ i ] -= min ; } res += min ; } System . out . println ( res ) ; } } +import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; long k = 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 = k - sum + first ; if ( saigo > max ) { System . out . println ( " [LOG] Block: max = saigo; " ) ; max = saigo ; } System . out . println ( k - max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; String S = in . next ( ) ; char [ ] s_chars = S . toCharArray ( ) ; int flag = 0 ; if ( s_chars [ A ] == '-' ) { for ( int i = 0 ; i < A + B + 1 ; i ++ ) { if ( s_chars [ i ] == '-' ) { flag ++ ; } } } if ( flag == 1 ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n < 105 ) { System . out . println ( 0 ) ; } else if ( n >= 105 && n < 135 ) { System . out . println ( 1 ) ; } else if ( n >= 135 && n < 165 ) { System . out . println ( 2 ) ; } else if ( n >= 165 && n < 189 ) { System . out . println ( 3 ) ; } else if ( n >= 189 && n < 195 ) { System . out . println ( 4 ) ; } else if ( n >= 195 ) { System . out . println ( " [LOG] Block: System.out.println(5); " ) ; System . out . println ( 5 ) ; } } } +import java . util . * ; public class Main { static public void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String c = s . next ( ) ; if ( n % 2 == 1 ) { System . out . println ( " No " ) ; } else { boolean yes = true ; for ( int i = 0 ; i < n / 2 && yes ; i ++ ) { System . out . println ( " [LOG] Block: if (c.charAt(i) != c.charAt(i + n / 2)) \n yes = false; " ) ; if ( c . charAt ( i ) != c . charAt ( i + n / 2 ) ) yes = false ; } if ( yes ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int length = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] array = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { array [ i ] = sc . nextLine ( ) ; if ( i == 0 ) { continue ; } if ( ! ( array [ i ] . substring ( 0 , 1 ) ) . equals ( array [ i - 1 ] . substring ( array [ i - 1 ] . length ( ) - 1 ) ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } for ( int i = 0 ; i < length - 1 ; i ++ ) { for ( int j = i + 1 ; j < length ; j ++ ) { if ( array [ i ] . equals ( array [ j ] ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } +import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal A = sc.nextBigDecimal(); \n BigDecimal B = sc.nextBigDecimal(); \n BigDecimal w = A.multiply(B); \n BigDecimal ans = w.setScale(0, RoundingMode.DOWN); \n System.out.println(ans); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] x = new int [ n ] ; int l = Integer . MAX_VALUE / 2 , r = - 1 ; for ( int i = 0 ; i < n ; 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 < n ; j ++ ) { System . out . println ( " [LOG] Block: d += Math.pow(i - x[j], 2); " ) ; d += Math . pow ( i - x [ j ] , 2 ) ; } min = Math . min ( min , d ) ; } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int temp = 0 ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < x ; i ++ ) { temp += 2 ; if ( ( i + 1 ) == x ) { if ( temp == y ) { System . out . println ( " Yes " ) ; } else { for ( int j = i ; j >= 0 ; j -- ) { temp -= 2 ; temp += 4 ; if ( temp == y ) { System . out . println ( " Yes " ) ; break ; } if ( j == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numFriends = sc . nextInt ( ) ; int cent = sc . nextInt ( ) ; int yes = 0 ; for ( int i = 0 ; i < numFriends ; i ++ ) { int height = sc . nextInt ( ) ; if ( height >= cent ) { System . out . println ( " [LOG] Block: yes++; " ) ; yes ++ ; } } System . out . print ( yes ) ; } } +import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int ans = 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 ( ans > tmp ) { System . out . println ( " [LOG] Block: ans = tmp; " ) ; ans = tmp ; } } System . out . println ( ans ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String num = sc . next ( ) ; String [ ] splitNum = num . split ( " " , 0 ) ; int S_N = Integer . parseInt ( num ) ; int N = 0 ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: N += Integer.parseInt(splitNum[i]); " ) ; N += Integer . parseInt ( splitNum [ i ] ) ; } System . out . println ( S_N % N == 0 ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; int count = 1 ; char [ ] slime = S . toCharArray ( ) ; for ( int i = 1 ; i < N ; i ++ ) { if ( slime [ i ] != slime [ i - 1 ] ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = 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 <= X ) { if ( X - a >= X - b ) { a = ( int ) b ; } } else { break ; } } } if ( X < 4 ) { System . out . println ( X ) ; } else { System . out . println ( " [LOG] Block: System.out.println(a); " ) ; System . out . println ( a ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String S = sc . next ( ) ; System . out . println ( solve ( n , S ) ) ; } private static String solve ( int N , String s ) { System . out . println ( " [LOG] Block: if (N % 2 == 1) \n return \" No \" ; \n if (s.substring(0, N / 2).equals(s.substring(N / 2))) \n return \" Yes \" ; \n return \" No \" ; " ) ; if ( N % 2 == 1 ) return " No " ; if ( s . substring ( 0 , N / 2 ) . equals ( s . substring ( N / 2 ) ) ) return " Yes " ; return " No " ; } } +import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] A = sc . next ( ) . toCharArray ( ) ; Map < Character , Integer > maplst = new TreeMap < Character , Integer > ( ) ; for ( char c : A ) { if ( maplst . containsKey ( c ) ) { maplst . put ( c , maplst . get ( c ) + 1 ) ; } else { maplst . put ( c , 1 ) ; } } boolean judge = true ; if ( maplst . keySet ( ) . size ( ) == 2 ) { for ( char c : maplst . keySet ( ) ) { if ( maplst . get ( c ) != 2 ) { judge = ! judge ; break ; } } } else { judge = ! judge ; } if ( judge ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . nextLine ( ) ; int count = 0 ; String t ; while ( ! ( ( t = sc . next ( ) ) . equals ( " END_OF_TEXT " ) ) ) { System . out . println ( " [LOG] Block: if (t.toLowerCase().equals(w)) \n count++; " ) ; if ( t . toLowerCase ( ) . equals ( w ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int i = 0 ; int cnt = 0 ; do { i = s . indexOf ( " ABC " , i ) ; if ( i != - 1 ) { System . out . println ( " [LOG] Block: cnt++; \n i++; " ) ; cnt ++ ; i ++ ; } } while ( i >= 0 ) ; System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { private static final Scanner SC = new Scanner ( System . in ) ; private static final int ELEMENTS = SC . nextInt ( ) ; private static final int [ ] VALUE = load ( SC ) ; private static int [ ] load ( Scanner sc ) { int [ ] value = new int [ ELEMENTS ] ; for ( int i = 0 ; i < ELEMENTS ; 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 ) { System . out . println ( " [LOG] Block: turningPoint = i; \n break; " ) ; turningPoint = i ; break ; } } int resultA = partialSum - sumOfAll ; int resultB = sumOfAll - partialSum + 2 * VALUE [ turningPoint ] ; System . out . println ( Math . min ( resultA , resultB ) ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { char a = input . charAt ( i ) ; if ( Character . isUpperCase ( a ) ) { System . out . print ( Character . toLowerCase ( a ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(Character.toUpperCase(a)); " ) ; System . out . print ( Character . toUpperCase ( a ) ) ; } } System . out . print ( " \n " ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] array = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int i ; for ( i = 0 ; i < a - 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 == ( a - 1 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String h = scan . nextLine ( ) ; String weather = " Sunny " ; if ( " Sunny " . equals ( h ) ) { weather = " Cloudy " ; } else if ( " Cloudy " . equals ( h ) ) { System . out . println ( " [LOG] Block: weather = \" Rainy \" ; " ) ; weather = " Rainy " ; } System . out . println ( weather ) ; } } +import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner input = new Scanner(System.in); \n int x = input.nextInt(); \n x %= 10; \n String ans = \" \" ; \n if (x == 3) \n ans = \" bon \" ; \n else if (x == 0 || x == 1 || x == 6 || x == 8) \n ans = \" pon \" ; \n else \n ans = \" hon \" ; \n System.out.println(ans); " ) ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; x %= 10 ; String ans = " " ; if ( x == 3 ) ans = " bon " ; else if ( x == 0 || x == 1 || x == 6 || x == 8 ) ans = " pon " ; else ans = " hon " ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int counter = 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 { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } } System . out . println ( counter ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int a = x - ( k - 1 ) ; for ( int i = 0 ; i < k * 2 - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (a < -1000000 || a > 1000000) \n continue; \n System.out.print(a + \" \" ); \n a++; " ) ; if ( a < - 1000000 || a > 1000000 ) continue ; System . out . print ( a + " " ) ; a ++ ; } } } +import java . io . FileNotFoundException ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < String > result = new ArrayList < > ( ) ; result . add ( sc . next ( ) ) ; for ( int i = 1 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: result.add(sc.next()); " ) ; result . add ( sc . next ( ) ) ; } ArrayList < String > ans = new ArrayList < String > ( new HashSet < > ( result ) ) ; System . out . println ( ans . size ( ) ) ; } } +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 Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String s = null ; try { s = br . readLine ( ) ; br . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy/MM/dd " ) ; Date formatDate = null ; try { formatDate = sdf . parse ( s ) ; } 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 ( " [LOG] Block: System.out.println( \" Heisei \" ); " ) ; System . out . println ( " Heisei " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; String s = String . valueOf ( a ) + 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 ( " [LOG] Block: System.out.println( \" Yes \" ); \n isSqare = true; \n break; " ) ; System . out . println ( " Yes " ) ; isSqare = true ; break ; } } if ( ! isSqare ) System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; if ( s . charAt ( 0 ) != 'A' ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } int count = 0 ; for ( int i = 2 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == 'C' ) { count ++ ; } } if ( count != 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; 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 ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } } System . out . println ( " AC " ) ; } } +import java . lang . reflect . Array ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int tmp = a; \n a = b; \n b = tmp; \n tmp = a; \n a = c; \n c = tmp; \n System.out.println(a + \" \" + b + \" \" + c); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int tmp = a ; a = b ; b = tmp ; tmp = a ; a = c ; c = tmp ; System . out . println ( a + " " + b + " " + c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int H = Integer . parseInt ( sc . next ( ) ) ; int W = Integer . parseInt ( sc . next ( ) ) ; if ( H == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < H ; i ++ ) { if ( i == 0 || i == H - 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 . println ( " [LOG] Block: System.out.print( \" . \" ); " ) ; System . out . print ( " . " ) ; } System . out . print ( " # " ) ; System . out . print ( " \n " ) ; } } System . out . print ( " \n " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double t = sc . nextDouble ( ) ; double a = sc . nextDouble ( ) ; double [ ] h = new double [ n ] ; double [ ] dist = new double [ n ] ; int answer = 0 ; double tmp = 10000000 ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextDouble ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { dist [ i ] = Math . abs ( a - ( t - h [ i ] * 0.006 ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( tmp > dist [ i ] ) { System . out . println ( " [LOG] Block: answer = i; \n tmp = dist[i]; " ) ; answer = i ; tmp = dist [ i ] ; } } System . out . println ( answer + 1 ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int ex = Integer . parseInt ( sc . next ( ) ) ; int [ ] teki = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { teki [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( teki ) ; n -= ex ; long res = 0L ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: res += teki[i]; " ) ; res += teki [ i ] ; } System . out . println ( res ) ; } } +import java . util . * ; import java . io . * ; import static java . lang . Math . * ; public class Main { static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , q = sc . nextInt ( ) ; String s = sc . next ( ) ; int [ ] AC = new int [ n + 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i - 1 ) == 'A' && s . charAt ( i ) == 'C' ) { AC [ i ] = 1 ; } } for ( int i = 1 ; i < n + 1 ; i ++ ) { AC [ i ] += AC [ i - 1 ] ; } for ( int i = 0 ; i < q ; i ++ ) { System . out . println ( " [LOG] Block: int l = sc.nextInt(), r = sc.nextInt(); \n int k = 0; \n if (r < n && s.charAt(r - 1) == 'A' && s.charAt(r) == 'C') \n k++; \n out.println(max(0, AC[r] - AC[l - 1] - k)); " ) ; int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; int k = 0 ; if ( r < n && 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 Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(), d = sc.nextInt(); \n sc.close(); \n int tmp = 2 * d + 1; \n int r = n % tmp; \n int ans = n / tmp; \n if (r != 0) \n ans++; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , d = sc . nextInt ( ) ; sc . close ( ) ; int tmp = 2 * d + 1 ; int r = n % tmp ; int ans = n / tmp ; if ( r != 0 ) ans ++ ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int d = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int result = 0 ; switch ( d ) { 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 { System . out . println ( " [LOG] Block: result = 10000 * n; " ) ; result = 10000 * n ; } break ; } System . out . println ( result ) ; } } } +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 Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = Integer . parseInt ( in . next ( ) ) ; int K = Integer . parseInt ( in . next ( ) ) ; Integer [ ] H = new Integer [ N ] ; long ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = Integer . valueOf ( in . next ( ) ) ; ans += H [ i ] ; } Arrays . sort ( H , Collections . reverseOrder ( ) ) ; if ( K > N ) K = N ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: ans -= H[i]; " ) ; ans -= H [ i ] ; } out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int i = 0 ; i <= x ; i ++ ) { if ( i * 2 + ( x - i ) * 4 == y ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . util . HashSet ; import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { int N ; int [ ] A1i ; int [ ] A2i ; Set < Integer > searched = new HashSet < > ( ) ; Queue < Integer > queue = new LinkedList < > ( ) ; try ( Scanner sc = new Scanner ( System . in ) ) { N = sc . nextInt ( ) ; A1i = new int [ N ] ; A2i = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A1i [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { A2i [ i ] = sc . nextInt ( ) ; } } int [ ] Sum1 = new int [ N ] ; int sum1 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum1 += A1i [ i ] ; Sum1 [ i ] = sum1 ; } int [ ] Sum2 = new int [ N ] ; int sum2 = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { sum2 += A2i [ i ] ; Sum2 [ i ] = sum2 ; } int result = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( result < Sum1 [ i ] + Sum2 [ i ] ) { System . out . println ( " [LOG] Block: result = Sum1[i] + Sum2[i]; " ) ; result = Sum1 [ i ] + Sum2 [ i ] ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { int n ; double sum = 0.0 , m , v , t = 0.0 ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { n = sc . nextInt ( ) ; if ( n == 0 ) break ; double [ ] A = new double [ n ] ; 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 ++ ) { System . out . println ( " [LOG] Block: t += (A[i] - m) * (A[i] - m); " ) ; 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 . io . * ; import java . util . * ; class Main { 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 h = Integer . parseInt ( st . nextToken ( ) ) ; int w = Integer . parseInt ( st . nextToken ( ) ) ; if ( w == 0 && h == 0 ) break ; for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int firstIndex = S . length ( ) ; int lastIndex = S . length ( ) ; char [ ] sArray = S . toCharArray ( ) ; for ( int i = 0 ; i < sArray . length ; i ++ ) { if ( sArray [ i ] == 'A' ) { firstIndex = i ; break ; } } for ( int i = 0 ; i < sArray . length ; i ++ ) { System . out . println ( " [LOG] Block: if (sArray[i] == 'Z') \n lastIndex = i; " ) ; if ( sArray [ i ] == 'Z' ) lastIndex = i ; } System . out . println ( S . substring ( firstIndex , lastIndex + 1 ) . length ( ) ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . length ( ) % 2 == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } int N = s . length ( ) ; String s1 = s . substring ( 0 , ( N - 1 ) / 2 ) ; String s2 = s . substring ( ( N + 3 ) / 2 - 1 , N ) ; String res = s2 + s . charAt ( ( N + 1 ) / 2 - 1 ) + s1 ; if ( res . equals ( s ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { long max = ( 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 > max || ans < 0 ) { isOver = true ; } } if ( isOver ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int i ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( i = 0 ; i < n ; i ++ ) { a . add ( Integer . parseInt ( sc . next ( ) ) ) ; } sc . close ( ) ; Collections . sort ( a , Comparator . reverseOrder ( ) ) ; int ans = 0 ; for ( i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (i % 2 == 0) \n ans += a.get(i); \n else \n ans -= a.get(i); " ) ; if ( i % 2 == 0 ) ans += a . get ( i ) ; else ans -= a . get ( i ) ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String n = scan . nextLine ( ) ; String [ ] array = n . split ( " " ) ; int frag = 0 ; for ( String a : array ) { if ( a . equals ( " 7 " ) ) { frag = 1 ; } } if ( frag == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int m = Integer . parseInt ( scan . next ( ) ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w , h , x , y , r ; w = sc . nextInt ( ) ; h = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; r = sc . nextInt ( ) ; if ( x + r > w || y + r > h || x - r < 0 || y - r < 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; true ; i ++ ) { n -= m ; ans ++ ; if ( n <= 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { 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 result = 0 ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { if ( tmp . equals ( str . substring ( i , i + 1 ) ) ) { result ++ ; tmp = tmp . equals ( " 0 " ) ? " 1 " : " 0 " ; } else { System . out . println ( " [LOG] Block: tmp = str.substring(i, i + 1); " ) ; tmp = str . substring ( i , i + 1 ) ; } } return result ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } if ( isAsc ( p ) ) { System . out . println ( " YES " ) ; return ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; 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 ++ ) { System . out . println ( " [LOG] Block: if (a[i] > a[i + 1]) \n return false; " ) ; if ( a [ i ] > a [ i + 1 ] ) return false ; } return true ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BDigitSums solver = new BDigitSums ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BDigitSums { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int sum = 0 ; int tmp = n ; while ( tmp > 0 ) { sum += tmp % 10 ; tmp /= 10 ; } out . println ( n % sum == 0 ? " Yes " : " No " ) ; } } static class InputReader { private BufferedReader br ; private StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(nextString()); " ) ; return Integer . parseInt ( nextString ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int maxNum = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x <= maxNum ; ++ x ) { for ( int y = 0 ; y <= maxNum ; ++ y ) { int z = sum - x - y ; if ( 0 <= z && z <= maxNum ) { System . out . println ( " [LOG] Block: ans = ans + 1; " ) ; ans = ans + 1 ; } } } System . out . println ( ans ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int sum = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: sum += d[i] * d[j]; " ) ; sum += d [ i ] * d [ j ] ; } } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int L = Integer . parseInt ( sc . next ( ) ) ; int [ ] appleValue = new int [ N ] ; int sum = 0 ; int a = 0 ; int min = 9999 ; for ( int i = 0 ; i < N ; i ++ ) { int value = L + i ; appleValue [ i ] = value ; sum += appleValue [ i ] ; if ( min > Math . abs ( value ) ) { System . out . println ( " [LOG] Block: min = Math.abs(value); \n a = value; " ) ; min = Math . abs ( value ) ; a = value ; } } System . out . println ( sum - a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = Integer.parseInt(sc.next()); \n int A = Integer.parseInt(sc.next()); \n int B = Integer.parseInt(sc.next()); \n int sumA = A * N; \n System.out.println((sumA >= B ? B : sumA)); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int sumA = A * N ; System . out . println ( ( sumA >= B ? B : sumA ) ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int m , 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 ( m = 0 ; m < n ; m ++ ) array [ m ] = 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 . println ( " [LOG] Block: System.out.print(array[k] + \" \" ); " ) ; System . out . print ( array [ k ] + " " ) ; } if ( k == ( n - 1 ) ) System . out . println ( array [ k ] ) ; System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( sc . nextInt ( ) == count + 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count == 0 ? - 1 : n - count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int saisi = sc . nextInt ( ) ; int c = a + b ; if ( a == - 1 && b == - 1 && saisi == - 1 ) { break ; } if ( a == - 1 || b == - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; 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 ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long ww = sc.nextLong(); \n long hh = sc.nextLong(); \n long xx = sc.nextLong(); \n long yy = sc.nextLong(); \n System.out.print(ww * hh / 2.0); \n System.out.print( \" \" + (xx * 2 == ww && yy * 2 == hh ? 1 : 0)); " ) ; Scanner sc = new Scanner ( System . in ) ; long ww = sc . nextLong ( ) ; long hh = sc . nextLong ( ) ; long xx = sc . nextLong ( ) ; long yy = sc . nextLong ( ) ; System . out . print ( ww * hh / 2.0 ) ; System . out . print ( " " + ( xx * 2 == ww && yy * 2 == hh ? 1 : 0 ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s1 = sc . next ( ) ; int H = Integer . parseInt ( s1 ) ; String s2 = sc . next ( ) ; int W = Integer . parseInt ( s2 ) ; if ( H <= 300 && W <= 300 ) { if ( H == 0 && W == 0 ) { break ; } for ( int i = 1 ; i <= H ; i ++ ) { if ( i == 1 || i == H ) { 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 . println ( " [LOG] Block: System.out.print( \" . \" ); " ) ; System . out . print ( " . " ) ; } } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int numN = 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 < numN ; k ++ ) { for ( int j = 0 ; j < numM ; j ++ ) { numForcheck += in . nextInt ( ) * arrayB [ j ] ; } if ( numForcheck + numC > 0 ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } numForcheck = 0 ; } System . out . println ( result ) ; in . close ( ) ; } } +import java . util . * ; public class Main { 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 count = 0 ; int ans = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( Y [ i ] . equals ( " # " ) ) { count ++ ; ans = ( count > ans ) ? count : ans ; if ( count == S . length ( ) ) { ans = count ; } } else { System . out . println ( " [LOG] Block: ans = (count > ans) ? count : ans; \n count = 0; " ) ; ans = ( count > ans ) ? count : ans ; count = 0 ; } } System . out . println ( ans ) ; keyboard . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] [ ] mrxA = new int [ n ] [ m ] ; int [ ] [ ] mrxB = new int [ m ] [ l ] ; long [ ] [ ] mrxC = new long [ n ] [ l ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int j = 0 , H , A ; H = scan . nextInt ( ) ; A = scan . nextInt ( ) ; while ( H > 0 ) { System . out . println ( " [LOG] Block: H = H - A; \n j++; " ) ; H = H - A ; j ++ ; } System . out . println ( j ) ; } } +import java . util . * ; import java . lang . * ; import java . math . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { int n = sc . nextInt ( ) ; int b = 100 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int 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 < N ; 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 ] == N ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] allList = new int [ 2 * N ] ; for ( int i = 0 ; i < 2 * N ; i ++ ) { allList [ i ] = sc . nextInt ( ) ; } int cost = 10001 ; for ( int i = 1 ; i < 2 * N ; 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 ( " [LOG] Block: System.out.println(cost); " ) ; System . out . println ( cost ) ; } } } +import java . util . * ; import java . io . * ; import java . awt . geom . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arr = new int [ n - 1 ] ; String [ ] s = br . readLine ( ) . split ( " " ) ; int prev = 987654321 ; long sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: int curr = Integer.parseInt(s[i]); \n sum += (long) Math.min(prev, curr); \n prev = curr; " ) ; int curr = Integer . parseInt ( s [ i ] ) ; sum += ( long ) Math . min ( prev , curr ) ; prev = curr ; } sum += prev ; System . out . println ( sum ) ; } } +import java . util . Scanner ; class Main { private static int gcd ( int a , int b ) { while ( b != 0 ) { int r = a % b ; a = b ; b = r ; } 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 ++ ) { System . out . println ( " [LOG] Block: res += gcd(k, temp); " ) ; res += gcd ( k , temp ) ; } } } System . out . println ( res ) ; } } +import java . text . MessageFormat ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Solve s = new Solve ( ) ; s . solve ( ) ; } } class Solve { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; double N = sc . nextInt ( ) ; double K = sc . nextInt ( ) ; double n = 0d ; double res = 0d ; String message ; for ( double i = 1 ; i <= N ; i ++ ) { for ( int j = 0 ; j < 100000 ; j ++ ) { if ( i * Math . pow ( 2 , j ) >= K ) { System . out . println ( " [LOG] Block: n = j; \n j = 100000; " ) ; n = j ; j = 100000 ; } } res += 1 / ( N * Math . pow ( 2 , n ) ) ; } message = MessageFormat . format ( " { 0,number,0.000000000000 } " , res ) ; System . out . println ( message ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; int min = 2018 ; if ( R - L > 2019 ) { System . out . println ( " [LOG] Block: System.out.print(0); " ) ; System . out . print ( 0 ) ; } else { int LMod = Math . floorMod ( L , 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 . println ( " [LOG] Block: System.out.print(0); " ) ; System . out . print ( 0 ) ; } } } } +import java . util . * ; import java . lang . * ; import java . io . * ; class Main { 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 sval ; int val = strArraySub . length ; for ( int i = 1 ; i <= val ; i ++ ) { System . out . println ( " [LOG] Block: sval = val - i; \n System.out.print(strArraySub[sval]); " ) ; sval = val - i ; System . out . print ( strArraySub [ sval ] ) ; } System . out . println ( " " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; int K = Integer . parseInt ( line [ 0 ] ) ; int S = Integer . parseInt ( line [ 1 ] ) ; int ans = 0 ; for ( int x = 0 ; x <= K ; x ++ ) { for ( int y = 0 ; y <= K ; y ++ ) { int target = S - x - y ; if ( target >= 0 && target <= K ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } System . out . println ( ans ) ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; HashSet < Integer > arr = new HashSet < Integer > ( ) ; boolean yes = true ; for ( int i = 0 ; i < N ; i ++ ) { int a = scn . nextInt ( ) ; if ( arr . contains ( a ) ) { yes = false ; break ; } else { System . out . println ( " [LOG] Block: arr.add(a); " ) ; arr . add ( a ) ; } } System . out . println ( yes ? " YES " : " NO " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , f = 1 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print( \" APPROVED \" ); " ) ; System . out . print ( " APPROVED " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner c = new Scanner(System.in); \n long num = c.nextInt(); \n System.out.println((num + (num * num) + (num * num * num))); " ) ; Scanner c = new Scanner ( System . in ) ; long num = c . nextInt ( ) ; System . out . println ( ( num + ( num * num ) + ( num * num * num ) ) ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc155_b solver = new abc155_b ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class abc155_b { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; boolean ret = true ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: out.println( \" DENIED \" ); " ) ; out . println ( " DENIED " ) ; } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 j = Integer . parseInt ( input ) - 1 ; j >= 0 ; j -- ) { System . out . println ( " [LOG] Block: System.out.print(inputan[j]); \n if (j > 0) \n System.out.print( \" \" ); \n if (j == 0) \n System.out.println(); " ) ; System . out . print ( inputan [ j ] ) ; if ( j > 0 ) System . out . print ( " " ) ; if ( j == 0 ) System . out . println ( ) ; } } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int s = scanner . nextInt ( ) ; final Set < Integer > appeared = new HashSet < > ( ) ; int m = 1 ; do { appeared . add ( s ) ; if ( s % 2 == 0 ) { s = s / 2 ; } else { System . out . println ( " [LOG] Block: s = 3 * s + 1; " ) ; s = 3 * s + 1 ; } m ++ ; } while ( ! appeared . contains ( s ) ) ; System . out . println ( m ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long num = sc . nextLong ( ) ; num -- ; String result = " " ; String alp = " abcdefghijklmnopqrstuvwxyz " ; while ( true ) { long syou = num / alp . length ( ) ; long mod = num % alp . length ( ) ; String tmp = alp . substring ( ( int ) mod , ( int ) mod + 1 ) ; result = tmp + result ; num = syou - 1 ; if ( syou == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w , n ; w = sc . nextInt ( ) ; n = sc . nextInt ( ) ; int [ ] ans ; ans = new int [ w + 1 ] ; for ( int i = 0 ; i <= w ; 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 <= w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(ans[i]); " ) ; System . out . println ( ans [ i ] ) ; } } } +import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { 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 rep = Integer . parseInt ( repStr ) ; for ( int i = 0 ; i < rep ; i ++ ) { System . out . println ( " [LOG] Block: String posStr = br.readLine(); \n int pos = Integer.parseInt(posStr); \n String left = str.substring(0, pos); \n String right = str.substring(pos); \n str = right + left; " ) ; 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 . * ; import java . io . * ; public class Main { 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 InputReader { BufferedReader in ; StringTokenizer st ; public InputReader ( InputStream is ) { in = new BufferedReader ( new InputStreamReader ( is ) ) ; } public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { 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 resultNum = 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 ( " + " ) ) { resultNum = ArrayA [ 0 ] + ArrayA [ 1 ] ; resultLine = resultLine + resultNum + ( " \n " ) ; } else if ( op . equals ( " - " ) ) { resultNum = ArrayA [ 0 ] - ArrayA [ 1 ] ; resultLine = resultLine + resultNum + ( " \n " ) ; } else if ( op . equals ( " * " ) ) { resultNum = ArrayA [ 0 ] * ArrayA [ 1 ] ; resultLine = resultLine + resultNum + ( " \n " ) ; } else if ( op . equals ( " / " ) ) { resultNum = ( ArrayA [ 0 ] / ArrayA [ 1 ] ) ; resultLine = resultLine + resultNum + ( " \n " ) ; } else if ( op . equals ( " ? " ) ) { System . out . println ( " [LOG] Block: check = false; " ) ; check = false ; } } System . out . print ( resultLine ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A <= 9 && B <= 9 ) { System . out . println ( A * B ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int s = ( A >= B ) ? A : B ; int f = ( A >= B ) ? B : A ; long ans = s ; for ( int i = 1 ; i <= f ; i ++ ) { ans *= i ; if ( ans % f == 0 ) { System . out . println ( " [LOG] Block: System.out.println(ans); \n return; " ) ; System . out . println ( ans ) ; return ; } ans /= i ; } } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { 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 ans = 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 ++ ; } ans = Math . min ( ans , na ) ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Objects ; import java . lang . StringBuilder ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } int k = sc . nextInt ( ) ; boolean cantConnect = false ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { for ( int j = i + 1 ; j < list . size ( ) ; j ++ ) { System . out . println ( " [LOG] Block: if (list.get(j) - list.get(i) > k) \n cantConnect = true; " ) ; if ( list . get ( j ) - list . get ( i ) > k ) cantConnect = true ; } } System . out . println ( cantConnect ? " :( " : " Yay! " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scn = new Scanner(System.in); \n double R = scn.nextDouble(); \n scn.close(); \n double ans = 2 * R * 3.1415926535; \n System.out.println(ans); " ) ; Scanner scn = new Scanner ( System . in ) ; double R = scn . nextDouble ( ) ; scn . close ( ) ; double ans = 2 * R * 3.1415926535 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; boolean flag = false ; A : for ( int x = 0 ; x <= Math . min ( Y / 10000 , N ) ; x ++ ) { for ( int y = 0 ; y <= Math . min ( ( Y - 10000 * x ) / 5000 , N - x ) ; y ++ ) { int k = Y - 10000 * x - 5000 * y ; if ( k % 1000 == 0 ) { int z = k / 1000 ; if ( z == ( N - x - y ) ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d %d %d \" , x, y, z); \n flag = true; \n break A; " ) ; 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] c = new int [ 9 ] ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: max = min + c[8]; " ) ; max = min + c [ 8 ] ; } System . out . println ( min + " " + max ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] L = new int [ N ] ; int [ ] D = new int [ N + 1 ] ; D [ 0 ] = 0 ; for ( int i = 0 ; i < N ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } int ans = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { D [ i ] = D [ i - 1 ] + L [ i - 1 ] ; if ( D [ i ] <= X ) { System . out . println ( " [LOG] Block: ans += 1; " ) ; ans += 1 ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] hills = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { hills [ i ] = in . nextInt ( ) ; } int counter = 1 ; int cur = hills [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( hills [ i ] >= cur ) { System . out . println ( " [LOG] Block: counter++; \n cur = hills[i]; " ) ; counter ++ ; cur = hills [ i ] ; } } System . out . println ( counter ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; ArrayList < Long > list = new ArrayList < > ( ) ; long num = 1 ; while ( num != n + 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 ++ ) { System . out . println ( " [LOG] Block: sum = sum + list.get(i); " ) ; sum = sum + list . get ( i ) ; } System . out . println ( sum ) ; } } +import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Queue < Character > [ ] queues = new Queue [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { queues [ i ] = new LinkedList < > ( ) ; for ( char ch : scanner . next ( ) . toCharArray ( ) ) queues [ i ] . add ( ch ) ; } int c = 0 ; while ( true ) { if ( queues [ c ] . isEmpty ( ) ) { System . out . println ( " [LOG] Block: System.out.println((char) ('A' + c)); \n return; " ) ; System . out . println ( ( char ) ( 'A' + c ) ) ; return ; } char ch = queues [ c ] . remove ( ) ; c = ch - 'a' ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int [ ] [ ] array ; array = new int [ a ] [ b ] ; int [ ] Vec = new int [ b ] ; int [ ] sum = new int [ a ] ; int x = 0 ; for ( int i = 0 ; i < a ; 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 < a ; 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 < a ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(sum[i]); " ) ; System . out . println ( sum [ i ] ) ; } scanner . close ( ) ; } } +import java . util . Scanner ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 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 ++ ) { System . out . println ( " [LOG] Block: inputStr[i] = String.valueOf(inputInt[i]); " ) ; inputStr [ i ] = String . valueOf ( inputInt [ i ] ) ; } System . out . println ( String . join ( " " , inputStr ) ) ; System . out . println ( numExchange ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < Integer > ( n ) ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: mans += ((a.get(i) - k) * (a.get(i) - k)); " ) ; mans += ( ( a . get ( i ) - k ) * ( a . get ( i ) - k ) ) ; } ans = Math . min ( ans , mans ) ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { 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 i = 0 ; i < list . size ( ) - 1 ; i ++ ) { String s = list . get ( i ) ; String [ ] ary = s . split ( " " ) ; data [ i ] [ 0 ] = Integer . parseInt ( ary [ 0 ] ) ; data [ i ] [ 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 ] ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } } } } System . out . println ( answer ) ; answer = 0 ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int x = s . nextInt ( ) ; char [ ] road = new char [ n ] ; 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 < n ; 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 < n ; q ++ ) { if ( road [ q ] == 'c' ) { System . out . println ( " [LOG] Block: ++countC; " ) ; ++ countC ; } } } System . out . println ( countC ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = Integer.parseInt(sc.next()); \n int y = Integer.parseInt(sc.next()); \n long z = n + y; \n System.out.println((n + y) % 2 == 0 ? (n + y) / 2 : \" IMPOSSIBLE \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; long z = n + y ; System . out . println ( ( n + y ) % 2 == 0 ? ( n + y ) / 2 : " IMPOSSIBLE " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int count = 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } yaku = 0 ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] L = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( L ) ; int sum = 0 ; for ( int i = N - 2 ; 0 <= i ; i -- ) { sum += L [ i ] ; } if ( L [ N - 1 ] < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int maxLen = 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 ) ) ) { System . out . println ( " [LOG] Block: maxLen = Math.max(maxLen, i - leftIdx); \n leftIdx = i + 1; " ) ; maxLen = Math . max ( maxLen , i - leftIdx ) ; leftIdx = i + 1 ; } } maxLen = Math . max ( maxLen , s . length ( ) - leftIdx ) ; System . out . println ( maxLen ) ; } } +import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal a = new BigDecimal(sc.next()); \n BigDecimal b = new BigDecimal(sc.next()); \n System.out.println(a.multiply(b).setScale(0, RoundingMode.DOWN).toString()); \n sc.close(); " ) ; 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 ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a, b, c; \n a = sc.nextInt(); \n b = sc.nextInt(); \n c = sc.nextInt(); \n System.out.println(c + \" \" + a + \" \" + b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; System . out . println ( c + " " + a + " " + b ) ; } } +import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: BigDecimal pi = new BigDecimal( \" 3.14159265359 \" ); \n Scanner sc = new Scanner(System.in); \n BigDecimal m = sc.nextBigDecimal(); \n System.out.println(m.multiply(pi).multiply(new BigDecimal(2))); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int red = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if ('0' == s.charAt(i)) \n red++; " ) ; if ( '0' == s . charAt ( i ) ) red ++ ; } System . out . println ( 2 * Math . min ( s . length ( ) - red , red ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int totalVotes = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; totalVotes += arr [ i ] ; } double popular = totalVotes / ( 4 * m ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (totalVotes <= arr[i] * 4 * m) \n ans++; " ) ; if ( totalVotes <= arr [ i ] * 4 * m ) ans ++ ; } if ( ans >= m ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { String [ ] lines = getStdin ( ) ; String [ ] inputs = lines [ 0 ] . split ( " " ) ; int x = Integer . parseInt ( inputs [ 0 ] ) ; int y = Integer . parseInt ( inputs [ 1 ] ) ; System . out . println ( x * y ) ; } private static String [ ] getStdin ( ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < String > lines = new ArrayList < > ( ) ; while ( scanner . hasNext ( ) ) { System . out . println ( " [LOG] Block: lines.add(scanner.nextLine()); " ) ; lines . add ( scanner . nextLine ( ) ) ; } return lines . toArray ( new String [ lines . size ( ) ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int a , b , c ; Scanner sc = new Scanner ( System . in ) ; String [ ] input = sc . nextLine ( ) . split ( " " ) ; a = Integer . parseInt ( input [ 0 ] ) ; b = Integer . parseInt ( input [ 1 ] ) ; c = Integer . parseInt ( input [ 2 ] ) ; int cnt = 0 ; for ( int i = a ; i <= b ; i ++ ) { System . out . println ( " [LOG] Block: if (c % i == 0) \n cnt++; " ) ; if ( c % i == 0 ) cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashSet < Integer > A = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! A . add ( sc . nextInt ( ) ) ) { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); \n return; " ) ; System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] != t [ i ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner scn = new Scanner(System.in); \n String S = scn.nextLine(); \n int N = S.length(); \n String str_before = S.substring(0, (N - 1) / 2); \n String str_after = S.substring((N + 2) / 2, N); \n StringBuffer hoge = new StringBuffer(str_before); \n String str = hoge.reverse().toString(); \n if (str_after.equals(str) && str_after.equals(str_before)) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner scn = new Scanner ( System . in ) ; String S = scn . nextLine ( ) ; int N = S . length ( ) ; String str_before = S . substring ( 0 , ( N - 1 ) / 2 ) ; String str_after = S . substring ( ( N + 2 ) / 2 , N ) ; 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; boolean can = false ; for ( int i = 0 ; i < 25 ; ++ i ) { for ( int j = 0 ; j < 25 ; ++ j ) { if ( N == 4 * i + 7 * j ) { can = true ; } } } if ( can == true ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int[] A = new int[3]; \n A[0] = sc.nextInt(); \n A[1] = sc.nextInt(); \n A[2] = sc.nextInt(); \n int K = sc.nextInt(); \n Arrays.parallelSort(A); \n System.out.println(A[0] + A[1] + (int) (A[2] * Math.pow(2, K))); " ) ; Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; A [ 0 ] = sc . nextInt ( ) ; A [ 1 ] = sc . nextInt ( ) ; A [ 2 ] = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; Arrays . parallelSort ( A ) ; System . out . println ( A [ 0 ] + A [ 1 ] + ( int ) ( A [ 2 ] * Math . pow ( 2 , K ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] ds = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ds [ i ] = s . nextInt ( ) ; for ( int j = 0 ; j < i ; j ++ ) { System . out . println ( " [LOG] Block: sum += ds[j] * ds[i]; " ) ; sum += ds [ j ] * ds [ i ] ; } } System . out . println ( sum ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { int count = 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 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } else if ( a [ 0 ] == a [ 2 ] && a [ 1 ] == a [ 3 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } else if ( a [ 0 ] == a [ 3 ] && a [ 1 ] == a [ 2 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } System . out . print ( ans [ count ] ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; public class Main { private static final String WATHER_SUNNY = " 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 ( WATHER_SUNNY ) ) { tomorrow = WATHER_CLOUDY ; } else if ( today . equals ( WATHER_CLOUDY ) ) { tomorrow = WATHER_RAINY ; } else if ( today . equals ( WATHER_RAINY ) ) { System . out . println ( " [LOG] Block: tomorrow = WATHER_SUNNY; " ) ; tomorrow = WATHER_SUNNY ; } return tomorrow ; } } +import java . io . * ; import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int q = Integer . parseInt ( scan . next ( ) ) ; int sumTime = 0 ; Queue < Process > queue = new ArrayDeque < Process > ( ) ; for ( int i = 0 ; i < n ; 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 Process { String name ; int pTime ; public Process ( String name , int pTime ) { System . out . println ( " [LOG] Block: this.name = name; \n this.pTime = pTime; " ) ; this . name = name ; this . pTime = pTime ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.nextLine(); \n sc.close(); \n String s2 = s.replace( \" 0 \" , \" \" ); \n System.out.println(s2.length()); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; sc . close ( ) ; String s2 = s . replace ( " 0 " , " " ) ; System . out . println ( s2 . length ( ) ) ; } } +import java . util . Scanner ; public class Main { private static int input_num , x ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; input_num = stdIn . nextInt ( ) ; for ( int i = 1 ; i <= input_num ; i ++ ) { x = i ; if ( x % 3 == 0 ) { System . out . print ( " " + x ) ; continue ; } while ( x > 0 ) { if ( x % 10 == 3 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" + i); \n break; " ) ; System . out . print ( " " + i ) ; break ; } x /= 10 ; } } System . out . println ( " " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 1 ; int min = P [ 1 ] ; for ( int i = 2 ; i <= N ; i ++ ) { min = Math . min ( min , P [ i ] ) ; if ( P [ i ] <= min ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . io . * ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N % 2 == 0 ) { System . out . println ( " 0.5000000000 " ) ; } else { System . out . println ( " [LOG] Block: int s = N / 2 + 1; \n double ans = (double) s / N; \n System.out.println(String.format( \" %.10f \" , ans)); " ) ; int s = N / 2 + 1 ; double ans = ( double ) s / N ; System . out . println ( String . format ( " %.10f " , ans ) ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] s = br . readLine ( ) . toCharArray ( ) ; br . close ( ) ; if ( s [ 2 ] == s [ 3 ] && s [ 4 ] == s [ 5 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { static boolean [ ] targetNumbers ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long gcd = calcGcd ( A , B ) ; System . out . println ( A * 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 ) { System . out . println ( " [LOG] Block: m = n; \n n = remainder; " ) ; m = n ; n = remainder ; } return n ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int t ; int j = 1 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int k = 0 ; k < N ; 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 < N ; i ++ ) { if ( max > a [ i ] ) { System . out . println ( " [LOG] Block: j++; \n max = a[i]; " ) ; j ++ ; max = a [ i ] ; } } System . out . println ( j ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] str = s . split ( " " ) ; int length = str . length ; boolean easiness = true ; for ( int i = 0 ; i < length ; i += 2 ) { if ( str [ i ] . equals ( " L " ) ) { easiness = false ; break ; } } for ( int i = 1 ; i < length ; i += 2 ) { if ( str [ i ] . equals ( " R " ) ) { easiness = false ; break ; } } if ( easiness ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] s ; int a , b , c ; for ( int i = 0 ; i < n ; ++ 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 { System . out . println ( " [LOG] Block: sb.append( \" NO \n \" ); " ) ; sb . append ( " NO \n " ) ; } } System . out . print ( sb ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , b , f , r , v ; int [ ] [ ] [ ] house = new int [ 4 ] [ 3 ] [ 10 ] ; String output ; String [ ] input = new String [ 4 ] ; n = Integer . parseInt ( sc . nextLine ( ) ) ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" #################### \" ); " ) ; System . out . println ( " #################### " ) ; } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { System . out . println ( " [LOG] Block: int a = in.nextInt(); \n int b = in.nextInt(); \n int c = (int) Math.log10(a + b) + 1; \n System.out.println(c); " ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = ( int ) Math . log10 ( a + b ) + 1 ; System . out . println ( c ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < n ; 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 ) ) { System . out . println ( " [LOG] Block: if (x % i == 0) \n return false; \n i = i + 2; " ) ; if ( x % i == 0 ) return false ; i = i + 2 ; } return true ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { N -= sc . nextInt ( ) ; } if ( N < 0 ) { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } else System . out . println ( N ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt() * scan.nextInt(); \n scan.close(); \n System.out.println(a); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) * scan . nextInt ( ) ; scan . close ( ) ; System . out . println ( a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { c [ i ] [ 0 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ i ] [ 1 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ i ] [ 2 ] = Integer . parseInt ( scanner . next ( ) ) ; } scanner . close ( ) ; for ( int i = 0 ; i < c . length ; i ++ ) { int min = Integer . MAX_VALUE ; for ( int j = 0 ; j < c [ i ] . length ; j ++ ) { int num = c [ i ] [ j ] ; if ( min > num ) { min = num ; } } for ( int j = 0 ; j < c [ i ] . length ; j ++ ) { c [ i ] [ j ] -= min ; } } for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ 0 ] [ i ] != c [ 1 ] [ i ] || c [ 1 ] [ i ] != c [ 2 ] [ i ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int a , b , c ; a = x + y ; b = x - y ; c = x * 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 . println ( " [LOG] Block: System.out.print(c); " ) ; System . out . print ( c ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int d = in.nextInt(); \n int t = in.nextInt(); \n int s = in.nextInt(); \n double time = (double) d / s; \n if (time - t > 0) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; Scanner in = new Scanner ( System . in ) ; int d = in . nextInt ( ) ; int t = in . nextInt ( ) ; int s = in . nextInt ( ) ; double time = ( double ) d / s ; if ( time - t > 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main2 cc = new Main2 ( ) ; cc . yesNo ( ) ; } } class Main2 { public void yesNo ( ) { Scanner scan = new Scanner ( System . in ) ; int [ ] abc = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { abc [ i ] = scan . nextInt ( ) ; } if ( abc [ 0 ] < abc [ 1 ] && abc [ 1 ] < abc [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; double debt = 100000 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: debt *= 1.05; \n debt = 1000.0 * Math.ceil(debt / 1000.0); \n n--; " ) ; debt *= 1.05 ; debt = 1000.0 * Math . ceil ( debt / 1000.0 ) ; n -- ; } System . out . println ( String . format ( " %.0f " , debt ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int vacation = 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 ( vacation - studyDay >= 0 ) { playable = vacation - studyDay ; System . out . println ( playable ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } scanner . close ( ) ; } } +import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { int bit = 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 ) { bit |= 1 ; } else if ( num < 2 ) { bit |= 2 ; } else if ( num < 3 ) { bit |= 4 ; } else if ( num < 4 ) { bit |= 8 ; } else if ( num < 5 ) { bit |= 16 ; } else if ( num < 6 ) { bit |= 32 ; } else if ( num < 7 ) { bit |= 64 ; } else if ( num < 8 ) { bit |= 128 ; } else { System . out . println ( " [LOG] Block: over++; " ) ; over ++ ; } if ( buf == '\n' ) break ; } int count = Integer . bitCount ( bit ) ; int max = count + over ; if ( count == 0 ) count = 1 ; System . out . print ( count + " " + max ) ; } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int even = sc.nextInt(); \n int odd = sc.nextInt(); \n int ans = even * (even - 1) / 2 + odd * (odd - 1) / 2; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int even = sc . nextInt ( ) ; int odd = sc . nextInt ( ) ; int ans = even * ( even - 1 ) / 2 + odd * ( odd - 1 ) / 2 ; System . out . println ( ans ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int [ ] ans = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { ans [ i ] = scan . nextInt ( ) ; } Arrays . sort ( ans ) ; int answer = 0 ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: answer = answer + ans[i]; " ) ; answer = answer + ans [ i ] ; } System . out . println ( answer ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { char [ ] input = line . toCharArray ( ) ; for ( int i = input . length ; i > 0 ; i -- ) { System . out . println ( " [LOG] Block: System.out.print(input[i - 1]); " ) ; System . out . print ( input [ i - 1 ] ) ; } System . out . println ( ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int a = 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 != a ) { correct = false ; break ; } size = 0 ; foundMinuse = true ; } } if ( foundMinuse && size == b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; import java . util . * ; class Main { 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 m = Integer . parseInt ( st . nextToken ( ) ) ; int f = Integer . parseInt ( st . nextToken ( ) ) ; int r = Integer . parseInt ( st . nextToken ( ) ) ; if ( m == - 1 && f == - 1 && r == - 1 ) { break ; } if ( m == - 1 || f == - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } else if ( ( m + f ) >= 80 ) { System . out . println ( " A " ) ; } else if ( ( m + f ) >= 65 ) { System . out . println ( " B " ) ; } else if ( ( ( m + f ) >= 50 ) || ( ( m + f ) >= 30 && r >= 50 ) ) { System . out . println ( " C " ) ; } else if ( ( m + f ) >= 30 ) { System . out . println ( " D " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; StringBuilder a_str = new StringBuilder ( ) ; StringBuilder b_str = new StringBuilder ( ) ; for ( int i = 0 ; i < a ; i ++ ) { a_str . append ( b ) ; } for ( int i = 0 ; i < b ; i ++ ) { System . out . println ( " [LOG] Block: b_str.append(a); " ) ; b_str . append ( a ) ; } System . out . println ( a_str . toString ( ) . compareTo ( b_str . toString ( ) ) < 0 ? a_str . toString ( ) : b_str . toString ( ) ) ; } } +import java . util . * ; import java . util . stream . Collectors ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int result = 0 ; int lower ; int upper ; lower = Math . max ( a , c ) ; upper = Math . min ( b , d ) ; if ( upper >= lower ) { System . out . println ( " [LOG] Block: result = upper - lower; " ) ; result = upper - lower ; } System . out . println ( result ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { new Main ( ) ; } Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int a , b ; Main ( ) { System . out . println ( " [LOG] Block: a = in.nextInt(); \n b = in.nextInt(); \n if ((a % 2) != (b % 2)) \n out.println( \" IMPOSSIBLE \" ); \n else \n out.println((a + b) / 2); \n out.close(); " ) ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; if ( ( a % 2 ) != ( b % 2 ) ) out . println ( " IMPOSSIBLE " ) ; else out . println ( ( a + b ) / 2 ) ; out . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int x = sc . nextInt ( ) ; for ( int i = x ; 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int rest = N % 7 ; for ( int i = 0 ; i < 25 ; i ++ ) { for ( int j = 0 ; j < 14 ; j ++ ) { if ( i * 4 + j * 7 == N ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { System . out . println ( " [LOG] Block: char[] x = sc.next().toCharArray(); \n x[3] = '8'; \n System.out.println(x); " ) ; char [ ] x = sc . next ( ) . toCharArray ( ) ; x [ 3 ] = '8' ; System . out . println ( x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; System . out . println ( ans ( a , b , c , x ) ) ; } static int ans ( int a , int b , int c , int x ) { int ans = 0 ; for ( int i = 0 ; i <= a ; i ++ ) { for ( int j = 0 ; j <= b ; j ++ ) { for ( int k = 0 ; k <= c ; k ++ ) { System . out . println ( " [LOG] Block: int work = i * 500 + j * 100 + k * 50; \n if (work == x) \n ans++; " ) ; int work = i * 500 + j * 100 + k * 50 ; if ( work == x ) ans ++ ; } } } return ans ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int totalFlower = scanner . nextInt ( ) ; int [ ] flowersHeight = new int [ totalFlower ] ; int maxFlowerHeight = 0 ; for ( int i = 0 ; i < totalFlower ; ++ 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 < totalFlower ; ++ 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 { System . out . println ( " [LOG] Block: if (++j == totalFlower) \n break loop; " ) ; if ( ++ j == totalFlower ) break loop ; } } ++ wateringTimes ; } System . out . print ( wateringTimes ) ; } } +import java . util . Collections ; import java . util . LinkedList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; LinkedList < Integer > inputs = new LinkedList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { inputs . add ( sc . nextInt ( ) ) ; } Collections . sort ( inputs ) ; double beforeParam = inputs . pop ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: beforeParam = (beforeParam + inputs.pop()) / 2; " ) ; beforeParam = ( beforeParam + inputs . pop ( ) ) / 2 ; } System . out . println ( beforeParam ) ; } } +import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { HashMap < Integer , Integer > num = new HashMap < > ( ) ; Scanner sc = new Scanner ( System . in ) ; int loop = sc . nextInt ( ) ; for ( int i = 1 ; i < loop ; 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 <= loop ; i ++ ) { if ( num . containsKey ( i ) ) { System . out . println ( num . get ( i ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; String S1 = S . substring ( N / 2 ) ; String S2 = S . substring ( 0 , N / 2 ) ; String S3 = S1 + S2 ; sc . close ( ) ; if ( N % 2 == 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } else { if ( S . equals ( S3 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long A = 1 ; for ( long i = 1 ; i * i <= N ; i ++ ) { if ( N % i == 0 && i > A ) { System . out . println ( " [LOG] Block: A = i; " ) ; A = i ; } } long B = N / A ; System . out . println ( A + B - 2 ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( int i = 1 ; i <= 10000 ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 0 && y == 0 ) { break ; } else { System . out . println ( " [LOG] Block: System.out.println(Math.min(x, y) + \" \" + Math.max(x, y)); " ) ; System . out . println ( Math . min ( x , y ) + " " + Math . max ( x , y ) ) ; } } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N ; Scanner in = new Scanner ( System . in ) ; N = Integer . parseInt ( in . next ( ) ) ; int cnt ; int ans = 0 ; for ( int i = 1 ; i <= N ; 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 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { private static int digitSum ( int input ) { int output = 0 ; int tmp = 1 ; while ( tmp <= input ) { output += ( input / tmp ) % 10 ; tmp *= 10 ; } return output ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int val = sc.nextInt(); \n String res = (val % digitSum(val) == 0) ? \" Yes \" : \" No \" ; \n System.out.println(res); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) - 1 ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { c [ i ] = scan . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum = sum + b [ a [ i ] ] ; if ( i != 0 && a [ i ] - a [ i - 1 ] == 1 ) { System . out . println ( " [LOG] Block: sum = sum + c[a[i]]; " ) ; sum = sum + c [ a [ i ] ] ; } } System . out . println ( sum ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n if ((a * b) % 2 == 0) \n System.out.println( \" Even \" ); \n else \n System.out.println( \" Odd \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( ( a * b ) % 2 == 0 ) System . out . println ( " Even " ) ; else System . out . println ( " Odd " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try ( BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int taro = 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 ) { taro += 3 ; } else if ( cmp == 0 ) { taro ++ ; hanako ++ ; } else { hanako += 3 ; } } System . out . println ( taro + " " + hanako ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < v . length ; i ++ ) { v [ i ] = Integer . parseInt ( k [ i ] ) ; } int count = 0 ; for ( int i = v [ 0 ] ; i <= v [ 1 ] ; i ++ ) { if ( v [ 2 ] % i == 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Integer [ ] a = new Integer [ N ] ; boolean s = true ; int Alice = 0 ; int Bob = 0 ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( a , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( s ) { Alice += a [ i ] ; } else { System . out . println ( " [LOG] Block: Bob += a[i]; " ) ; Bob += a [ i ] ; } s = ! s ; } System . out . println ( Alice - Bob ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] h = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextLong ( ) ; } long max = 0 , count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( h [ i ] >= h [ i + 1 ] ) { count += 1 ; } else { count = 0 ; } if ( max < count ) { System . out . println ( " [LOG] Block: max = count; " ) ; max = count ; } } System . out . println ( max ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += a [ i ] ; } System . out . println ( a [ n - 1 ] < sum ? " Yes " : " No " ) ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] a ; int i = 0 , count = 1 ; a = new int [ 100000 ] ; a [ 0 ] = 1 ; Scanner n = new Scanner ( System . in ) ; while ( a [ i ] != 0 ) { i ++ ; a [ i ] = n . nextInt ( ) ; if ( a [ i ] != 0 ) { count += 1 ; } } i = 1 ; while ( count > i ) { System . out . println ( " [LOG] Block: System.out.println( \" Case \" + i + \" : \" + a[i]); \n i++; " ) ; System . out . println ( " Case " + i + " : " + a [ i ] ) ; i ++ ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] task = new int [ 3 ] ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { task [ i ] = sc . nextInt ( ) ; } Arrays . sort ( task ) ; for ( int i = 0 ; i < 2 ; i ++ ) { System . out . println ( " [LOG] Block: ans += Math.abs(task[i] - task[i + 1]); " ) ; ans += Math . abs ( task [ i ] - task [ i + 1 ] ) ; } System . out . println ( ans ) ; } } +import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; boolean flg = 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 ) { flg = true ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( i == at ) continue ; if ( s . charAt ( i ) < 'a' || 'z' < s . charAt ( i ) ) { System . out . println ( " [LOG] Block: flg = false; \n break; " ) ; flg = false ; break ; } } } } System . out . println ( flg ? " AC " : " WA " ) ; } } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n Map<String, Integer> map = new HashMap<>(); \n map.put( \" SUN \" , 1); \n map.put( \" MON \" , 2); \n map.put( \" TUE \" , 3); \n map.put( \" WED \" , 4); \n map.put( \" THU \" , 5); \n map.put( \" FRI \" , 6); \n map.put( \" SAT \" , 7); \n String ss = s.nextLine(); \n System.out.println(8 - map.get(ss)); " ) ; 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 ss = s . nextLine ( ) ; System . out . println ( 8 - map . get ( ss ) ) ; } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String word = null ; String prevWord = null ; Set < String > wordSet = new HashSet < > ( ) ; boolean failed = false ; while ( sc . hasNextLine ( ) ) { word = sc . nextLine ( ) ; if ( ! wordSet . add ( word ) ) { System . out . println ( " [LOG] Block: failed = true; \n break; " ) ; failed = true ; break ; } if ( prevWord != null ) { boolean chained = ( prevWord . charAt ( prevWord . length ( ) - 1 ) == word . charAt ( 0 ) ) ; if ( ! chained ) { System . out . println ( " [LOG] Block: failed = true; \n break; " ) ; failed = true ; break ; } } prevWord = word ; } System . out . println ( failed ? " No " : " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] menu = new int [ 5 ] ; int ans = 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 ) { ans += menu [ i ] ; } else { System . out . println ( " [LOG] Block: ans += menu[i] + (10 - (menu[i] % 10)); " ) ; ans += menu [ i ] + ( 10 - ( menu [ i ] % 10 ) ) ; } } } ans += menu [ idx ] ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int X = input . nextInt ( ) ; int [ ] L = new int [ n ] ; 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 ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } System . out . println ( count + 1 ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int n , point1 = 0 , point2 = 0 ; String card1 , card2 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { card1 = sc . next ( ) ; card2 = sc . next ( ) ; if ( card2 . compareTo ( card1 ) < 0 ) { point1 += 3 ; } else if ( card1 . equals ( card2 ) ) { point1 ++ ; point2 ++ ; } else { System . out . println ( " [LOG] Block: point2 += 3; " ) ; point2 += 3 ; } } System . out . println ( point1 + " " + point2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s1 = new Scanner ( System . in ) ; int n = s1 . nextInt ( ) ; int A = s1 . nextInt ( ) ; int B = s1 . nextInt ( ) ; for ( int i = A ; i <= B ; i ++ ) { if ( i % n == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" OK \" ); \n return; " ) ; System . out . println ( " OK " ) ; return ; } } System . out . println ( " NG " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int A = stdIn . nextInt ( ) ; int B = stdIn . nextInt ( ) ; int z = 1 , y = 0 , x = 0 , ans = 0 ; while ( z <= N ) { y = z ; while ( true ) { System . out . println ( " [LOG] Block: x += y % 10; \n y /= 10; \n if (y == 0) \n break; " ) ; 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } 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 . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( " " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . close ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= N ; i ++ ) { int cnt = 0 ; double p = i ; while ( p < K ) { System . out . println ( " [LOG] Block: cnt++; \n p *= 2.0; " ) ; cnt ++ ; p *= 2.0 ; } ans += 1.0 / N * Math . pow ( 0.5 , cnt ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long N = sc . nextLong ( ) ; Long total = 0L ; for ( int i = 1 ; i <= N ; ++ i ) { if ( i % 3 == 0 && i % 5 == 0 ) { continue ; } else if ( i % 3 == 0 ) { continue ; } else if ( i % 5 == 0 ) { continue ; } else { System . out . println ( " [LOG] Block: total += i; " ) ; total += i ; } } System . out . println ( total ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String C = sc.next(); \n char c = C.charAt(0); \n System.out.println((char) (((int) c) + 1)); " ) ; Scanner sc = new Scanner ( System . in ) ; String C = sc . next ( ) ; char c = C . charAt ( 0 ) ; System . out . println ( ( char ) ( ( ( int ) c ) + 1 ) ) ; } } +import java . util . * ; import java . util . function . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String A = sc.next(); \n System.out.println( \" ABC \" .equals(A) ? \" ARC \" : \" ABC \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String A = sc . next ( ) ; System . out . println ( " ABC " . equals ( A ) ? " ARC " : " ABC " ) ; } } +import java . io . * ; public class Main { 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 cnt = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { cnt = 0 ; for ( int j = 0 ; j < p . length ( ) ; j ++ ) { if ( s . charAt ( ( i + j ) % s . length ( ) ) == p . charAt ( j ) ) { cnt ++ ; } else { break ; } } if ( cnt == p . length ( ) ) { break ; } } if ( cnt == p . length ( ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . InputStreamReader ; import java . io . BufferedReader ; import java . io . IOException ; class Main { 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 h = Integer . parseInt ( strAry [ 0 ] ) ; int w = Integer . parseInt ( strAry [ 1 ] ) ; if ( h == 0 && w == 0 ) { break ; } for ( int i = 1 ; i <= h ; 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 ++ ) { System . out . println ( " [LOG] Block: if (k % 2 != 0) \n System.out.print( \" . \" ); \n else if (k % 2 == 0) \n System.out.print( \" # \" ); " ) ; if ( k % 2 != 0 ) System . out . print ( " . " ) ; else if ( k % 2 == 0 ) System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . io . * ; import java . util . * ; public class Main { 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 N = readInt ( ) ; long D = readInt ( ) ; long D_squared = D * D ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: long dx = readInt(); \n long dy = readInt(); \n if (dx * dx + dy * dy <= D_squared) \n count++; " ) ; long dx = readInt ( ) ; long dy = readInt ( ) ; if ( dx * dx + dy * dy <= D_squared ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static int func ( int n ) { int res = 0 ; if ( n % 2 == 0 ) { res = n / 2 ; } else if ( n % 2 == 1 ) { res = 3 * n + 1 ; } return res ; } 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 ] ) { System . out . println ( " [LOG] Block: ans = i + 1; \n break; " ) ; ans = i + 1 ; break ; } } if ( ans != 0 ) break ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int num = Integer . parseInt ( br . readLine ( ) ) ; if ( num == 0 ) { break ; } int [ ] su = new int [ num ] ; 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 / num ; double result = 0 ; for ( int i = 0 ; i < num ; i ++ ) { System . out . println ( " [LOG] Block: result += (Math.pow((su[i] - avg), 2) / num); " ) ; result += ( Math . pow ( ( su [ i ] - avg ) , 2 ) / num ) ; } System . out . println ( Math . sqrt ( result ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final StringBuilder S1 = new StringBuilder ( sc . next ( ) ) ; final int N = S1 . length ( ) ; final StringBuilder S2 = new StringBuilder ( S1 . substring ( 0 , ( N - 1 ) / 2 ) ) ; final StringBuilder S3 = new StringBuilder ( S1 . substring ( ( N + 3 ) / 2 - 1 , N ) ) ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; String [ ] t = s . split ( " " ) ; for ( int i = 0 ; i < t . length ; i ++ ) { System . out . println ( " [LOG] Block: t[i] = \" x \" ; " ) ; t [ i ] = " x " ; } String u = String . join ( " " , t ) ; System . out . println ( u ) ; } } +import java . util . Scanner ; public class Main { private static final String SUNNY = " Sunny " ; private static final String CLOUDY = " Cloudy " ; private static final String RAINY = " Rainy " ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String r = null; \n switch(s) { \n case SUNNY: \n r = CLOUDY; \n break; \n case CLOUDY: \n r = RAINY; \n break; \n case RAINY: \n r = SUNNY; \n break; \n default: \n break; \n } \n System.out.println(r); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String r = null ; switch ( s ) { case SUNNY : r = CLOUDY ; break ; case CLOUDY : r = RAINY ; break ; case RAINY : r = SUNNY ; break ; default : break ; } System . out . println ( r ) ; sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { String [ ] arr = line . split ( " " ) ; int n = Integer . parseInt ( arr [ 0 ] ) ; int x = Integer . parseInt ( arr [ 1 ] ) ; if ( n == 0 && x == 0 ) break ; int cnt = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { for ( int k = j + 1 ; k <= n ; k ++ ) { System . out . println ( " [LOG] Block: if (i + j + k == x) \n cnt++; " ) ; if ( i + j + k == x ) cnt ++ ; } } } System . out . println ( cnt ) ; } } } +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 Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ; long ans = 0 , mod = 1000000007 ; while ( t -- > 0 ) { System . out . println ( " [LOG] Block: int n = sc.nextInt(), m = sc.nextInt(); \n pw.println((n * (n - 1)) / 2 + (m * (m - 1)) / 2); " ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; pw . println ( ( n * ( n - 1 ) ) / 2 + ( m * ( m - 1 ) ) / 2 ) ; } pw . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] nums = new int [ 4 ] [ 13 ] ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(suit + \" \" + (j + 1)); " ) ; System . out . println ( suit + " " + ( j + 1 ) ) ; } } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long co = 0 ; HashMap < String , Long > l = new HashMap < String , Long > ( ) ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: l.put(S, (long) 0); " ) ; l . put ( S , ( long ) 0 ) ; } } sc . close ( ) ; System . out . println ( co ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long mod = 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 ++ ) { System . out . println ( " [LOG] Block: if (S[i] == -1) \n S[i] = 0; \n else \n S[i] = (S[i - 1] + S[i - 2]) % mod; " ) ; if ( S [ i ] == - 1 ) S [ i ] = 0 ; else S [ i ] = ( S [ i - 1 ] + S [ i - 2 ] ) % mod ; } System . out . println ( S [ n ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int len = str . length ( ) ; char [ ] c = new char [ len ] ; 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { final static int INPUT_COUNT = 2 ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] num = new int [ INPUT_COUNT + 1 ] ; for ( int i = 0 ; i <= INPUT_COUNT ; i ++ ) { System . out . println ( " [LOG] Block: num[i] = scan.nextInt(); " ) ; num [ i ] = scan . nextInt ( ) ; } Arrays . sort ( num ) ; System . out . println ( num [ 0 ] + " " + num [ 1 ] + " " + num [ 2 ] ) ; scan . close ( ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = s . nextInt ( ) ; int y = s . nextInt ( ) ; int flag = 0 ; for ( int i = 0 ; i <= x ; i ++ ) { if ( i * 2 + ( x - i ) * 4 == y ) { System . out . println ( " Yes " ) ; flag = 1 ; break ; } } if ( flag == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { exec ( ) ; } static void exec ( ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; if ( x * x + y * y <= d * d ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; for ( int i = a ; 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 ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N ; String S ; String T ; StringBuilder ans = new StringBuilder ( ) ; Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; S = sc . next ( ) ; T = sc . next ( ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: ans.append(S.charAt(i)).append(T.charAt(i)); " ) ; ans . append ( S . charAt ( i ) ) . append ( T . charAt ( i ) ) ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int a = - 1 ; int b = - 1 ; int c = - 1 ; for ( int i = 0 ; i <= N ; i ++ ) { for ( int j = 0 ; j <= N - i ; j ++ ) { if ( Y == ( 10000 * i + 5000 * j + 1000 * ( N - i - j ) ) ) { System . out . println ( " [LOG] Block: a = i; \n b = j; \n c = N - i - j; " ) ; a = i ; b = j ; c = N - i - j ; } } } System . out . print ( a + " " ) ; System . out . print ( b + " " ) ; System . out . print ( c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x <= K ; x ++ ) { for ( int y = 0 ; y <= K ; y ++ ) { int z = S - ( x + y ) ; if ( 0 <= z && z <= K ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . print ( count ) ; } } +import java . util . * ; import java . lang . * ; import java . math . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { int w = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] ret = new int [ w + 1 ] ; for ( int i = 0 ; i < w + 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 < w + 1 ; i ++ ) { System . out . println ( ret [ i ] ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Main m = new Main(); \n m.run(); " ) ; Main m = new Main ( ) ; m . run ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: ans = ans + s1.charAt(i) + s2.charAt(i); " ) ; ans = ans + s1 . charAt ( i ) + s2 . charAt ( i ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . equals ( " AAA " ) || s . equals ( " BBB " ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double T = sc . nextDouble ( ) , A = sc . nextInt ( ) , temp = 60001 ; int ans = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { double h = A - ( T - ( 0.006 * sc . nextDouble ( ) ) ) ; if ( Math . abs ( h ) < Math . abs ( temp ) ) { System . out . println ( " [LOG] Block: temp = Math.abs(h); \n ans = i; " ) ; temp = Math . abs ( h ) ; ans = i ; } } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] a = new Integer [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( a , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(a[i]); " ) ; System . out . println ( a [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; int D = ob . nextInt ( ) ; int T = ob . nextInt ( ) ; int S = ob . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= T ; i ++ ) { System . out . println ( " [LOG] Block: sum += S; " ) ; sum += S ; } System . out . println ( ( sum < D ) ? " No " : " Yes " ) ; ob . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; StringTokenizer dates = new StringTokenizer ( sc . nextLine ( ) ) ; StringTokenizer dates2 = new StringTokenizer ( sc . nextLine ( ) ) ; int mayor = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int a = Integer . parseInt ( dates . nextToken ( ) ) ; int b = Integer . parseInt ( dates2 . nextToken ( ) ) ; if ( a - b > 0 ) { System . out . println ( " [LOG] Block: mayor += a - b; " ) ; mayor += a - b ; } } System . out . println ( mayor ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n String line = reader.readLine(); \n char C = line.charAt(0); \n C++; \n System.out.println(C); " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; char C = line . charAt ( 0 ) ; C ++ ; System . out . println ( C ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] arr = new int [ N ] ; boolean flg = true ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } while ( flg ) { boolean existOdd = false ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 != 0 ) { flg = false ; } } if ( ! flg ) break ; for ( int j = 0 ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: arr[j] = arr[j] / 2; " ) ; arr [ j ] = arr [ j ] / 2 ; } count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int city = sc . nextInt ( ) ; long [ ] monster = new long [ city + 1 ] ; long [ ] brave = new long [ city ] ; long anser = 0 ; for ( int i = 0 ; i < city + 1 ; i ++ ) { monster [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < city ; i ++ ) { brave [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < brave . length ; i ++ ) { System . out . println ( " [LOG] Block: anser += Math.min(monster[i], brave[i]); \n anser += Math.min(monster[i + 1], Math.max(brave[i] - monster[i], 0)); \n monster[i + 1] -= Math.min(monster[i + 1], Math.max(brave[i] - monster[i], 0)); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int h = sc.nextInt(); \n int n = sc.nextInt(); \n long at = 0; \n for (int i = 0; i < n; i++) at += sc.nextInt(); \n if (h <= at) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; long at = 0 ; for ( int i = 0 ; i < n ; i ++ ) at += sc . nextInt ( ) ; if ( h <= at ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , sum = 0 ; double ave , tmpsum = 0 ; while ( n != 0 ) { int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: s[i] = sc.nextInt(); \n sum += s[i]; " ) ; s [ i ] = sc . nextInt ( ) ; sum += s [ i ] ; } ave = ( double ) sum / n ; for ( int i = 0 ; i < n ; i ++ ) tmpsum += ( s [ i ] - ave ) * ( s [ i ] - ave ) ; ave = tmpsum / n ; System . out . println ( Math . sqrt ( ave ) ) ; sum = 0 ; tmpsum = 0 ; n = sc . nextInt ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; int max = 0 ; int pnt = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = sc . nextInt ( ) ; if ( max < l [ i ] ) { max = l [ i ] ; pnt = i ; } } int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == pnt ) continue ; total += l [ i ] ; } if ( max < total ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; class Main { boolean [ ] primeTable ; public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; PrimeNum prime = new PrimeNum ( 100000010 ) ; prime . createTable ( ) ; int n = cin . nextInt ( ) , ct = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int num = cin . nextInt ( ) ; if ( prime . judge ( num ) ) ct ++ ; } System . out . println ( ct ) ; } } class PrimeNum { private boolean [ ] primeTable ; private int maxNum ; PrimeNum ( int n ) { primeTable = new boolean [ n ] ; Arrays . fill ( primeTable , true ) ; this . maxNum = n ; } 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 n ) { return ( primeTable [ n ] ) ; } protected int serch ( int n ) { for ( int i = 2 ; i < maxNum ; i ++ ) { System . out . println ( " [LOG] Block: if (primeTable[i]) \n n--; \n if (n == 0) \n return (i); " ) ; if ( primeTable [ i ] ) n -- ; if ( n == 0 ) return ( i ) ; } return ( - 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int [ ] array = new int [ num ] ; int [ ] array_min = new int [ num ] ; int min = num + 1 ; for ( int i = 0 ; i < num ; i ++ ) { array [ i ] = sc . nextInt ( ) ; if ( min > array [ i ] ) { min = array [ i ] ; } array_min [ i ] = min ; } int count = 0 ; for ( int i = 0 ; i < num ; i ++ ) { if ( array_min [ i ] >= array [ i ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static long gcd ( long a , long b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n long a = s.nextLong(); \n long b = s.nextLong(); \n long k = gcd(a, b); \n System.out.println((a * b) / k); " ) ; Scanner s = new Scanner ( System . in ) ; long a = s . nextLong ( ) ; long b = s . nextLong ( ) ; long k = gcd ( a , b ) ; System . out . println ( ( a * b ) / k ) ; } } +import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int abprice = A * 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 = A ; 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 ( " [LOG] Block: System.out.println(abprice); " ) ; System . out . println ( abprice ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = 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 = k + a [ 0 ] - a [ n - 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( d < a [ i ] - a [ i - 1 ] ) { System . out . println ( " [LOG] Block: d = a[i] - a[i - 1]; " ) ; d = a [ i ] - a [ i - 1 ] ; } } System . out . println ( k - d ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = scan . nextInt ( ) ; if ( n == 1 ) { System . out . println ( 1 ) ; return ; } int answer = 0 ; while ( n != 1 ) { System . out . println ( " [LOG] Block: answer += 1; \n n /= 2; " ) ; answer += 1 ; n /= 2 ; } System . out . println ( ( int ) Math . pow ( 2 , answer ) ) ; } } +import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int j ; 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 ( j = i + 1 ; j < 10 ; j ++ ) if ( height [ i ] > height [ j ] ) { int temp = height [ i ] ; height [ i ] = height [ j ] ; height [ j ] = temp ; } } for ( i = 9 ; i > 6 ; i -- ) { System . out . println ( " [LOG] Block: System.out.println(height[i]); " ) ; System . out . println ( height [ i ] ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] d = new int [ 3 ] [ 2 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { d [ i ] [ j ] = c [ i ] [ j + 1 ] - c [ i ] [ j ] ; } } if ( d [ 0 ] [ 0 ] == d [ 1 ] [ 0 ] && d [ 1 ] [ 0 ] == d [ 2 ] [ 0 ] && d [ 0 ] [ 1 ] == d [ 1 ] [ 1 ] && d [ 1 ] [ 1 ] == d [ 2 ] [ 1 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Integer [ ] h = new Integer [ n ] ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } if ( k >= n ) { 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: ans += h[i]; " ) ; ans += h [ i ] ; } System . out . println ( ans ) ; } } } +import java . math . * ; import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; if ( isPrime ( x ) ) { System . out . println ( x ) ; } else { while ( ! isPrime ( x ) ) { x ++ ; } System . out . println ( x ) ; } } public static boolean isPrime ( int a ) { System . out . println ( " [LOG] Block: BigInteger bi = BigInteger.valueOf(a); \n return bi.isProbablePrime(1); " ) ; BigInteger bi = BigInteger . valueOf ( a ) ; return bi . isProbablePrime ( 1 ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( c [ i ] != 'B' ) list . add ( ( int ) c [ i ] - '0' ) ; else { System . out . println ( " [LOG] Block: if (list.size() > 0) \n list.remove(list.size() - 1); " ) ; if ( list . size ( ) > 0 ) list . remove ( list . size ( ) - 1 ) ; } } for ( int i = 0 ; i < list . size ( ) ; i ++ ) System . out . print ( list . get ( i ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer a = sc . nextInt ( ) ; Integer b = sc . nextInt ( ) ; if ( a % 2 == 1 && b % 2 == 1 ) { System . out . println ( " Odd " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Even \" ); " ) ; System . out . println ( " Even " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int count = 0; \n Scanner sc = new Scanner(System.in); \n int n = Integer.parseInt(sc.next()); \n int m = Integer.parseInt(sc.next()); \n int totalConbination = (n + m) * (n + m - 1) / 2; \n int oddConbination = n * m; \n System.out.println(totalConbination - oddConbination); " ) ; int count = 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cards = 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 ) { System . out . println ( " [LOG] Block: result = 0; " ) ; result = 0 ; } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) . trim ( ) ; String [ ] segments = S . split ( " " ) ; int N = Integer . parseInt ( segments [ 0 ] ) ; int K = Integer . parseInt ( segments [ 1 ] ) ; double result = 0 ; double np = ( double ) 1.0 / N ; for ( int i = 1 ; i <= N ; 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 { System . out . println ( " [LOG] Block: return 1; " ) ; return 1 ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: map.put(s2, 1); " ) ; map . put ( s2 , 1 ) ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] point = new int [ 2 ] ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: point[1] += 3; " ) ; point [ 1 ] += 3 ; } } System . out . println ( String . format ( " %d %d " , point [ 0 ] , point [ 1 ] ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; boolean [ ] bool = new boolean [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { bool [ i ] = true ; } for ( int i = 0 ; i < m ; i ++ ) { bool [ scanner . nextInt ( ) ] = false ; } int [ ] b = new int [ n + 1 ] ; b [ 0 ] = 1 ; b [ 1 ] = 1 ; int mod = 1000000007 ; for ( int i = 2 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: b[i] = 0; \n if (bool[i - 2]) \n b[i] += b[i - 2]; \n if (bool[i - 1]) \n b[i] += b[i - 1]; \n b[i] %= mod; " ) ; 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 [ n ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int dataset = sc . nextInt ( ) ; int a , b , c ; for ( int i = 0 ; i < dataset ; 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 ) { System . out . println ( " [LOG] Block: int da = a * a; \n int db = b * b; \n int dc = c * c; \n if (da + db == dc) \n return true; \n else if (db + dc == da) \n return true; \n else if (dc + da == db) \n return true; \n else \n return false; " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int count = 0 ; int compare = 0 ; for ( int i = a ; 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 ) { System . out . println ( " [LOG] Block: count += i; " ) ; count += i ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int j = 1 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( j == a [ i ] ) { j ++ ; } } if ( j == 1 ) { System . out . println ( " [LOG] Block: System.out.println(-1); \n return; " ) ; System . out . println ( - 1 ) ; return ; } System . out . println ( n - j + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = Long.parseLong(sc.next()); \n long k = Long.parseLong(sc.next()); \n System.out.println(Math.min(n % k, k - (n % k))); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = Long . parseLong ( sc . next ( ) ) ; long k = Long . parseLong ( sc . next ( ) ) ; System . out . println ( Math . min ( n % k , k - ( n % k ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int num = sc.nextInt(); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int ans = 0; \n if (a * num < b) \n ans = a * num; \n else \n ans = b; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( a * num < b ) ans = a * num ; else ans = b ; System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class Main { 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 n = Integer . parseInt ( st1 . nextToken ( ) ) ; int k = Integer . parseInt ( st1 . nextToken ( ) ) ; int q = Integer . parseInt ( st1 . nextToken ( ) ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < q ; i ++ ) { arr [ Integer . parseInt ( br . readLine ( ) ) - 1 ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { if ( k - ( q - arr [ i ] ) > 0 ) { out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: out.println( \" No \" ); " ) ; out . println ( " No " ) ; } } out . flush ( ) ; out . close ( ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( map . containsKey ( s . charAt ( i ) ) ) { map . put ( s . charAt ( i ) , map . get ( s . charAt ( i ) ) + 1 ) ; } else { map . put ( s . charAt ( i ) , 1 ) ; } } String ans = " Yes " ; if ( map . keySet ( ) . size ( ) != 2 ) { System . out . println ( " [LOG] Block: ans = \" No \" ; " ) ; ans = " No " ; } for ( Character ch : map . keySet ( ) ) { if ( map . get ( ch ) != 2 ) { System . out . println ( " [LOG] Block: ans = \" No \" ; " ) ; ans = " No " ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String line = sc . nextLine ( ) ; String answer = " " ; for ( int i = 0 ; i < line . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: char ch = line.charAt(i); \n if (Character.isLowerCase(ch)) \n answer = answer + Character.toUpperCase(ch); \n else \n answer = answer + Character.toLowerCase(ch); " ) ; char ch = line . charAt ( i ) ; if ( Character . isLowerCase ( ch ) ) answer = answer + Character . toUpperCase ( ch ) ; else answer = answer + Character . toLowerCase ( ch ) ; } System . out . println ( answer ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int A = in . Int ( ) ; int B = in . Int ( ) ; out . println ( A * B ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) , n = sc . nextInt ( ) ; int sum = 0 , count = 0 , flag = 0 , max = - 999999 , min = 99999 ; if ( d == 0 ) { if ( n != 100 ) System . out . println ( n ) ; else System . out . println ( n + 1 ) ; } else if ( d == 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 ) { System . out . println ( " [LOG] Block: return n; " ) ; return n ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int count = sc . nextInt ( ) ; if ( count == 0 ) { break ; } double [ ] s = new double [ count ] ; double sum = 0 ; for ( int i = 0 ; i < count ; i ++ ) { s [ i ] = sc . nextDouble ( ) ; sum += s [ i ] ; } double average = sum / count ; double res = 0 ; for ( int i = 0 ; i < count ; i ++ ) { System . out . println ( " [LOG] Block: res += Math.pow(s[i] - average, 2) / count; " ) ; res += Math . pow ( s [ i ] - average , 2 ) / count ; } System . out . println ( Math . sqrt ( res ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 10 ) { if ( b < 10 ) { System . out . println ( a * b ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Map ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int n = Integer . parseInt ( br . readLine ( ) ) ; Map < String , Integer > map = new TreeMap < > ( ) ; int max = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: out.println(key); " ) ; out . println ( key ) ; } } out . flush ( ) ; } } } +import java . util . * ; import java . math . BigDecimal ; import java . math . RoundingMode ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = 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 == A && t1 == B ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . print ( ans ) ; } } +import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int L = sc.nextInt(); \n double a = L / 3.0; \n double b = L / 3.0; \n double v = a * b * (L - a - b); \n System.out.println(v); " ) ; Scanner sc = new Scanner ( System . in ) ; int L = sc . nextInt ( ) ; double a = L / 3.0 ; double b = L / 3.0 ; double v = a * b * ( L - a - b ) ; System . out . println ( v ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int count = 0 ; for ( int i = A ; i <= B ; i ++ ) { String tmp = String . valueOf ( i ) ; if ( tmp . charAt ( 0 ) == tmp . charAt ( 4 ) && tmp . charAt ( 1 ) == tmp . charAt ( 3 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( K >= S . length ( ) ) { System . out . println ( S ) ; } else { System . out . println ( " [LOG] Block: System.out.println(S.substring(0, K) + \" ... \" ); " ) ; System . out . println ( S . substring ( 0 , K ) + " ... " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long hp = sc . nextLong ( ) ; System . out . println ( hit ( hp ) ) ; } private static long hit ( long hp ) { System . out . println ( " [LOG] Block: return hp == 1 ? 1 : hit(hp / 2) * 2 + 1; " ) ; return hp == 1 ? 1 : hit ( hp / 2 ) * 2 + 1 ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i , n , j , S = 0 ; double avr , O = 0 , s ; for ( i = 0 ; ; i ++ ) { 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 ++ ) { System . out . println ( " [LOG] Block: O += (avr - array[j - 1]) * (avr - array[j - 1]); " ) ; 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 . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; String [ ] S = new String [ N + 1 ] ; int [ ] C = { 0 , 0 , 0 , 0 } ; for ( int i = 0 ; i < N + 1 ; i ++ ) { S [ i ] = scan . nextLine ( ) ; } for ( int i = 0 ; i < N + 1 ; i ++ ) { System . out . println ( " [LOG] Block: switch(S[i]) { \n case \" AC \" : \n C[0] += 1; \n break; \n case \" WA \" : \n C[1] += 1; \n break; \n case \" TLE \" : \n C[2] += 1; \n break; \n case \" RE \" : \n C[3] += 1; \n break; \n default: \n } " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] surp = new int [ Math . min ( a , b ) + 1 ] ; for ( int i = 1 ; i <= Math . min ( a , b ) ; i ++ ) { if ( a % i == 0 && b % i == 0 ) { System . out . println ( " [LOG] Block: surp[i] = i; " ) ; surp [ i ] = i ; } } Arrays . sort ( surp ) ; System . out . println ( surp [ Math . min ( a , b ) - k + 1 ] ) ; } } +import java . util . * ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Double > list = new ArrayList < > ( ) ; Double n = sc . nextDouble ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: list.add(sc.nextDouble()); " ) ; list . add ( sc . nextDouble ( ) ) ; } Collections . sort ( list ) ; System . out . println ( ( int ) ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) ) ; return ; } } +import java . util . Scanner ; public class Main { private static int sum ( int aNum , int bNum , int cNum , int k ) { int sum = 0 ; if ( k <= aNum ) { return k ; } else { sum += aNum ; k -= aNum ; } if ( k <= bNum ) { return sum ; } else { k -= bNum ; } return sum + Math . min ( k , cNum ) * - 1 ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int aNum = sc.nextInt(), bNum = sc.nextInt(), cNum = sc.nextInt(), k = sc.nextInt(); \n System.out.println(sum(aNum, bNum, cNum, k)); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int aNum = sc . nextInt ( ) , bNum = sc . nextInt ( ) , cNum = sc . nextInt ( ) , k = sc . nextInt ( ) ; System . out . println ( sum ( aNum , bNum , cNum , k ) ) ; sc . close ( ) ; } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; char [ ] C = S . toCharArray ( ) ; char x = C [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { if ( C [ i ] == x ) { C [ i ] = 0 ; } else { x = C [ i ] ; } } int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( C [ i ] != 0 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new java.util.Scanner(System.in); \n String s = scan.next(); \n switch(s) { \n case \" SAT \" : \n System.out.println( \" 1 \" ); \n break; \n case \" FRI \" : \n System.out.println( \" 2 \" ); \n break; \n case \" THU \" : \n System.out.println( \" 3 \" ); \n break; \n case \" WED \" : \n System.out.println( \" 4 \" ); \n break; \n case \" TUE \" : \n System.out.println( \" 5 \" ); \n break; \n case \" MON \" : \n System.out.println( \" 6 \" ); \n break; \n case \" SUN \" : \n System.out.println( \" 7 \" ); \n break; \n } " ) ; Scanner scan = new java . util . Scanner ( System . in ) ; String s = scan . next ( ) ; switch ( s ) { 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; for ( int i = x ; 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 ++ ) { System . out . println ( " [LOG] Block: if (n % i == 0) \n return false; " ) ; if ( n % i == 0 ) return false ; } return true ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long N = 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 ( N ) + 10 ; l ++ ) { if ( N % l == 0 ) { System . out . println ( " [LOG] Block: O = l; \n T = N / l; \n o = (int) Math.log10(O) + 1; \n t = (int) Math.log10(T) + 1; \n if (i > (o > t ? o : t)) \n i = (o > t ? o : t); " ) ; O = l ; T = N / 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 . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; Set < Long > numSet = new HashSet < > ( ) ; boolean hasSame = false ; for ( int i = 0 ; i < n ; i ++ ) { Long num = sc . nextLong ( ) ; if ( numSet . contains ( num ) ) { hasSame = true ; break ; } else { System . out . println ( " [LOG] Block: numSet.add(num); " ) ; numSet . add ( num ) ; } } System . out . println ( hasSame ? " NO " : " YES " ) ; sc . close ( ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal a = sc.nextBigDecimal(); \n BigDecimal b = sc.nextBigDecimal(); \n BigDecimal c = a.multiply(b); \n System.out.println(c.setScale(0, BigDecimal.ROUND_DOWN)); " ) ; 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 . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int L = sc.nextInt(); \n double x = (double) L / 3; \n double V = x * x * x; \n System.out.println(V); " ) ; Scanner sc = new Scanner ( System . in ) ; int L = sc . nextInt ( ) ; double x = ( double ) L / 3 ; double V = x * x * x ; System . out . println ( V ) ; } } +import java . util . * ; import static java . lang . Integer . * ; import static java . lang . System . * ; import java . io . PrintWriter ; public class Main { public static void main ( String [ ] args ) { int i , 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 ( i = 0 ; i < so . length ; i ++ ) { System . out . println ( " [LOG] Block: if (so[i] <= n) \n cnt++; " ) ; if ( so [ i ] <= n ) cnt ++ ; } out . println ( cnt ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . close ( ) ; List < Integer > ary = new ArrayList < > ( ) ; int flg = 1 ; while ( flg <= A || flg <= B ) { if ( A % flg == 0 && B % flg == 0 ) { System . out . println ( " [LOG] Block: ary.add(flg); " ) ; ary . add ( flg ) ; } flg ++ ; } Collections . sort ( ary , Collections . reverseOrder ( ) ) ; System . out . println ( ary . get ( K - 1 ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int x = N * A ; int y = B ; if ( x < y ) { System . out . println ( x ) ; } else if ( x > y ) { System . out . println ( " [LOG] Block: System.out.println(y); " ) ; System . out . println ( y ) ; } else if ( x == y ) { System . out . println ( " [LOG] Block: System.out.println(y); " ) ; System . out . println ( y ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AStationAndBus solver = new AStationAndBus ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AStationAndBus { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: char[] c = in.next().toCharArray(); \n Arrays.sort(c); \n out.println(c[0] == c[c.length - 1] ? \" No \" : \" Yes \" ); " ) ; char [ ] c = in . next ( ) . toCharArray ( ) ; Arrays . sort ( c ) ; out . println ( c [ 0 ] == c [ c . length - 1 ] ? " No " : " Yes " ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int playerNum = sc . nextInt ( ) ; int firstPoint = sc . nextInt ( ) ; ArrayList < Integer > playerPoint = new ArrayList < > ( ) ; for ( int i = 0 ; i < playerNum ; 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 < playerNum ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(firstPoint - cnt + playerPoint.get(i) > 0 ? \" Yes \" : \" No \" ); " ) ; System . out . println ( firstPoint - cnt + playerPoint . get ( i ) > 0 ? " Yes " : " No " ) ; } } } +import java . util . * ; public class Main { 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 tj ; 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 ++ ) { tj = t . charAt ( j ) ; sj = s . charAt ( j + startcount ) ; if ( tj == sj ) { matchcount ++ ; } } if ( min == 0 || min > t . length ( ) - matchcount ) { System . out . println ( " [LOG] Block: min = t.length() - matchcount; " ) ; min = t . length ( ) - matchcount ; } startcount ++ ; } System . out . println ( min ) ; sc . close ( ) ; } } +import java . util . * ; class Main { public Main ( ) { int N ; String S ; HashMap < String , Integer > HM = new HashMap < String , Integer > ( ) ; Scanner scanner = new Scanner ( System . in ) ; N = scanner . nextInt ( ) ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: Main main = new Main(); " ) ; Main main = new Main ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int time = t ; int x1 = x ; while ( x < n ) { System . out . println ( " [LOG] Block: t = t + time; \n x = x + x1; " ) ; t = t + time ; x = x + x1 ; } System . out . println ( t ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long d = sc . nextInt ( ) ; d = d * d ; int cnt = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: long x = sc.nextInt(); \n long y = sc.nextInt(); \n if (d >= x * x + y * y) \n cnt++; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int b = sc . nextInt ( ) ; int [ ] a = new int [ b ] ; for ( int i = 0 ; i < b ; 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 < b ; j ++ ) { System . out . println ( " [LOG] Block: System.out.println(a[j]); " ) ; System . out . println ( a [ j ] ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int [ ] a = new int [ 1000000 ] ; int Answer = 0 ; a [ 0 ] = s ; 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 ] ) { System . out . println ( " [LOG] Block: Answer = i; \n break loop; " ) ; Answer = i ; break loop ; } } } System . out . println ( Answer + 1 ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n int c = Math.max(a, b); \n int d = Math.min(a, b); \n int out = 0; \n out += c; \n out += Math.max(c - 1, d); \n System.out.println(out); \n scan.close(); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = Math . max ( a , b ) ; int d = Math . min ( a , b ) ; int out = 0 ; out += c ; out += Math . max ( c - 1 , d ) ; System . out . println ( out ) ; scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] work = new int [ m ] ; int ans = 0 ; for ( int i = 0 ; i < m ; ++ i ) { System . out . println ( " [LOG] Block: work[i] = sc.nextInt(); \n ans += work[i]; " ) ; work [ i ] = sc . nextInt ( ) ; ans += work [ i ] ; } ans = n - ans ; if ( ans < 0 ) ans = - 1 ; sc . close ( ) ; System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: int a = scan.nextInt(); \n int b = scan.nextInt(); \n if (a == 0 && b == 0) \n break; \n if (a < b) \n System.out.println(a + \" \" + b); \n else \n System.out.println(b + \" \" + a); " ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a == 0 && b == 0 ) break ; if ( a < b ) System . out . println ( a + " " + b ) ; else System . out . println ( b + " " + a ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int total = 0 ; int [ ] num = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i ++ ) { System . out . println ( " [LOG] Block: num[i] = sc.nextInt(); \n total += num[i]; " ) ; num [ i ] = sc . nextInt ( ) ; total += 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 ( total % 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 . * ; import java . io . * ; public class Main { 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 i = 0 ; i < splitWord . length - 1 ; i ++ ) { String rear = splitWord [ i ] ; String front = splitWord [ i + 1 ] ; if ( front . equals ( rear ) ) { System . out . println ( " [LOG] Block: return true; " ) ; return true ; } } return false ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( scan . hasNext ( ) ) { int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; while ( x != 0 && y != 0 ) { System . out . println ( " [LOG] Block: int t = y; \n y = x; \n x = t % x; " ) ; int t = y ; y = x ; x = t % x ; } System . out . println ( ( x == 0 ) ? y : x ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String S = s . next ( ) ; String T = s . next ( ) ; int count = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (S.charAt(i) != T.charAt(i)) \n count++; " ) ; if ( S . charAt ( i ) != T . charAt ( i ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int n = scan . nextInt ( ) ; int x = 1 ; int y = 0 ; if ( n >= 3 && n <= 10000 ) { for ( int count = 0 ; count < n ; count ++ ) { y = x / 10 ; if ( x % 3 == 0 ) { sb . append ( " " ) . append ( x ) ; } else { y = x ; while ( y != 0 ) { if ( y % 10 == 3 ) { System . out . println ( " [LOG] Block: sb.append( \" \" ).append(x); \n break; " ) ; sb . append ( " " ) . append ( x ) ; break ; } y /= 10 ; } } x ++ ; } System . out . println ( sb ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 0 ; String str = sc . next ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { System . out . println ( " [LOG] Block: if (str.charAt(i) == '+') \n n++; \n else \n n--; " ) ; if ( str . charAt ( i ) == '+' ) n ++ ; else n -- ; } System . out . println ( n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) == 17 && ( a * b * c ) == 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; public class Main { 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 i = 0 ; i < line . length ( ) ; i ++ ) { String str = Character . toString ( line . charAt ( i ) ) . 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 { System . out . println ( " [LOG] Block: sb.append( \" 0 \" ); " ) ; sb . append ( " 0 " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb . toString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int n = scanner.nextInt(); \n int i = 0; \n int m = 0; \n i = n / 500; \n n = n - 500 * i; \n m = n / 5; \n System.out.println(1000 * i + 5 * m); " ) ; Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int i = 0 ; int m = 0 ; i = n / 500 ; n = n - 500 * i ; m = n / 5 ; System . out . println ( 1000 * i + 5 * m ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { private void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] charArray = S . toCharArray ( ) ; List < Integer > counts = new ArrayList < Integer > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < charArray . length ; i ++ ) { if ( charArray [ i ] == 'A' || charArray [ i ] == 'C' || charArray [ i ] == 'G' || charArray [ i ] == 'T' ) { cnt ++ ; if ( i == charArray . length - 1 ) { counts . add ( cnt ) ; } } else { if ( cnt != 0 ) { counts . add ( cnt ) ; cnt = 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 ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . Scanner ; public class Main { 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 ok = true ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { ok = true ; for ( int j = 0 ; j < n - i ; j ++ ) { if ( a [ j ] != b [ j + i ] ) { System . out . println ( " [LOG] Block: ok = false; \n break; " ) ; ok = false ; break ; } } for ( int j = n - i ; j < n ; j ++ ) { if ( a [ j ] != b [ j - n + i ] ) { System . out . println ( " [LOG] Block: ok = false; \n break; " ) ; ok = false ; break ; } } if ( ok ) break ; } System . out . println ( ok ? " Yes " : " No " ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n char input = in.next().charAt(0); \n int integerInput = input; \n integerInput++; \n char output = (char) integerInput; \n System.out.print(output); " ) ; Scanner in = new Scanner ( System . in ) ; char input = in . next ( ) . charAt ( 0 ) ; int integerInput = input ; integerInput ++ ; char output = ( char ) integerInput ; System . out . print ( output ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = ( a + b ) / 2 ; String ans = " " ; if ( ( a + b ) % 2 == 0 && Math . abs ( a - k ) == Math . abs ( b - k ) ) { ans = String . valueOf ( k ) ; } else { System . out . println ( " [LOG] Block: ans = \" IMPOSSIBLE \" ; " ) ; ans = " IMPOSSIBLE " ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(), m = sc.nextInt(); \n int[] a = new int[n]; \n for (int i = 0; i < n; i++) a[i] = sc.nextInt(); \n int sum = 0; \n for (int ele : a) sum += ele; \n double min = ((double) sum) / (4 * m); \n int sat = 0; \n for (double ele : a) if (ele >= min) \n sat++; \n String ans = ((sat >= m) ? \" Yes \" : \" No \" ); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; 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 . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int N = in . Int ( ) ; out . println ( ( 1000 - ( N % 1000 ) ) % 1000 ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int ans = A + B; \n ans = ans < A - B ? A - B : ans; \n ans = ans < A * B ? A * B : ans; \n System.out.print(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = A + B ; ans = ans < A - B ? A - B : ans ; ans = ans < A * B ? A * B : ans ; System . out . print ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: ans = ans + Sarray[i]; \n ans = ans + Tarray[i]; " ) ; ans = ans + Sarray [ i ] ; ans = ans + Tarray [ i ] ; } System . out . println ( ans ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; List < Long > divisor = divisor ( n ) ; long min = 1000000000001L ; for ( Long elm : divisor ) { min = Math . min ( min , elm + ( n / elm ) ) ; } long ans = min - 2 ; System . out . println ( ans ) ; } static List < Long > divisor ( long n ) { Set < Long > ret = new HashSet < > ( ) ; for ( long i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: ret.add(i); \n if (i != n / i) \n ret.add(n / i); " ) ; ret . add ( i ) ; if ( i != n / i ) ret . add ( n / i ) ; } } return ret . stream ( ) . sorted ( Comparator . naturalOrder ( ) ) . collect ( Collectors . toList ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int z ; int count = 0 ; for ( int x = 0 ; x <= k ; x ++ ) { for ( int y = 0 ; y <= k ; y ++ ) { z = s - x - y ; if ( 0 <= z && z <= k ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flg = false ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sc . nextLine ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == b ) { cnt ++ ; if ( cnt == 3 ) { flg = true ; } } else { System . out . println ( " [LOG] Block: cnt = 0; " ) ; cnt = 0 ; } } String ans = flg ? " Yes " : " No " ; System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 n = Integer . parseInt ( br . readLine ( ) ) ; long ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( ( i % 3 != 0 ) && ( i % 5 != 0 ) ) { System . out . println ( " [LOG] Block: ans += i; " ) ; ans += i ; } } out . println ( ans ) ; out . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double r = sc.nextDouble(); \n double are = 0; \n double circ = 0; \n are = r * r * Math.PI; \n circ = (r + r) * Math.PI; \n ; \n System.out.printf( \" %f %f \n \" , are, circ); " ) ; Scanner sc = new Scanner ( System . in ) ; double r = sc . nextDouble ( ) ; double are = 0 ; double circ = 0 ; are = r * r * Math . PI ; circ = ( r + r ) * Math . PI ; ; System . out . printf ( " %f %f \n " , are , circ ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char [ ] nChar = String . valueOf ( n ) . toCharArray ( ) ; int sn = 0 ; for ( int i = 0 ; i < nChar . length ; i ++ ) { sn += Integer . parseInt ( String . valueOf ( nChar [ i ] ) ) ; } if ( n % sn == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n int count = s.lastIndexOf( \" Z \" ) - s.indexOf( \" A \" ) + 1; \n System.out.println(count); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int count = s . lastIndexOf ( " Z " ) - s . indexOf ( " A " ) + 1 ; System . out . println ( count ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; sc . close ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < w . length ( ) ; ++ i ) { if ( map . containsKey ( w . charAt ( i ) ) ) { Integer cap = map . get ( w . charAt ( i ) ) ; map . remove ( w . charAt ( i ) ) ; map . put ( w . charAt ( i ) , cap + 1 ) ; } else { map . put ( w . charAt ( i ) , 1 ) ; } } boolean flag = true ; for ( Character c : map . keySet ( ) ) { if ( map . get ( c ) % 2 != 0 ) { System . out . println ( " [LOG] Block: flag = false; \n break; " ) ; flag = false ; break ; } } if ( flag ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = 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 >= h ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { final int DATAMAX = 10 ; int [ ] a = new int [ DATAMAX ] ; InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; for ( int i = 0 ; i < DATAMAX ; i ++ ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } for ( int i = 0 ; i < DATAMAX ; i ++ ) { for ( int j = i + 1 ; j < DATAMAX ; 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 ( " [LOG] Block: System.out.println(a[i]); " ) ; System . out . println ( a [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String N = scan . next ( ) ; if ( N . length ( ) == 3 ) { if ( N . contains ( " 7 " ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] answerArr = new int [ M ] ; int answer = 0 ; Arrays . fill ( answerArr , 0 ) ; for ( int i = 0 ; i < N ; 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 ] == N ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } } System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] p = new Integer [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Integer [ ] p_ = p . clone ( ) ; Arrays . sort ( p ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( p [ i ] != p_ [ i ] ) { count ++ ; } } if ( count == 0 || count == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] ss = S . toCharArray ( ) ; ArrayList < Integer > ans = new ArrayList < > ( ) ; int cou = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( ss [ i ] == 'A' || ss [ i ] == 'C' || ss [ i ] == 'G' || ss [ i ] == 'T' ) { cou ++ ; } else { System . out . println ( " [LOG] Block: ans.add(cou); \n cou = 0; " ) ; ans . add ( cou ) ; cou = 0 ; } } ans . add ( cou ) ; Collections . sort ( ans , Collections . reverseOrder ( ) ) ; System . out . println ( ans . get ( 0 ) ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( stdReader . readLine ( ) ) ; String [ ] A = stdReader . readLine ( ) . split ( " " , 0 ) ; int j = 0 ; System . out . println ( String . join ( " " , A ) ) ; for ( int i = 1 ; i < N ; i ++ ) { String v = A [ i ] ; j = i - 1 ; while ( j >= 0 && Integer . parseInt ( A [ j ] ) > Integer . parseInt ( v ) ) { System . out . println ( " [LOG] Block: A[j + 1] = A[j]; \n j--; " ) ; A [ j + 1 ] = A [ j ] ; j -- ; } A [ j + 1 ] = v ; System . out . println ( String . join ( " " , A ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] n = sc . nextLine ( ) . toCharArray ( ) ; int sum = 0 ; for ( char c : n ) { sum += Character . getNumericValue ( c ) ; } if ( sum % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( long i = 0L ; i < N ; i ++ ) { long t = sc . nextLong ( ) * 100000000L + ( i + 1L ) ; A [ ( int ) i ] = t ; } Arrays . sort ( A ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . print ( A [ i ] % 100000000 + " " ) ; } System . out . println ( A [ N - 1 ] % 100000000 ) ; } public static void p ( Object o ) { System . out . println ( " [LOG] Block: System.out.println(o); " ) ; System . out . println ( o ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 1 ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i - 1 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = in . nextInt ( ) ; String [ ] array = new String [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( list . contains ( array [ i ] ) || array [ i ] . charAt ( 0 ) != c ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } c = array [ i ] . charAt ( array [ i ] . length ( ) - 1 ) ; list . add ( array [ i ] ) ; } System . out . println ( " Yes " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int stones = s . nextInt ( ) ; int [ ] arr = new int [ stones ] ; for ( int i = 0 ; i < stones ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } long [ ] dp = new long [ stones ] ; dp [ 0 ] = 0 ; for ( int i = 1 ; i < stones ; i ++ ) { System . out . println ( " [LOG] Block: long option1 = Math.abs(arr[i] - arr[i - 1]) + dp[i - 1]; \n long option2 = i == 1 ? Integer.MAX_VALUE : Math.abs(arr[i] - arr[i - 2]) + dp[i - 2]; \n dp[i] = Math.min(option1, option2); " ) ; 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 [ stones - 1 ] ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int i = 1 ; while ( true ) { System . out . println ( " [LOG] Block: int x = scanner.nextInt(); \n if (x == 0) \n break; \n System.out.println( \" Case \" + i + \" : \" + x); \n i += 1; " ) ; int x = scanner . nextInt ( ) ; if ( x == 0 ) break ; System . out . println ( " Case " + i + " : " + x ) ; i += 1 ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long count = 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 ( " [LOG] Block: System.out.println( \" Heisei \" ); " ) ; System . out . println ( " Heisei " ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n PrintWriter ou = new PrintWriter(System.out); \n int w = Integer.parseInt(sc.next()); \n int h = Integer.parseInt(sc.next()); \n boolean ebishu = false; \n if (w == 2 * Integer.parseInt(sc.next()) && h == 2 * Integer.parseInt(sc.next())) \n ebishu = true; \n ou.print(w * (long) h / 2.0 + \" \" ); \n if (ebishu) \n ou.print(1 + \" \n \" ); \n else \n ou.print(0 + \" \n \" ); \n ou.flush(); " ) ; Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int w = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; boolean ebishu = false ; if ( w == 2 * Integer . parseInt ( sc . next ( ) ) && h == 2 * Integer . parseInt ( sc . next ( ) ) ) ebishu = true ; ou . print ( w * ( long ) h / 2.0 + " " ) ; if ( ebishu ) ou . print ( 1 + " \n " ) ; else ou . print ( 0 + " \n " ) ; ou . flush ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: int a = scanner.nextInt(); \n int b = scanner.nextInt(); \n int c = scanner.nextInt(); \n if (a == -1 && b == -1 && c == -1) \n break; \n if (a == -1 || b == -1) \n System.out.println( \" F \" ); \n else if (a + b >= 80) \n System.out.println( \" A \" ); \n else if (a + b >= 65) \n System.out.println( \" B \" ); \n else if (a + b >= 50) \n System.out.println( \" C \" ); \n else if (a + b >= 30) \n if (c >= 50) \n System.out.println( \" C \" ); \n else \n System.out.println( \" D \" ); \n else \n System.out.println( \" F \" ); " ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( a == - 1 && b == - 1 && c == - 1 ) break ; if ( a == - 1 || b == - 1 ) System . out . println ( " F " ) ; else if ( a + b >= 80 ) System . out . println ( " A " ) ; else if ( a + b >= 65 ) System . out . println ( " B " ) ; else if ( a + b >= 50 ) System . out . println ( " C " ) ; else if ( a + b >= 30 ) if ( c >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; else System . out . println ( " F " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; String S = stdIn . next ( ) ; String answer = " Yes " ; if ( N % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < N / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( N / 2 + i ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner yomi = new Scanner ( System . in ) ; String n = yomi . next ( ) ; if ( n . equals ( " SUN " ) ) { System . out . println ( 7 ) ; } else if ( n . equalsIgnoreCase ( " MON " ) ) { System . out . println ( 6 ) ; } else if ( n . equalsIgnoreCase ( " TUE " ) ) { System . out . println ( 5 ) ; } else if ( n . equalsIgnoreCase ( " WED " ) ) { System . out . println ( 4 ) ; } else if ( n . equalsIgnoreCase ( " THU " ) ) { System . out . println ( 3 ) ; } else if ( n . equalsIgnoreCase ( " FRI " ) ) { System . out . println ( 2 ) ; } else if ( n . equalsIgnoreCase ( " SAT " ) ) { System . out . println ( " [LOG] Block: System.out.println(1); " ) ; System . out . println ( 1 ) ; } } } +import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int count = 1 ; while ( ! str . equals ( " 0 " ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Case \" + count + \" : \" + str); \n count++; \n str = br.readLine(); " ) ; System . out . println ( " Case " + count + " : " + str ) ; count ++ ; str = br . readLine ( ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numRow1 = sc . nextInt ( ) ; int numCol1Row2 = sc . nextInt ( ) ; int numCol2 = sc . nextInt ( ) ; int [ ] [ ] mat1 = new int [ numRow1 ] [ numCol1Row2 ] ; int [ ] [ ] mat2 = new int [ numCol1Row2 ] [ numCol2 ] ; long [ ] [ ] matOut = new long [ numRow1 ] [ numCol2 ] ; int i , j , k ; for ( i = 0 ; i < numRow1 ; 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 < numRow1 ; i ++ ) { for ( j = 0 ; j < numCol2 ; j ++ ) { for ( k = 0 ; k < numCol1Row2 ; k ++ ) { System . out . println ( " [LOG] Block: matOut[i][j] += mat1[i][k] * mat2[k][j]; " ) ; 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 . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String s = br . readLine ( ) ; String p = br . readLine ( ) ; s = s + s ; if ( s . equals ( " " ) || p . equals ( " " ) ) System . exit ( 0 ) ; if ( s . indexOf ( p ) != - 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.err.println(e); " ) ; System . err . println ( e ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = 0 , b = 0 , c = 0 ; int [ ] n = new int [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { n [ i ] = sc . nextInt ( ) ; if ( n [ i ] > a ) { c = b ; b = a ; a = n [ i ] ; } else if ( n [ i ] > b ) { c = b ; b = n [ i ] ; } else if ( n [ i ] > c ) { System . out . println ( " [LOG] Block: c = n[i]; " ) ; c = n [ i ] ; } } System . out . println ( a ) ; System . out . println ( b ) ; System . out . println ( c ) ; } } +class Main { public static void main ( String [ ] s ) { System . out . println ( " [LOG] Block: long i = 1, a = 101, o = new java.util.Scanner(System.in).nextLong(); \n for (; a < o; i++) a += a / 100; \n System.out.print(i); " ) ; long i = 1 , a = 101 , o = new java . util . Scanner ( System . in ) . nextLong ( ) ; for ( ; a < o ; i ++ ) a += a / 100 ; System . out . print ( i ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( lcm ( A , B ) ) ; } public static long lcm ( int A , int B ) { int temp ; long C = A ; C *= B ; while ( ( temp = A % B ) != 0 ) { System . out . println ( " [LOG] Block: A = B; \n B = temp; " ) ; A = B ; B = temp ; } return ( C / B ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int sum = 0; \n for (int i = 0; i < 3; i++) sum += sc.nextInt(); \n System.out.println(sum < 22 ? \" win \" : \" bust \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) sum += sc . nextInt ( ) ; System . out . println ( sum < 22 ? " win " : " bust " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; for ( int i = 1 ; i < 10001 ; i ++ ) { if ( list . get ( i - 1 ) == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . println ( " Case " + i + " : " + list . get ( i - 1 ) ) ; list . add ( sc . nextInt ( ) ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sho = 0 ; int amrS = 0 ; int ans = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { sho = i ; amrS = 0 ; while ( sho != 0 ) { amrS += sho % 10 ; sho /= 10 ; } if ( amrS >= a && amrS <= b ) { System . out . println ( " [LOG] Block: ans += i; " ) ; ans += i ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; int s = - 1 ; for ( int i = 1 ; i <= 1009 ; i ++ ) { if ( ( int ) ( i * 0.08 ) == A && ( int ) ( i * 0.1 ) == B ) { System . out . println ( " [LOG] Block: s = i; \n break; " ) ; s = i ; break ; } } System . out . println ( s ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) - 1 ; List < Integer > list = new ArrayList < > ( ) ; while ( N > 25 ) { list . add ( ( int ) ( N % 26 ) ) ; N = N / 26 - 1 ; } list . add ( ( int ) N ) ; char [ ] alphabet = " abcdefghijklmnopqrstuvwxyz " . toCharArray ( ) ; String ans = " " ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { System . out . println ( " [LOG] Block: int index = list.get(list.size() - i - 1); \n ans += alphabet[index]; " ) ; int index = list . get ( list . size ( ) - i - 1 ) ; ans += alphabet [ index ] ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { Scanner sc ; public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } public void execute ( ) { this . sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int d0 = sc . nextInt ( ) ; int d1 = sc . nextInt ( ) ; if ( d0 == d1 ) { cnt ++ ; if ( cnt >= 3 ) { System . out . println ( " Yes " ) ; return ; } } else { System . out . println ( " [LOG] Block: cnt = 0; " ) ; cnt = 0 ; } } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; String ss = s ; ss = ss . substring ( a , a + 1 ) ; if ( ss . equals ( " - " ) ) { s = s . replace ( " - " , " " ) ; int slen = s . length ( ) ; if ( slen == a + b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] a = new int [ 2 ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ 0 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { a [ 1 ] [ i ] = sc . nextInt ( ) ; } int x = 0 ; int y = 0 ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x += a [ 0 ] [ i ] ; for ( int j = i ; j < n ; j ++ ) { y += a [ 1 ] [ j ] ; } if ( max < x + y ) { System . out . println ( " [LOG] Block: max = x + y; " ) ; max = x + y ; } y = 0 ; } System . out . println ( max ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 3 != 0 && i % 5 != 0 ) ans += i ; } System . out . println ( ans ) ; } static class Scanner { 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 { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < n - 2 ; i ++ ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'B' && s . charAt ( i + 2 ) == 'C' ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; if ( n == 0 ) { System . out . println ( x ) ; 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 ( x - i <= 0 ) continue ; if ( x + i > 200 ) continue ; if ( number [ x - i ] == 1 ) { System . out . println ( x - i ) ; System . exit ( 0 ) ; } if ( number [ x + i ] == 1 ) { System . out . println ( " [LOG] Block: System.out.println(x + i); \n System.exit(0); " ) ; System . out . println ( x + i ) ; System . exit ( 0 ) ; } } System . out . println ( 0 ) ; } } class Monmo { } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long num = lcm ( a , n ) ; long deno = sum ( a , n , 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 n ) { long lc = 1 ; for ( int i = 0 ; i < n ; i ++ ) { lc = ( lc * a [ i ] ) / gcd ( lc , a [ i ] ) ; } return lc ; } public static long sum ( long [ ] a , int n , long num ) { long count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: count += (num / a[i]); " ) ; count += ( num / a [ i ] ) ; } return count ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] result = new int [ 4 ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: String s = sc.next(); \n switch(s) { \n case \" AC \" : \n result[0]++; \n break; \n case \" WA \" : \n result[1]++; \n break; \n case \" TLE \" : \n result[2]++; \n break; \n case \" RE \" : \n result[3]++; \n break; \n } " ) ; 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 Main { 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 countNum = 0 ; for ( int i = 0 ; i <= 2 ; i ++ ) { if ( Slist [ i ] . equals ( Tlist [ i ] ) ) { System . out . println ( " [LOG] Block: countNum++; " ) ; countNum ++ ; } } System . out . println ( countNum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String N = input . next ( ) ; int a = N . charAt ( N . length ( ) - 1 ) - 48 ; if ( a == 3 ) { System . out . print ( " bon " ) ; } else if ( a == 0 || a == 1 || a == 6 || a == 8 ) { System . out . print ( " pon " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" hon \" ); " ) ; System . out . print ( " hon " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Ans = 0 ; int Max = Math . max ( A , B ) ; Max = Math . max ( Max , C ) ; double pow = Math . pow ( 2 , K ) ; if ( Max == A ) { Ans = ( A * ( int ) pow ) + B + C ; } else if ( Max == B ) { Ans = ( B * ( ( int ) pow ) ) + A + C ; } else { System . out . println ( " [LOG] Block: Ans = (C * ((int) pow)) + A + B; " ) ; Ans = ( C * ( ( int ) pow ) ) + A + B ; } System . out . println ( Ans ) ; } } +import java . util . * ; public class Main { static long GOSENCHOU = 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 { System . out . println ( " [LOG] Block: answer = s[i]; \n break; " ) ; answer = s [ i ] ; break ; } } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; sc . close ( ) ; if ( Character . isUpperCase ( S . charAt ( 0 ) ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int k = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . length ( ) <= k ) { System . out . println ( s ) ; } else { System . out . println ( " [LOG] Block: System.out.println(s.subSequence(0, k) + \" ... \" ); " ) ; System . out . println ( s . subSequence ( 0 , k ) + " ... " ) ; } } } } +import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . List ; import java . util . stream . Collectors ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Sum = 0 ; List < String > listA = new ArrayList < String > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: listA.add(sc.next()); " ) ; listA . add ( sc . next ( ) ) ; } List < String > listB = listA . stream ( ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; System . out . println ( listB . size ( ) ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int time = Integer . parseInt ( line ) ; int sec = 0 , min = 0 , hour = 0 ; if ( time >= 3600 ) { hour = time / 3600 ; time = time % 3600 ; min = time / 60 ; sec = time % 60 ; System . out . println ( hour + " : " + min + " : " + sec ) ; } else if ( time >= 60 ) { min = time / 60 ; sec = time % 60 ; System . out . println ( hour + " : " + min + " : " + sec ) ; } else { System . out . println ( " [LOG] Block: System.out.println(hour + \" : \" + min + \" : \" + sec); " ) ; System . out . println ( hour + " : " + min + " : " + sec ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { int n , nTaro = 0 , nHana = 0 ; String str ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; n = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; 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 ] ) ) { System . out . println ( " [LOG] Block: nTaro++; \n nHana++; " ) ; nTaro ++ ; nHana ++ ; } else nHana += 3 ; } System . out . println ( nTaro + " " + nHana ) ; } } +import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; int max = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: max = Math.min(max, Integer.numberOfTrailingZeros(scanner.nextInt())); " ) ; max = Math . min ( max , Integer . numberOfTrailingZeros ( scanner . nextInt ( ) ) ) ; } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int P = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; System . out . println ( solve ( P , Q , R ) ) ; sc . close ( ) ; } static int solve ( int P , int Q , int R ) { System . out . println ( " [LOG] Block: return P + Q + R - Math.max(Math.max(P, Q), R); " ) ; return P + Q + R - Math . max ( Math . max ( P , Q ) , R ) ; } } +import java . util . Scanner ; public class Main { void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int L = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; long min = Long . MAX_VALUE ; for ( int i = L ; 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 ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long A = sc.nextLong(); \n double B = sc.nextDouble(); \n long ans = 0; \n ans = A * (Math.round(B * 100)) / 100; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; double B = sc . nextDouble ( ) ; long ans = 0 ; ans = A * ( Math . round ( B * 100 ) ) / 100 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int tarop = 0 ; int hanakop = 0 ; String tarow ; String hanakow ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: hanakop = hanakop + 1; \n tarop = tarop + 1; " ) ; hanakop = hanakop + 1 ; tarop = tarop + 1 ; } } System . out . println ( tarop + " " + hanakop ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; for ( ; ; ) { int h = stdIn . nextInt ( ) ; int w = stdIn . nextInt ( ) ; if ( h == 0 && w == 0 ) break ; for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( ( i + j ) % 2 == 0 ) { System . out . print ( " # " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" . \" ); " ) ; System . out . print ( " . " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int x = 1 ; int result = 0 ; while ( x < B ) { System . out . println ( " [LOG] Block: x += (A - 1); \n result++; " ) ; x += ( A - 1 ) ; result ++ ; } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } int [ ] dp = new int [ n ] ; int max = - 1 ; for ( int i = n - 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 ( " [LOG] Block: System.out.println(max); " ) ; System . out . println ( max ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] num = new int [ Q ] ; int [ ] count = new int [ N ] ; int t = 0 ; for ( int i = 0 ; i < Q ; i ++ ) { num [ i ] = sc . nextInt ( ) ; count [ num [ i ] - 1 ] ++ ; } for ( int j = 0 ; j < N ; j ++ ) { if ( ( count [ j ] + K - Q ) > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] height = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { height [ i ] = Integer . parseInt ( sc . next ( ) ) ; } boolean pos = true ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( height [ n - i - 2 ] - height [ n - i - 1 ] <= 0 ) { continue ; } else if ( height [ n - i - 2 ] - height [ n - i - 1 ] == 1 ) { height [ n - i - 2 ] -- ; } else { pos = false ; break ; } } if ( pos ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] clash = new boolean [ n + 1 ] ; Arrays . fill ( clash , true ) ; for ( int i = 0 ; i < m ; i ++ ) clash [ sc . nextInt ( ) ] = false ; int [ ] dp = new int [ n + 1 ] ; dp [ 0 ] = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= Math . min ( i + 2 , n ) ; j ++ ) { if ( clash [ j ] ) { System . out . println ( " [LOG] Block: dp[j] += dp[i]; \n dp[j] %= 1000000007; " ) ; dp [ j ] += dp [ i ] ; dp [ j ] %= 1000000007 ; } } } System . out . println ( dp [ n ] ) ; sc . close ( ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: InputStreamReader isr = new InputStreamReader(System.in); \n BufferedReader br = new BufferedReader(isr); \n String s = br.readLine(); \n StringTokenizer st = new StringTokenizer(s, \" \" ); \n int x = Integer.parseInt(st.nextToken()); \n int y = Integer.parseInt(st.nextToken()); \n System.out.print(x * y); \n System.out.print( \" \" ); \n System.out.println(2 * x + 2 * y); " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String s = br . readLine ( ) ; StringTokenizer st = new StringTokenizer ( s , " " ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ; System . out . print ( x * y ) ; System . out . print ( " " ) ; System . out . println ( 2 * x + 2 * y ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; int [ ] arr = new int [ i ] ; 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 ++ ) { System . out . println ( " [LOG] Block: if (arr[x] == arr[x + 1]) \n f = false; " ) ; if ( arr [ x ] == arr [ x + 1 ] ) f = false ; } if ( f == true ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double min = Math . pow ( 10 , 10 ) ; double max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double target = sc . nextInt ( ) ; if ( min > target ) { min = target ; } if ( max < target ) { System . out . println ( " [LOG] Block: max = target; " ) ; max = target ; } } System . out . println ( ( int ) ( max - min ) ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; while ( H != 0 || W != 0 ) { for ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . println ( " [LOG] Block: System.out.printf( \" # \" ); " ) ; System . out . printf ( " # " ) ; } System . out . printf ( " \n " ) ; } System . out . printf ( " \n " ) ; H = sc . nextInt ( ) ; W = sc . nextInt ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] [ ] vectorA = new int [ n ] [ m ] ; int [ ] vectorB = new int [ m ] ; int [ ] vectorC = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { vectorC [ i ] += vectorA [ i ] [ j ] * vectorB [ j ] ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(vectorC[i]); " ) ; System . out . println ( vectorC [ i ] ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = s . length ( ) ; String add = " ... " ; if ( count <= k ) { System . out . println ( s ) ; } else if ( count > k ) { System . out . println ( " [LOG] Block: String result = s.substring(0, k) + add; \n System.out.println(result); " ) ; String result = s . substring ( 0 , k ) + add ; System . out . println ( result ) ; } } } +import java . util . * ; class Main { static int mod = 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 ( " [LOG] Block: System.out.println( \" safe \" ); " ) ; System . out . println ( " safe " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; double W = stdIn . nextDouble ( ) ; double H = stdIn . nextDouble ( ) ; double x = stdIn . nextDouble ( ) ; double y = stdIn . nextDouble ( ) ; System . out . println ( W * H / 2 ) ; if ( x == W / 2 && y == H / 2 ) { System . out . println ( 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main mainObj = new Main ( ) ; mainObj . solve ( ) ; } public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] heightStrArr = sc . nextLine ( ) . split ( " " ) ; sc . close ( ) ; int [ ] heightArr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { heightArr [ i ] = Integer . parseInt ( heightStrArr [ i ] ) ; } if ( heightArr [ 0 ] > 0 ) { heightArr [ 0 ] = heightArr [ 0 ] - 1 ; } for ( int i = 1 ; i < n ; i ++ ) { if ( heightArr [ i ] > heightArr [ i - 1 ] ) { heightArr [ i ] = heightArr [ i ] - 1 ; } if ( heightArr [ i ] < heightArr [ i - 1 ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] str = br.readLine().split( \" \" ); \n int a = Integer.parseInt(str[0]); \n int b = Integer.parseInt(str[1]); \n int d = a / b; \n int e = a % b; \n double f = (double) a / b; \n System.out.printf( \" %d %d %.5f \n \" , d, e, f); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int d = a / b ; int e = a % b ; double f = ( double ) a / b ; System . out . printf ( " %d %d %.5f \n " , d , e , f ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner Str = new Scanner ( System . in ) ; int a = Integer . parseInt ( Str . next ( ) ) ; int b = Integer . parseInt ( Str . next ( ) ) ; if ( Math . floor ( a / 10 ) + Math . floor ( b / 10 ) == 0 ) { System . out . println ( a * b ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count = 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 ) { System . out . println ( " [LOG] Block: answer = \" TBD \" ; \n System.out.println(answer); \n System.exit(0); " ) ; answer = " TBD " ; System . out . println ( answer ) ; System . exit ( 0 ) ; } s = S . substring ( 5 , 7 ) ; m = Integer . parseInt ( s ) ; if ( m > 4 ) { System . out . println ( " [LOG] Block: answer = \" TBD \" ; \n System.out.println(answer); \n System.exit(0); " ) ; answer = " TBD " ; System . out . println ( answer ) ; System . exit ( 0 ) ; } s = S . substring ( 8 , 10 ) ; d = Integer . parseInt ( s ) ; if ( d > 30 ) { System . out . println ( " [LOG] Block: answer = \" TBD \" ; \n System.out.println(answer); \n System.exit(0); " ) ; answer = " TBD " ; System . out . println ( answer ) ; System . exit ( 0 ) ; } System . out . println ( answer ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Long > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: list.add(sc.nextLong()); " ) ; list . add ( sc . nextLong ( ) ) ; } long max = Collections . max ( list ) ; long min = Collections . min ( list ) ; System . out . println ( max - min ) ; } } +import java . math . BigInteger ; import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; pw . println ( 1 - n ) ; pw . flush ( ) ; } static class Scanner { 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 n ) throws IOException { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: arr[i] = Integer.parseInt(next()); " ) ; arr [ i ] = Integer . parseInt ( next ( ) ) ; } return arr ; } } } +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 Main { public static void main ( final String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; boolean niceTap = true ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { char tap = S . charAt ( i ) ; if ( i % 2 == 1 ) { if ( tap == 'R' ) niceTap = false ; } else { System . out . println ( " [LOG] Block: if (tap == 'L') \n niceTap = false; " ) ; if ( tap == 'L' ) niceTap = false ; } } System . out . println ( niceTap ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int max = 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 { System . out . println ( " [LOG] Block: break; " ) ; break ; } } max = Math . max ( max , cnt ) ; } System . out . println ( max ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { int counter = 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 ) { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } System . out . println ( counter ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] array = new String [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 == n - 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 ( " [LOG] Block: System.out.println(answer); " ) ; System . out . println ( answer ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double A = in . nextDouble ( ) ; double B = in . nextDouble ( ) ; double ho = in . nextDouble ( ) ; double mi = in . nextDouble ( ) ; double rad = 60 / mi ; double radMi = 360 / rad ; double radiHo = ( ho * 30 ) + ( 30 / rad ) ; double radian = 0 ; if ( radiHo > radMi ) { radian = radiHo - radMi ; } else { System . out . println ( " [LOG] Block: radian = radMi - radiHo; " ) ; radian = radMi - radiHo ; } double result = ( A * A ) + ( B * B ) - 2 * A * B * Math . cos ( Math . toRadians ( radian ) ) ; double ans = Math . sqrt ( result ) ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { 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 f = false ; if ( s . length ( ) >= i + 7 && s . substring ( i , i + 7 ) . equals ( " dreamer " ) ) { f |= judge ( s , i + 7 ) ; } if ( s . length ( ) >= i + 5 && s . substring ( i , i + 5 ) . equals ( " dream " ) ) { System . out . println ( " [LOG] Block: f |= judge(s, i + 5); " ) ; f |= judge ( s , i + 5 ) ; } if ( s . length ( ) >= i + 6 && s . substring ( i , i + 6 ) . equals ( " eraser " ) ) { f |= judge ( s , i + 6 ) ; } if ( s . length ( ) >= i + 5 && s . substring ( i , i + 5 ) . equals ( " erase " ) ) { System . out . println ( " [LOG] Block: f |= judge(s, i + 5); " ) ; f |= judge ( s , i + 5 ) ; } return f ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; String s ; HashSet < String > list = new HashSet < String > ( N ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: s = scanner.next(); \n list.add(s); " ) ; s = scanner . next ( ) ; list . add ( s ) ; } System . out . println ( list . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int sn = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: sn += str.charAt(i) - '0'; " ) ; sn += str . charAt ( i ) - '0' ; } System . out . println ( Integer . parseInt ( str ) % sn == 0 ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] s ) { Scanner sc = new Scanner ( System . in ) ; int n = 0 ; if ( sc . hasNextInt ( ) ) n = sc . nextInt ( ) ; int cnt = 0 ; boolean res = false ; while ( n -- != 0 ) { System . out . println ( " [LOG] Block: byte x = sc.nextByte(); \n byte y = sc.nextByte(); \n if (x == y) \n cnt++; \n else \n cnt = 0; \n if (cnt == 3) \n res = true; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int sum = 0 ; for ( int i = 1 ; i < N + 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 ) { System . out . println ( " [LOG] Block: sum += i % 10; \n i /= 10; " ) ; sum += i % 10 ; i /= 10 ; } return sum ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int sa12 = Math . abs ( a1 - a2 ) ; int sa23 = Math . abs ( a2 - a3 ) ; int sa31 = Math . abs ( a3 - a1 ) ; 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 { System . out . println ( " [LOG] Block: cost = sa12 + sa23; " ) ; cost = sa12 + sa23 ; } System . out . println ( cost ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int back , i , j = 1 ; while ( true ) { i = j * 1000 ; if ( i >= n ) { System . out . println ( " [LOG] Block: back = i - n; \n break; " ) ; back = i - n ; break ; } j ++ ; } System . out . println ( back ) ; } } +import java . text . DecimalFormat ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String[] s = sc.nextLine().split( \" \" ); \n int a = Integer.parseInt(s[0]); \n int b = Integer.parseInt(s[1]); \n int d = a / b; \n int r = a % b; \n double af = (double) a; \n double bf = (double) b; \n double f = af / bf; \n System.out.println(d + \" \" + r + \" \" + new DecimalFormat( \" 0000000000.0000000000 \" ).format(f)); " ) ; Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; int a = Integer . parseInt ( s [ 0 ] ) ; int b = Integer . parseInt ( s [ 1 ] ) ; int d = a / b ; int r = a % b ; double af = ( double ) a ; double bf = ( double ) b ; double f = af / bf ; System . out . println ( d + " " + r + " " + new DecimalFormat ( " 0000000000.0000000000 " ) . format ( f ) ) ; } } +import java . util . * ; import java . lang . * ; import java . math . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { long x , y , z ; long first , second ; long tmp ; while ( sc . hasNext ( ) ) { first = sc . nextLong ( ) ; second = sc . nextLong ( ) ; x = first ; y = second ; if ( x < y ) { tmp = x ; x = y ; y = tmp ; } do { z = x % y ; x = y ; y = z ; } while ( z != 0 ) ; System . out . println ( x + " " + first * second / x ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } for ( int i = 0 ; i < n - 3 ; i ++ ) { a = b ; b = c ; c = sc . nextInt ( ) ; if ( ( a < b && b < c ) || ( c < b && b < a ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] b = new int [ n ] [ 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 < n ; i ++ ) { if ( b [ i ] [ 0 ] > 0 ) { System . out . println ( " [LOG] Block: ok++; \n ng += b[i][1]; " ) ; ok ++ ; ng += b [ i ] [ 1 ] ; } } System . out . println ( ok + " " + ng ) ; } } +import java . util . MissingResourceException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; try { while ( true ) { String line = sc . next ( ) ; if ( line . equals ( " - " ) ) { break ; } int m = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int h = sc . nextInt ( ) ; line = line . substring ( h ) + line . substring ( 0 , h ) ; } System . out . println ( line ) ; } } catch ( MissingResourceException e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } sc . close ( ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: d[i] = sc.nextInt(); " ) ; d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; System . out . print ( d [ N / 2 ] - d [ N / 2 - 1 ] ) ; } } +import java . util . * ; public class Main { static int MOD = 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 { System . out . println ( " [LOG] Block: b = (long) 0; " ) ; b = ( long ) 0 ; } } else if ( a < 1 ) { if ( b >= k ) { b = b - k ; } else { System . out . println ( " [LOG] Block: b = (long) 0; " ) ; b = ( long ) 0 ; } } System . out . println ( a + " " + b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] ac = new boolean [ n + 1 ] ; long [ ] wa = new long [ n + 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 <= n ; i ++ ) { if ( ac [ i ] ) { System . out . println ( " [LOG] Block: sum1++; \n sum2 += wa[i]; " ) ; sum1 ++ ; sum2 += wa [ i ] ; } } System . out . println ( sum1 + " " + sum2 ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( a + b <= c * 2 ) { System . out . println ( " [LOG] Block: System.out.println(a * x + b * y); \n return; " ) ; System . out . println ( a * x + b * y ) ; return ; } int tmp = Math . min ( x , y ) ; int tmp2 = c * tmp * 2 ; int tmp3 = a * ( 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String line = sc . next ( ) ; if ( line . equals ( " - " ) ) { break ; } ; int n = line . length ( ) ; char [ ] str = new char [ n ] ; for ( int i = 0 ; i < n ; 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 [ n ] ; System . arraycopy ( str , 0 , hoge , 0 , n ) ; for ( int j = 0 ; j < n ; j ++ ) { str [ j ] = hoge [ ( j + h ) % n ] ; } } for ( int k = 0 ; k < n ; k ++ ) { System . out . println ( " [LOG] Block: System.out.print(str[k]); " ) ; System . out . print ( str [ k ] ) ; } System . out . println ( " " ) ; } } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) >= 'a' && s . charAt ( i ) <= 'z' ) { a [ s . charAt ( i ) - 'a' ] ++ ; } } } for ( char i = 'a' ; i <= 'z' ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(i + \" : \" + a[i - 'a']); " ) ; System . out . println ( i + " : " + a [ i - 'a' ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 1 ) { n = 0 ; } else { System . out . println ( " [LOG] Block: n = 1; " ) ; n = 1 ; } System . out . println ( n ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int input = scan . nextInt ( ) ; int [ ] num = new int [ input ] ; int count ; for ( int c = 0 ; c < input ; c ++ ) { num [ c ] = scan . nextInt ( ) ; } count = bubbleSort ( num , input ) ; for ( int i = 0 ; i < input ; i ++ ) { if ( i != input - 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 ] ) { System . out . println ( " [LOG] Block: temp = data[j]; \n data[j] = data[j - 1]; \n data[j - 1] = temp; \n c++; " ) ; temp = data [ j ] ; data [ j ] = data [ j - 1 ] ; data [ j - 1 ] = temp ; c ++ ; } } } return c ; } } +import java . util . * ; class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double D = scan . nextDouble ( ) ; double T = scan . nextDouble ( ) ; double S = scan . nextDouble ( ) ; double reqTime = ( D / S ) ; if ( reqTime > T ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int xymin = Math . min ( x , y ) ; long ans = xymin * Math . min ( a + b , c * 2 ) ; x -= xymin ; y -= xymin ; if ( x == 0 ) { ans += y * Math . min ( b , c * 2 ) ; } else { System . out . println ( " [LOG] Block: ans += x * Math.min(a, c * 2); " ) ; ans += x * Math . min ( a , c * 2 ) ; } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int [ ] rec = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { rec [ s . charAt ( i ) - 'a' ] ++ ; } String ans = " Yes " ; for ( int i = 0 ; i < 26 ; i ++ ) { System . out . println ( " [LOG] Block: if (rec[i] % 2 == 1) \n ans = \" No \" ; " ) ; if ( rec [ i ] % 2 == 1 ) ans = " No " ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; if ( x == 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 >= x ) { System . out . println ( i ) ; break ; } else if ( l == 0 ) { System . out . println ( " [LOG] Block: li.add(i); " ) ; li . add ( i ) ; } i ++ ; l = 0 ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.nextLine(); \n s = s.replace( \" 2017/ \" , \" 2018/ \" ); \n System.out.println(s); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; s = s . replace ( " 2017/ " , " 2018/ " ) ; System . out . println ( s ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > List = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { int j = sc . nextInt ( ) ; List . add ( j ) ; } int k = sc . nextInt ( ) ; int num = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = i + 1 ; j < 5 ; j ++ ) { System . out . println ( " [LOG] Block: if (List.get(j) - List.get(i) > k) \n num++; " ) ; if ( List . get ( j ) - List . get ( i ) > k ) num ++ ; } } if ( num == 0 ) System . out . println ( " Yay! " ) ; else System . out . println ( " :( " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int powD = 1 ; for ( int i = 0 ; i < D ; 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 ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; int sum = 0 ; for ( int i = 0 ; i <= K ; i ++ ) { for ( int j = 0 ; j <= K ; j ++ ) { sum = S - ( i + j ) ; if ( 0 <= sum && sum <= K ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( in . readLine ( ) ) ; int ans = 0 ; while ( x >= 5 ) { if ( x >= 500 ) { ans += 1000 * ( x / 500 ) ; x %= 500 ; } else { System . out . println ( " [LOG] Block: ans += 5 * (x / 5); \n x %= 5; " ) ; ans += 5 * ( x / 5 ) ; x %= 5 ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int k = sc.nextInt(); \n String s = sc.next(); \n char c1 = s.charAt(k - 1); \n String c2 = (String.valueOf(c1)).toLowerCase(); \n String before = s.substring(0, k - 1); \n String after = s.substring(k, s.length()); \n System.out.println(before + c2 + after); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = 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 ( H <= all ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; int [ ] c = new int [ n ] ; Arrays . fill ( c , 0 ) ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: c[i] = c[i] + a[i][j] * b[j]; " ) ; c [ i ] = c [ i ] + a [ i ] [ j ] * b [ j ] ; } System . out . println ( c [ i ] ) ; } scn . close ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BPalindromicNumbers solver = new BPalindromicNumbers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BPalindromicNumbers { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: int a = in.nextInt(); \n int b = in.nextInt(); \n int res = 0; \n for (int i = a; i <= b; i++) if (i / 10000 == i % 10 && i / 10 % 10 == i / 1000 % 10) \n res++; \n out.println(res); " ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int res = 0 ; for ( int i = a ; i <= b ; i ++ ) if ( i / 10000 == i % 10 && i / 10 % 10 == i / 1000 % 10 ) res ++ ; out . println ( res ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long c = sc.nextLong(); \n long d = sc.nextLong(); \n long x1 = a * c; \n long x2 = a * d; \n long x3 = b * c; \n long x4 = b * d; \n long ans = Math.max(x1, x2); \n ans = Math.max(ans, x3); \n ans = Math.max(ans, x4); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long x1 = a * c ; long x2 = a * 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int buildcnt = sc . nextInt ( ) ; int [ ] hights = new int [ buildcnt ] ; boolean reach = false ; String answer = " Yes " ; for ( int i = 0 ; i < buildcnt ; i ++ ) { hights [ i ] = sc . nextInt ( ) ; } for ( int i = buildcnt - 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 { System . out . println ( " [LOG] Block: reach = false; " ) ; reach = false ; } } System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int ans = 0 ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: if (ans == 0) \n ans = count; \n else \n ans = Math.min(ans, count); " ) ; if ( ans == 0 ) ans = count ; else ans = Math . min ( ans , count ) ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str = in . nextLine ( ) ; in . close ( ) ; int max = 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 { System . out . println ( " [LOG] Block: if (max < count) \n max = count; \n count = 0; " ) ; if ( max < count ) max = count ; count = 0 ; } } if ( max < count ) max = count ; System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean [ ] b = new boolean [ 1000001 ] ; b [ n ] = true ; int i = 2 ; while ( true ) { if ( n % 2 == 0 ) { n /= 2 ; } else { n = n * 3 + 1 ; } if ( b [ n ] ) { break ; } else { System . out . println ( " [LOG] Block: b[n] = true; " ) ; b [ n ] = true ; } i ++ ; } System . out . println ( i ) ; } } +import java . util . Scanner ; public class Main { public static int total ( int t ) { int sum = 0 ; while ( t != 0 ) { sum += t % 10 ; t /= 10 ; } return sum ; } 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 ++ ) { System . out . println ( " [LOG] Block: if (A <= total(i) && total(i) <= B) \n result += i; " ) ; if ( A <= total ( i ) && total ( i ) <= B ) result += i ; } System . out . println ( result ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , l = scan . nextInt ( ) ; ArrayList < String > dict = new ArrayList < String > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { dict . add ( scan . next ( ) ) ; } Collections . sort ( dict ) ; String result = " " ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: result += dict.get(i); " ) ; result += dict . get ( i ) ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] str = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = sc . next ( ) ; } int acCount = 0 ; int waCount = 0 ; int tleCount = 0 ; int reCount = 0 ; for ( int j = 0 ; j < n ; 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 " ) ) { System . out . println ( " [LOG] Block: reCount++; " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double sum = 0 ; int cnt = 0 ; Integer [ ] items = new Integer [ N ] ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int ans = 0 ; for ( int a = 1 ; a <= k ; a ++ ) { for ( int b = 1 ; b <= k ; b ++ ) { for ( int c = 1 ; c <= k ; 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 { System . out . println ( " [LOG] Block: int z = x % y; \n ret = gcd(y, z); " ) ; int z = x % y ; ret = gcd ( y , z ) ; } return ret ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; double r = cin . nextDouble ( ) ; System . out . printf ( " %.6f %.6f \n " , cal_area ( r ) , cal_cirum ( r ) ) ; } private static double cal_cirum ( double r ) { return ( r * 2 * Math . PI ) ; } private static double cal_area ( double r ) { System . out . println ( " [LOG] Block: return (r * r * Math.PI); " ) ; return ( r * r * Math . PI ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; try { int W , H , x , y , r ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] strAry = str . split ( " " ) ; W = 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 <= W && y - r >= 0 && y + r <= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner inputs = new Scanner ( System . in ) ; int n = inputs . nextInt ( ) ; int x = inputs . nextInt ( ) ; int t = inputs . nextInt ( ) ; int takoyakiMade = 0 ; int timeTook = 0 ; do { System . out . println ( " [LOG] Block: timeTook += t; \n takoyakiMade += x; " ) ; timeTook += t ; takoyakiMade += x ; } while ( takoyakiMade < n ) ; System . out . println ( timeTook ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int b = sc.nextInt(); \n if (a <= b) \n c++; " ) ; int b = sc . nextInt ( ) ; if ( a <= b ) c ++ ; } System . out . println ( c ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] x = new int [ b ] ; for ( int i = 0 ; i < a ; 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 ++ ) { System . out . println ( " [LOG] Block: if (a == x[k]) \n ret = ret + 1; " ) ; if ( a == x [ k ] ) ret = ret + 1 ; } System . out . println ( ret ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] a = sc . nextLine ( ) . split ( " " ) ; int b = a . length ; String answer = " " ; for ( int i = 0 ; i < b ; 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 ) { System . out . println ( " [LOG] Block: answer = answer.substring(0, answer.length() - 1); " ) ; answer = answer . substring ( 0 , answer . length ( ) - 1 ) ; } } } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; char [ ] cs = sc . next ( ) . toCharArray ( ) ; for ( char c : cs ) { switch ( c ) { case '1' : sb . append ( c ) ; break ; case '0' : sb . append ( c ) ; break ; case 'B' : if ( sb . length ( ) > 0 ) { System . out . println ( " [LOG] Block: sb.deleteCharAt(sb.length() - 1); " ) ; sb . deleteCharAt ( sb . length ( ) - 1 ) ; } break ; } } System . out . println ( sb ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String ans = " " ; for ( char c : S . toCharArray ( ) ) { if ( c == '0' ) { ans += " 0 " ; } else if ( c == '1' ) { ans += " 1 " ; } else if ( c == 'B' && ans . length ( ) == 0 ) { continue ; } else { System . out . println ( " [LOG] Block: ans = ans.substring(0, ans.length() - 1); " ) ; ans = ans . substring ( 0 , ans . length ( ) - 1 ) ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C - ( A - B ) < 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(C - (A - B)); " ) ; System . out . println ( C - ( A - B ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n double b = sc.nextDouble(); \n long ans = (long) (a * (b * 100)) / 100; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; double b = sc . nextDouble ( ) ; long ans = ( long ) ( a * ( b * 100 ) ) / 100 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int N = scanner.nextInt(); \n int K = scanner.nextInt(); \n System.out.println(Integer.toString(N, K).length()); " ) ; Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; System . out . println ( Integer . toString ( N , K ) . length ( ) ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; Map < String , String > map = new HashMap < String , String > ( ) ; map . put ( " ABC " , " ARC " ) ; map . put ( " ARC " , " ABC " ) ; if ( map . containsKey ( a ) ) { System . out . println ( map . get ( a ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" もう一度やり直して下さい\");"); System.out.print ln (" も う 度やり直して 下 さい" ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; double sum = 0 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ 200009 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } a [ n ] = k + a [ 0 ] ; int ans = 1000000009 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: ans = Math.min(ans, k - (a[i + 1] - a[i])); " ) ; ans = Math . min ( ans , k - ( a [ i + 1 ] - a [ i ] ) ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int ans = 0 ; if ( b <= c || d <= a ) { ans = 0 ; } else if ( c <= a && b <= d ) { ans = b - a ; } else if ( a <= c && d <= b ) { ans = d - c ; } else if ( a <= c && c <= b && b <= d ) { ans = b - c ; } else if ( c <= a && a <= d && d <= b ) { System . out . println ( " [LOG] Block: ans = d - a; " ) ; ans = d - a ; } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int N = 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 ) { System . out . println ( " [LOG] Block: Rmin = R[i]; " ) ; Rmin = R [ i ] ; } } out . printf ( " %d \n " , Math . max ( 0 , Rmin - Lmax + 1 ) ) ; out . flush ( ) ; } } +import java . util . * ; class Reader { Scanner sc = new Scanner ( System . in ) ; public int ini ( ) { return sc . nextInt ( ) ; } public int [ ] vi ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; return a ; } } public class Main 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 i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { ans += a [ i ] * a [ j ] ; } } return ans ; } void show ( int ans ) { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; boolean bl = true ; int a = 0 , b = 0 ; while ( bl ) { a = stdIn . nextInt ( ) ; b = stdIn . nextInt ( ) ; if ( ( 1 <= a ) && ( a <= Math . pow ( 10 , 9 ) ) && ( 1 <= b ) && ( b <= Math . pow ( 10 , 9 ) ) ) { System . out . println ( " [LOG] Block: break; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = 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 [ N + 1 ] ; String find = " AC " ; for ( int i = 0 ; i < N ; 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 [ N + 1 ] ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(s[b[i] - 1] - s[a[i] - 1]); " ) ; System . out . println ( s [ b [ i ] - 1 ] - s [ a [ i ] - 1 ] ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String S = br.readLine(); \n char[] ch = S.toCharArray(); \n if (ch[0] == ch[1] && ch[1] == ch[2]) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String S = br . readLine ( ) ; char [ ] ch = S . 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int n = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; if ( n == 0 ) break ; int count = 0 ; for ( int i = 1 ; i <= n - 2 ; i ++ ) { for ( int j = i + 1 ; j <= n - 1 ; j ++ ) { int check_number = x - i - j ; if ( check_number <= n && check_number > j ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } } +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 Main { public static void main ( String [ ] args ) { String q = in . next ( ) ; if ( q . charAt ( 0 ) == q . charAt ( 1 ) && q . charAt ( 1 ) == q . 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 InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int NI ( ) { return Integer . parseInt ( next ( ) ) ; } public long NL ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int x = sc.nextInt(); \n sum += x; " ) ; int x = sc . nextInt ( ) ; sum += x ; } System . out . println ( n - sum < 0 ? - 1 : n - sum ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; int ans = 0 ; int num = 0 ; while ( N / ( 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 ) { System . out . println ( " [LOG] Block: ans += N - Math.pow(10, num - 1) + 1; " ) ; ans += N - Math . pow ( 10 , num - 1 ) + 1 ; } System . out . println ( ans ) ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int next = 1 ; int [ ] a = new int [ n ] ; HashSet < Integer > hSet = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { next = a [ next - 1 ] ; if ( next == 2 ) { System . out . println ( i + 1 ) ; return ; } if ( hSet . contains ( next ) ) { System . out . println ( - 1 ) ; return ; } else { System . out . println ( " [LOG] Block: hSet.add(next); " ) ; hSet . add ( next ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner Sc = new Scanner(System.in); \n String s = Sc.next(); \n if (s.contains( \" 7 \" )) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner Sc = new Scanner ( System . in ) ; String s = Sc . next ( ) ; if ( s . contains ( " 7 " ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ans = lcm ( a , b ) ; System . out . println ( ans ) ; sc . close ( ) ; } public long gcd ( long a , long b ) { if ( b == 0 ) { return a ; } long ans = gcd ( b , a % b ) ; return ans ; } public long lcm ( long a , long b ) { System . out . println ( " [LOG] Block: long g = gcd(a, b); \n return a * b / g; " ) ; long g = gcd ( a , b ) ; return a * b / g ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; boolean f = false ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( ( 4 * i ) + ( 7 * j ) == n ) { System . out . println ( " [LOG] Block: f = true; \n System.out.println( \" Yes \" ); \n return; " ) ; f = true ; System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; char ch = fr . next ( ) . charAt ( 0 ) ; if ( ch >= 65 && ch <= 90 ) { System . out . println ( " A " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } } } +import java . util . ArrayList ; import static java . util . Collections . reverse ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print(get + \" \" ); " ) ; System . out . print ( get + " " ) ; } } System . out . println ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = new int [ k ] ; long sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { a [ i ] = sc . nextInt ( ) ; sum = sum + a [ i ] ; } if ( sum >= n ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int 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 > a + b ) { t = 1 ; } else { t = 2 ; } if ( t == 2 ) { sum += Math . min ( x , y ) * a_b ; if ( x > y ) { sum += ( x - y ) * a ; } else { sum += ( y - x ) * b ; } sum = Math . min ( sum , a_b * ( Math . max ( x , y ) ) ) ; } else { System . out . println ( " [LOG] Block: sum += (x * a) + (y * b); " ) ; sum += ( x * a ) + ( y * b ) ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) { if ( N <= 111 * i ) { System . out . println ( " [LOG] Block: System.out.println(111 * i); \n break; " ) ; System . out . println ( 111 * i ) ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner t = new Scanner ( System . in ) ; String S = t . nextLine ( ) ; int c = 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 ( " [LOG] Block: System.out.println( \" Good \" ); \n t.close(); " ) ; System . out . println ( " Good " ) ; t . close ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String N_str = sc . next ( ) ; String [ ] N_list = N_str . split ( " " ) ; int check = 0 ; for ( int i = 0 ; i < N_list . length ; i ++ ) { check += Integer . parseInt ( N_list [ i ] ) ; } if ( check % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; import java . io . * ; class Main { static PrintStream out = System . out ; static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; int a = in . nextInt ( ) ; long min = a , max = a , sum = a ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: a = in.nextInt(); \n min = Math.min(a, min); \n max = Math.max(a, max); \n sum += a; " ) ; 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 . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; long a = in . nextLong ( ) ; long b = in . nextLong ( ) ; long max = Math . max ( a , b ) ; for ( long i = 0 ; i < max ; i ++ ) { if ( Math . abs ( a - i ) == Math . abs ( b - i ) ) { out . println ( i ) ; out . close ( ) ; return ; } } out . println ( " IMPOSSIBLE " ) ; out . close ( ) ; } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] chars = sc . next ( ) . toCharArray ( ) ; for ( char c : chars ) { if ( c == '1' ) { System . out . print ( 9 ) ; } else if ( c == '9' ) { System . out . print ( 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(c); " ) ; System . out . println ( c ) ; } } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; String [ ] S = sc . next ( ) . split ( " - " ) ; if ( S . length == 2 ) { if ( S [ 0 ] . length ( ) == A && S [ 1 ] . length ( ) == B ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n sc.close(); \n System.exit(0); " ) ; System . out . println ( " Yes " ) ; sc . close ( ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(s[i]); \n System.out.print(t[i]); " ) ; System . out . print ( s [ i ] ) ; System . out . print ( t [ i ] ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; if ( S . matches ( " ^A[a-z]+[C] { 1 } +[a-z]+$ " ) ) { System . out . println ( " AC " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); " ) ; System . out . println ( " WA " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 ( n % cut == 0 ) { flag = 1 ; break ; } if ( cut > 100 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } if ( flag == 1 ) break ; } if ( flag == 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; int ans = x ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } for ( int dif = 0 ; dif <= n ; dif ++ ) { if ( ! list . contains ( x - dif ) ) { ans = x - dif ; break ; } if ( ! list . contains ( x + dif ) ) { ans = x + dif ; break ; } } if ( n > 100 ) { System . out . println ( " [LOG] Block: System.out.println( \" error \" ); " ) ; System . out . println ( " error " ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) nums [ i ] = scanner . nextInt ( ) ; bubbleSort ( n , nums ) ; } private static void bubbleSort ( int n , int [ ] a ) { boolean flg = true ; int i = 0 ; int sw = 0 ; while ( flg ) { flg = false ; for ( int j = n - 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 ( " [LOG] Block: System.out.println(Arrays.toString(nums).replaceAll( \" [ \\ [ \\ ],] \" , \" \" )); " ) ; System . out . println ( Arrays . toString ( nums ) . replaceAll ( " [ \\ [ \\ ],] " , " " ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int str1 = scan.nextInt(); \n int str2 = scan.nextInt(); \n System.out.println(str1 * str2 + \" \" + (str1 * 2 + str2 * 2)); " ) ; Scanner scan = new Scanner ( System . in ) ; int str1 = scan . nextInt ( ) ; int str2 = scan . nextInt ( ) ; System . out . println ( str1 * str2 + " " + ( str1 * 2 + str2 * 2 ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: arr[i] = sc.nextInt(); " ) ; arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; System . out . println ( Math . abs ( arr [ 1 ] - arr [ 0 ] ) + Math . abs ( arr [ 2 ] - arr [ 1 ] ) ) ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; final int MOD = ( 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 ) { System . out . println ( " [LOG] Block: new Main().doIt(); " ) ; new Main ( ) . doIt ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int res ; if ( a <= 5 ) { res = 0 ; } else if ( a <= 12 ) { res = b / 2 ; } else { System . out . println ( " [LOG] Block: res = b; " ) ; res = b ; } System . out . println ( res ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; char [ ] s = new char [ n ] ; char [ ] t = new char [ n ] ; int i ; int m ; char [ ] b = new char [ 2 * n ] ; for ( i = 0 ; i < n ; i ++ ) { s [ i ] = S . charAt ( i ) ; } for ( i = 0 ; i < n ; i ++ ) { t [ i ] = T . charAt ( i ) ; } for ( i = 0 , m = 0 ; i < n ; i ++ , m = m + 2 ) { b [ m ] = s [ i ] ; } for ( i = 0 , m = 1 ; i < n ; i ++ , m = m + 2 ) { System . out . println ( " [LOG] Block: b[m] = t[i]; " ) ; b [ m ] = t [ i ] ; } String str = String . valueOf ( b ) ; System . out . println ( str ) ; } } +import java . io . * ; class Main { 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 i = 0 ; i < ch . length ; i ++ ) { if ( Character . isUpperCase ( ch [ i ] ) ) { ch [ i ] = Character . toLowerCase ( ch [ i ] ) ; } else ch [ i ] = Character . toUpperCase ( ch [ i ] ) ; } for ( int i = 0 ; i < ch . length ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(ch[i]); " ) ; System . out . print ( ch [ i ] ) ; } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < String , Integer > m = new HashMap ( ) ; for ( int i = 0 ; i < n ; 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 ( ) ) { System . out . println ( " [LOG] Block: if (e.getValue() == max) \n al.add(e.getKey()); " ) ; if ( e . getValue ( ) == max ) al . add ( e . getKey ( ) ) ; } Collections . sort ( al ) ; for ( String s : al ) System . out . println ( s ) ; } } +import java . util . * ; public class Main { private static void prin ( String ans ) { System . out . println ( ans ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int upp = N / 100; \n int downn = N % 100; \n boolean my = ((1 <= upp) && (upp <= 12)); \n boolean ym = ((1 <= downn) && (downn <= 12)); \n if (my && ym) \n prin( \" AMBIGUOUS \" ); \n else if (my) \n prin( \" MMYY \" ); \n else if (ym) \n prin( \" YYMM \" ); \n else \n prin( \" NA \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int upp = N / 100 ; int downn = N % 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int sum = 0 ; for ( int x = a ; x <= b ; x ++ ) { if ( c % x == 0 ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . valueOf ( br . readLine ( ) ) ; int z = Integer . valueOf ( br . readLine ( ) ) ; if ( n == 1 ) { if ( z == 2 ) { System . out . print ( " 3 " ) ; } else if ( z == 3 ) { System . out . print ( " 2 " ) ; } } else if ( n == 2 ) { if ( z == 1 ) { System . out . print ( " 3 " ) ; } else if ( z == 3 ) { System . out . println ( " [LOG] Block: System.out.print( \" 1 \" ); " ) ; System . out . print ( " 1 " ) ; } } else if ( n == 3 ) { if ( z == 1 ) { System . out . print ( " 2 " ) ; } else if ( z == 2 ) { System . out . println ( " [LOG] Block: System.out.print( \" 1 \" ); " ) ; System . out . print ( " 1 " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n int a = s.nextInt(); \n long res = a; \n res += a * a + a * a * a; \n System.out.println(res); " ) ; Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; long res = a ; res += a * a + a * a * a ; System . out . println ( res ) ; } } +import java . io . * ; import java . util . * ; public class Main { 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 H = Integer . parseInt ( line [ 0 ] ) ; int W = Integer . parseInt ( line [ 1 ] ) ; if ( H != 0 && W != 0 ) { String yoko = Wwrite ( W ) ; Hwrite ( H , 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 H , String yoko ) { for ( int i = 0 ; i < H ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(yoko); " ) ; System . out . println ( yoko ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int hp1 = sc . nextInt ( ) ; int attack1 = sc . nextInt ( ) ; int hp2 = sc . nextInt ( ) ; int attack2 = sc . nextInt ( ) ; while ( hp1 > 0 && hp2 > 0 ) { hp2 -= attack1 ; if ( hp2 <= 0 ) { System . out . println ( " Yes " ) ; continue ; } hp1 -= attack2 ; if ( hp1 <= 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n continue; " ) ; System . out . println ( " No " ) ; continue ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . close ( ) ; long sum = 0 ; if ( K >= a [ 0 ] ) { sum += a [ 0 ] ; K -= a [ 0 ] ; } else { sum += K ; K = 0 ; } if ( K >= a [ 1 ] ) { K -= a [ 1 ] ; } else { K = 0 ; } if ( K >= a [ 2 ] ) { sum -= a [ 2 ] ; K -= a [ 2 ] ; } else { System . out . println ( " [LOG] Block: sum -= K; \n K = 0; " ) ; sum -= K ; K = 0 ; } System . out . println ( sum ) ; } } +import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (n.charAt(i) == '1') \n System.out.print(9); \n if (n.charAt(i) == '9') \n System.out.print(1); " ) ; if ( n . charAt ( i ) == '1' ) System . out . print ( 9 ) ; if ( n . charAt ( i ) == '9' ) System . out . print ( 1 ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strAry ; long n , max , min , sum ; n = 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 < n ; i ++ ) { sum = sum + Integer . parseInt ( strAry [ i ] ) ; if ( min > Integer . parseInt ( strAry [ i ] ) ) { min = Integer . parseInt ( strAry [ i ] ) ; } if ( max < Integer . parseInt ( strAry [ i ] ) ) { System . out . println ( " [LOG] Block: max = Integer.parseInt(strAry[i]); " ) ; max = Integer . parseInt ( strAry [ i ] ) ; } } System . out . println ( min + " " + max + " " + sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; a -- ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long total = b - a ; long divD = b / d - a / d ; long divC = b / c - a / c ; long lcm = getLcm ( c , d ) ; long divL = b / lcm - a / 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 { System . out . println ( " [LOG] Block: m += bm; " ) ; m += bm ; } } return n ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( b + c <= a ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b + c - a); " ) ; System . out . println ( b + c - a ) ; } } } +import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int N = Integer . parseInt ( stdin . next ( ) ) ; int [ ] H = new int [ N ] ; int flag ; if ( N == 1 ) { flag = 1 ; } else { flag = 0 ; } for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = Integer . parseInt ( stdin . next ( ) ) ; } for ( int i = N - 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 < N - 1 ; i ++ ) { if ( H [ i ] <= H [ i + 1 ] ) { flag = 1 ; } else { flag = 0 ; break ; } } if ( flag == 1 ) { out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: out.println( \" No \" ); " ) ; out . println ( " No " ) ; } out . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: return 1; " ) ; return 1 ; } return 0 ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int max = 0 ; int m = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = sc.nextInt(); \n max = Math.max(max, a[i]); \n m += a[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 . * ; class Main { public static void main ( String [ ] args ) { new Solver ( ) . run ( ) ; } } class Solver { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = A ; 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 ] ) { System . out . println ( " [LOG] Block: ok = false; \n break; " ) ; ok = false ; break ; } } if ( ok ) cnt ++ ; } System . out . println ( cnt ) ; return ; } } +import java . util . * ; class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String a = s . next ( ) , b = s . next ( ) ; char [ ] c = new char [ n * 2 ] ; for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( " [LOG] Block: c[i * 2] = a.charAt(i); \n c[i * 2 + 1] = b.charAt(i); " ) ; c [ i * 2 ] = a . charAt ( i ) ; c [ i * 2 + 1 ] = b . charAt ( i ) ; } System . out . println ( c ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc134_b solver = new abc134_b ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class abc134_b { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int D = in . nextInt ( ) ; int mans = ( int ) Math . ceil ( N / ( ( D * 2 ) + 1 ) ) ; if ( N % ( ( D * 2 ) + 1 ) != 0 ) { System . out . println ( " [LOG] Block: mans++; " ) ; mans ++ ; } out . println ( mans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = Integer . parseInt ( scan . next ( ) ) ; if ( N <= 111 ) { System . out . println ( 111 ) ; } else if ( N <= 222 ) { System . out . println ( 222 ) ; } else if ( N <= 333 ) { System . out . println ( 333 ) ; } else if ( N <= 444 ) { System . out . println ( 444 ) ; } else if ( N <= 555 ) { System . out . println ( 555 ) ; } else if ( N <= 666 ) { System . out . println ( 666 ) ; } else if ( N <= 777 ) { System . out . println ( 777 ) ; } else if ( N <= 888 ) { System . out . println ( 888 ) ; } else if ( N <= 999 ) { System . out . println ( " [LOG] Block: System.out.println(999); " ) ; System . out . println ( 999 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Integer [ ] d = new Integer [ N ] ; int s = 1 ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( d , Comparator . reverseOrder ( ) ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (d[i] > d[i + 1]) \n s++; " ) ; if ( d [ i ] > d [ i + 1 ] ) s ++ ; } System . out . println ( s ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] P = new int [ N ] ; int countI = 1 ; for ( int i = 0 ; i < N ; i ++ ) { int b = scan . nextInt ( ) ; P [ i ] = b ; } int j = 1 ; int Min = P [ 0 ] ; while ( j < N ) { if ( P [ j ] < Min ) { System . out . println ( " [LOG] Block: Min = P[j]; \n countI++; " ) ; Min = P [ j ] ; countI ++ ; } j ++ ; } System . out . println ( countI ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } List < Integer > collect = list . stream ( ) . sorted ( ) . collect ( Collectors . toList ( ) ) ; int sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: sum += collect.get(i); " ) ; sum += collect . get ( i ) ; } System . out . println ( sum ) ; } } +import java . util . ArrayDeque ; import java . util . Deque ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int n , q , t ; int t_sum = 0 ; String pros ; Deque < String > name = new ArrayDeque < > ( ) ; Deque < Integer > time = new ArrayDeque < > ( ) ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; q = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: t_sum += q; \n time.offerLast(t - q); \n name.offerLast(name.poll()); " ) ; t_sum += q ; time . offerLast ( t - q ) ; name . offerLast ( name . poll ( ) ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str1 = sc . next ( ) ; String str2 = " 7 " ; int result = str1 . indexOf ( str2 ) ; if ( result != - 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int ans = 0 ; if ( c < a && d < a ) { ans = 0 ; } if ( c <= a && d >= a && d <= b ) { ans = d - a ; } if ( c >= a && d <= b ) { ans = d - c ; } if ( c >= a && d >= b && c <= b ) { ans = b - c ; } if ( b < c ) { ans = 0 ; } if ( c <= a && b <= d ) { System . out . println ( " [LOG] Block: ans = b - a; " ) ; ans = b - a ; } System . out . println ( ans ) ; } } +import java . util . * ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) { int N ; int [ ] A ; try ( Scanner sc = new Scanner ( System . in ) ) { N = sc . nextInt ( ) ; A = new int [ N ] ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: int[] a1 = new int[n1]; \n System.arraycopy(a, n0, a1, 0, n1); \n double s1 = solve(a1); \n r += 1 / s1; " ) ; 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 ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String ns = s . nextLine ( ) ; String str = s . nextLine ( ) ; int n = Integer . parseInt ( ns ) ; int [ ] arr = new int [ n + 1 ] ; arr [ 0 ] = 0 ; String [ ] sss = str . split ( " \\ s " ) ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = Integer . parseInt ( sss [ i - 1 ] ) ; } int [ ] a = new int [ n + 1 ] ; a [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a [ ( arr [ i ] ) ] = i ; } for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[i] + \" \" ); " ) ; System . out . print ( a [ i ] + " " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int R = sc.nextInt(); \n double a = 2 * R * Math.PI; \n System.out.println(a); " ) ; Scanner sc = new Scanner ( System . in ) ; int R = sc . nextInt ( ) ; double a = 2 * R * Math . PI ; System . out . println ( a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int n = scanner . nextInt ( ) ; final int x = scanner . nextInt ( ) ; final int [ ] lengths = new int [ n ] ; for ( int i = 0 ; i < lengths . length ; i ++ ) { lengths [ i ] = scanner . nextInt ( ) ; } int i ; int distance = 0 ; for ( i = 0 ; i < n ; i ++ ) { distance += lengths [ i ] ; if ( distance > x ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( i + 1 ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int sol = 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } k ++ ; } sol = Math . min ( count , sol ) ; } System . out . println ( sol ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; int n = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { n += ( Math . pow ( 10 , i ) * ( s . charAt ( 3 - i ) - 48 ) ) ; } n *= 10000 ; n += ( s . charAt ( 5 ) - 48 ) * 1000 ; n += ( s . charAt ( 6 ) - 48 ) * 100 ; n += ( s . charAt ( 8 ) - 48 ) * 10 ; n += s . charAt ( 9 ) - 48 ; if ( n < 20190431 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" TBD \" ); " ) ; System . out . println ( " TBD " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long h = sc . nextLong ( ) ; if ( h == 1 ) { System . out . println ( 1 ) ; return ; } long x = h ; int cnt = 0 ; while ( true ) { x /= 2 ; cnt ++ ; if ( x == 1 ) break ; } long ans = 2 ; for ( int i = 0 ; i < cnt ; i ++ ) { System . out . println ( " [LOG] Block: ans *= 2; " ) ; ans *= 2 ; } if ( cnt > 0 ) ans -- ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Integer [ ] list = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } Integer [ ] sorted = Arrays . copyOf ( list , n ) ; Arrays . sort ( sorted ) ; String ans = " YES " ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! sorted [ i ] . equals ( list [ i ] ) ) { count ++ ; if ( count > 2 ) { System . out . println ( " [LOG] Block: ans = \" NO \" ; \n break; " ) ; ans = " NO " ; break ; } } } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; String [ ] tokens = in . readLine ( ) . split ( " " ) ; int A = 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 , A ) ; String str = valid ? " Yes " : " No " ; System . out . println ( str ) ; } static boolean isValid ( String S , Set < Character > numbers , int A ) { for ( int i = 0 ; i < S . length ( ) ; ++ i ) { if ( i == A ) { if ( S . charAt ( i ) != '-' ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } else { if ( ! numbers . contains ( S . charAt ( i ) ) ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } } return true ; } } +import java . util . * ; public class Main { 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 i = 0 ; i < x + 1 ; i ++ ) { System . out . println ( " [LOG] Block: Integer sum = 2 * i + 4 * (x - i); \n if (sum == y) \n ans = \" Yes \" ; " ) ; Integer sum = 2 * i + 4 * ( x - i ) ; if ( sum == y ) ans = " Yes " ; } 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 Main { static class FastReader { 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 { System . out . println ( " [LOG] Block: FastReader s = new FastReader(); \n String n = s.next(); \n if (n.charAt(0) >= 65 && n.charAt(0) <= 90) \n System.out.println( \" A \" ); \n else \n System.out.println( \" a \" ); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long nam = sc . nextLong ( ) ; long ans = Long . MAX_VALUE ; long j = 0 ; for ( long i = 1 ; i * i <= nam ; i ++ ) { if ( nam % i != 0 ) { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } j = nam / i ; ans = Math . min ( ans , i + j - 2 ) ; } System . out . println ( ans ) ; } } +import java . io . InputStream ; import java . io . OutputStream ; import java . util . Scanner ; import java . io . PrintWriter ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task task = new Task ( ) ; while ( in . hasNext ( ) ) { task . solve ( in , out ) ; out . flush ( ) ; } out . close ( ) ; } static class Task { public void solve ( Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: int a = in.nextInt(), b = in.nextInt(); \n out.println((a * b) % 2 == 0 ? \" Even \" : \" Odd \" ); " ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) ; out . println ( ( a * b ) % 2 == 0 ? " Even " : " Odd " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; int N = ob . nextInt ( ) ; boolean C = true ; String R = " " ; while ( C ) { N %= 10 ; C = false ; } if ( ( N == 2 ) || ( N == 4 ) || ( N == 5 ) || ( N == 7 ) || ( N == 9 ) ) { R += " hon " ; } else if ( ( N == 0 ) || ( N == 1 ) || ( N == 6 ) || ( N == 8 ) ) { R += " pon " ; } else if ( N == 3 ) { System . out . println ( " [LOG] Block: R += \" bon \" ; " ) ; R += " bon " ; } System . out . println ( R ) ; } } +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 Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n out.println((int) ceil((Double.parseDouble(br.readLine())) / 2)); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out . println ( ( int ) ceil ( ( Double . parseDouble ( br . readLine ( ) ) ) / 2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int f = 0 ; for ( int price = B * 10 ; price < ( B + 1 ) * 10 ; price ++ ) { if ( ( int ) ( ( double ) price * 0.08 + 0.01 ) == A ) { System . out . println ( price ) ; f ++ ; break ; } } if ( f == 0 ) { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . Scanner ; public class Main { private static Scanner scanner ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: scanner = new Scanner(System.in); \n int S; \n while (0 > (S = scanner.nextInt()) || S >= 86400) ; \n int hour = S / 3600; \n int minute = (S - hour * 3600) / 60; \n int second = (S - hour * 3600 - minute * 60); \n System.out.println(hour + \" : \" + minute + \" : \" + second); " ) ; scanner = new Scanner ( System . in ) ; int S ; while ( 0 > ( S = scanner . nextInt ( ) ) || S >= 86400 ) ; int hour = S / 3600 ; int minute = ( S - hour * 3600 ) / 60 ; int second = ( S - hour * 3600 - minute * 60 ) ; System . out . println ( hour + " : " + minute + " : " + second ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; aLoop : for ( int a = 0 ; a <= k ; a ++ ) { bLoop : for ( int b = 0 ; b <= k ; b ++ ) { int abSum = a + b ; if ( abSum > s ) { continue aLoop ; } else if ( s - abSum <= k ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( solve ( n ) ) ; } public static int solve ( int n ) { int max = ( int ) Math . pow ( n , 0.5 ) + 1 ; int ret = 1 ; for ( int i = 2 ; i < max ; i ++ ) { int pow = 2 ; while ( Math . pow ( i , pow ) <= n ) { System . out . println ( " [LOG] Block: ret = Math.max(ret, (int) Math.pow(i, pow)); \n pow++; " ) ; ret = Math . max ( ret , ( int ) Math . pow ( i , pow ) ) ; pow ++ ; } } return ret ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = 200000 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: int P = sc.nextInt(); \n min = Math.min(min, P); \n if (min == P) \n cnt++; " ) ; int P = sc . nextInt ( ) ; min = Math . min ( min , P ) ; if ( min == P ) cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c = 1 ; while ( true ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n if (a != 0) \n System.out.println( \" Case \" + c + \" : \" + a); \n else \n break; \n c = c + 1; " ) ; int a = sc . nextInt ( ) ; if ( a != 0 ) System . out . println ( " Case " + c + " : " + a ) ; else break ; c = c + 1 ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] a = new int [ 100 ] ; for ( int i = 0 ; i < N ; i ++ ) { int val = in . nextInt ( ) ; a [ i ] = val ; } for ( int i = 1 ; i < N ; i ++ ) { output ( a , N ) ; 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 , N ) ; } static void output ( int [ ] a , int N ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[i] + \" \" ); " ) ; System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ N - 1 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: if (s[i] - '0' == 1) \n count++; " ) ; if ( s [ i ] - '0' == 1 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num = scanner . nextInt ( ) ; int [ ] array = new int [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { array [ i ] = scanner . nextInt ( ) ; } insertionSort ( array , num ) ; scanner . close ( ) ; } public static int [ ] insertionSort ( int [ ] array , int num ) { int sub ; int comp = 0 ; int i ; for ( int cou = 0 ; cou < num ; cou ++ ) { System . out . print ( array [ cou ] ) ; if ( cou == num - 1 ) { System . out . print ( " \n " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } for ( i = 1 ; i <= num - 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 < num ; cou ++ ) { System . out . print ( array [ cou ] ) ; if ( cou == num - 1 ) { System . out . print ( " \n " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } } return array ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n % 10 == 3 || n % 100 == 3 ) { System . out . println ( " bon " ) ; } else if ( n % 10 == 0 || n % 10 == 1 | n % 10 == 6 || n % 10 == 8 ) { System . out . println ( " [LOG] Block: System.out.println( \" pon \" ); " ) ; System . out . println ( " pon " ) ; } else System . out . println ( " hon " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String num = sc . next ( ) ; int [ ] x ; x = new int [ 1000 ] ; int length = num . length ( ) ; int sum = 0 ; for ( int i = 0 ; i < length ; i ++ ) x [ i ] = num . charAt ( i ) - '0' ; for ( int i = 0 ; i < length ; i ++ ) sum += x [ i ] ; if ( sum == 0 ) { break ; } else { System . out . println ( " [LOG] Block: System.out.println(sum); " ) ; System . out . println ( sum ) ; } } } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n PrintWriter ou = new PrintWriter(System.out); \n int[] a = new int[5]; \n for (int i = 0; i < 5; i++) a[i] = Integer.parseInt(sc.next()); \n int k = Integer.parseInt(sc.next()); \n sc.close(); \n Arrays.sort(a); \n if (k >= a[4] - a[0]) \n ou.println( \" Yay! \" ); \n else \n ou.println( \" :( \" ); \n ou.flush(); " ) ; Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i ++ ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; Arrays . sort ( a ) ; if ( k >= a [ 4 ] - a [ 0 ] ) ou . println ( " Yay! " ) ; else ou . println ( " :( " ) ; ou . flush ( ) ; } } +import java . io . * ; class Main { 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 sum = 0 ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { digit [ i ] = Character . getNumericValue ( str1 . charAt ( i ) ) ; sum += digit [ i ] ; } if ( sum == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } else System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int K = sc.nextInt(); \n String S = sc.next(); \n String substring = S.substring(K - 1, K); \n String lower = substring.toLowerCase(); \n String front = S.substring(0, K - 1); \n String back = S.substring(K, N); \n System.out.println(front + lower + back); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = 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 , N ) ; System . out . println ( front + lower + back ) ; sc . close ( ) ; } } +import java . io . IOException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( Scanner s = new Scanner ( System . in ) ) { int n = 3 ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: array[i] = s.nextInt(); " ) ; array [ i ] = s . nextInt ( ) ; } Arrays . sort ( array ) ; System . out . println ( ( array [ 0 ] == 5 && array [ 1 ] == 5 && array [ 2 ] == 7 ) ? " YES " : " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int value = a + b + c ; int product = a * b * c ; if ( value == 17 & product == 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int yen = sc . nextInt ( ) ; boolean flg = true ; int i = 1 ; while ( flg ) { int cg = 1000 * i - yen ; if ( cg >= 0 ) { System . out . println ( " [LOG] Block: flg = false; \n System.out.println(cg); " ) ; flg = false ; System . out . println ( cg ) ; } i ++ ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long ans = sc.nextLong() + sc.nextLong(); \n if (ans % 2 == 1) \n System.out.println( \" IMPOSSIBLE \" ); \n else \n System.out.println(ans / 2); " ) ; Scanner sc = new Scanner ( System . in ) ; long ans = sc . nextLong ( ) + sc . nextLong ( ) ; if ( ans % 2 == 1 ) System . out . println ( " IMPOSSIBLE " ) ; else System . out . println ( ans / 2 ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = 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 < n ; j ++ ) { int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int a = in . nextInt ( ) ; sum += a * b [ i ] ; } if ( sum + c > 0 ) { System . out . println ( " [LOG] Block: ret++; " ) ; ret ++ ; } } System . out . println ( ret ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > x = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { x . add ( sc . nextInt ( ) ) ; } for ( Integer i : x ) { if ( i == 0 ) { System . out . println ( " [LOG] Block: System.out.println(x.indexOf(i) + 1); " ) ; System . out . println ( x . indexOf ( i ) + 1 ) ; } } sc . close ( ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int count = Integer . parseInt ( in . readLine ( ) ) ; int [ ] iArr = new int [ count ] ; 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 ) { System . out . println ( " [LOG] Block: sb.append(i).append( \" \" ); " ) ; sb . append ( i ) . append ( " " ) ; } System . out . println ( sb . toString ( ) . trim ( ) ) ; System . out . println ( swapCount ) ; } catch ( IOException e ) { } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int count = 1 ; while ( true ) { String str = input . nextLine ( ) ; if ( ! str . equals ( " 0 " ) ) { System . out . println ( " Case " + count + " : " + str ) ; count = count + 1 ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n System.out.println((10000 - n) % 1000); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( ( 10000 - n ) % 1000 ) ; sc . close ( ) ; } } +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 Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; Map < String , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(s); " ) ; System . out . println ( s ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextLong ( ) ; int count = 1 ; long money = 100 ; while ( true ) { money *= 1.01 ; if ( money >= X ) { System . out . println ( " [LOG] Block: System.out.println(count); \n return; " ) ; System . out . println ( count ) ; return ; } count ++ ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char c = ' ' ; for ( int i = 0 ; i < S . length ( ) ; i = i + 2 ) { c = S . charAt ( i ) ; if ( c != 'R' && c != 'U' && c != 'D' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } for ( int k = 1 ; k < S . length ( ) ; k = k + 2 ) { c = S . charAt ( k ) ; if ( c != 'L' && c != 'U' && c != 'D' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; String str = scan . next ( ) ; if ( k >= str . length ( ) ) { System . out . println ( str ) ; } else { System . out . println ( " [LOG] Block: System.out.println(str.substring(0, k) + \" ... \" ); " ) ; System . out . println ( str . substring ( 0 , k ) + " ... " ) ; } } } +import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { static BigInteger limit = new BigInteger ( " 1000000000000000000 " ) ; public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int num = sc . nextInt ( ) ; List < BigInteger > values = new ArrayList < BigInteger > ( ) ; for ( int i = 0 ; i < num ; 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 ( " [LOG] Block: System.out.println(-1); \n e.printStackTrace(); " ) ; System . out . println ( - 1 ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 1000000000 ; int max = - 1000000000 ; for ( int i = 0 ; i < n ; i ++ ) { int r = sc . nextInt ( ) ; if ( i == 0 ) { min = r ; } else { System . out . println ( " [LOG] Block: max = Math.max(max, r - min); \n min = Math.min(min, r); " ) ; max = Math . max ( max , r - min ) ; min = Math . min ( min , r ) ; } } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int h = sc.nextInt(); \n int m = sc.nextInt(); \n double kakudo = Math.abs((m * 360 / 60) - ((h + (double) m / 60) * 360 / 12)); \n double x = Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(Math.toRadians(kakudo)); \n System.out.println(Math.sqrt(x)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double kakudo = Math . abs ( ( m * 360 / 60 ) - ( ( h + ( double ) m / 60 ) * 360 / 12 ) ) ; double x = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( kakudo ) ) ; System . out . println ( Math . sqrt ( x ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long start = 100 ; int answer = 0 ; while ( x > start ) { System . out . println ( " [LOG] Block: start += start / 100; \n answer++; " ) ; start += start / 100 ; answer ++ ; } System . out . println ( answer ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n String result = (a == b) ? \" a == b \" : (a > b) ? \" a > b \" : \" a < b \" ; \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String result = ( a == b ) ? " a == b " : ( a > b ) ? " a > b " : " a < b " ; System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int min = 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 ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i + j) != t.charAt(j)) \n sum++; " ) ; if ( s . charAt ( i + j ) != t . charAt ( j ) ) sum ++ ; } min = Math . min ( min , sum ) ; } System . out . println ( min ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) , n = in . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i <= a ; i ++ ) { int x = 500 * i ; for ( int j = 0 ; j <= b ; j ++ ) { System . out . println ( " [LOG] Block: int y = 100 * j; \n if (n - x - y >= 0 && (n - x - y) % 50 == 0 && (n - x - y) / 50 <= c) \n count++; " ) ; 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 . * ; import java . util . regex . Pattern ; import java . util . regex . Matcher ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int M = Integer . parseInt ( st . nextToken ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; String regex = String . format ( " [0-9] { %d } -[0-9] { %d } " , M , 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int r , c , a [ ] [ ] = new int [ 101 ] [ 101 ] , i , j ; r = stdIn . nextInt ( ) ; c = stdIn . nextInt ( ) ; for ( i = 0 ; i < r ; 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 < r ; j ++ ) a [ r ] [ i ] += a [ j ] [ i ] ; a [ r ] [ c ] += a [ r ] [ i ] ; } for ( i = 0 ; i <= r ; i ++ ) { for ( j = 0 ; j <= c ; j ++ ) { System . out . println ( " [LOG] Block: if (j != 0) \n System.out.print( \" \" ); \n System.out.print(a[i][j]); " ) ; if ( j != 0 ) System . out . print ( " " ) ; System . out . print ( a [ i ] [ j ] ) ; } System . out . println ( ) ; } } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: not_prime = true; \n break; " ) ; not_prime = true ; break ; } } count += not_prime ? 0 : 1 ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; 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 = n - 1 ; while ( l <= r ) { mid = ( l + r ) / 2 ; if ( s [ mid ] == t ) { cnt ++ ; break ; } else if ( s [ mid ] > t ) { r = mid - 1 ; } else { System . out . println ( " [LOG] Block: l = mid + 1; " ) ; l = mid + 1 ; } } } System . out . printf ( " %d%n " , cnt ) ; } } +import java . util . Scanner ; import java . io . PrintWriter ; class Main { static String blackjack ( int a1 , int a2 , int a3 ) { if ( a1 + a2 + a3 <= 21 ) { return " win " ; } return " bust " ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n PrintWriter out = new PrintWriter(System.out); \n int a1 = Integer.parseInt(sc.next()); \n int a2 = Integer.parseInt(sc.next()); \n int a3 = Integer.parseInt(sc.next()); \n out.println(blackjack(a1, a2, a3)); \n out.flush(); " ) ; Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int a1 = Integer . parseInt ( sc . next ( ) ) ; int a2 = Integer . parseInt ( sc . next ( ) ) ; int a3 = Integer . parseInt ( sc . next ( ) ) ; out . println ( blackjack ( a1 , a2 , a3 ) ) ; out . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int [ ] num = new int [ 1000000 ] ; int ans = 0 ; num [ 0 ] = S ; for ( int i = 1 ; i < 1000000 ; i ++ ) { if ( S % 2 == 0 ) { num [ i ] = S / 2 ; S = S / 2 ; } else if ( S % 2 == 1 ) { num [ i ] = 3 * S + 1 ; S = 3 * S + 1 ; } for ( int j = 0 ; j < i ; j ++ ) { if ( num [ j ] == num [ i ] ) { ans = i + 1 ; } } if ( ans != 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( ans ) ; } } +import java . awt . print . Printable ; import java . util . Scanner ; import javax . sound . midi . SysexMessage ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] strs = new String [ 100 ] ; int count2 = 0 ; while ( true ) { String str = sc . next ( ) ; if ( str . equals ( " - " ) ) { for ( int j = 0 ; j < count2 ; j ++ ) { System . out . println ( strs [ j ] ) ; } sc . close ( ) ; break ; } int num = sc . nextInt ( ) ; for ( int i = 0 ; i < num ; i ++ ) { System . out . println ( " [LOG] Block: int count = sc.nextInt(); \n String str1 = str.substring(0, count); \n String str2 = str.substring(count, str.length()); \n str = str2 + str1; " ) ; int count = sc . nextInt ( ) ; String str1 = str . substring ( 0 , count ) ; String str2 = str . substring ( count , str . length ( ) ) ; str = str2 + str1 ; } strs [ count2 ] = str ; count2 ++ ; } } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { int n , q , time = 0 ; Queue < String > queueName = new ArrayDeque < String > ( ) ; Queue < Integer > queueTime = new ArrayDeque < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; q = sc . nextInt ( ) ; sc . nextLine ( ) ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(qn + \" \" + time); " ) ; System . out . println ( qn + " " + time ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = 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 ( x ) ; return ; } for ( int i = 0 ; i < n ; i ++ ) { int countm = 0 ; int countp = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( x - i != p [ j ] ) { countm ++ ; } if ( x + i != p [ j ] ) { countp ++ ; } } if ( countm == n ) { System . out . println ( x - i ) ; return ; } else if ( countp == n ) { System . out . println ( " [LOG] Block: System.out.println(x + i); \n return; " ) ; System . out . println ( x + i ) ; return ; } } System . out . println ( x - 1 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { int numN = 0 ; int i = 0 ; String outputNum = " " ; String [ ] NumList ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; numN = Integer . parseInt ( line ) ; line = br . readLine ( ) ; if ( line != null ) { NumList = line . split ( " " , 0 ) ; int Count = numN - 1 ; for ( i = 0 ; i < NumList . length ; i ++ ) { if ( Count != numN - 1 ) { outputNum += " " ; } outputNum += NumList [ Count ] ; Count -- ; } System . out . println ( outputNum ) ; } } catch ( NumberFormatException e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } } } +import java . util . * ; public class Main { 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 i = 0 ; i < s . length ; i ++ ) { if ( n == s . length ) { System . out . println ( " No " ) ; break ; } else if ( s [ i + n >= s . length ? i + n - s . length : i + n ] != p [ i ] ) { n ++ ; func ( s , p , n ) ; break ; } else if ( i == p . length - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n break; " ) ; System . out . println ( " Yes " ) ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int ans = a * b ; int ans2 = 0 ; for ( int i = 0 ; i < b ; i ++ ) { System . out . println ( " [LOG] Block: ans2 += a; " ) ; ans2 += a ; } System . out . println ( ans2 ) ; } } +import java . util . Scanner ; import java . util . InputMismatchException ; class Main { public static void main ( String [ ] args ) { int x = 0 , y = 0 ; int [ ] [ ] z ; Scanner scanner = new Scanner ( System . in ) ; x = 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 ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int c = 0 ; while ( a % 2 == 0 ) { System . out . println ( " [LOG] Block: a /= 2; \n c++; " ) ; a /= 2 ; c ++ ; } if ( c < min ) min = c ; } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . next ( ) ; int r = 1 ; char [ ] str = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; for ( int i = 0 ; i < str . length - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (str[i] != str[i + 1]) \n ++r; " ) ; if ( str [ i ] != str [ i + 1 ] ) ++ r ; } System . out . println ( r ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String C = sc.nextLine(); \n String alp = \" abcdefghijklmnopqrstuvwxyz \" ; \n int X = alp.indexOf(C); \n System.out.println(alp.charAt(X + 1)); " ) ; Scanner sc = new Scanner ( System . in ) ; String C = sc . nextLine ( ) ; String alp = " abcdefghijklmnopqrstuvwxyz " ; int X = alp . indexOf ( C ) ; System . out . println ( alp . charAt ( X + 1 ) ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = Integer . parseInt ( scan . next ( ) ) ; List < String > list = new ArrayList < > ( ) ; String W = scan . next ( ) ; list . add ( W ) ; String preW ; for ( int i = 1 ; i < N ; i ++ ) { W = scan . next ( ) ; if ( list . contains ( W ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } preW = list . get ( i - 1 ) ; if ( preW . charAt ( preW . length ( ) - 1 ) != W . charAt ( 0 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } list . add ( W ) ; } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = 0 ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { a [ s . nextInt ( ) - 1 ] ++ ; } for ( int i : a ) { System . out . println ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int xx = 0 ; int yy = 0 ; int time = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } xx = x ; yy = y ; time = t ; } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = a * b ; if ( ans == 2 ) { System . out . println ( " 3 " ) ; } else if ( ans == 3 ) { System . out . println ( " 2 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" 1 \" ); " ) ; System . out . println ( " 1 " ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] s = new int [ n ] ; int i ; Arrays . fill ( s , k - q ) ; for ( i = 0 ; i < q ; i ++ ) { s [ Integer . parseInt ( sc . next ( ) ) - 1 ] ++ ; } for ( i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (s[i] > 0) \n ou.print( \" Yes \n \" ); \n else \n ou.print( \" No \n \" ); " ) ; if ( s [ i ] > 0 ) ou . print ( " Yes \n " ) ; else ou . print ( " No \n " ) ; } ou . flush ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String [ ] list = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( list [ 0 ] ) ; int b = Integer . parseInt ( list [ 1 ] ) ; int d = a / b ; int r = a % b ; double f = ( double ) a / b ; System . out . println ( d + " " + r + " " + String . format ( " %.5f " , f ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc139_a solver = new abc139_a ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class abc139_a { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String [ ] S = in . next ( ) . split ( " " ) ; String [ ] T = in . next ( ) . split ( " " ) ; int hit = 0 ; for ( int i = 0 ; i < S . length ; i ++ ) { if ( S [ i ] . compareTo ( T [ i ] ) == 0 ) { System . out . println ( " [LOG] Block: hit++; " ) ; hit ++ ; } } out . println ( hit ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; String str = sc . next ( ) ; if ( a % 2 == 1 ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } String m = str . substring ( a / 2 ) ; if ( str . substring ( 0 , a / 2 ) . equals ( m ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String str = sc . next ( ) ; if ( str . equals ( " - " ) ) break ; int m = sc . nextInt ( ) ; int [ ] array = new int [ m ] ; String result = str ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int shuffleNum = sc.nextInt(); \n result = result.substring(shuffleNum) + result.substring(0, shuffleNum); " ) ; int shuffleNum = sc . nextInt ( ) ; result = result . substring ( shuffleNum ) + result . substring ( 0 , shuffleNum ) ; } System . out . println ( result ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int prev = ( H [ 0 ] > 1 ) ? H [ 0 ] - 1 : H [ 0 ] ; for ( int i = 1 ; i < N - 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 ) { System . out . println ( " [LOG] Block: target -= 1; " ) ; target -= 1 ; } } prev = target ; } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = stdIn . nextInt ( ) ; } int counter = 1 ; long zahyou = 0 ; for ( int i = 0 ; i < n ; i ++ ) { zahyou += l [ i ] ; if ( x < zahyou ) { break ; } else { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } System . out . println ( counter ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max_first = 0 ; int max_second = 0 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; ++ 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 ) { System . out . println ( " [LOG] Block: if (ii != max_first) \n System.out.println(max_first); \n else if (ii != 0) \n System.out.println(max_second); " ) ; if ( ii != max_first ) System . out . println ( max_first ) ; else if ( ii != 0 ) System . out . println ( max_second ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = 0 ; for ( int i = 0 ; i < ( b - a + 1 ) ; i ++ ) { System . out . println ( " [LOG] Block: String[] s = String.valueOf(a + i).split( \" \" ); \n String t = s[4] + s[3] + s[2] + s[1] + s[0]; \n if (String.valueOf(a + i).equals(t)) \n n++; " ) ; String [ ] s = String . valueOf ( a + i ) . split ( " " ) ; String t = s [ 4 ] + s [ 3 ] + s [ 2 ] + s [ 1 ] + s [ 0 ] ; if ( String . valueOf ( a + i ) . equals ( t ) ) n ++ ; } System . out . println ( n ) ; } } +import java . util . Scanner ; class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int lower ; int bigger ; if ( a > b ) { lower = b ; bigger = a ; } else { lower = a ; bigger = b ; } int tmp = bigger % lower ; while ( lower != 0 ) { System . out . println ( " [LOG] Block: tmp = bigger % lower; \n bigger = lower; \n lower = tmp; " ) ; tmp = bigger % lower ; bigger = lower ; lower = tmp ; } System . out . println ( bigger ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int num = Integer . parseInt ( str ) ; if ( ( num % 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 ++ ) { System . out . println ( " [LOG] Block: result += Integer.parseInt(str.charAt(ct) + \" \" ); " ) ; result += Integer . parseInt ( str . charAt ( ct ) + " " ) ; } return result ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] input = new int [ 10 ] ; boolean [ ] checked = new boolean [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { input [ i ] = Integer . parseInt ( br . readLine ( ) ) ; checked [ i ] = false ; } for ( int i = 0 ; i < 3 ; i ++ ) { int maxIndex = - 1 ; int max = - 1 ; for ( int j = 0 ; j < 10 ; j ++ ) { if ( input [ j ] > max && checked [ j ] == false ) { System . out . println ( " [LOG] Block: max = input[j]; \n maxIndex = j; " ) ; max = input [ j ] ; maxIndex = j ; } } checked [ maxIndex ] = true ; System . out . println ( input [ maxIndex ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int n = scanner.nextInt(); \n String s = scanner.next(); \n System.out.println((n - s.replaceAll( \" ABC \" , \" \" ).length()) / 3); " ) ; Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; String s = scanner . next ( ) ; System . out . println ( ( n - s . replaceAll ( " ABC " , " " ) . length ( ) ) / 3 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int te = - 1 ; for ( int i = 0 ; i < 10000 ; i ++ ) { if ( ( int ) ( i * 0.08 ) == a && ( int ) ( i * 0.1 ) == b ) { System . out . println ( " [LOG] Block: te = i; \n break; " ) ; te = i ; break ; } } System . out . print ( te ) ; } } +import java . io . * ; public class Main { 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 sec = Integer . parseInt ( sec_ ) ; m . SecToTime ( sec ) ; } public void SecToTime ( int sec ) { int h = 0 , m = 0 ; while ( sec >= 3600 ) { h ++ ; sec -= 3600 ; } while ( sec >= 60 ) { System . out . println ( " [LOG] Block: m++; \n sec -= 60; " ) ; m ++ ; sec -= 60 ; } System . out . println ( h + " : " + m + " : " + sec ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; try { while ( ( s = br . readLine ( ) ) != null ) { System . out . println ( " [LOG] Block: String[] str = s.split( \" \" ); \n int n = Integer.parseInt(str[0]) + Integer.parseInt(str[1]); \n System.out.println(Integer.toString(n).length()); " ) ; String [ ] str = s . split ( " " ) ; int n = Integer . parseInt ( str [ 0 ] ) + Integer . parseInt ( str [ 1 ] ) ; System . out . println ( Integer . toString ( n ) . length ( ) ) ; } br . close ( ) ; } catch ( Exception e ) { } } } +import java . util . Scanner ; class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String S = scan . next ( ) ; String T = scan . next ( ) ; int i = 0 ; int j = 0 ; int count = 0 ; while ( i < S . length ( ) && j < T . length ( ) ) { if ( S . charAt ( i ) != T . charAt ( j ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } i ++ ; j ++ ; } System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: final Scanner sc = new Scanner(System.in); \n final int N = Integer.parseInt(sc.next()); \n final int A = Integer.parseInt(sc.next()); \n final int B = Integer.parseInt(sc.next()); \n sc.close(); \n System.out.println(Math.min(N * A, B)); " ) ; final Scanner sc = new Scanner ( System . in ) ; final int N = 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 ( N * A , B ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n int a = Integer.parseInt(s.next()); \n int b = Integer.parseInt(s.next()); \n System.out.printf( \" %d %d %.5f \" , a / b, a % b, (double) a / (double) b); " ) ; Scanner s = new Scanner ( System . in ) ; int a = Integer . parseInt ( s . next ( ) ) ; int b = Integer . parseInt ( s . next ( ) ) ; System . out . printf ( " %d %d %.5f " , a / b , a % b , ( double ) a / ( double ) b ) ; } } +import java . util . Scanner ; public class Main { public static int Num ; 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 ) ; Num = scan . nextInt ( ) ; List = new int [ Num ] ; for ( int i = 0 ; i < Num ; i ++ ) { List [ i ] = scan . nextInt ( ) ; } SelectionSort ( ) ; if ( Num == 1 ) System . out . println ( List [ 0 ] ) ; else { for ( int i = 0 ; i < Num ; i ++ ) { if ( i == Num - 1 ) System . out . println ( List [ Num - 1 ] ) ; else System . out . print ( List [ i ] + " " ) ; } } System . out . println ( Count ) ; } public static void SelectionSort ( ) { for ( int i = 0 ; i < Num ; i ++ ) { min_j = i ; for ( int j = i ; j < Num ; j ++ ) { if ( List [ j ] < List [ min_j ] ) { min_j = j ; } } if ( min_j != i ) { System . out . println ( " [LOG] Block: tmp = List[i]; \n List[i] = List[min_j]; \n List[min_j] = tmp; \n Count++; " ) ; tmp = List [ i ] ; List [ i ] = List [ min_j ] ; List [ min_j ] = tmp ; Count ++ ; } } } } +import java . io . InputStream ; import java . io . PrintStream ; import java . math . BigDecimal ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; long W = sc . nextInt ( ) ; long H = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; sc . close ( ) ; String a = BigDecimal . valueOf ( ( ( double ) W * H ) / 2.0 ) . toPlainString ( ) ; out . print ( a ) ; out . print ( " " ) ; if ( W == x * 2 && H == y * 2 ) { out . println ( " 1 " ) ; } else { out . println ( " 0 " ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main()._main(args); " ) ; new Main ( ) . _main ( args ) ; } } +import java . io . * ; public class Main { 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 i = numbers . length - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: System.out.print(numbers[i]); " ) ; System . out . print ( numbers [ i ] ) ; } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int sum = l * n ; int [ ] aji = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { sum += i ; aji [ i ] = l + i ; } int min = Integer . MAX_VALUE / 2 ; int aji2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int apple_pie = sum - aji [ i ] ; int sa = Math . abs ( sum - apple_pie ) ; if ( min > sa ) { System . out . println ( " [LOG] Block: aji2 = apple_pie; \n min = sa; " ) ; aji2 = apple_pie ; min = sa ; } } sc . close ( ) ; System . out . println ( aji2 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String str = br.readLine(); \n String[] depth_width = str.split( \" \" , 0); \n int depth = Integer.parseInt(depth_width[0]); \n int width = Integer.parseInt(depth_width[1]); \n ; \n int perimeter = depth * 2 + width * 2; \n int area = depth * width; \n System.out.println(area + \" \" + perimeter); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] depth_width = str . split ( " " , 0 ) ; int depth = Integer . parseInt ( depth_width [ 0 ] ) ; int width = Integer . parseInt ( depth_width [ 1 ] ) ; ; int perimeter = depth * 2 + width * 2 ; int area = depth * width ; System . out . println ( area + " " + perimeter ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) - 1 ; } int x = 0 ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { c ++ ; x = a [ x ] ; if ( x == 1 ) { System . out . println ( " [LOG] Block: System.out.println(c); \n return; " ) ; System . out . println ( c ) ; return ; } } System . out . println ( " -1 " ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long x = 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 ] >= x ) break ; for ( int k = 0 ; k <= j ; k ++ ) { if ( i % ary [ k ] == 0 ) { flag = false ; break ; } } if ( flag ) { System . out . println ( " [LOG] Block: j++; \n ary[j] = i; " ) ; j ++ ; ary [ j ] = i ; } } System . out . println ( ary [ j ] ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] n = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; int sum = 0 ; for ( int i = 0 ; i < a - 1 ; i ++ ) { sum += n [ i ] ; } if ( n [ a - 1 ] < sum ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n System.out.println(((n + 1) / 2)); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( ( ( n + 1 ) / 2 ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; int buttonA = Integer . parseInt ( line [ 0 ] ) ; int buttonB = Integer . parseInt ( line [ 1 ] ) ; int ans = 0 ; if ( buttonA > buttonB ) { ans += buttonA ; buttonA -- ; } else { ans += buttonB ; buttonB -- ; } if ( buttonA > buttonB ) { ans += buttonA ; } else { System . out . println ( " [LOG] Block: ans += buttonB; " ) ; ans += buttonB ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n ; double t , a ; n = scan . nextInt ( ) ; t = scan . nextDouble ( ) ; a = scan . nextDouble ( ) ; double [ ] h = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = scan . nextDouble ( ) ; } double min = 99999999.0 ; double x ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x = t - h [ i ] * 0.006 ; if ( Math . abs ( x - a ) < min ) { System . out . println ( " [LOG] Block: min = Math.abs(x - a); \n ans = i + 1; " ) ; min = Math . abs ( x - a ) ; ans = i + 1 ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: int x = sc.nextInt(); \n max = Math.max(max, x); \n sum += x; " ) ; int x = sc . nextInt ( ) ; max = Math . max ( max , x ) ; sum += x ; } System . out . println ( sum - max ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . valueOf ( br . readLine ( ) ) ; String [ ] z = br . readLine ( ) . split ( " " ) ; String nums1 = z [ 0 ] ; String nums2 = z [ 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(nums1.charAt(i)); \n System.out.print(nums2.charAt(i)); " ) ; System . out . print ( nums1 . charAt ( i ) ) ; System . out . print ( nums2 . charAt ( i ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int ans ; if ( K <= A ) { ans = K ; } else if ( K <= A + B ) { ans = A ; } else { System . out . println ( " [LOG] Block: ans = A - (K - (A + B)); " ) ; ans = A - ( K - ( A + B ) ) ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int cnt = 1 ; for ( int i = 0 ; i < N ; i ++ ) { int sc = scanner . nextInt ( ) ; if ( sc == cnt ) { System . out . println ( " [LOG] Block: list.add(cnt++); " ) ; list . add ( cnt ++ ) ; } } int rst = N - list . size ( ) ; System . out . println ( rst == N ? - 1 : rst ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String N = sc . next ( ) ; sc . close ( ) ; String [ ] arr = N . split ( " " ) ; int n = Integer . valueOf ( N ) ; int sn = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { sn += Integer . valueOf ( arr [ i ] ) ; } if ( n % sn == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String passS = scan . nextLine ( ) ; String passT = scan . nextLine ( ) ; int moji = passS . length ( ) ; String passTa = passT . substring ( 0 , moji ) ; if ( passS . equals ( passTa ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } boolean ok = true ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" DENIED \" ); " ) ; System . out . println ( " DENIED " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } long [ ] L = new long [ N ] ; for ( int i = 1 ; i < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: S = S + L[i]; " ) ; S = S + L [ i ] ; } System . out . println ( S ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n - 1 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } a [ 0 ] = b [ 0 ] ; int score = a [ 0 ] ; for ( int i = 1 ; i < n - 1 ; i ++ ) { a [ i ] = Math . min ( b [ i - 1 ] , b [ i ] ) ; score += a [ i ] ; } if ( n != 1 ) { System . out . println ( " [LOG] Block: a[n - 1] = b[n - 2]; \n score += a[n - 1]; " ) ; a [ n - 1 ] = b [ n - 2 ] ; score += a [ n - 1 ] ; } System . out . println ( score ) ; } } +import java . util . * ; public class Main { private static final Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int a = scn.nextInt(), b = scn.nextInt(), c = scn.nextInt(); \n System.out.println(a < b && b < c ? \" Yes \" : \" No \" ); " ) ; int a = scn . nextInt ( ) , b = scn . nextInt ( ) , c = scn . nextInt ( ) ; System . out . println ( a < b && b < c ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner In = new Scanner ( System . in ) ; int n ; do { n = In . nextInt ( ) ; } while ( n <= 2 && n >= 200000 ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; 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 <= n - 1 ; j ++ ) { System . out . println ( " [LOG] Block: maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv); \n minv = minv < a[j] ? minv : a[j]; " ) ; maxv = maxv > ( a [ j ] - minv ) ? maxv : ( a [ j ] - minv ) ; minv = minv < a [ j ] ? minv : a [ j ] ; } System . out . println ( maxv ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int counter = 0 ; for ( int i = a ; i <= b ; i ++ ) { if ( c % i == 0 ) { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } System . out . println ( counter ) ; scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A, B, T; \n A = sc.nextInt(); \n B = sc.nextInt(); \n T = sc.nextInt(); \n int result = (T / A) * B; \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; int A , B , T ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; T = sc . nextInt ( ) ; int result = ( T / A ) * B ; System . out . println ( result ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { 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 i = 0 ; i < aa . length ; i ++ ) { a [ i ] = Long . parseLong ( aa [ i ] ) ; } 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 { System . out . println ( " [LOG] Block: return a; " ) ; return a ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n String str = in.nextLine(); \n char[] array = str.toCharArray(); \n array[3] = '8'; \n System.out.println(array); " ) ; Scanner in = new Scanner ( System . in ) ; String str = in . nextLine ( ) ; char [ ] array = str . toCharArray ( ) ; array [ 3 ] = '8' ; System . out . println ( array ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int H = sc.nextInt(); \n int N = sc.nextInt(); \n int a = 0; \n for (int i = 0; i < N; i++) a += sc.nextInt(); \n if (a >= H) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int a = 0 ; for ( int i = 0 ; i < N ; i ++ ) a += sc . nextInt ( ) ; if ( a >= H ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . nextLine ( ) . toLowerCase ( ) ; int count = 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 ( ) ) ) { System . out . println ( " [LOG] Block: count += 1; " ) ; count += 1 ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numbers = sc . nextInt ( ) ; int point = sc . nextInt ( ) ; int min = point - numbers + 1 ; int max = point + numbers - 1 ; for ( int i = min ; i <= max ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(i + \" \" ); " ) ; System . out . print ( i + " " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; long N = sc . nextLong ( ) ; long D = sc . nextLong ( ) ; long ans = 0 ; for ( long i = 0 ; i < N ; 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 FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } double min = Double . MAX_VALUE ; int minPotision = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( Math . abs ( T - H [ i ] * 0.006 - A ) < min ) { System . out . println ( " [LOG] Block: min = Math.abs(T - H[i] * 0.006 - A); \n minPotision = i; " ) ; min = Math . abs ( T - H [ i ] * 0.006 - A ) ; minPotision = i ; } } System . out . print ( minPotision + 1 ) ; } } +import java . util . * ; public class Main { private final static int MOD = 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 ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) != t.charAt(i)) \n res++; " ) ; if ( s . charAt ( i ) != t . charAt ( i ) ) res ++ ; } System . out . println ( res ) ; in . close ( ) ; } } +import java . util . * ; import java . io . * ; class Main { void solve ( ) { char [ ] a = incharar ( ) ; int cost = 0 ; for ( int i = 0 ; i < a . length / 2 ; i ++ ) { if ( a [ i ] != a [ a . length - i - 1 ] ) cost ++ ; } out . println ( cost ) ; } 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 ( ) { System . out . println ( " [LOG] Block: return in.next().toCharArray(); " ) ; return in . next ( ) . toCharArray ( ) ; } } +import java . util . * ; public class Main { static int c = 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 ; c = 0 ; } System . out . println ( sum_power ) ; } } static int doublet ( int n , int f ) { if ( n < f ) { System . out . println ( " [LOG] Block: c = c + 1; \n return doublet(2 * n, f); " ) ; c = c + 1 ; return doublet ( 2 * n , f ) ; } else return c ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char pre = s . charAt ( 0 ) ; String ans = " Good " ; for ( int i = 1 ; i < 4 ; i ++ ) { System . out . println ( " [LOG] Block: if (pre == s.charAt(i)) \n ans = \" Bad \" ; \n pre = s.charAt(i); " ) ; if ( pre == s . charAt ( i ) ) ans = " Bad " ; pre = s . charAt ( i ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double n = in . nextDouble ( ) ; double d = in . nextDouble ( ) ; int ans = 0 ; while ( n -- > 0 ) { System . out . println ( " [LOG] Block: double x = in.nextDouble(); \n double y = in.nextDouble(); \n if (Math.sqrt(x * x + y * y) <= d) \n ans++; " ) ; 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 . Scanner ; import java . util . Arrays ; import static java . lang . System . out ; class SortingThreeNumbers { public static int [ ] sorted ( int [ ] inputs ) { int [ ] res = Arrays . copyOf ( inputs , inputs . length ) ; for ( int i = 0 ; i < res . length ; i ++ ) { for ( int j = 1 ; j < res . length - i ; j ++ ) { if ( res [ j - 1 ] > res [ j ] ) { int tmp = res [ j - 1 ] ; res [ j - 1 ] = res [ j ] ; res [ j ] = tmp ; } } } return res ; } } public class Main { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] inputs = new int [ 3 ] ; int i = 0 ; while ( scan . hasNext ( ) ) { inputs [ i ] = scan . nextInt ( ) ; i ++ ; } StringBuilder output = new StringBuilder ( ) ; for ( int num : SortingThreeNumbers . sorted ( inputs ) ) { System . out . println ( " [LOG] Block: output.append(String.valueOf(num) + \" \" ); " ) ; output . append ( String . valueOf ( num ) + " " ) ; } output . deleteCharAt ( output . length ( ) - 1 ) ; out . println ( output ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int max = a + b ; if ( max < a - b ) { max = a - b ; } if ( max < a * b ) { System . out . println ( " [LOG] Block: max = a * b; " ) ; max = a * b ; } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long divc = b / c - ( a - 1 ) / c ; long divd = b / d - ( a - 1 ) / d ; long lcmcd = lcm ( c , d ) ; long divcd = b / lcmcd - ( a - 1 ) / lcmcd ; System . out . println ( ( b - a + 1 ) - divc - divd + divcd ) ; } private static long gcd ( long a , long b ) { while ( b > 0 ) { long temp = b ; b = a % b ; a = temp ; } return a ; } private static long lcm ( long a , long b ) { System . out . println ( " [LOG] Block: return a * (b / gcd(a, b)); " ) ; return a * ( b / gcd ( a , b ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int range = Integer . parseInt ( in . readLine ( ) ) ; if ( range < 0 || Math . pow ( 10 , 4 ) < range ) throw new RuntimeException ( " error:range " ) ; String [ ] nums = new String [ range ] ; nums = in . readLine ( ) . split ( " " ) ; int min = Integer . parseInt ( nums [ 0 ] ) , max = Integer . parseInt ( nums [ 0 ] ) ; long sum = 0 ; for ( int i = 0 ; i < range ; i += 1 ) { System . out . println ( " [LOG] Block: max = Math.max(max, Integer.parseInt(nums[i])); \n min = Math.min(min, Integer.parseInt(nums[i])); \n if (Integer.parseInt(nums[i]) < -Math.pow(10, 6) || Math.pow(10, 6) < Integer.parseInt(nums[i])) \n throw new RuntimeException( \" error:nums \" ); \n sum = sum + Integer.parseInt(nums[i]); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] pizza = new int [ 5 ] ; int ans = 1000000000 ; for ( int i = 0 ; i < 5 ; i ++ ) { pizza [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < 2 * ( pizza [ 3 ] + pizza [ 4 ] ) + 1 ; i ++ ) { System . out . println ( " [LOG] Block: int a = Math.max(0, (pizza[3] - i / 2)); \n int b = Math.max(0, (pizza[4] - i / 2)); \n int c = i; \n ans = Math.min(ans, pizza[0] * a + pizza[1] * b + pizza[2] * c); " ) ; int a = Math . max ( 0 , ( pizza [ 3 ] - i / 2 ) ) ; int b = Math . max ( 0 , ( pizza [ 4 ] - i / 2 ) ) ; int c = i ; ans = Math . min ( ans , pizza [ 0 ] * a + pizza [ 1 ] * b + pizza [ 2 ] * c ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; StringBuilder answer = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String a = String . valueOf ( s . charAt ( i ) ) ; if ( ( i + 1 ) == k ) { System . out . println ( " [LOG] Block: a = a.toLowerCase(); " ) ; a = a . toLowerCase ( ) ; } answer . append ( a ) ; } System . out . println ( answer ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int plus = a + b ; int minus = a - b ; int multiplied = a * b ; int result = 0 ; if ( plus > minus ) { if ( plus > multiplied ) { result = plus ; } else { System . out . println ( " [LOG] Block: result = multiplied; " ) ; result = multiplied ; } } else if ( minus > multiplied ) { result = minus ; } else { System . out . println ( " [LOG] Block: result = multiplied; " ) ; result = multiplied ; } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int res = 0 ; if ( ( A >= 10 ) || ( B >= 10 ) ) { res = - 1 ; } else { System . out . println ( " [LOG] Block: res = A * B; " ) ; res = A * B ; } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { static class Solution { Integer [ ] [ ] dp ; public void find ( int k ) { dp = new Integer [ k + 1 ] [ k + 1 ] ; long res = 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 ; } res += val2 ; } } } System . out . println ( res ) ; } 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 ) { System . out . println ( " [LOG] Block: Solution sol = new Solution(); \n Scanner sc = new Scanner(System.in); \n int k = sc.nextInt(); \n sol.find(k); " ) ; Solution sol = new Solution ( ) ; Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; sol . find ( k ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n && key < q ; ) { if ( s [ i ] < t [ key ] ) { i ++ ; } else if ( s [ i ] == t [ key ] ) { count ++ ; i ++ ; key ++ ; } else { System . out . println ( " [LOG] Block: key++; " ) ; key ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } +import java . util . LinkedHashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Set < Integer > lhs = new LinkedHashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: lhs.add(a[i]); " ) ; lhs . add ( a [ i ] ) ; } Object [ ] newa = lhs . toArray ( ) ; System . out . println ( newa . length ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String s = Integer . toString ( n ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '7' ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . io . * ; import java . util . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader scanner = new FastReader ( ) ; int N = scanner . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = scanner . nextInt ( ) ; } int [ ] DP = new int [ N ] ; DP [ 1 ] = Math . abs ( A [ 1 ] - A [ 0 ] ) ; for ( int i = 2 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: DP[i] = Math.min(DP[i - 1] + Math.abs(A[i] - A[i - 1]), DP[i - 2] + Math.abs(A[i] - A[i - 2])); " ) ; 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 [ N - 1 ] ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = reader . readLine ( ) ; int n = Integer . parseInt ( str ) ; long sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: if (i % 3 == 0 || i % 5 == 0) \n continue; \n sum += i; " ) ; if ( i % 3 == 0 || i % 5 == 0 ) continue ; sum += i ; } System . out . print ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n long num = in.nextLong(); \n long tk = 0; \n long pchso = num / 500; \n tk = pchso * 1000; \n int baki = (int) (num % 500); \n long pach = baki / 5; \n tk = tk + (pach * 5); \n System.out.println(tk); " ) ; Scanner in = new Scanner ( System . in ) ; long num = in . nextLong ( ) ; long tk = 0 ; long pchso = num / 500 ; tk = pchso * 1000 ; int baki = ( int ) ( num % 500 ) ; long pach = baki / 5 ; tk = tk + ( pach * 5 ) ; System . out . println ( tk ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 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 ) ) { System . out . println ( " [LOG] Block: ans = ans + 1; " ) ; ans = ans + 1 ; } wk = 0 ; } } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int x = 0 ; int y = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i % 2 == 0 ) { x += a [ i ] ; } else { System . out . println ( " [LOG] Block: y += a[i]; " ) ; y += a [ i ] ; } } System . out . println ( Math . abs ( x - y ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = 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 < a ; i ++ ) { System . out . println ( " [LOG] Block: String ans = sc.next(); \n map.put(ans, map.get(ans) + 1); " ) ; 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 . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; long [ ] a = new long [ n ] ; long sum = 1 ; long lastSum = 1 ; boolean over = false ; String [ ] str = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Long . parseLong ( str [ i ] ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } sum *= a [ i ] ; if ( lastSum > sum || sum > 1000000000000000000L ) { System . out . println ( " [LOG] Block: over = true; " ) ; over = true ; } lastSum = sum ; } System . out . println ( over ? - 1 : sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; boolean out = false ; H [ 0 ] -- ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( H [ i + 1 ] < H [ i ] ) { out = true ; } if ( H [ i + 1 ] - 1 >= H [ i ] ) { System . out . println ( " [LOG] Block: H[i + 1]--; " ) ; H [ i + 1 ] -- ; } } if ( out ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int X = sc.nextInt(); \n int T = sc.nextInt(); \n int A = 0; \n if (N % X > 0) \n A = 1; \n System.out.println((N / X + A) * T); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = 0 ; if ( N % X > 0 ) A = 1 ; System . out . println ( ( N / X + A ) * T ) ; sc . close ( ) ; } } +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 Main { 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 N = nextInt ( ) ; int [ ] K = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { K [ nextInt ( ) - 1 ] = i ; } for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: PrintWriter out = new PrintWriter(System.out); \n out.print(o); \n out.flush(); " ) ; PrintWriter out = new PrintWriter ( System . out ) ; out . print ( o ) ; out . flush ( ) ; } } +import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int sum = 0 ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: final int L = sc.nextInt(); \n max = Math.max(max, L); \n sum += L; " ) ; final int L = sc . nextInt ( ) ; max = Math . max ( max , L ) ; sum += L ; } System . out . println ( max * 2 < sum ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { static final String ascii = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int index = sc . nextInt ( ) ; String str = sc . next ( ) ; if ( index == 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 + index ; if ( ri >= ascii . length ( ) ) { System . out . println ( " [LOG] Block: ri = ri - ascii.length(); " ) ; ri = ri - ascii . length ( ) ; } replaced = replaced + String . valueOf ( ascii . charAt ( ri ) ) ; } System . out . println ( replaced ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] p = s . toCharArray ( ) ; int flag = 0 ; for ( int i = 0 ; i < a ; i ++ ) { if ( p [ i ] < '0' || p [ i ] > '9' ) { flag = 1 ; } } if ( p [ a ] != '-' ) { flag = 1 ; } for ( int i = a + 1 ; i <= a + b ; i ++ ) { if ( p [ i ] < '0' || p [ i ] > '9' ) { flag = 1 ; } } if ( flag == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int x = 0 ; int aa = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; aa += a [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { if ( ( ( double ) aa / ( 4 * m ) ) <= a [ i ] ) { x ++ ; } } if ( m <= x ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; while ( true ) { String word = input . nextLine ( ) ; if ( word . equals ( " - " ) ) break ; int wrapTime = input . nextInt ( ) ; for ( int i = 0 ; i < wrapTime ; i ++ ) { System . out . println ( " [LOG] Block: int index = input.nextInt(); \n String move = word.substring(0, index); \n String left = word.substring(index); \n word = left + move; " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int m = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int sum = m + f ; if ( m == - 1 && f == - 1 && r == - 1 ) break ; else if ( m == - 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 ) { System . out . println ( " [LOG] Block: if (r >= 50) \n System.out.println( \" C \" ); \n else \n System.out.println( \" D \" ); " ) ; if ( r >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int ans = 0 ; if ( n == 0 && x == 0 ) break ; for ( int i = 1 ; i < n + 1 ; i ++ ) { for ( int j = i + 1 ; j < n + 1 ; j ++ ) { for ( int k = j + 1 ; k < n + 1 ; k ++ ) { System . out . println ( " [LOG] Block: if (i + j + k == x) \n ans++; " ) ; if ( i + j + k == x ) ans ++ ; } } } System . out . println ( ans ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] nums = br.readLine().split( \" \" ); \n br.close(); \n int a = Integer.parseInt(nums[0]); \n int b = Integer.parseInt(nums[1]); \n if (a > 9 || b > 9) \n System.out.println(-1); \n else \n System.out.println(a * b); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] nums = br . readLine ( ) . split ( " " ) ; br . close ( ) ; int a = Integer . parseInt ( nums [ 0 ] ) ; int b = Integer . parseInt ( nums [ 1 ] ) ; if ( a > 9 || b > 9 ) System . out . println ( - 1 ) ; else System . out . println ( a * b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; int N = 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 ( N % S == 0 ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int A ; int B ; int C ; Main ( Scanner sc ) { this . sc = sc ; this . A = sc . nextInt ( ) ; this . B = sc . nextInt ( ) ; this . C = sc . nextInt ( ) ; } private String solve ( ) { String answer = " No " ; if ( A == B && B != C || A == C && B != C || B == C && C != A ) { answer = " Yes " ; } return answer ; } public void show ( String answer ) { System . out . println ( " [LOG] Block: System.out.println(answer); " ) ; System . out . println ( answer ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int number = sc.nextInt(); \n set.add(number); " ) ; int number = sc . nextInt ( ) ; set . add ( number ) ; } System . out . println ( set . size ( ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . next ( ) ) ; double [ ] S = new double [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { S [ i ] = Double . parseDouble ( scanner . next ( ) ) ; } Arrays . parallelSort ( S ) ; double m = ( S [ 0 ] + S [ 1 ] ) / 2 ; for ( int i = 2 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: m = (m + S[i]) / 2; " ) ; m = ( m + S [ i ] ) / 2 ; } System . out . print ( m ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Long [ ] in = new Long [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { in [ i ] = sc . nextLong ( ) ; } Arrays . sort ( in ) ; Long c = in [ 0 ] - in [ 0 ] ; for ( int i = 0 ; i < a - b ; i ++ ) { System . out . println ( " [LOG] Block: c += in[i]; " ) ; c += in [ i ] ; } System . out . println ( c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( int i = 1 ; ; i ++ ) { int x = sc . nextInt ( ) ; if ( x == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . printf ( " Case %d: %d \n " , i , x ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] scan = scanner . nextLine ( ) . split ( " " ) ; int k = scanner . nextInt ( ) ; scanner . close ( ) ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: int n = Integer.parseInt(scan[i]); \n sum += n; \n if (max < n) \n max = n; " ) ; int n = Integer . parseInt ( scan [ i ] ) ; sum += n ; if ( max < n ) max = n ; } sum -= max ; sum += max * Math . pow ( 2 , k ) ; System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int D = Integer . parseInt ( sc . next ( ) ) ; int [ ] [ ] arrayTwoDimension = new int [ N ] [ D ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < D ; j ++ ) { arrayTwoDimension [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( B == 1 ) { System . out . println ( 0 ) ; return ; } int count = 0 ; while ( ( A * count - ( count - 1 ) ) < B ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } System . out . println ( count ) ; } } +import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; int N = Integer . parseInt ( s ) ; boolean flg = false ; for ( int i = 0 ; i <= N ; i ++ ) { for ( int j = 0 ; j <= N ; j ++ ) { if ( N == 4 * i + 7 * j ) { System . out . println ( " [LOG] Block: flg = true; \n break; " ) ; flg = true ; break ; } } } System . out . println ( flg ? " Yes " : " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; ArrayList < Character > caca = new ArrayList < Character > ( ) ; String n = scn . next ( ) ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { if ( n . charAt ( i ) == '1' ) caca . add ( '1' ) ; else if ( n . charAt ( i ) == '0' ) caca . add ( '0' ) ; else if ( n . charAt ( i ) == 'B' ) { System . out . println ( " [LOG] Block: if (!caca.isEmpty()) \n caca.remove(caca.size() - 1); " ) ; if ( ! caca . isEmpty ( ) ) caca . remove ( caca . size ( ) - 1 ) ; } } for ( int i = 0 ; i < caca . size ( ) ; i ++ ) System . out . print ( caca . get ( i ) ) ; System . out . println ( ) ; scn . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; } long ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i - 1 ] > a [ i ] ) { System . out . println ( " [LOG] Block: ans += a[i - 1] - a[i]; \n a[i] = a[i - 1]; " ) ; ans += a [ i - 1 ] - a [ i ] ; a [ i ] = a [ i - 1 ] ; } } System . out . println ( ans ) ; } } +import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String result = \" Heisei \" ; \n if (s.compareTo( \" 2019/04/30 \" ) > 0) \n result = \" TBD \" ; \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String result = " Heisei " ; if ( s . compareTo ( " 2019/04/30 " ) > 0 ) result = " TBD " ; System . out . println ( result ) ; } } +import java . util . * ; import static java . lang . Math . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int x = sc.nextInt(); \n int ans = (int) pow(x, 3); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = ( int ) pow ( x , 3 ) ; System . out . println ( ans ) ; } } +import java . io . BufferedInputStream ; import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(new BufferedInputStream(System.in)); \n int d = scanner.nextInt(); \n int t = scanner.nextInt(); \n int s = scanner.nextInt(); \n double need = (double) d / s; \n System.out.println(need <= t ? \" Yes \" : \" No \" ); " ) ; Scanner scanner = new Scanner ( new BufferedInputStream ( System . in ) ) ; int d = scanner . nextInt ( ) ; int t = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; double need = ( double ) d / s ; System . out . println ( need <= t ? " Yes " : " No " ) ; } } +import java . util . * ; import java . util . stream . * ; class Main { 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 N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(R + \" x \" + (result.get(R) == null ? 0 : result.get(R))); " ) ; System . out . println ( R + " x " + ( result . get ( R ) == null ? 0 : result . get ( R ) ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Yes " ; int nowT = 0 ; int nowX = 0 ; int nowY = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } else if ( vGap % 2 != tGap % 2 ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k <= a ) { System . out . println ( k ) ; return ; } if ( k <= a + b ) { System . out . println ( " [LOG] Block: System.out.println(a); \n return; " ) ; System . out . println ( a ) ; return ; } System . out . println ( a - ( k - a - b ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = a - b ; if ( x <= c ) { System . out . println ( c - x ) ; } if ( x > c ) { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int S = scan.nextInt(); \n int h = S / 3600; \n int d = (S % 3600) / 60; \n int s = (S % 3600) % 60; \n System.out.println(h + \" : \" + d + \" : \" + s); \n scan.close(); " ) ; Scanner scan = new Scanner ( System . in ) ; int S = scan . nextInt ( ) ; int h = S / 3600 ; int d = ( S % 3600 ) / 60 ; int s = ( S % 3600 ) % 60 ; System . out . println ( h + " : " + d + " : " + s ) ; scan . 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 Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final List < Integer > list = new ArrayList < > ( ) ; int n = sc . nextInt ( ) ; int s1 = 0 ; int s2 = 0 ; int min = 10001 ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( j <= i ) { s1 += list . get ( j ) ; } else { s2 += list . get ( j ) ; } } if ( min >= Math . abs ( s1 - s2 ) ) { System . out . println ( " [LOG] Block: min = Math.abs(s1 - s2); " ) ; min = Math . abs ( s1 - s2 ) ; } s1 = 0 ; s2 = 0 ; } System . out . println ( min ) ; } } +import java . util . * ; public class Main { 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 number = 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 . println ( " [LOG] Block: System.out.print(str_cha.charAt((j + number) % 26)); " ) ; System . out . print ( str_cha . charAt ( ( j + number ) % 26 ) ) ; } } } System . out . print ( " \n " ) ; } } +import java . util . Scanner ; public class Main { 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 C = N / ( A + B ) ; long D = N % ( 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 ( " [LOG] Block: System.out.println(C * A + A); " ) ; System . out . println ( C * A + A ) ; } } } +import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static Scanner sc2 = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] c = new int [ N ] ; int [ ] t = new int [ N ] ; int min = 10000 ; for ( int i = 0 ; i < N ; i ++ ) { c [ i ] = sc . nextInt ( ) ; t [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( T >= t [ i ] ) { min = min > c [ i ] ? c [ i ] : min ; } } if ( min == 10000 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(min); " ) ; System . out . println ( min ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a >= 0 && a <= 100 ) { if ( b >= 0 && b <= 100 ) { if ( c >= 0 && c <= 100 ) { if ( a < b && b < c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; sc . close ( ) ; boolean sa = false ; boolean sine = false ; if ( n % 2 != 0 ) { System . out . println ( " No " ) ; sine = true ; } else { int [ ] a = new int [ n / 2 ] ; int [ ] b = new int [ n / 2 ] ; for ( int i = 0 ; i < n / 2 ; i ++ ) { a [ i ] = s . charAt ( i ) ; b [ i ] = s . charAt ( i + n / 2 ) ; if ( a [ i ] != b [ i ] ) { sa = true ; } } } if ( sa == true ) { System . out . println ( " No " ) ; } else if ( sine == false ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 1 ; int Answer = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( sc . nextInt ( ) == count ) { count ++ ; } else { Answer ++ ; } } if ( Answer == N ) { System . out . println ( " [LOG] Block: Answer = -1; " ) ; Answer = - 1 ; } System . out . println ( Answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int [ ] [ ] dp = new int [ 201 ] [ 201 ] ; long res = 0 ; for ( int i = 1 ; i <= K ; i ++ ) { for ( int j = 1 ; j <= K ; 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 <= K ; 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 { System . out . println ( " [LOG] Block: i %= j; " ) ; i %= j ; } } return Math . max ( i , j ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int min = 0 ; int count = 0 ; if ( A < B ) { min = A ; } else { min = B ; } for ( int i = min ; i >= 1 ; i -- ) { if ( A % i == 0 && B % i == 0 ) { count ++ ; if ( count == K ) { System . out . println ( " [LOG] Block: System.out.println(i); \n break; " ) ; System . out . println ( i ) ; break ; } } } scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; String s = sc . next ( ) ; int b = 0 ; for ( int i = 0 ; i < a - 2 ; i ++ ) { if ( s . substring ( i , i + 3 ) . equals ( " ABC " ) ) { System . out . println ( " [LOG] Block: b++; " ) ; b ++ ; } } System . out . println ( b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N == 1 ) { System . out . println ( 0 ) ; } else { int Ans = 0 ; int Temp = 0 ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( H [ i ] >= H [ i + 1 ] ) { Temp += 1 ; } if ( ( H [ i ] < H [ i + 1 ] ) | ( i == N - 2 ) ) { if ( Ans < Temp ) { System . out . println ( " [LOG] Block: Ans = Temp; " ) ; Ans = Temp ; } Temp = 0 ; } } System . out . println ( Ans ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long A = ( long ) ( Math . pow ( 10 , 18 ) ) ; long [ ] B = new long [ N ] ; boolean chk_0 = false ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(C); " ) ; System . out . println ( C ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int K, X; \n K = sc.nextInt(); \n X = sc.nextInt(); \n int count = X - K + 1; \n for (int i = 0; i < (2 * K) - 1; i++, count++) System.out.print(count + \" \" ); \n System.out.println(); " ) ; Scanner sc = new Scanner ( System . in ) ; int K , X ; K = sc . nextInt ( ) ; X = sc . nextInt ( ) ; int count = X - K + 1 ; for ( int i = 0 ; i < ( 2 * K ) - 1 ; i ++ , count ++ ) System . out . print ( count + " " ) ; System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextLong(); \n double b = sc.nextDouble(); \n int c = (int) Math.round(100 * b); \n System.out.println((long) (a * c) / 100); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; double b = sc . nextDouble ( ) ; int c = ( int ) Math . round ( 100 * b ) ; System . out . println ( ( long ) ( a * c ) / 100 ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; char before = '0' ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c != before ) { System . out . println ( " [LOG] Block: before = c; \n count++; " ) ; before = c ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { 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 count = 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 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } } System . out . println ( count ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] A = new int [ 2 ] [ N ] ; int [ ] sum = new int [ N ] ; int x = 0 , y = 0 , collect = 0 , max = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int j = 0 ; j < N ; j ++ ) { for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: if (i <= j) \n collect += A[0][i]; \n if (i >= j) \n collect += A[1][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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arrs = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { arrs [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: result += Math.max(arrs[i] - arrs[i - 1], 0); " ) ; result += Math . max ( arrs [ i ] - arrs [ i - 1 ] , 0 ) ; } System . out . println ( result ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { int button = 0 ; if ( A > B ) { sum += A ; A -= 1 ; } else { System . out . println ( " [LOG] Block: sum += B; \n B -= 1; " ) ; sum += B ; B -= 1 ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { 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 month = Integer . parseInt ( monthS ) ; int day = Integer . parseInt ( dayS ) ; if ( month <= 4 && day <= 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" TBD \" ); " ) ; System . out . println ( " TBD " ) ; } } } +import java . util . Scanner ; public class Main { 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 ( K <= A ) { A = A - K ; K = 0 ; } else { K = K - A ; A = 0 ; } if ( K <= B ) { B = B - K ; K = 0 ; } else { System . out . println ( " [LOG] Block: K = K - B; \n B = 0; " ) ; K = K - B ; B = 0 ; } System . out . println ( A + " " + B ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; for ( ; x > 1 ; x -- ) { for ( int i = 2 ; i < x ; i ++ ) { int n = i * i ; if ( n > x ) break ; while ( n <= x ) { if ( n == x ) { System . out . println ( " [LOG] Block: System.out.println(x); \n return; " ) ; System . out . println ( x ) ; return ; } n *= i ; } } } System . out . println ( x ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { char temp ; 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 ++ ) { temp = str . charAt ( i ) ; if ( '0' > temp || temp > '9' ) { System . out . println ( " No " ) ; return ; } } if ( str . charAt ( a ) != '-' ) { System . out . println ( " No " ) ; return ; } for ( int i = a + 1 ; i <= a + b ; i ++ ) { temp = str . charAt ( i ) ; if ( '0' > temp || temp > '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 ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . * ; public class Main { static int MOD = 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 ) { System . out . println ( " [LOG] Block: int d = gcd(a, b); \n return (long) a / d * b; " ) ; int d = gcd ( a , b ) ; return ( long ) a / d * b ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { String alphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ; Scanner sc = new Scanner ( System . in ) ; int N = 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 ) ) ) { System . out . println ( " [LOG] Block: ans += alphabet.substring((j + N) % alphabet.length(), ((j + N) % alphabet.length()) + 1); " ) ; ans += alphabet . substring ( ( j + N ) % alphabet . length ( ) , ( ( j + N ) % alphabet . length ( ) ) + 1 ) ; } } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int min = 124 ; int max = - 1 ; for ( int i = 0 ; i < 5 ; i ++ ) { System . out . println ( " [LOG] Block: int n = in.nextInt(); \n if (n < min) \n min = n; \n if (n > max) \n max = n; " ) ; int n = in . nextInt ( ) ; if ( n < min ) min = n ; if ( n > max ) max = n ; } int k = in . nextInt ( ) ; System . out . println ( ( max - min <= k ) ? " Yay! " : " :( " ) ; in . close ( ) ; } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 1 ; int D = 0 ; for ( int i = 0 ; i < N ; i ++ ) { D += sc . nextInt ( ) ; if ( D <= X ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count = 0 ; if ( a == b ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } if ( b == c ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } if ( c == a ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } System . out . println ( count == 1 ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] nyu = sc . nextLine ( ) . split ( " " ) ; int num = Integer . parseInt ( nyu [ 0 ] ) ; int numnext = Integer . parseInt ( nyu [ 1 ] ) ; int numend = Integer . parseInt ( nyu [ 2 ] ) ; int count = 0 ; if ( numend - ( num - numnext ) < 0 ) { count = 0 ; } else { System . out . println ( " [LOG] Block: count = numend - (num - numnext); " ) ; count = numend - ( num - numnext ) ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String moji = sc . nextLine ( ) ; char [ ] chmoji = new char [ moji . length ( ) ] ; for ( int i = 0 ; i < moji . length ( ) ; i ++ ) { chmoji [ i ] = moji . charAt ( i ) ; boolean kekka = Character . isUpperCase ( chmoji [ i ] ) ; if ( kekka == true ) { chmoji [ i ] = Character . toLowerCase ( chmoji [ i ] ) ; } else { System . out . println ( " [LOG] Block: chmoji[i] = Character.toUpperCase(chmoji[i]); " ) ; chmoji [ i ] = Character . toUpperCase ( chmoji [ i ] ) ; } System . out . print ( chmoji [ i ] ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { static Scanner scan ; static int count = 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 ( count ) ; } 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 ) { count ++ ; break ; } else if ( s [ p ] < t ) { hi = p + 1 ; continue ; } else { System . out . println ( " [LOG] Block: ti = p - 1; \n continue; " ) ; ti = p - 1 ; continue ; } } return ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; while ( sc . hasNext ( ) ) { list . add ( Integer . parseInt ( sc . next ( ) ) ) ; } int num = list . get ( 0 ) ; int sum = list . get ( 1 ) ; int i = 0 ; if ( sum == 1 ) { System . out . print ( 0 ) ; } else if ( num >= sum ) { System . out . print ( 1 ) ; } else { sum = sum - num ; i ++ ; num -- ; while ( true ) { sum = sum - num ; i ++ ; if ( sum < 1 ) { System . out . println ( " [LOG] Block: System.out.print(i); \n break; " ) ; System . out . print ( i ) ; break ; } } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String str = sc . next ( ) ; char [ ] c = str . toCharArray ( ) ; int count = 0 ; if ( N % 2 == 0 ) { for ( int i = 0 ; i < N / 2 ; i ++ ) { if ( c [ i ] == c [ N / 2 + i ] ) { count ++ ; } } if ( count == N / 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int health = 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 ++ ) { health -= attack . remove ( 0 ) ; if ( health <= 0 ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; int [ ] cnts = new int [ M ] ; for ( int i = 0 ; i < N ; 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 ] == N ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { 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 ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String str = scan.nextLine(); \n Main m = new Main(str); \n int start = m.searchA(); \n int end = m.searchZ(); \n System.out.println(end - start); " ) ; Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; Main m = new Main ( str ) ; int start = m . searchA ( ) ; int end = m . searchZ ( ) ; System . out . println ( end - start ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String t = sc . nextLine ( ) ; int min = 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 ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i + j) != t.charAt(j)) \n tot++; " ) ; if ( s . charAt ( i + j ) != t . charAt ( j ) ) tot ++ ; } min = Math . min ( min , tot ) ; } } System . out . println ( min ) ; } } +import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int n = s.nextInt(), x = s.nextInt(), t = s.nextInt(); \n int count = 0; \n count = n / x * t; \n if (n % x > 0) \n count += t; \n System.out.println(count); " ) ; int n = s . nextInt ( ) , x = s . nextInt ( ) , t = s . nextInt ( ) ; int count = 0 ; count = n / x * t ; if ( n % x > 0 ) count += t ; System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; int [ ] [ ] nums = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i ++ ) { System . out . println ( " [LOG] Block: nums[i / 3][i % 3] = sc.nextInt(); " ) ; nums [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; } System . out . println ( nums [ 1 ] [ 0 ] - nums [ 0 ] [ 0 ] == nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] && nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] == nums [ 1 ] [ 2 ] - nums [ 0 ] [ 2 ] && nums [ 2 ] [ 0 ] - nums [ 1 ] [ 0 ] == nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] && nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] == nums [ 2 ] [ 2 ] - nums [ 1 ] [ 2 ] ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 1 ; while ( true ) { if ( n == 1 || n == 2 || n == 4 ) { System . out . println ( " [LOG] Block: System.out.println(cnt + 3); \n return; " ) ; System . out . println ( cnt + 3 ) ; return ; } if ( n % 2 == 0 ) n /= 2 ; else n = n * 3 + 1 ; cnt ++ ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] variation = new int [ N ] ; int count = 0 ; int i , j , k = 0 ; int [ ] max = new int [ N ] ; for ( i = 0 ; i < N ; i ++ ) { variation [ i ] = sc . nextInt ( ) ; } for ( j = 0 ; j < N ; j ++ ) { X = X - variation [ j ] ; count ++ ; } for ( k = 0 ; k < N ; k ++ ) { max [ k ] = X / variation [ k ] ; } for ( j = 0 ; j < N ; j ++ ) { for ( k = j + 1 ; k < N ; k ++ ) { if ( max [ k ] > max [ j ] ) { System . out . println ( " [LOG] Block: int t = max[k]; \n max[k] = max[j]; \n max[j] = t; " ) ; int t = max [ k ] ; max [ k ] = max [ j ] ; max [ j ] = t ; } } } count = count + max [ 0 ] ; System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { private static final Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = scanner . nextInt ( ) ; boolean canReach = true ; int prevT = 0 ; int prevX = 0 ; int prevY = 0 ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: canReach = false; \n break; " ) ; canReach = false ; break ; } prevT = t ; prevX = hereX ; prevY = hereY ; } System . out . println ( canReach ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int R = scanner.nextInt(); \n System.out.println(2 * R * Math.PI); " ) ; Scanner scanner = new Scanner ( System . in ) ; int R = scanner . nextInt ( ) ; System . out . println ( 2 * R * Math . PI ) ; } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int N = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int [ ] ans = null ; for ( int m = 0 ; m <= N ; m ++ ) { for ( int g = 0 ; g <= N - m ; g ++ ) { int s = N - ( 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 ) { System . out . println ( " [LOG] Block: new Main()._main(args); " ) ; new Main ( ) . _main ( args ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; boolean is_odd = false ; while ( ! is_odd ) { for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] & 1 ) == 0 ) { a [ i ] >>= 1 ; } else { System . out . println ( " [LOG] Block: is_odd = true; \n break; " ) ; is_odd = true ; break ; } } if ( ! is_odd ) cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; if ( x == 0 ) { System . out . println ( " 1 " ) ; } else if ( x == 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" 0 \" ); " ) ; System . out . println ( " 0 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String S1 = S . substring ( 0 , 1 ) ; String S2 = S . substring ( 1 , 2 ) ; String S3 = S . substring ( 2 , 3 ) ; String S4 = S . substring ( 3 , 4 ) ; String kekka = " Good " ; if ( S1 . equals ( S2 ) || S2 . equals ( S3 ) || S3 . equals ( S4 ) ) { System . out . println ( " [LOG] Block: kekka = \" Bad \" ; " ) ; kekka = " Bad " ; } System . out . println ( kekka ) ; } } +import java . util . Scanner ; public class Main { private static int countPower ( int n ) { int count = 0 ; while ( n % 2 == 0 ) { ++ count ; n /= 2 ; } return count ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 100 ; for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n ans = Math.min(ans, countPower(a)); " ) ; int a = sc . nextInt ( ) ; ans = Math . min ( ans , countPower ( a ) ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double [ ] data = new double [ 1000 ] ; int v ; double temp ; double lenkin ; for ( int i = 0 ; i < N ; i ++ ) { v = sc . nextInt ( ) ; data [ i ] = v ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: lenkin = (lenkin + data[i]) / 2; " ) ; lenkin = ( lenkin + data [ i ] ) / 2 ; } System . out . println ( lenkin ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; int x = S . length ( ) ; String ans = " " ; for ( int i = 0 ; i < x ; i ++ ) { System . out . println ( " [LOG] Block: ans = ans.concat( \" x \" ); " ) ; ans = ans . concat ( " x " ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; int c = sc . nextInt ( ) , x = sc . nextInt ( ) ; sc . close ( ) ; int tmpa = a , 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 ) { System . out . println ( " [LOG] Block: if (j > tmpb) \n break; \n int tmp2 = (tmp - j) / 5; \n if (tmp2 <= a && tmp >= 0) \n ++ans; " ) ; if ( j > tmpb ) break ; int tmp2 = ( tmp - j ) / 5 ; if ( tmp2 <= a && tmp >= 0 ) ++ ans ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int min = x - k + 1 ; int max = x + k - 1 ; for ( int i = min ; i <= max ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(i + (i == max ? \" \" : \" \" )); " ) ; System . out . print ( i + ( i == max ? " " : " " ) ) ; } System . out . println ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String s = in . nextString ( ) ; out . println ( s . replaceAll ( " 1 " , " 2 " ) . replaceAll ( " 9 " , " 1 " ) . replaceAll ( " 2 " , " 9 " ) ) ; } } static class InputReader { private BufferedReader br ; private StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: throw new InputMismatchException(); " ) ; throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } } } +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 Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { System . out . println ( " [LOG] Block: ArrayList<Integer> input = new ArrayList<Integer>(); \n BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n for (int i = 0; i < 10; i++) input.add(Integer.parseInt(br.readLine())); \n Collections.sort(input, Collections.reverseOrder()); \n for (int i = 0; i < 3; i++) System.out.println(input.get(i)); " ) ; ArrayList < Integer > input = new ArrayList < Integer > ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < 10 ; i ++ ) input . add ( Integer . parseInt ( br . readLine ( ) ) ) ; Collections . sort ( input , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < 3 ; i ++ ) System . out . println ( input . get ( i ) ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 1 ; int count = 0 ; int x = 0 ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) { x = countHalf ( i ) ; if ( count < x ) { count = x ; ans = i ; } } } System . out . println ( ans ) ; sc . close ( ) ; } public static int countHalf ( int i ) { int count = 0 ; boolean a = true ; while ( a ) { if ( i % 2 == 0 ) { i /= 2 ; count ++ ; } else { System . out . println ( " [LOG] Block: a = false; " ) ; a = false ; } } return count ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int d = 0 ; int cnt = 1 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: d = d + l[i]; \n if (d <= x) \n cnt++; " ) ; d = d + l [ i ] ; if ( d <= x ) cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; import java . util . Arrays ; import java . util . List ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String input = sc.nextLine(); \n String[] array = input.split( \" \" ); \n List<String> list = Arrays.asList(array); \n System.out.println(list.indexOf( \" 0 \" ) + 1); " ) ; Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; String [ ] array = input . split ( " " ) ; List < String > list = Arrays . asList ( array ) ; System . out . println ( list . indexOf ( " 0 " ) + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] check = { 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; String ans = " No " ; if ( n >= 10 ) { for ( int i = 0 ; i < check . length ; i ++ ) { if ( n % check [ i ] == 0 && n / check [ i ] < 10 ) { ans = " Yes " ; break ; } } } else { System . out . println ( " [LOG] Block: ans = \" Yes \" ; " ) ; ans = " Yes " ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = Integer . parseInt ( a + " " + b ) ; int d = ( int ) Math . sqrt ( c ) ; if ( d * d == c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 n = s . length ( ) ; int m = t . length ( ) ; int gg = m ; for ( int i = 0 ; i <= n - m ; i ++ ) { int c = m ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i + j) == t.charAt(j)) \n c--; " ) ; if ( s . charAt ( i + j ) == t . charAt ( j ) ) c -- ; } gg = Math . min ( gg , c ) ; } System . out . println ( gg ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int leg = sc . nextInt ( ) ; for ( int i = 0 ; i < num + 1 ; i ++ ) { if ( ( i * 2 + ( num - i ) * 4 ) == leg ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n System.exit(0); " ) ; System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; int max = 1 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(maxstr.get(i)); " ) ; System . out . println ( maxstr . get ( i ) ) ; } } } +import java . io . * ; class Program { } class Main { public static void main ( String [ ] args ) throws IOException { Program obj = new Program ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] ip ; int N , M , C ; int [ ] A , B ; ip = in . readLine ( ) . split ( " " ) ; N = 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 ( -- N >= 0 ) { ip = in . readLine ( ) . split ( " " ) ; score = 0 ; for ( int i = 0 ; i < M ; i ++ ) { System . out . println ( " [LOG] Block: A[i] = Integer.parseInt(ip[i]); \n score += B[i] * A[i]; " ) ; A [ i ] = Integer . parseInt ( ip [ i ] ) ; score += B [ i ] * A [ i ] ; } if ( score + C > 0 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; if ( A <= C && B <= C ) { System . out . println ( " 0 " ) ; } else if ( A <= C && B <= D ) { System . out . println ( B - C ) ; } else if ( A <= C && B > D ) { System . out . println ( D - C ) ; } else if ( A > C && D <= A ) { System . out . println ( " 0 " ) ; } else if ( A > C && B >= D ) { System . out . println ( D - A ) ; } else { System . out . println ( " [LOG] Block: System.out.println(B - A); " ) ; System . out . println ( B - A ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < C + 1 ; i ++ ) { int Y = X - 50 * i ; if ( Y == 0 ) { System . out . println ( " [LOG] Block: cnt++; \n continue; " ) ; cnt ++ ; continue ; } for ( int j = 0 ; j < B + 1 ; j ++ ) { int Z = Y - 100 * j ; if ( Z == 0 ) { System . out . println ( " [LOG] Block: cnt++; \n continue; " ) ; cnt ++ ; continue ; } for ( int k = 0 ; k < A + 1 ; k ++ ) { int W = Z - 500 * k ; if ( W == 0 ) { System . out . println ( " [LOG] Block: cnt++; \n continue; " ) ; cnt ++ ; continue ; } } } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n int a = stdIn.nextInt(); \n int b = stdIn.nextInt(); \n int c = stdIn.nextInt(); \n int x = b + c; \n if (a < x) \n System.out.println(x - a); \n else \n System.out.println( \" 0 \" ); " ) ; Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int x = b + c ; if ( a < x ) System . out . println ( x - a ) ; else System . out . println ( " 0 " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] S = scan . nextLine ( ) . split ( " " ) ; int count = 0 ; for ( int i = 0 ; i < S . length / 2 ; i ++ ) { if ( ! ( S [ i ] . equals ( S [ S . length - 1 - i ] ) ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > divsA = new ArrayList < > ( ) ; List < Integer > divsB = new ArrayList < > ( ) ; for ( int i = 1 ; i <= a ; ++ i ) { if ( a % 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 ) ) { System . out . println ( " [LOG] Block: divs.add(divsA.get(i)); " ) ; divs . add ( divsA . get ( i ) ) ; } } } System . out . println ( divs . get ( divs . size ( ) - k ) ) ; } } +import java . util . Scanner ; public class Main { static final long MOD = 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 ++ ) { System . out . println ( " [LOG] Block: dp[i] = broken[i] ? 0 : (dp[i - 2] + dp[i - 1]) % MOD; " ) ; dp [ i ] = broken [ i ] ? 0 : ( dp [ i - 2 ] + dp [ i - 1 ] ) % MOD ; } System . out . println ( dp [ n ] ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] h = new int [ N ] ; int max = 0 ; int idx = 0 ; for ( int i = 0 ; i < N ; i ++ ) { h [ i ] = sc . nextInt ( ) ; if ( h [ i ] > max ) { max = h [ i ] ; idx = i ; } } int max2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i != idx ) { if ( h [ i ] > max2 ) { max2 = h [ i ] ; } } } for ( int i = 0 ; i < N ; i ++ ) { if ( i != idx ) { System . out . println ( max ) ; } else { System . out . println ( " [LOG] Block: System.out.println(max2); " ) ; System . out . println ( max2 ) ; } } } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; if ( a == 2 ) { System . out . println ( a ) ; return ; } ArrayList < Integer > list = getPrime ( a ) ; while ( true ) { if ( check ( a , list ) ) { System . out . println ( a ) ; return ; } a ++ ; } } 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; char c ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { c = s . charAt ( i ) ; if ( c >= 'A' && c <= 'Z' ) { c += 'a' - 'A' ; } else if ( c >= 'a' && c <= 'z' ) { System . out . println ( " [LOG] Block: c += 'A' - 'a'; " ) ; c += 'A' - 'a' ; } System . out . print ( c ) ; } System . out . println ( " " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] [ ] BigHouse = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { BigHouse [ i ] [ j ] [ k ] = 0 ; } } } int order = sc . nextInt ( ) ; for ( int i = 0 ; i < order ; i ++ ) { 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 i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 10 ; k ++ ) { System . out . print ( " " + BigHouse [ i ] [ j ] [ k ] ) ; } System . out . println ( ) ; } if ( i != 3 ) { System . out . println ( " [LOG] Block: System.out.println( \" #################### \" ); " ) ; System . out . println ( " #################### " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n >= 100 && n < 112 ) { System . out . println ( 111 ) ; } else if ( n >= 112 && n <= 222 ) { System . out . println ( 222 ) ; } else if ( n > 222 && n <= 333 ) { System . out . println ( 333 ) ; } else if ( n > 333 && n <= 444 ) { System . out . println ( 444 ) ; } else if ( n > 444 && n <= 555 ) { System . out . println ( 555 ) ; } else if ( n > 555 && n <= 666 ) { System . out . println ( 666 ) ; } else if ( n > 666 && n <= 777 ) { System . out . println ( 777 ) ; } else if ( n > 777 && n <= 888 ) { System . out . println ( 888 ) ; } else if ( n > 888 && n <= 999 ) { System . out . println ( " [LOG] Block: System.out.println(999); " ) ; System . out . println ( 999 ) ; } } } +import java . util . * ; import java . io . * ; class Main { void solve ( ) { int a = in . nextInt ( ) ; if ( a % 2 == 0 ) System . out . println ( 0.5 ) ; else { double b = a / 2 + 1 ; double c = a ; 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 ) { System . out . println ( " [LOG] Block: new Main().solve(); \n out.flush(); " ) ; new Main ( ) . solve ( ) ; out . flush ( ) ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; final int MOD = 1000000007 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; int 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 ] ) % MOD ; } if ( i + 2 < n ) { dp [ i + 2 ] = ( dp [ i + 2 ] + dp [ i ] ) % MOD ; } } } System . out . println ( dp [ n - 1 ] ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().doIt(); " ) ; new Main ( ) . doIt ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i <= K ; i ++ ) { for ( int j = 0 ; j <= K ; j ++ ) { System . out . println ( " [LOG] Block: if (S - i - j >= 0 && S - i - j <= K) \n count++; " ) ; if ( S - i - j >= 0 && S - i - j <= K ) count ++ ; } } System . out . println ( count ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = getInputInteger ( sc ) ; int b = getInputInteger ( sc ) ; if ( a % 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 ) { System . out . println ( " [LOG] Block: str += \" \" ; " ) ; str += " " ; } str += s ; isInit = false ; } System . out . println ( str ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int Ri = sc . nextInt ( ) ; int Rj = 1 ; int minv = Ri ; int maxv = Integer . MIN_VALUE ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: Rj = sc.nextInt(); \n maxv = Math.max(Rj - minv, maxv); \n minv = Math.min(minv, Rj); " ) ; Rj = sc . nextInt ( ) ; maxv = Math . max ( Rj - minv , maxv ) ; minv = Math . min ( minv , Rj ) ; } System . out . println ( maxv ) ; } } +import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) ; } HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; map . put ( s [ 0 ] , 1 ) ; int ans = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( ! map . containsKey ( s [ i ] ) ) { System . out . println ( " [LOG] Block: ans++; \n map.put(s[i], 1); " ) ; ans ++ ; map . put ( s [ i ] , 1 ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int o = 0 ; int [ ] a = new int [ n ] ; PriorityQueue < Integer > num = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { int b = sc . nextInt ( ) ; o += b ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { int c = sc . nextInt ( ) ; if ( num . peek ( ) != null && i == num . peek ( ) ) { System . out . println ( " [LOG] Block: o += c; \n num.poll(); " ) ; o += c ; num . poll ( ) ; } } System . out . println ( o ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; long sum = 0 ; for ( int i = 0 ; i < a ; i ++ ) { if ( ( i + 1 ) % 3 != 0 ) { if ( ( i + 1 ) % 5 != 0 ) { System . out . println ( " [LOG] Block: sum = sum + (i + 1); " ) ; sum = sum + ( i + 1 ) ; } } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; if ( a * b >= a + b && a * b >= a - b ) { System . out . println ( a * b ) ; } else if ( a + b >= a - b && a + b >= a * b ) { System . out . println ( a + b ) ; } else { System . out . println ( " [LOG] Block: System.out.println(a - b); " ) ; System . out . println ( a - b ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int [ ] a = new int [ n ] ; int hantei = 1 ; int cntContinuous = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; if ( hantei == a [ i ] ) { System . out . println ( " [LOG] Block: cntContinuous++; \n hantei++; " ) ; cntContinuous ++ ; hantei ++ ; } } System . out . println ( cntContinuous == 0 ? - 1 : n - cntContinuous ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long N = scanner . nextLong ( ) ; String S = scanner . next ( ) ; scanner . close ( ) ; long ans = 1 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (S.charAt(i) != S.charAt(i + 1)) \n ans++; " ) ; if ( S . charAt ( i ) != S . charAt ( i + 1 ) ) ans ++ ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String s = ( new Scanner ( System . in ) ) . next ( ) ; char [ ] acgt = { 'A' , 'C' , 'G' , 'T' } ; int ans = 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 ) { System . out . println ( " [LOG] Block: ans = Math.max(ans, tmp1); \n tmp1 = 0; " ) ; ans = Math . max ( ans , tmp1 ) ; tmp1 = 0 ; } } ans = Math . max ( ans , tmp1 ) ; System . out . println ( ans ) ; } } +import java . io . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sc . nextLine ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { int min = Integer . MAX_VALUE ; for ( int j = 1 ; j <= K ; j ++ ) { if ( i - j >= 0 ) { System . out . println ( " [LOG] Block: min = (int) Math.min(min, Math.abs(list.get(i) - list.get(i - j)) + dyn.get(i - j)); " ) ; 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 ( n - 1 ) ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] gg ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int counter = 0 ; int i = 0 ; while ( i < n - 2 ) { if ( s . charAt ( i ) == 'A' && s . charAt ( i + 1 ) == 'B' && s . charAt ( i + 2 ) == 'C' ) { counter ++ ; i ++ ; } else { System . out . println ( " [LOG] Block: i++; " ) ; i ++ ; } } System . out . println ( counter ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = 0 ; int T = N * A ; if ( T < B ) { ans = T ; } else { System . out . println ( " [LOG] Block: ans = B; " ) ; ans = B ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { static Scanner scan ; public static boolean judgePN ( int a ) { if ( a == 1 ) return false ; int quotient = a ; for ( int i = 2 ; i < a ; i ++ ) { quotient = a / i ; if ( a % i == 0 ) return false ; if ( i > quotient ) 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 ++ ) { System . out . println ( " [LOG] Block: if (judgePN(list[i])) \n count++; " ) ; if ( judgePN ( list [ i ] ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { static String str ; static int N , zeroC , oneC ; static int [ ] A ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; str = sc . next ( ) ; N = str . length ( ) ; A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = Character . getNumericValue ( str . charAt ( i ) ) ; if ( A [ i ] == 0 ) { zeroC ++ ; } else { System . out . println ( " [LOG] Block: oneC++; " ) ; oneC ++ ; } } System . out . println ( N - ( Math . abs ( zeroC - oneC ) ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] [ ] A = new int [ 2 ] [ N ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = in . nextInt ( ) ; } } int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j <= i ; j ++ ) { sum += A [ 0 ] [ j ] ; } for ( int j = i ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: sum += A[1][j]; " ) ; sum += A [ 1 ] [ j ] ; } ans = Math . max ( ans , sum ) ; } System . out . println ( ans ) ; in . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int inputValue = Integer . parseInt ( br . readLine ( ) ) ; String [ ] inputData = br . readLine ( ) . split ( " " ) ; Integer [ ] number = new Integer [ inputValue ] ; for ( int i = 0 ; i < inputData . length ; i ++ ) { number [ i ] = Integer . parseInt ( inputData [ i ] ) ; } for ( int i = number . length - 1 ; i >= 1 ; i -- ) { System . out . println ( " [LOG] Block: sb.append(number[i] + \" \" ); " ) ; sb . append ( number [ i ] + " " ) ; } sb . append ( number [ 0 ] ) ; System . out . println ( sb ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int [ ] count = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) count [ s . charAt ( i ) - 97 ] ++ ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( count [ i ] % 2 == 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int out = 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 ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(j + i) != t.charAt(j)) \n diff++; " ) ; if ( s . charAt ( j + i ) != t . charAt ( j ) ) diff ++ ; } out = Math . min ( out , diff ) ; } System . out . println ( out ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] an = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i ++ ) { an [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " :( " ; sc . close ( ) ; if ( an [ 4 ] - an [ 0 ] <= k ) { System . out . println ( " [LOG] Block: ans = \" Yay! \" ; " ) ; ans = " Yay! " ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int res10000 = - 1 , res5000 = - 1 , res1000 = - 1 ; sc . close ( ) ; for ( int a = 0 ; a <= N ; a ++ ) { for ( int b = 0 ; b + a <= N ; b ++ ) { int c = N - a - b ; int total = 10000 * a + 5000 * b + 1000 * c ; if ( total == y ) { System . out . println ( " [LOG] Block: res10000 = a; \n res5000 = b; \n res1000 = c; " ) ; res10000 = a ; res5000 = b ; res1000 = c ; } } } System . out . println ( res10000 + " " + res5000 + " " + res1000 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . charAt ( 0 ) == 'A' ) { int cnt = 0 ; int index = 0 ; for ( int j = 2 ; j < s . length ( ) - 1 ; j ++ ) { if ( s . charAt ( j ) == 'C' ) { cnt ++ ; index = j ; } } if ( cnt == 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 ( " [LOG] Block: System.out.println( \" AC \" ); \n return; " ) ; System . out . println ( " AC " ) ; return ; } } } System . out . println ( " WA " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) , K = sc . nextLong ( ) ; double ch = Math . log ( N ) / Math . log ( K ) ; int ans = ( int ) Math . ceil ( ch ) ; if ( ans == ch ) { System . out . println ( ans + 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( true ) { if ( array [ i ] % 2 == 0 ) { array [ i ] /= 2 ; ans ++ ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; int C = 1 ; int D = 0 ; while ( B > C ) { System . out . println ( " [LOG] Block: C += A - 1; \n D++; " ) ; C += A - 1 ; D ++ ; } System . out . println ( D ) ; } } +import java . util . Scanner ; public class Main { public static void debug ( String str ) { boolean debug = false ; if ( debug == 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 ) ) { System . out . println ( " [LOG] Block: N = sc.nextInt(); \n A = sc.nextInt(); \n B = sc.nextInt(); " ) ; 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 Main { void run ( ) { Scanner s = new Scanner ( System . in ) ; while ( true ) { int n = s . nextInt ( ) ; int x = s . nextInt ( ) ; if ( n == 0 && x == 0 ) break ; int sum = 0 ; int count = 0 ; int a = 0 ; int [ ] num = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) num [ i ] = i + 1 ; for ( int i = a ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { sum = num [ i ] + num [ j ] + num [ k ] ; if ( sum == x ) { count ++ ; } a ++ ; } } } System . out . println ( count ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i ++ ) arr [ i ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) arr [ i ] [ j ] = scan . nextInt ( ) ; } int [ ] diff = new int [ 9 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) diff [ i * 3 + j ] = arr [ i ] [ j ] - arr [ i ] [ ( j + 1 ) % 3 ] ; } for ( int i = 0 ; i < 3 ; i ++ ) { if ( diff [ i ] != diff [ i + 3 ] || diff [ i + 3 ] != diff [ i + 6 ] ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AAirplane solver = new AAirplane ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AAirplane { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int p = in . nextInt ( ) ; int q = in . nextInt ( ) ; int r = in . nextInt ( ) ; out . println ( Math . min ( Math . min ( p + q , p + r ) , q + r ) ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] [ ] matrix = new int [ r ] [ c ] ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } int rc_sum = 0 ; for ( int i = 0 ; i < r ; 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 . println ( " [LOG] Block: System.out.print(matrix[r - 1][j] + \" \" ); " ) ; System . out . print ( matrix [ r - 1 ] [ j ] + " " ) ; } System . out . println ( rc_sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n long a = stdIn.nextInt(); \n long b = stdIn.nextInt(); \n long c = stdIn.nextInt(); \n long d = stdIn.nextInt(); \n System.out.println(Math.max(a * c, Math.max(a * d, Math.max(b * c, b * d)))); " ) ; Scanner stdIn = new Scanner ( System . in ) ; long a = stdIn . nextInt ( ) ; long b = stdIn . nextInt ( ) ; long c = stdIn . nextInt ( ) ; long d = stdIn . nextInt ( ) ; System . out . println ( Math . max ( a * c , Math . max ( a * d , Math . max ( b * c , b * d ) ) ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] seqS = new int [ n ] ; String [ ] line = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: mid = (left + right) / 2; \n if (tar[mid] == ref) \n return true; \n else if (tar[mid] > ref) \n right = mid; \n else \n left = mid + 1; " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( 0 <= A && A <= 5 ) { B = 0 ; System . out . print ( B ) ; } else if ( 6 <= A && A <= 12 ) { B = B / 2 ; System . out . print ( B ) ; } else if ( 13 <= A && A <= 100 ) { System . out . println ( " [LOG] Block: System.out.print(B); " ) ; System . out . print ( B ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long Y = sc . nextLong ( ) ; sc . close ( ) ; int A = 0 ; int B = 0 ; int C = 0 ; for ( int i = 0 ; i <= N ; i ++ ) { A = i * 10000 ; for ( int j = 0 ; j <= N ; j ++ ) { B = j * 5000 ; C = ( N - i - j ) * 1000 ; if ( A + B + C == Y && C >= 0 ) { System . out . println ( " [LOG] Block: System.out.println(i + \" \" + j + \" \" + (N - i - j)); \n return; " ) ; System . out . println ( i + " " + j + " " + ( N - i - j ) ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String ans = " APPROVED " ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: int A = sc.nextInt(); \n if (A % 2 == 0 && A % 3 != 0 && A % 5 != 0) \n ans = \" DENIED \" ; " ) ; int A = sc . nextInt ( ) ; if ( A % 2 == 0 && A % 3 != 0 && A % 5 != 0 ) ans = " DENIED " ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int count = 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 ( " [LOG] Block: System.out.println(count); \n break me; " ) ; System . out . println ( count ) ; break me ; } } count ++ ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; char [ ] chars = str . toCharArray ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if ('a' <= chars[i] && chars[i] <= 'z') \n chars[i] = Character.toUpperCase(chars[i]); \n else if ('A' <= chars[i] && chars[i] <= 'Z') \n chars[i] = Character.toLowerCase(chars[i]); " ) ; if ( 'a' <= chars [ i ] && chars [ i ] <= 'z' ) chars [ i ] = Character . toUpperCase ( chars [ i ] ) ; else if ( 'A' <= chars [ i ] && chars [ i ] <= 'Z' ) chars [ i ] = Character . toLowerCase ( chars [ i ] ) ; } String str2 = String . valueOf ( chars ) ; System . out . println ( str2 ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int diff = 1 ; char prev = s . charAt ( 0 ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) != prev ) { System . out . println ( " [LOG] Block: diff++; " ) ; diff ++ ; } prev = s . charAt ( i ) ; } System . out . println ( diff ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int L = sc.nextInt(); \n int sum = L * N + (N * (N - 1)) / 2; \n if (L > 0) \n sum -= L; \n else if (L + N - 1 < 0) \n sum -= L + N - 1; \n System.out.println(sum); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; int sum = L * N + ( N * ( N - 1 ) ) / 2 ; if ( L > 0 ) sum -= L ; else if ( L + N - 1 < 0 ) sum -= L + N - 1 ; System . out . println ( sum ) ; sc . close ( ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder stb = new StringBuilder ( ) ; int a = Integer . parseInt ( buf . readLine ( ) ) ; int [ ] h = new int [ a ] ; String [ ] str = buf . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < h . length ; i ++ ) { h [ i ] = Integer . parseInt ( str [ i ] ) ; } Sert ( h , a ) ; } public static void Sert ( int [ ] h , int a ) { 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 ++ ) { System . out . println ( " [LOG] Block: sbu.append(h[i]); \n if (i < h.length - 1) \n sbu.append( \" \" ); " ) ; sbu . append ( h [ i ] ) ; if ( i < h . length - 1 ) sbu . append ( " " ) ; } System . out . println ( sbu ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] sum1 = new int [ n + 1 ] ; int [ ] sum2 = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { sum1 [ i ] = sum1 [ i - 1 ] + sc . nextInt ( ) ; } for ( int i = 1 ; i <= n ; i ++ ) { sum2 [ i ] = sum2 [ i - 1 ] + sc . nextInt ( ) ; } int max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: max = Math.max(max, sum1[i] + sum2[n] - sum2[i - 1]); " ) ; max = Math . max ( max , sum1 [ i ] + sum2 [ n ] - sum2 [ i - 1 ] ) ; } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int N6 = N / 100000 % 10 ; int N5 = N / 10000 % 10 ; int N4 = N / 1000 % 10 ; int N3 = N / 100 % 10 ; int N2 = N / 10 % 10 ; int result = 0 ; if ( N6 == 1 ) { result = 90909 ; } else if ( N5 != 0 ) { result = ( N - 9999 ) + 909 ; } else if ( N4 != 0 ) { result = 909 ; } else if ( N3 != 0 ) { result = ( N - 99 ) + 9 ; } else if ( N2 != 0 ) { result = 9 ; } else { System . out . println ( " [LOG] Block: result = N; " ) ; result = N ; } System . out . println ( result ) ; } } +import java . time . temporal . TemporalUnit ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String day = sc . next ( ) ; if ( day . equals ( " MON " ) ) { System . out . println ( 6 ) ; } else if ( day . equals ( " TUE " ) ) { System . out . println ( 5 ) ; } else if ( day . equals ( " WED " ) ) { System . out . println ( 4 ) ; } else if ( day . equals ( " THU " ) ) { System . out . println ( 3 ) ; } else if ( day . equals ( " FRI " ) ) { System . out . println ( 2 ) ; } else if ( day . equals ( " SAT " ) ) { System . out . println ( 1 ) ; } else if ( day . equals ( " SUN " ) ) { System . out . println ( " [LOG] Block: System.out.println(7); " ) ; System . out . println ( 7 ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int 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 ; } a = a - d ; if ( a <= 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n flg = false; " ) ; System . out . println ( " No " ) ; flg = false ; } } } } +import java . io . * ; import java . util . * ; public class Main { static PrintWriter out = new PrintWriter ( ( System . out ) ) ; public static void main ( String [ ] args ) throws IOException { Kioken sc = new Kioken ( ) ; char ch = sc . next ( ) . charAt ( 0 ) ; if ( Character . isUpperCase ( ch ) ) { out . println ( " A " ) ; } else { out . println ( " a " ) ; } out . close ( ) ; } public static void kamehameha ( ) { } static class Kioken { 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } st = new StringTokenizer ( next ) ; return true ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { ALDS1_1_A ( ) ; } public static void ALDS1_1_A ( ) { 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 ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( j == n - 1 ) { System . out . print ( a [ j ] ) ; } else { System . out . println ( " [LOG] Block: System.out.print(a[j] + \" \" ); " ) ; 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 < n ; j ++ ) { if ( j == n - 1 ) { System . out . print ( a [ j ] ) ; } else { System . out . println ( " [LOG] Block: System.out.print(a[j] + \" \" ); " ) ; System . out . print ( a [ j ] + " " ) ; } } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] [ ] nm = new int [ n ] [ m ] ; int [ ] [ ] ml = new int [ m ] [ l ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 . println ( " [LOG] Block: System.out.print(ans); " ) ; System . out . print ( ans ) ; } } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; int ans = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { System . out . println ( " [LOG] Block: x[i] = sc.nextInt(); \n if (x[i] != i + 1) \n ans = i + 1; " ) ; x [ i ] = sc . nextInt ( ) ; if ( x [ i ] != i + 1 ) ans = i + 1 ; } 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 Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = Integer . parseInt ( in . next ( ) ) ; int preT = 0 ; int preX = 0 ; int preY = 0 ; for ( int i = 0 ; i < N ; 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 ) ) { System . out . println ( " [LOG] Block: out.println( \" No \" ); \n return; " ) ; out . println ( " No " ) ; return ; } preT = postT ; preX = postX ; preY = postY ; } out . println ( " Yes " ) ; } } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; static void p ( String ans ) { System . out . println ( ans ) ; } static void p ( int ans ) { System . out . println ( ans ) ; } static void p ( long ans ) { System . out . println ( ans ) ; } static void p ( double ans ) { System . out . println ( ans ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: String aa = sc.next(); \n char a = (char) (aa.charAt(0) + 1); \n String vv = a + \" \" ; \n p(vv); " ) ; String aa = sc . next ( ) ; char a = ( char ) ( aa . charAt ( 0 ) + 1 ) ; String vv = a + " " ; p ( vv ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = 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 < N ; i ++ ) { if ( result . get ( result . size ( ) - 1 ) == original [ i ] ) { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } else result . add ( original [ i ] ) ; } System . out . println ( result . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; if ( ( double ) D / T <= S ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Scanner ; public class Main { void reverse ( ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextInt ( ) ; } for ( int i = n - 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 ) { System . out . println ( " [LOG] Block: Main m = new Main(); \n m.reverse(); " ) ; Main m = new Main ( ) ; m . reverse ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { 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 h = Integer . parseInt ( num [ 0 ] ) ; int w = Integer . parseInt ( num [ 1 ] ) ; if ( h == 0 && w == 0 ) { break ; } for ( int i = 0 ; i < h ; i ++ ) { if ( i == 0 || i == h - 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 ) { System . out . println ( " [LOG] Block: return (element.split( \" \" )); " ) ; return ( element . split ( " " ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int [ ] [ ] root = new int [ N ] [ N ] ; 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 < N ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < N ; j ++ ) { System . out . println ( " [LOG] Block: sum += root[i][j]; " ) ; sum += root [ i ] [ j ] ; } System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int ones = N % 10 ; String ans ; if ( ones == 3 ) { ans = " bon " ; } else if ( ones == 0 || ones == 1 || ones == 6 || ones == 8 ) { ans = " pon " ; } else { System . out . println ( " [LOG] Block: ans = \" hon \" ; " ) ; ans = " hon " ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } private void solve ( ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; double nearOndo = 0 ; int nearIndex = 26 ; for ( int index = 0 ; index < N ; index ++ ) { int temp = scanner . nextInt ( ) ; double ondo = T - ( temp * 0.006 ) ; if ( index == 0 ) { System . out . println ( " [LOG] Block: nearOndo = ondo; \n nearIndex = index; " ) ; nearOndo = ondo ; nearIndex = index ; } else if ( Math . abs ( ondo - A ) < Math . abs ( nearOndo - A ) ) { System . out . println ( " [LOG] Block: nearOndo = ondo; \n nearIndex = index; " ) ; nearOndo = ondo ; nearIndex = index ; } } System . out . println ( nearIndex + 1 ) ; } } +import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { System . out . println ( " [LOG] Block: int a = scanner.nextInt(); \n int b = scanner.nextInt(); \n System.out.println(scanner.next().matches(String.format( \" \\ d { %d } - \\ d { %d } \" , a, b)) ? \" Yes \" : \" No \" ); " ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; System . out . println ( scanner . next ( ) . matches ( String . format ( " \\ d { %d } - \\ d { %d } " , a , b ) ) ? " Yes " : " No " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; char [ ] S ; int count = 0 ; S = input . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( S [ i ] == S [ i + 1 ] ) { System . out . println ( " Bad " ) ; count ++ ; break ; } } if ( count == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" Good \" ); " ) ; System . out . println ( " Good " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( k <= a ) { a = a - k ; k = 0 ; } else { k = k - a ; a = 0 ; } if ( k <= b ) { b = b - k ; k = 0 ; } else { System . out . println ( " [LOG] Block: k = k - b; \n b = 0; " ) ; k = k - b ; b = 0 ; } System . out . println ( a + " " + b ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int n = scanner . nextInt ( ) ; final int k = scanner . nextInt ( ) ; double result = 0 ; for ( int i = 1 ; i <= n ; 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 ) { System . out . println ( " [LOG] Block: ceil = 0; " ) ; ceil = 0 ; } final double pow = Math . pow ( 0.5 , ceil ) ; result += pow ; } System . out . println ( result / n ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] data = new int [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { data [ i ] = scan . nextInt ( ) ; } int afterData , beforeIndex ; for ( int i = 1 ; i < 10 ; i ++ ) { afterData = data [ i ] ; beforeIndex = i - 1 ; while ( beforeIndex >= 0 && data [ beforeIndex ] > afterData ) { System . out . println ( " [LOG] Block: data[beforeIndex + 1] = data[beforeIndex]; \n beforeIndex--; " ) ; 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 . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: sum += sc.nextInt(); " ) ; sum += sc . nextInt ( ) ; } System . out . print ( h <= sum ? " Yes " : " No " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( l ) ; int x = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { x += l [ i ] ; } if ( l [ n - 1 ] < x ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; ArrayList < Integer > result = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { result . add ( 0 ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { int tmp = scan . nextInt ( ) ; result . set ( tmp - 1 , result . get ( tmp - 1 ) + 1 ) ; } for ( Integer r : result ) { System . out . println ( " [LOG] Block: System.out.println(r); " ) ; System . out . println ( r ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int ans = s . length ( ) ; for ( int i = 0 ; i < 2 ; i ++ ) { int cnt = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { System . out . println ( " [LOG] Block: if (j % 2 == 0 && s.charAt(j) != (char) (i + '0')) \n cnt++; \n if (j % 2 == 1 && s.charAt(j) == (char) (i + '0')) \n cnt++; " ) ; if ( j % 2 == 0 && s . charAt ( j ) != ( char ) ( i + '0' ) ) cnt ++ ; if ( j % 2 == 1 && s . charAt ( j ) == ( char ) ( i + '0' ) ) cnt ++ ; } ans = Math . min ( ans , cnt ) ; } System . out . println ( ans ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int wk = 0 ; int ans = 0 ; ans = N / 2 ; wk = N % 2 ; if ( wk == 1 ) { System . out . println ( " [LOG] Block: ans = ans + 1; " ) ; ans = ans + 1 ; } System . out . println ( ans ) ; } } +import java . util . HashMap ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( ( long ) a * b / gcd ( a , b ) ) ; } public static int gcd ( int a , int b ) { if ( a % b == 0 ) { System . out . println ( " [LOG] Block: return b; " ) ; return b ; } return gcd ( b , a % b ) ; } } +import java . util . * ; public class Main { 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 count = 0 ; int maxCount = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( acgt . contains ( sArray [ i ] ) ) { count ++ ; if ( count > maxCount ) { maxCount = count ; } } else { System . out . println ( " [LOG] Block: count = 0; " ) ; count = 0 ; } } System . out . println ( maxCount ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int A , B , T ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; T = sc . nextInt ( ) ; int sum = 0 ; for ( int time = 1 ; time <= T ; time ++ ) { if ( time % A == 0 ) { System . out . println ( " [LOG] Block: sum += B; " ) ; sum += B ; } } System . out . println ( sum ) ; } catch ( Exception e ) { } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int i = 0 ; i < input . length ( ) ; ++ i ) { if ( input . charAt ( i ) != 'B' ) { output . append ( input . charAt ( i ) ) ; } else { int len = output . length ( ) ; if ( len > 0 ) { System . out . println ( " [LOG] Block: output.deleteCharAt(len - 1); " ) ; output . deleteCharAt ( len - 1 ) ; } } } sc . close ( ) ; System . out . println ( output ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { char [ ] ch = " abcdefghijklmnopqrstuvwxyz " . toCharArray ( ) ; Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) ; StringBuilder sb = new StringBuilder ( ) ; int t ; for ( ; n > 0 ; n = ( n - 1 ) / 26 ) { System . out . println ( " [LOG] Block: t = (int) ((n - 1) % 26); \n sb.append(ch[t]); " ) ; t = ( int ) ( ( n - 1 ) % 26 ) ; sb . append ( ch [ t ] ) ; } System . out . println ( sb . reverse ( ) . toString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] W = new int [ N ] ; int [ ] sub = new int [ N ] ; int ans ; for ( int i = 0 ; i < N ; i ++ ) { W [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { int S1 = 0 , S2 = 0 ; for ( int k = i ; k >= 0 ; k -- ) { S1 = S1 + W [ k ] ; } for ( int k = i + 1 ; k < N ; k ++ ) { S2 = S2 + W [ k ] ; } sub [ i ] = Math . abs ( S1 - S2 ) ; } ans = sub [ 0 ] ; for ( int n : sub ) { if ( ans > n ) { System . out . println ( " [LOG] Block: ans = n; " ) ; ans = n ; } } System . out . println ( ans ) ; scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; while ( x > 0 && x % 2 == 0 ) { System . out . println ( " [LOG] Block: count++; \n x /= 2; " ) ; count ++ ; x /= 2 ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String l1 = scan.nextLine(); \n scan.close(); \n int L = Integer.valueOf(l1); \n double side = L / 3.0; \n System.out.println(String.format( \" %.12f \" , side * side * side)); " ) ; Scanner scan = new Scanner ( System . in ) ; String l1 = scan . nextLine ( ) ; scan . close ( ) ; int L = Integer . valueOf ( l1 ) ; double side = L / 3.0 ; System . out . println ( String . format ( " %.12f " , side * side * side ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int n1 = n + 1 ; long [ ] m = new long [ n1 ] ; long [ ] h = new long [ n ] ; for ( int i = 0 ; i < n1 ; i ++ ) { m [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } long result = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: m[i] -= xh; \n result += xh; " ) ; m [ i ] -= xh ; result += xh ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] 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 minj = i ; for ( int j = i ; j < N ; 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 < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(A[i] + \" \" ); " ) ; System . out . print ( A [ i ] + " " ) ; } System . out . println ( A [ N - 1 ] ) ; System . out . print ( count ) ; System . out . printf ( " \n " ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long size = 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 ( size < total ) { if ( size >= blue ) { ans = blue ; } else if ( size < blue ) { ans = size ; } } else if ( size >= total ) { div = size / total ; mod = size % total ; if ( mod > blue ) { System . out . println ( " [LOG] Block: mod = blue; " ) ; mod = blue ; } ans = ( div * blue ) + mod ; } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; } } class Solver { int N ; int cnt ; public void init ( ) { N = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " " ) ; N = 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 < N ; } public void readBody ( String str ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } public void solve ( ) { } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int syaink = sc.nextInt(); \n int syainj = sc.nextInt(); \n System.out.println(syaink * syainj); " ) ; Scanner sc = new Scanner ( System . in ) ; int syaink = sc . nextInt ( ) ; int syainj = sc . nextInt ( ) ; System . out . println ( syaink * syainj ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N % 2 == 1 ) { System . out . println ( ( double ) ( ( N - 1 ) / 2 + 1 ) / N ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0.5); " ) ; System . out . println ( 0.5 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 100 ] ; int count = 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { static int keta ( int s ) { int sum = 0 ; while ( s > 0 ) { sum += ( s % 10 ) ; s /= 10 ; } return sum ; } 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 sum = 0 ; for ( int i = 1 ; i < N + 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (keta[i] >= A && keta[i] <= B) \n sum += i; " ) ; if ( keta [ i ] >= A && keta [ i ] <= B ) sum += i ; } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > dan = new ArrayList < > ( ) ; int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = sc . nextInt ( ) ; if ( ! dan . contains ( d [ i ] ) ) { System . out . println ( " [LOG] Block: dan.add(d[i]); " ) ; dan . add ( d [ i ] ) ; } } System . out . println ( dan . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n char[] s = sc.next().toCharArray(); \n if (s[2] == s[3] && s[4] == s[5]) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; 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 . 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 Main { 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 s = Integer . parseInt ( in . readLine ( ) ) ; int lim = 1000000 , i = 2 , a = s ; HashSet < Integer > set = new HashSet ( ) ; set . add ( s ) ; 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 ) { System . out . println ( " [LOG] Block: ex.printStackTrace(); " ) ; ex . printStackTrace ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int [ ] leftSum = new int [ n ] ; leftSum [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) leftSum [ i ] = leftSum [ i - 1 ] + arr [ i ] ; int [ ] rightSum = new int [ n ] ; rightSum [ n - 1 ] = arr [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: rightSum[i] += rightSum[i + 1] + arr[i]; " ) ; rightSum [ i ] += rightSum [ i + 1 ] + arr [ i ] ; } int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n - 1 ; i ++ ) min = Math . min ( min , Math . abs ( leftSum [ i ] - rightSum [ i + 1 ] ) ) ; System . out . println ( min ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String sStr = stdReader . readLine ( ) ; String [ ] inputStr = sStr . split ( " " ) ; int w = 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 ( w >= x + r && h >= y + r && ( x > 0 && y > 0 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } stdReader . close ( ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.exit(-1); " ) ; System . exit ( - 1 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] N = sc . next ( ) . toCharArray ( ) ; int res = 0 ; for ( int i = 0 ; i < N . length ; i ++ ) { res = ( res + Character . getNumericValue ( N [ i ] ) ) % 9 ; } if ( res % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int ans = a % 1000 ; if ( ans != 0 ) { System . out . println ( " [LOG] Block: ans = 1000 - ans; " ) ; ans = 1000 - ans ; } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] numbers = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( numbers [ 0 ] ) ; int x = Integer . parseInt ( numbers [ 1 ] ) ; String [ ] length = br . readLine ( ) . split ( " " ) ; int [ ] len = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { len [ i ] = Integer . parseInt ( length [ i ] ) ; } int [ ] bounces = new int [ n + 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int tax8pricemin = ( int ) ( ( ( double ) a ) / 0.08 ) ; int tax8pricemax = ( int ) ( ( ( double ) a + 1 ) / 0.08 ) ; for ( int i = tax8pricemin ; i < tax8pricemax ; i ++ ) { int tax8 = ( int ) ( i * 0.08 ) ; int tax10 = ( int ) ( i * 0.1 ) ; if ( tax8 == a && tax10 == b ) { System . out . println ( " [LOG] Block: System.out.println(i); \n System.exit(0); " ) ; System . out . println ( i ) ; System . exit ( 0 ) ; } } System . out . println ( - 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { String inputNameA ; String inputNameB ; int numberOfA ; 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 ( " " ) ; numberOfA = Integer . parseInt ( editInputNum [ 0 ] ) ; numberOfB = Integer . parseInt ( editInputNum [ 1 ] ) ; if ( inputNameA . equals ( choiceName ) ) { numberOfA -- ; } else if ( inputNameB . equals ( choiceName ) ) { System . out . println ( " [LOG] Block: numberOfB--; " ) ; numberOfB -- ; } System . out . println ( numberOfA + " " + numberOfB ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; int [ ] [ ] vectorA = new int [ n ] [ m ] ; int [ ] [ ] vectorB = new int [ m ] [ l ] ; long [ ] [ ] vectorC = new long [ n ] [ l ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { long ans = 0 ; for ( int k = 0 ; k < m ; k ++ ) { System . out . println ( " [LOG] Block: ans += (long) vectorA[i][k] * (long) vectorB[k][j]; " ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String readStr ; int c = 0 ; while ( ( readStr = reader . readLine ( ) ) != null ) { System . out . println ( " [LOG] Block: int[] list = new int[3]; \n list[0] = Integer.parseInt(readStr.split( \" \" )[0]); \n list[1] = Integer.parseInt(readStr.split( \" \" )[1]); \n String sssss = String.format( \" %.6f \" , (1.0 * list[0] / list[1])); \n System.out.println((int) (list[0] / list[1]) + \" \" + (list[0] % list[1]) + \" \" + sssss); \n break; " ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String info = br . readLine ( ) ; String [ ] split = info . split ( " " ) ; int H = Integer . parseInt ( split [ 0 ] ) ; int N = Integer . parseInt ( split [ 1 ] ) ; info = br . readLine ( ) ; String [ ] A = info . split ( " " ) ; for ( int i = 0 ; i < N ; i ++ ) { H = H - Integer . parseInt ( A [ i ] ) ; } if ( H <= 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = new Main ( ) . gcd ( Math . max ( a , b ) , Math . min ( a , b ) ) ; System . out . println ( ans ) ; } public int gcd ( int b , int l ) { System . out . println ( " [LOG] Block: if (l == 0) \n return b; \n if (l == 1) \n return l; \n return gcd(l, b % l); " ) ; if ( l == 0 ) return b ; if ( l == 1 ) return l ; return gcd ( l , b % l ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; if ( n < 105 ) { System . out . println ( 0 ) ; } else if ( n < 135 ) { System . out . println ( 1 ) ; } else if ( n < 165 ) { System . out . println ( 2 ) ; } else if ( n < 189 ) { System . out . println ( 3 ) ; } else if ( n < 195 ) { System . out . println ( 4 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(5); " ) ; System . out . println ( 5 ) ; } } } +import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < num - 1 ; i ++ ) { int input = sc . nextInt ( ) ; if ( input >= max ) { System . out . println ( " [LOG] Block: count++; \n max = input; " ) ; count ++ ; max = input ; } } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int n = gi ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = gi ( ) ; } Arrays . parallelSort ( A ) ; System . out . println ( A [ A . length - 1 ] - A [ 0 ] ) ; } public static int s ( int n ) { String S = String . valueOf ( n ) ; 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 n ) { String a = String . valueOf ( n ) ; return ( long ) a . length ( ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(scanner.next()); " ) ; return Double . parseDouble ( scanner . next ( ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; public class Main { 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 a = Integer . parseInt ( arrStr [ 0 ] ) ; long b = Integer . parseInt ( arrStr [ 1 ] ) ; long d = a / b ; long r = a % b ; double f = ( double ) a / b ; DecimalFormat df = new DecimalFormat ( " 0.00000000 " ) ; System . out . println ( d + " " + r + " " + df . format ( f ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = 0 ; int [ ] d = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < a ; i ++ ) { if ( d [ i ] >= b ) { System . out . println ( " [LOG] Block: c++; " ) ; c ++ ; } } System . out . println ( c ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = s . length ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; 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' ) ) { System . out . println ( " [LOG] Block: cnt = 0; \n break; " ) ; cnt = 0 ; break ; } cnt ++ ; } ans = Math . max ( ans , cnt ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < String > s = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: String a = sc.next(); \n s.add(a); " ) ; String a = sc . next ( ) ; s . add ( a ) ; } int out = s . size ( ) ; System . out . println ( out ) ; } } +import java . util . Scanner ; public class Main { 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 result = true ; int len = s . length ( ) ; for ( int i = 0 ; i <= len / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( len - 1 - i ) ) { System . out . println ( " [LOG] Block: result = false; \n break; " ) ; result = false ; break ; } } return result ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; int c = 0 ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a < b && b < c && a < c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int count = 0 ; boolean flg = true ; while ( flg ) { for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 0 ) { a [ i ] /= 2 ; if ( i == n - 1 ) count ++ ; } else { System . out . println ( " [LOG] Block: flg = false; \n break; " ) ; flg = false ; break ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; String [ ] Sarr = new String [ S . length ( ) ] ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { Sarr [ i ] = S . substring ( i ) + S . substring ( 0 , i ) ; } boolean result = false ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( Sarr [ i ] . equals ( T ) ) { System . out . println ( " [LOG] Block: result = true; \n break; " ) ; result = true ; break ; } } System . out . println ( result ? " Yes " : " No " ) ; } } +import java . util . * ; import java . math . * ; import java . io . * ; public class Main { 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 Pair { public long first ; public long second ; public Pair ( ) { this ( 0 , 0 ) ; } public Pair ( final long first , final long second ) { System . out . println ( " [LOG] Block: this.first = first; \n this.second = second; " ) ; this . first = first ; this . second = second ; } } } +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 Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; int count1 = 0 ; int count2 = 0 ; int count3 = 0 ; int count4 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . next ( ) ) ; } for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: count4++; " ) ; 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 ; public class Main { 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 i = 0 ; i < input . length - 1 ; i ++ ) { if ( input [ i ] . equals ( input [ i + 1 ] ) ) { System . out . println ( " [LOG] Block: return Result.Bad; " ) ; return Result . Bad ; } } return Result . Good ; } enum Result { Good , Bad } } +import java . util . Scanner ; class Main { 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 j = 0 ; for ( int i = 0 ; i <= 6 ; i ++ ) { System . out . println ( " [LOG] Block: if (input.equals(s[i])) \n j = 7 - i; " ) ; if ( input . equals ( s [ i ] ) ) j = 7 - i ; } System . out . println ( j ) ; } } +import java . lang . reflect . Array ; import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n System.out.println(Math.max(Math.max(a + b, a - b), a * b)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( a + b , a - b ) , a * b ) ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; int [ ] a = new int [ n . length ( ) + 1 ] ; int ans = 0 ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { a [ i ] = n . charAt ( i ) - '0' ; } for ( int i = 0 ; i < n . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: ans = ans + a[i]; " ) ; ans = ans + a [ i ] ; } if ( ans % 9 == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int i = 0 ; int Alice = 0 ; int Bob = 0 ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } Arrays . sort ( a ) ; for ( i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 1 ) { Alice = Alice + a [ n - i ] ; } else { System . out . println ( " [LOG] Block: Bob = Bob + a[n - i]; " ) ; Bob = Bob + a [ n - i ] ; } } System . out . println ( Alice - Bob ) ; } } +import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; int sum = 0 ; int res = 114514 ; for ( int i = 0 ; i < n ; 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 io { 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 Algo { public static boolean isOdd ( int n ) { return n % 2 == 1 ; } public static boolean isEven ( int n ) { System . out . println ( " [LOG] Block: return n % 2 == 0; " ) ; return n % 2 == 0 ; } } +import java . util . * ; public class Main { static int gcd ( int a , int b ) { return b > 0 ? gcd ( b , a % b ) : a ; } static long mod = 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 ] ) { System . out . println ( " [LOG] Block: tempAns++; " ) ; tempAns ++ ; } } ans = Math . min ( ans , tempAns ) ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sp = new Scanner ( System . in ) ; int a = sp . nextInt ( ) ; int b = sp . nextInt ( ) ; int l = 0 ; int n = 0 ; if ( a < b ) { l = b ; } else { l = a ; } for ( int k = 0 ; k < l ; k ++ ) { if ( Math . abs ( a - k ) == Math . abs ( b - k ) ) { n = k ; } } if ( ! ( n == 0 ) ) { System . out . println ( n ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; if ( S . length ( ) < 6 ) { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } else { if ( S . charAt ( 2 ) == S . charAt ( 3 ) && S . charAt ( 4 ) == S . charAt ( 5 ) ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] items = reader . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( items [ 0 ] ) ; int b = Integer . parseInt ( items [ 1 ] ) ; int c = Integer . parseInt ( items [ 2 ] ) ; int counter = 0 ; for ( int i = a ; i <= b ; i ++ ) { if ( c % i == 0 ) { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } System . out . println ( counter ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n Integer n = Integer.parseInt(sc.next()); \n Integer k = Integer.parseInt(sc.next()); \n String num = Integer.toString(n, k); \n int result = num.length(); \n System.out.println(result); " ) ; 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 result = num . length ( ) ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long k = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; int [ ] a = new int [ q ] ; int [ ] win = new int [ n ] ; 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 < n ; i ++ ) { if ( k - ( q - win [ i ] ) > 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n continue; " ) ; System . out . println ( " Yes " ) ; continue ; } System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.next(); \n String Ss = S.substring(0, 4) + S.substring(5, 7) + S.substring(8, 10); \n int day = Integer.parseInt(Ss); \n if (day <= 20190430) \n System.out.println( \" Heisei \" ); \n else \n System.out.println( \" TBD \" ); " ) ; 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 day = Integer . parseInt ( Ss ) ; if ( day <= 20190430 ) System . out . println ( " Heisei " ) ; else System . out . println ( " TBD " ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ans = 0 ; int able = 2 * d + 1 ; for ( int i = 1 ; i < 20 ; i ++ ) { if ( i * able >= n ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = Long . parseLong ( sc . next ( ) ) ; long yokin = 100 ; int counter = 0 ; while ( ! ( yokin >= X ) ) { System . out . println ( " [LOG] Block: yokin *= 1.01; \n counter++; " ) ; yokin *= 1.01 ; counter ++ ; } System . out . println ( counter ) ; } } +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 Main { public static void main ( String [ ] args ) { int ans = 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 ( " [LOG] Block: System.out.println(n * 10000); " ) ; System . out . println ( n * 10000 ) ; } break ; } scanner . close ( ) ; } } +import java . util . ArrayDeque ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; Queue < Process > Q = new ArrayDeque < > ( ) ; for ( int i = 0 ; i < n ; 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 Process { String name ; int time ; public Process ( String name , int time ) { System . out . println ( " [LOG] Block: this.name = name; \n this.time = time; " ) ; this . name = name ; this . time = time ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] a = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . next ( ) ; } sc . close ( ) ; Arrays . sort ( a ) ; int yono = 1 ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (!a[i - 1].equals(a[i])) \n yono++; " ) ; if ( ! a [ i - 1 ] . equals ( a [ i ] ) ) yono ++ ; } System . out . println ( yono ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i , j , t ; int cnt = 0 ; int check = 0 ; int mini , minikey ; int n = sc . nextInt ( ) ; int [ ] num ; num = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } for ( i = 0 ; i < n - 1 ; i ++ ) { mini = i ; minikey = num [ i ] ; for ( j = i + 1 ; j < n ; j ++ ) { if ( num [ j ] < minikey ) { mini = j ; minikey = num [ j ] ; check ++ ; } } t = num [ i ] ; num [ i ] = num [ mini ] ; num [ mini ] = t ; if ( check > 0 ) cnt ++ ; check = 0 ; } for ( i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(num[i] + \" \" ); " ) ; System . out . print ( num [ i ] + " " ) ; } System . out . println ( num [ n - 1 ] ) ; System . out . println ( cnt ) ; sc . close ( ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; 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 < N ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } number . clear ( ) ; } System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int x = stdIn . nextInt ( ) ; int count = 1 ; int sum = 0 ; while ( n -- > 0 ) { System . out . println ( " [LOG] Block: sum += stdIn.nextInt(); \n if (x < sum) \n break; \n count++; " ) ; sum += stdIn . nextInt ( ) ; if ( x < sum ) break ; count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String A = sc . next ( ) ; if ( " SAT " . equals ( A ) ) { System . out . println ( " 1 " ) ; } else if ( " FRI " . equals ( A ) ) { System . out . println ( " 2 " ) ; } else if ( " THU " . equals ( A ) ) { System . out . println ( " 3 " ) ; } else if ( " WED " . equals ( A ) ) { System . out . println ( " 4 " ) ; } else if ( " TUE " . equals ( A ) ) { System . out . println ( " 5 " ) ; } else if ( " MON " . equals ( A ) ) { System . out . println ( " 6 " ) ; } else if ( " SUN " . equals ( A ) ) { 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 ) { System . out . println ( " [LOG] Block: if (m < n) \n return gcd(n, m); \n if (n == 0) \n return m; \n return gcd(n, m % n); " ) ; if ( m < n ) return gcd ( n , m ) ; if ( n == 0 ) return m ; return gcd ( n , m % n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] d = new int [ n + 1 ] ; d [ 0 ] = 0 ; int j ; int bound = 1 ; for ( j = 1 ; j <= n ; j ++ ) { int l = sc . nextInt ( ) ; d [ j ] = d [ j - 1 ] + l ; if ( d [ j ] <= x ) bound ++ ; else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( bound ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String weather = sc . next ( ) ; String S = " Sunny " ; String C = " Cloudy " ; String R = " Rainy " ; if ( weather . equals ( S ) ) { System . out . println ( C ) ; } else if ( weather . equals ( C ) ) { System . out . println ( R ) ; } else { System . out . println ( " [LOG] Block: System.out.println(S); " ) ; System . out . println ( S ) ; } } } +import java . util . Scanner ; public class Main { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] counts = new int [ N ] ; for ( int i = 0 ; i < M ; i ++ ) { System . out . println ( " [LOG] Block: int a = sc.nextInt() - 1; \n int b = sc.nextInt() - 1; \n counts[a]++; \n counts[b]++; " ) ; 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 ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int[] a = new int[N]; \n for (int i = 0; i < N; i++) a[i] = sc.nextInt(); \n Arrays.sort(a); \n int ans = a[N / 2] - a[N / 2 - 1]; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; int ans = a [ N / 2 ] - a [ N / 2 - 1 ] ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] s = sc . next ( ) . split ( " " ) ; for ( int i = 0 ; i < s . length ; i ++ ) { System . out . println ( " [LOG] Block: sb.append(s[i].equals( \" 1 \" ) ? \" 9 \" : \" 1 \" ); " ) ; sb . append ( s [ i ] . equals ( " 1 " ) ? " 9 " : " 1 " ) ; } System . out . println ( sb ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int wa = 0 ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; wa += A [ i ] ; } sc . close ( ) ; int ok = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: ok += A[i] * (4 * M) >= wa ? 1 : 0; " ) ; ok += A [ i ] * ( 4 * M ) >= wa ? 1 : 0 ; } System . out . println ( ok >= M ? " Yes " : " No " ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner f = new Scanner ( System . in ) ; while ( true ) { int num = f . nextInt ( ) ; if ( num == 0 ) break ; BigDecimal [ ] entries = new BigDecimal [ num ] ; BigDecimal sum = new BigDecimal ( 0 ) ; BigDecimal std = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < num ; i ++ ) { BigDecimal temp = new BigDecimal ( f . nextInt ( ) ) ; entries [ i ] = temp ; sum = sum . add ( temp ) ; } BigDecimal average = sum . divide ( new BigDecimal ( num ) , 6 , BigDecimal . ROUND_HALF_UP ) ; for ( int i = 0 ; i < num ; i ++ ) { System . out . println ( " [LOG] Block: std = std.add(entries[i].subtract(average).pow(2)); " ) ; std = std . add ( entries [ i ] . subtract ( average ) . pow ( 2 ) ) ; } System . out . println ( Math . sqrt ( std . divide ( new BigDecimal ( num ) , 6 , BigDecimal . ROUND_HALF_UP ) . doubleValue ( ) ) ) ; } } } +import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( InputReader in = new InputReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ) { new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } } void solve ( InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; int cL = 0 ; int cR = N + 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 InputReader implements AutoCloseable { private final Scanner sc = new Scanner ( System . in ) ; String next ( ) { return this . sc . next ( ) ; } int nextInt ( ) { return Integer . parseInt ( this . sc . next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( this . sc . next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( this . sc . next ( ) ) ; } @ Override public void close ( ) { System . out . println ( " [LOG] Block: this.sc.close(); " ) ; this . sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > divisor = new ArrayList < Integer > ( ) ; for ( int i = a ; i > 0 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { System . out . println ( " [LOG] Block: divisor.add(i); " ) ; divisor . add ( i ) ; } } System . out . println ( divisor . get ( k - 1 ) ) ; } } +import java . util . Scanner ; public class Main { Scanner scan = new Scanner ( System . in ) ; void compute ( ) { int N = scan . nextInt ( ) ; int D = scan . nextInt ( ) ; double x = ( double ) N / ( double ) ( 2 * D + 1 ) ; int y = N / ( 2 * D + 1 ) ; if ( 0 < x - y ) { y ++ ; } System . out . println ( y ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().compute(); " ) ; new Main ( ) . compute ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner sc = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int ab = Integer . parseInt ( a + b ) ; double number = Math . sqrt ( ab ) ; if ( number == Math . floor ( number ) ) { out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: out.println( \" No \" ); " ) ; out . println ( " No " ) ; } out . close ( ) ; } } +import java . util . * ; public class Main { Scanner sc ; int N ; int [ ] v ; public Main ( ) { sc = new Scanner ( System . in ) ; } private void calc ( ) { N = sc . nextInt ( ) ; v = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) v [ i ] = sc . nextInt ( ) ; Arrays . sort ( v ) ; double ans = ( double ) v [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) ans = ( ans + v [ i ] ) / 2d ; System . out . println ( ans ) ; System . out . flush ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int C = sc.nextInt(); \n int D = sc.nextInt(); \n int keypress = (B < D ? B : D) - (A > C ? A : C); \n System.out.println(keypress > 0 ? keypress : 0); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int keypress = ( B < D ? B : D ) - ( A > C ? A : C ) ; System . out . println ( keypress > 0 ? keypress : 0 ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { solve ( sc ) ; } } static void solve ( Scanner sc ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( d <= a || b <= c ) { System . out . println ( 0 ) ; return ; } if ( c <= a ) { if ( d <= b ) { System . out . println ( d - a ) ; } else { System . out . println ( b - a ) ; } } else if ( c < b ) { if ( d <= b ) { System . out . println ( d - c ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b - c); " ) ; System . out . println ( b - c ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int s = scanner.nextInt(), w = scanner.nextInt(); \n System.out.println((s > w) ? \" safe \" : \" unsafe \" ); " ) ; int s = scanner . nextInt ( ) , w = scanner . nextInt ( ) ; System . out . println ( ( s > w ) ? " safe " : " unsafe " ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { C [ i ] = s . charAt ( i ) ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( C [ i ] == '1' ) { c . add ( '1' ) ; } if ( C [ i ] == '0' ) { c . add ( '0' ) ; } if ( C [ i ] == 'B' && c . size ( ) > 0 ) { c . remove ( c . size ( ) - 1 ) ; } } for ( int i = 0 ; i < c . size ( ) ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(c.get(i)); " ) ; System . out . print ( c . get ( i ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n String po = sc.next(); \n String po2 = po.substring(0, n / 2); \n String po3 = po.substring(n / 2); \n System.out.println((po2.equals(po3)) ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String po = sc . next ( ) ; String po2 = po . substring ( 0 , n / 2 ) ; String po3 = po . substring ( n / 2 ) ; System . out . println ( ( po2 . equals ( po3 ) ) ? " Yes " : " No " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; Integer [ ] h = new Integer [ N ] ; int c = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: h[i] = Integer.parseInt(sc.next()); \n if (h[i] >= K) \n c++; " ) ; h [ i ] = Integer . parseInt ( sc . next ( ) ) ; if ( h [ i ] >= K ) c ++ ; } System . out . println ( c ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] 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 { System . out . println ( " [LOG] Block: rx = c - 1; " ) ; rx = c - 1 ; } } return - 1 ; } } +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 Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int temp1 = b; \n b = a; \n a = temp1; \n int temp = c; \n c = a; \n a = temp; \n System.out.print(a + \" \" + b + \" \" + c); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int temp1 = b ; b = a ; a = temp1 ; int temp = c ; c = a ; a = temp ; System . out . print ( a + " " + b + " " + c ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int x = Integer . parseInt ( str [ 0 ] ) , y = Integer . parseInt ( str [ 1 ] ) , rest ; if ( x < y ) { int temp = x ; x = y ; y = temp ; } do { System . out . println ( " [LOG] Block: rest = x % y; \n x = y; \n y = rest; " ) ; rest = x % y ; x = y ; y = rest ; } while ( y != 0 ) ; System . out . println ( x ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int check = 0 ; String [ ] W = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { W [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( W [ i ] . charAt ( W [ i ] . length ( ) - 1 ) != W [ i + 1 ] . charAt ( 0 ) ) { check ++ ; break ; } for ( int j = i + 1 ; j < N ; j ++ ) { if ( W [ i ] . equals ( W [ j ] ) ) { check ++ ; break ; } } } if ( check != 0 ) { System . out . print ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" Yes \" ); " ) ; System . out . print ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] people = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { people [ i ] = sc . nextInt ( ) ; } int ok = 0 ; for ( int h : people ) { System . out . println ( " [LOG] Block: ok += h >= k ? 1 : 0; " ) ; ok += h >= k ? 1 : 0 ; } System . out . println ( ok ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int X = 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 ( X - ans ) > Math . abs ( X - i ) ) { System . out . println ( " [LOG] Block: ans = i; " ) ; ans = i ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double rA = 0.08 ; double rB = 0.1 ; for ( int i = 12 ; i < 1001 ; i ++ ) { if ( Math . floor ( i * rA ) == A && Math . floor ( i * rB ) == B ) { System . out . println ( " [LOG] Block: System.out.println(i); \n return; " ) ; System . out . println ( i ) ; return ; } } System . out . println ( - 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; int c = n / 4 ; int d = n / 7 ; for ( int i = 0 ; i <= c ; i ++ ) { for ( int j = 0 ; j <= d ; j ++ ) { if ( 4 * i + 7 * j == n ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int count = 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 ++ ) { count = x ; if ( min * x > X ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } count += N ; System . out . println ( count ) ; } } +import static java . lang . Math . log10 ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int temp = i ; int count = 0 ; while ( temp != 0 ) { temp = temp / 10 ; count ++ ; } if ( count % 2 == 1 ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n System.out.println((s.nextInt() * s.nextInt()) % 2 == 0 ? \" Even \" : \" Odd \" ); " ) ; Scanner s = new Scanner ( System . in ) ; System . out . println ( ( s . nextInt ( ) * s . nextInt ( ) ) % 2 == 0 ? " Even " : " Odd " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int [ ] [ ] matrix = new int [ n ] [ m ] ; int [ ] vector = new int [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { int kakezan = 0 ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: kakezan += matrix[i][j] * vector[j]; " ) ; kakezan += matrix [ i ] [ j ] * vector [ j ] ; } System . out . println ( kakezan ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = 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 ( ( H - sum ) <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] A = new int [ N + 1 ] [ 3 ] ; for ( int i = 1 ; i <= N ; 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 <= N ; 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 == N ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . math . BigDecimal ; import java . util . Scanner ; public class Main { 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 ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String sa = sc.next(); \n String sb = sc.next(); \n BigDecimal A = new BigDecimal(sa); \n BigDecimal B = new BigDecimal(sb); \n System.out.println(A.multiply(B).setScale(0, BigDecimal.ROUND_DOWN)); " ) ; Scanner sc = new Scanner ( System . in ) ; String sa = sc . next ( ) ; String sb = sc . next ( ) ; BigDecimal A = new BigDecimal ( sa ) ; BigDecimal B = new BigDecimal ( sb ) ; System . out . println ( A . multiply ( B ) . setScale ( 0 , BigDecimal . ROUND_DOWN ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { int [ ] data = new int [ 10 ] ; final String BR = System . getProperty ( " line.separator " ) ; int first = 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 ( first < datum ) { temp1 = first ; temp2 = second ; first = datum ; second = temp1 ; third = temp2 ; } else if ( second < datum ) { temp2 = second ; second = datum ; third = temp2 ; } else if ( third < datum ) { System . out . println ( " [LOG] Block: third = datum; " ) ; third = datum ; } } System . out . println ( first + BR + second + BR + third ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 0 ; int ahead ; int current = 100000 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: ahead = current; \n current = sc.nextInt(); \n result += Math.min(ahead, current); " ) ; ahead = current ; current = sc . nextInt ( ) ; result += Math . min ( ahead , current ) ; } result += current ; System . out . println ( result ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = 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 ) { a = 1 ; b = 1 ; break ; } } } if ( b == 1 ) { break ; } } if ( a == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String cards = sc . next ( ) ; if ( cards . equals ( " - " ) ) { break ; } int m = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int count = sc.nextInt(); \n String move = cards.substring(0, count); \n String move2 = cards.substring(count); \n cards = move2 + move; " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long max = 0L ; int Bi = 0 ; int save = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i == N - 1 ) { max += save ; break ; } Bi = sc . nextInt ( ) ; if ( i == 0 ) { max += Bi ; save = Bi ; } else if ( Bi < save ) { max += Bi ; save = Bi ; } else { System . out . println ( " [LOG] Block: max += save; \n save = Bi; " ) ; max += save ; save = Bi ; } } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long sum = 0 ; while ( s . length ( ) > 0 ) { System . out . println ( " [LOG] Block: sum += Integer.parseInt(s.substring(0, 1)); \n s = s.substring(1); " ) ; sum += Integer . parseInt ( s . substring ( 0 , 1 ) ) ; s = s . substring ( 1 ) ; } System . out . println ( sum % 9 == 0 ? " Yes " : " No " ) ; } } +import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i <= 2 ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } int K = sc . nextInt ( ) ; Collections . sort ( list , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: list.set(0, list.get(0) * 2); " ) ; list . set ( 0 , list . get ( 0 ) * 2 ) ; } System . out . println ( list . get ( 0 ) + list . get ( 1 ) + list . get ( 2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int M = scanner.nextInt(); \n int N = scanner.nextInt(); \n System.out.print((M * (M - 1) + N * (N - 1)) / 2); " ) ; Scanner scanner = new Scanner ( System . in ) ; int M = scanner . nextInt ( ) ; int N = scanner . nextInt ( ) ; System . out . print ( ( M * ( M - 1 ) + N * ( N - 1 ) ) / 2 ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = reader . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( str [ 0 ] ) ; int B = Integer . parseInt ( str [ 1 ] ) ; if ( 1 <= A && A <= 9 && 1 <= B && B <= 9 ) { System . out . println ( A * B ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; 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 . println ( " [LOG] Block: System.out.print( \" \" + i); \n break; " ) ; System . out . print ( " " + i ) ; break ; } } } System . out . print ( " \n " ) ; } } +import java . lang . reflect . Array ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; List < String [ ] > list = new ArrayList < > ( ) ; int count = 0 ; int N = 0 ; int M = 0 ; while ( scan . hasNext ( ) ) { if ( count == 0 ) { N = scan . nextInt ( ) ; M = scan . nextInt ( ) ; count ++ ; continue ; } String str = scan . nextLine ( ) ; String [ ] sp = str . split ( " " ) ; list . add ( sp ) ; count ++ ; if ( count > 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 ) { System . out . println ( " [LOG] Block: resultCount++; " ) ; resultCount ++ ; } } System . out . print ( resultCount ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int a = sc . nextInt ( ) ; String strA = sc . next ( ) ; int b = sc . nextInt ( ) ; if ( strA == " ? " ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } switch ( strA ) { case " + " : System . out . println ( a + b ) ; break ; case " - " : System . out . println ( a - b ) ; break ; case " * " : System . out . println ( a * b ) ; break ; case " / " : System . out . println ( a / b ) ; break ; } } } } +import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arr = new int [ n ] ; StringTokenizer st1 = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st1 . nextToken ( ) ) ; } int [ ] cnt = new int [ n ] ; int max = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( arr [ i ] >= arr [ i + 1 ] ) { System . out . println ( " [LOG] Block: cnt[i] = cnt[i + 1] + 1; " ) ; cnt [ i ] = cnt [ i + 1 ] + 1 ; } } for ( int i = 0 ; i < n ; i ++ ) max = Math . max ( max , cnt [ i ] ) ; out . println ( max ) ; out . flush ( ) ; out . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; String [ ] str2 = str . split ( " " ) ; if ( " 7 " . equals ( str2 [ 0 ] ) || " 7 " . equals ( str2 [ 1 ] ) || " 7 " . equals ( str2 [ 2 ] ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { private void calc ( ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; int d = x / y ; int r = x % y ; double f = ( double ) x / ( double ) y ; System . out . printf ( " %d %d %05f " , d , r , f ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Main run = new Main(); \n run.calc(); " ) ; Main run = new Main ( ) ; run . calc ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int size = scanner . nextInt ( ) ; int [ ] arr = new int [ size ] ; for ( int i = 0 ; i < size ; 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 ) { System . out . println ( " [LOG] Block: cost2 = Math.abs(arr[j + 2] - arr[j]) + sol[j + 2]; " ) ; cost2 = Math . abs ( arr [ j + 2 ] - arr [ j ] ) + sol [ j + 2 ] ; } sol [ j ] = Math . min ( cost1 , cost2 ) ; } return sol [ 0 ] ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String nyu = sc . next ( ) ; int cnt = 0 , mem = 0 , leng ; leng = nyu . length ( ) ; for ( int i = 0 ; i < leng ; i ++ ) { char top = nyu . charAt ( i ) ; switch ( top ) { case 'A' : cnt += 1 ; break ; case 'C' : cnt += 1 ; break ; case 'G' : cnt += 1 ; break ; case 'T' : cnt += 1 ; break ; default : if ( cnt > mem ) { mem = cnt ; cnt = 0 ; } } } if ( cnt > mem ) { System . out . println ( " [LOG] Block: mem = cnt; " ) ; mem = cnt ; } System . out . println ( mem ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextShort ( ) ; int n1 = 1 ; int n2 ; do { n2 = 100 * n1 + 10 * n1 + n1 ; if ( n <= n2 ) { System . out . println ( " [LOG] Block: System.out.println(n2); \n return; " ) ; System . out . println ( n2 ) ; return ; } n1 = n1 + 1 ; } while ( n1 <= 9 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int number_n , i , answer ; int sum = 0 ; int temp_a = 0 ; int temp_b = 0 ; number_n = Integer . parseInt ( sc . next ( ) ) ; int [ ] weight = new int [ number_n ] ; for ( i = 0 ; i < number_n ; i ++ ) { weight [ i ] = Integer . parseInt ( sc . next ( ) ) ; sum += weight [ i ] ; } for ( i = 0 ; i < number_n ; 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 { System . out . println ( " [LOG] Block: answer = temp_a; " ) ; answer = temp_a ; } System . out . println ( answer ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double A = ( t - a ) * 1000 / 6.0 ; double [ ] h = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = Math . abs ( sc . nextInt ( ) - A ) ; } int idx = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( h [ i ] < h [ idx ] ) { System . out . println ( " [LOG] Block: idx = i; " ) ; idx = i ; } } System . out . println ( idx + 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String slimes = sc . next ( ) ; StringBuilder ans = new StringBuilder ( ) ; String [ ] slimesarr = new String [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { slimesarr [ i ] = String . valueOf ( slimes . charAt ( i ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( slimesarr [ i ] . equals ( slimesarr [ i + 1 ] ) ) { } else { System . out . println ( " [LOG] Block: ans.append(slimesarr[i]); " ) ; ans . append ( slimesarr [ i ] ) ; } } System . out . println ( ans . toString ( ) . length ( ) ) ; } } +import java . lang . reflect . Array ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int alice = 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 ) { alice += max ; } else { System . out . println ( " [LOG] Block: bob += max; " ) ; bob += max ; } iCards . remove ( iCards . indexOf ( max ) ) ; } System . out . println ( alice - bob ) ; } } +import java . util . * ; class Main { 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 i = 0 , size = list . size ( ) ; i < size ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(list.get(i)); " ) ; System . out . println ( list . get ( i ) ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a == b || b == c || a == c ) { System . out . println ( " No " ) ; } else if ( a > b || a > c ) { System . out . println ( " No " ) ; } else if ( b > c ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = Long . parseLong ( sc . next ( ) ) ; long b = Long . parseLong ( sc . next ( ) ) ; long k = Long . parseLong ( sc . next ( ) ) ; long resultA = a - k ; long resultB = b ; if ( resultA < 0 ) { System . out . println ( " [LOG] Block: resultB = Math.max(b + resultA, 0); \n resultA = 0; " ) ; resultB = Math . max ( b + resultA , 0 ) ; resultA = 0 ; } System . out . println ( resultA + " " + resultB ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] list ; int length ; int primes = 0 ; Scanner keyboard = new Scanner ( System . in ) ; length = keyboard . nextInt ( ) ; list = new int [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { list [ i ] = keyboard . nextInt ( ) ; } for ( int i = 0 ; i < length ; 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } for ( int j = 3 ; j <= Math . sqrt ( a ) ; j ++ ) { if ( a % j == 0 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; sc . close ( ) ; long ret = x ; while ( true ) { if ( isPrime ( ret ) ) { break ; } ret ++ ; } System . out . println ( ret ) ; } public static boolean isPrime ( long x ) { if ( x == 1 || x == 2 ) { return true ; } if ( x % 2 == 0 ) { return false ; } boolean ret = false ; for ( long i = 2 ; i <= Math . sqrt ( x ) ; i ++ ) { if ( x % i == 0 ) { System . out . println ( " [LOG] Block: ret = false; \n break; " ) ; ret = false ; break ; } ret = true ; } return ret ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , ans ; while ( sc . hasNext ( ) ) { n = sc . nextInt ( ) ; ans = 100000 ; for ( int i = 0 ; i < n ; i ++ ) { ans += ans / 20 ; if ( ans != ( ans = ans / 1000 * 1000 ) ) { System . out . println ( " [LOG] Block: ans += 1000; " ) ; ans += 1000 ; } } System . out . println ( ans ) ; } } } +import java . io . * ; import java . util . * ; public class Main { 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 i = 0 ; i < n ; i ++ ) { arr [ i ] = ipar ( ) ; } return arr ; } public long lpar ( ) { return Long . parseLong ( tok . nextToken ( ) ) ; } public long [ ] lapar ( int n ) { long [ ] arr = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = 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 { System . out . println ( " [LOG] Block: new Main().go(); " ) ; new Main ( ) . go ( ) ; } } +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 Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int t = scan . nextInt ( ) ; int time = 0 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: n -= x; \n time += t; " ) ; n -= x ; time += t ; } System . out . println ( time ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char [ ] [ ] s = new char [ n ] [ 10 ] ; HashMap < String , Long > h = new HashMap < > ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) . toCharArray ( ) ; Arrays . parallelSort ( s [ i ] ) ; String st = String . valueOf ( s [ i ] ) ; if ( h . containsKey ( st ) ) { System . out . println ( " [LOG] Block: long temp = h.get(st); \n ans += temp; \n h.put(st, temp + 1); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . close ( ) ; String str = String . valueOf ( n ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: int x = Character.getNumericValue(str.charAt(i)); \n System.out.print((x == 1) ? \" 9 \" : ((x == 9) ? \" 1 \" : x)); " ) ; int x = Character . getNumericValue ( str . charAt ( i ) ) ; System . out . print ( ( x == 1 ) ? " 9 " : ( ( x == 9 ) ? " 1 " : x ) ) ; } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static int [ ] ans ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } int count = 0 ; boolean flag = true ; while ( flag ) { for ( int i = 0 ; i < n ; i ++ ) { if ( list [ i ] % 2 == 1 ) { flag = false ; } list [ i ] = list [ i ] / 2 ; if ( i == n - 1 && flag ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( N % 2 == 0 ) { for ( int i = 0 ; i < N / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( N / 2 + i ) ) { System . out . println ( " No " ) ; break ; } else if ( i < N / 2 - 1 ) { continue ; } System . out . println ( " Yes " ) ; } } else if ( N % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int now = sc . nextInt ( ) ; int next = 0 ; int count = 0 ; int answer = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { next = sc . nextInt ( ) ; if ( now >= next ) { count ++ ; } else { System . out . println ( " [LOG] Block: answer = Math.max(answer, count); \n count = 0; " ) ; answer = Math . max ( answer , count ) ; count = 0 ; } now = next ; } answer = Math . max ( answer , count ) ; System . out . println ( answer ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; ArrayList < Integer > aList = new ArrayList < Integer > ( A ) ; ArrayList < Integer > bList = new ArrayList < Integer > ( B ) ; for ( int i = 1 ; i <= A ; i ++ ) { if ( A % 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 ) { System . out . println ( " [LOG] Block: aList.remove(aList.get(i)); \n i--; " ) ; aList . remove ( aList . get ( i ) ) ; i -- ; } } System . out . println ( aList . get ( aList . size ( ) - K ) ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 K = 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 ( K - input [ N - 1 ] + input [ 0 ] , max ) ; System . out . println ( K - 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 { System . out . println ( " [LOG] Block: while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine().trim()); \n return st.nextToken(); " ) ; while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = scan.nextInt(); \n scan.close(); \n if ((1 <= a && a < 10) && (1 <= b && b < 10)) \n System.out.println(a * b); \n else \n System.out.println(-1); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; scan . close ( ) ; if ( ( 1 <= a && a < 10 ) && ( 1 <= b && b < 10 ) ) System . out . println ( a * b ) ; else System . out . println ( - 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double [ ] h = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int b = sc . nextInt ( ) ; h [ i ] = t - b * 0.006 ; } double min = 1000000000 ; int ans = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { double x ; if ( h [ i ] >= a ) { x = h [ i ] - a ; } else { x = a - h [ i ] ; } if ( x <= min ) { System . out . println ( " [LOG] Block: ans = i; \n min = x; " ) ; ans = i ; min = x ; } } System . out . println ( ans + 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N , M ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; int [ ] broken = new int [ N + 1 ] ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; broken [ a ] = 1 ; } int [ ] dp = new int [ N + 2 ] ; dp [ N ] = 1 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( broken [ i ] == 1 ) { System . out . println ( " [LOG] Block: dp[i] = 0; \n continue; " ) ; dp [ i ] = 0 ; continue ; } dp [ i ] = ( dp [ i + 1 ] + dp [ i + 2 ] ) % 1000000007 ; } System . out . println ( dp [ 0 ] ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long ans = 1 ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; if ( A [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String strs = sc . next ( ) ; String strp = sc . next ( ) ; int snum = strs . length ( ) ; int psum = strp . length ( ) ; for ( int p = 0 ; p < snum ; p ++ ) { String str1 = " " ; String str2 = " " ; String str3 = " " ; for ( int q = p ; q < snum ; 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 == snum - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { static final long mod = ( 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 ] ) { System . out . println ( " [LOG] Block: dp[next] += dp[now]; \n dp[next] %= mod; " ) ; dp [ next ] += dp [ now ] ; dp [ next ] %= mod ; } } } System . out . println ( dp [ n ] ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n String S = scanner.nextLine(); \n char s = S.charAt(0); \n System.out.println(Character.isUpperCase(s) ? \" A \" : \" a \" ); " ) ; Scanner scanner = new Scanner ( System . in ) ; String S = scanner . nextLine ( ) ; char s = S . charAt ( 0 ) ; System . out . println ( Character . isUpperCase ( s ) ? " A " : " a " ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AProduct solver = new AProduct ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AProduct { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; out . print ( a * b % 2 == 0 ? " Even " : " Odd " ) ; } } static class InputReader implements AutoCloseable { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } public void close ( ) { } } } +import java . util . Collections ; import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int k = 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 = k - aArray [ n - 1 ] + aArray [ 0 ] ; pq . add ( dist ) ; } else { System . out . println ( " [LOG] Block: pq.add(aArray[i] - aArray[i - 1]); " ) ; pq . add ( aArray [ i ] - aArray [ i - 1 ] ) ; } } int max = pq . poll ( ) ; System . out . println ( k - max ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( ( A + B ) % 2 == 0 ) { System . out . println ( ( A + B ) / 2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; double nearest = Double . MAX_VALUE ; int ans = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int H = sc . nextInt ( ) ; double avg = T - H * 0.006 ; if ( nearest > Math . abs ( A - avg ) ) { System . out . println ( " [LOG] Block: nearest = Math.abs(A - avg); \n ans = i; " ) ; nearest = Math . abs ( A - avg ) ; ans = i ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] C = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; int zeroCnt = 0 ; int oneCnt = 0 ; for ( int i = 0 ; i < C . length ; i ++ ) { if ( C [ i ] == '0' ) { zeroCnt ++ ; } else { System . out . println ( " [LOG] Block: oneCnt++; " ) ; oneCnt ++ ; } } System . out . println ( Math . min ( zeroCnt , oneCnt ) * 2 ) ; } } +import java . util . Scanner ; public class Main { private static String text ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n String line = scanner.nextLine(); \n String[] lines = line.split( \" \" ); \n int A = Integer.parseInt(lines[0]); \n int B = Integer.parseInt(lines[1]); \n int plus = A + B; \n int minus = A - B; \n int multi = A * B; \n int display; \n if (plus > minus && plus > multi) \n display = plus; \n else if (minus > plus && minus > multi) \n display = minus; \n else if (plus == minus && plus > multi) \n display = plus; \n else \n display = multi; \n System.out.println(display); " ) ; Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; int A = Integer . parseInt ( lines [ 0 ] ) ; int B = Integer . parseInt ( lines [ 1 ] ) ; int plus = A + B ; int minus = A - B ; int multi = A * 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 . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 i = str . length - 1 ; i >= 0 ; i -- ) { if ( i != 0 ) { System . out . print ( str [ i ] + " " ) ; } else { System . out . println ( " [LOG] Block: System.out.print(str[i]); " ) ; System . out . print ( str [ i ] ) ; } } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= N ; 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 ) { System . out . println ( " [LOG] Block: sum += i; " ) ; sum += i ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int n1 = n / 100 ; n = n - n1 * 100 ; int n2 = n / 10 ; n = n - n2 * 10 ; if ( n == 2 || n == 4 || n == 5 || n == 7 || n == 9 ) { System . out . println ( " hon " ) ; } else if ( n == 0 || n == 1 || n == 6 || n == 8 ) { System . out . println ( " pon " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" bon \" ); " ) ; System . out . println ( " bon " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; while ( true ) { int x = stdin . nextInt ( ) ; int y = stdin . nextInt ( ) ; if ( x == 0 && y == 0 ) { break ; } else if ( x > y ) { System . out . printf ( " %d %d%n " , y , x ) ; } else { System . out . println ( " [LOG] Block: System.out.printf( \" %d %d%n \" , x, y); " ) ; System . out . printf ( " %d %d%n " , x , y ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] str = sc . next ( ) . toCharArray ( ) ; int count = 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' ) ) { count ++ ; } } for ( int i = 0 ; i < str . length ; i ++ ) { if ( ( i % 2 == 1 && str [ i ] == '0' ) || ( i % 2 == 0 && str [ i ] == '1' ) ) { System . out . println ( " [LOG] Block: tmpCount++; " ) ; tmpCount ++ ; } } System . out . println ( Math . min ( count , tmpCount ) ) ; } } +import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String a = sc.next(); \n String b = sc.next(); \n BigDecimal a1 = new BigDecimal(a); \n BigDecimal b1 = new BigDecimal(b); \n BigDecimal res = a1.multiply(b1); \n System.out.println(res.setScale(0, RoundingMode.DOWN)); " ) ; Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; BigDecimal a1 = new BigDecimal ( a ) ; BigDecimal b1 = new BigDecimal ( b ) ; BigDecimal res = a1 . multiply ( b1 ) ; System . out . println ( res . setScale ( 0 , RoundingMode . DOWN ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] ave = new int [ N ] ; 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 ( " [LOG] Block: System.out.println(ave[i]); " ) ; System . out . println ( ave [ i ] ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int min = 0 ; for ( int i = 1 ; i <= 1009 ; i ++ ) { if ( ( int ) ( i * 0.08 ) == a && ( int ) ( i * 0.1 ) == b ) { min = i ; break ; } else { System . out . println ( " [LOG] Block: min = -1; " ) ; min = - 1 ; } } System . out . println ( min ) ; scan . close ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Main { 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 i = 0 ; i < ary . length ; i ++ ) { list . add ( new Integer ( ary [ i ] ) ) ; } Collections . reverse ( list ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { System . out . print ( list . get ( i ) ) ; if ( i == list . size ( ) - 1 ) { System . out . println ( ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } } } +import java . util . * ; public class Main { 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 i = 0 ; i < tc . length ; i ++ ) { if ( i < sc . length && sc [ i ] != tc [ i ] ) { System . out . println ( " No " ) ; break ; } if ( i == tc . length - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] tako = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { tako [ i ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int k = i + 1 ; k < N ; k ++ ) { System . out . println ( " [LOG] Block: sum += tako[i] * tako[k]; " ) ; sum += tako [ i ] * tako [ k ] ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { static boolean binary_search ( int x , int [ ] data ) { int left = 0 , right = data . length ; while ( true ) { int mid = ( left + right ) / 2 ; if ( left > right ) return false ; if ( data [ mid ] == x ) { return true ; } else if ( data [ mid ] < x ) { left = 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 ) { System . out . println ( " [LOG] Block: int t = scanner.nextInt(); \n if (binary_search(t, s)) \n ++cnt; " ) ; int t = scanner . nextInt ( ) ; if ( binary_search ( t , s ) ) ++ cnt ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = sc . nextLong ( ) ; long sum = 0 ; for ( int a = 1 ; a <= k ; ++ a ) { for ( int b = 1 ; b <= k ; ++ b ) { long g1 = findGcd ( a , b ) ; for ( int c = 1 ; c <= k ; ++ c ) { long g2 = findGcd ( g1 , c ) ; sum += g2 ; } } } System . out . println ( sum ) ; } public static long findGcd ( long a , long b ) { if ( b == 0L ) { System . out . println ( " [LOG] Block: return a; " ) ; return a ; } return findGcd ( b , a % b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int A = scanner.nextInt(); \n int B = scanner.nextInt(); \n int H = scanner.nextInt(); \n int M = scanner.nextInt(); \n double angle = Math.abs(360.0 * H / 12.0 - 360.0 * M / 60.0 + 30.0 * M / 60.0); \n double length = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(angle))); \n System.out.println(length); " ) ; Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double angle = Math . abs ( 360.0 * H / 12.0 - 360.0 * M / 60.0 + 30.0 * M / 60.0 ) ; double length = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( length ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int place ; double tSurf , tA ; Scanner sc = new Scanner ( System . in ) ; place = sc . nextInt ( ) ; tSurf = sc . nextDouble ( ) ; tA = sc . nextDouble ( ) ; double [ ] ts = new double [ place ] ; int result = 1 ; double min = 0 ; for ( int i = 0 ; i < place ; 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 ) { System . out . println ( " [LOG] Block: min = Math.abs(tA - ts[i]); \n result = i + 1; " ) ; min = Math . abs ( tA - ts [ i ] ) ; result = i + 1 ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] , rep = new int [ 2 ] ; rep [ 0 ] = 0 ; rep [ 1 ] = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; if ( nums [ i ] == 5 ) { rep [ 0 ] ++ ; } else if ( nums [ i ] == 7 ) { rep [ 1 ] ++ ; } } if ( rep [ 0 ] == 2 && rep [ 1 ] == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int p = sc . nextInt ( ) ; list . add ( p ) ; } Collections . sort ( list ) ; int sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: sum += list.get(i); " ) ; sum += list . get ( i ) ; } System . out . println ( sum ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner s = new Scanner(System.in); \n String n = s.next(); \n n = n.replaceAll( \" eraser \" , \" \" ); \n n = n.replaceAll( \" erase \" , \" \" ); \n n = n.replaceAll( \" dreamer \" , \" \" ); \n n = n.replaceAll( \" dream \" , \" \" ); \n System.out.println(n.length() == 0 ? \" YES \" : \" NO \" ); " ) ; Scanner s = new Scanner ( System . in ) ; String n = s . next ( ) ; n = n . replaceAll ( " eraser " , " " ) ; n = n . replaceAll ( " erase " , " " ) ; n = n . replaceAll ( " dreamer " , " " ) ; n = n . replaceAll ( " dream " , " " ) ; System . out . println ( n . length ( ) == 0 ? " YES " : " NO " ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { String [ ] line = br . readLine ( ) . split ( " " ) ; int h = Integer . parseInt ( line [ 0 ] ) ; int w = Integer . parseInt ( line [ 1 ] ) ; if ( h == 0 && w == 0 ) break ; for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { System . out . println ( " [LOG] Block: if ((i % 2 == 0 && j % 2 != 0) || (i % 2 != 0 && j % 2 == 0)) \n sb.append( \" . \" ); \n else \n sb.append( \" # \" ); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] level = new int [ n ] ; int count = 1 ; int min = 0 ; for ( int i = 0 ; i < n ; i ++ ) { level [ i ] = input . nextInt ( ) ; if ( i == 0 ) { min = level [ 0 ] ; } else { if ( level [ i ] <= min ) { System . out . println ( " [LOG] Block: count++; \n min = level[i]; " ) ; count ++ ; min = level [ i ] ; } } } System . out . println ( count ) ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: set.add(sc.nextInt()); " ) ; set . add ( sc . nextInt ( ) ) ; } System . out . println ( set . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; Set < Integer > set = new TreeSet < > ( ) ; for ( int i = 1 ; i <= n ; 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 ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } set . clear ( ) ; } System . out . println ( cnt ) ; } } +import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int out = 0 ; int h = 0 ; int t = s . length ( ) - 1 ; while ( h < t ) { if ( s . charAt ( h ) != s . charAt ( t ) ) { System . out . println ( " [LOG] Block: out += 1; " ) ; out += 1 ; } h += 1 ; t -= 1 ; } System . out . println ( out ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int [ ] lst = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { lst [ i ] = Integer . parseInt ( scan . next ( ) ) ; } for ( int i = 0 ; i < n - 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 ] ) ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3000 ; i ++ ) { int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; if ( x == 0 && y == 0 ) { break ; } int z ; if ( x > y ) { System . out . println ( " [LOG] Block: z = x; \n x = y; \n y = z; " ) ; z = x ; x = y ; y = z ; } System . out . println ( x + " " + y ) ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) , min = 11 ; String a = " " , b = " " ; for ( int i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { a = String . valueOf ( i ) ; b = String . valueOf ( n / i ) ; min = Math . min ( min , Math . max ( a . length ( ) , b . length ( ) ) ) ; } } System . out . println ( min ) ; } public static List < Long > divisorEnum ( long n ) { List < Long > l = new ArrayList < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: l.add(i); \n if (i != Math.sqrt(n)) \n l.add(n / i); " ) ; l . add ( i ) ; if ( i != Math . sqrt ( n ) ) l . add ( n / i ) ; } } l . sort ( null ) ; return l ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 2 ; int m = sc . nextInt ( ) ; int [ ] [ ] table = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { table [ i ] [ j ] = sc . nextInt ( ) ; } } int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: if (table[0][i] > table[1][i]) \n sum += table[0][i] - table[1][i]; " ) ; if ( table [ 0 ] [ i ] > table [ 1 ] [ i ] ) sum += table [ 0 ] [ i ] - table [ 1 ] [ i ] ; } System . out . println ( sum ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { solve ( ) ; } private static void solve ( ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] nums = new int [ n ] ; int first = 0 ; int second = 0 ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( nums [ i ] == first ) { System . out . println ( second ) ; } else { System . out . println ( " [LOG] Block: System.out.println(first); " ) ; System . out . println ( first ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int count = 0 ; for ( int ca = 0 ; ca < A + 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 ) { System . out . println ( " [LOG] Block: ++count; " ) ; ++ count ; } } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { 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 sa = 0 ; int sb = 0 ; int sc = 0 ; char next = 'a' ; boolean flag = true ; char winner = 0 ; while ( flag ) { switch ( next ) { case 'a' : if ( sa == SA . length ( ) ) { flag = false ; winner = 'A' ; } else { next = SA . charAt ( sa ) ; sa ++ ; } 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 { System . out . println ( " [LOG] Block: next = SC.charAt(sc); \n sc++; " ) ; next = SC . charAt ( sc ) ; sc ++ ; } break ; } } System . out . println ( winner ) ; scan . close ( ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int inputN = scan . nextInt ( ) ; int inputQ = scan . nextInt ( ) ; int [ ] memory = new int [ inputN + 1 ] ; memory [ 0 ] = 0 ; String inputStr = scan . next ( ) ; for ( int n = 2 ; n < inputN + 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 ( " [LOG] Block: System.out.println(ans.get(i)); " ) ; System . out . println ( ans . get ( i ) ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long ret = 0; \n long rep = (long) (n / (a + b)); \n ret += rep * a; \n long remain = n - (rep * (a + b)); \n System.out.println(ret + Math.max(0, Math.min(a, remain))); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ret = 0 ; long rep = ( long ) ( n / ( a + b ) ) ; ret += rep * a ; long remain = n - ( rep * ( a + b ) ) ; System . out . println ( ret + Math . max ( 0 , Math . min ( a , remain ) ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a * b % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Odd \" ); " ) ; System . out . println ( " Odd " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int startNum ; int endNum ; int answer = 0 ; Scanner sc = new Scanner ( System . in ) ; startNum = sc . nextInt ( ) ; endNum = sc . nextInt ( ) ; for ( int i = startNum ; 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 ) ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } } System . out . println ( answer ) ; } } +import java . util . * ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigDecimal L = new BigDecimal(sc.next()); \n BigDecimal three = new BigDecimal( \" 3 \" ); \n L = L.divide(three, 6, BigDecimal.ROUND_HALF_UP); \n System.out.println(L.multiply(L).multiply(L)); " ) ; 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 . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int A , B , C , mili = 0 ; A = reader . nextInt ( ) ; B = reader . nextInt ( ) ; C = reader . nextInt ( ) ; mili = ( B + C ) - A ; if ( mili > 0 ) { System . out . println ( mili ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int a , b ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { String [ ] input = sc . nextLine ( ) . split ( " " ) ; a = Integer . parseInt ( input [ 0 ] ) ; b = Integer . parseInt ( input [ 1 ] ) ; if ( a == 0 && b == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . println ( Math . min ( a , b ) + " " + Math . max ( a , b ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; int first = num / 100 ; int last = num % 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 ) { System . out . println ( " [LOG] Block: answer = \" MMYY \" ; " ) ; answer = " MMYY " ; } System . out . println ( answer ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 i = 0 ; i < Integer . parseInt ( turn ) ; i ++ ) { 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 { System . out . println ( " [LOG] Block: hanako += 3; " ) ; hanako += 3 ; } } s . close ( ) ; System . out . println ( tarou + " " + hanako ) ; } } +import java . lang . reflect . Array ; import java . util . * ; public class Main { static int N ; static int K ; static long Q ; static int A ; static int B ; static long C ; static double min = 9999999 ; static long ans = 0 ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int A = scanner.nextInt(); \n int B = scanner.nextInt(); \n int T = scanner.nextInt(); \n System.out.println((T / A) * B); " ) ; 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 . * ; class Main { private static Scanner sc ; public static void main ( final String [ ] args ) { sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) , ans = 0 , num = 100 ; while ( true ) { if ( num >= a ) { System . out . println ( " [LOG] Block: System.out.println(ans); \n break; " ) ; System . out . println ( ans ) ; break ; } num += num / 100 ; ans ++ ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { if ( i % 3 != 0 && i % 5 != 0 ) ans += i ; } System . out . println ( ans ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; if ( str . matches ( " A[a-z]+C[a-z]+ " ) ) { System . out . println ( " AC " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); " ) ; System . out . println ( " WA " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = 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 = X ; for ( int i = 0 ; i <= 101 ; i ++ ) { if ( q [ i ] == 0 ) { if ( Math . abs ( X - i ) < minDif ) { System . out . println ( " [LOG] Block: ans = i; \n minDif = Math.abs(X - i); " ) ; ans = i ; minDif = Math . abs ( X - i ) ; } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String alpha = sc . next ( ) ; if ( alpha . toUpperCase ( ) . equals ( alpha ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n System.out.printf( \" %d %d %.10f \" , a / b, a % b, (double) a / b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . printf ( " %d %d %.10f " , a / b , a % b , ( double ) a / b ) ; } } +import java . util . Scanner ; public class Main { static Scanner sc = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( sc . hasNext ( ) ) { long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long x = a ; long y = b ; long max = y ; while ( x % y != 0 ) { System . out . println ( " [LOG] Block: max = x % y; \n x = y; \n y = max; " ) ; max = x % y ; x = y ; y = max ; } long min = a * b / max ; System . out . println ( max + " " + min ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int strNum = sc . nextInt ( ) ; int strLen = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] strs = new String [ strNum ] ; for ( int i = 0 ; i < strNum ; i ++ ) { strs [ i ] = sc . nextLine ( ) ; } for ( int i = 0 ; i < strNum ; i ++ ) { for ( int j = i + 1 ; j < strNum ; 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 . println ( " [LOG] Block: System.out.print(strs[i]); " ) ; System . out . print ( strs [ i ] ) ; } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; if ( N >= 195 ) { ans = 5 ; } else if ( N >= 189 ) { ans = 4 ; } else if ( N >= 165 ) { ans = 3 ; } else if ( N >= 135 ) { ans = 2 ; } else if ( N >= 105 ) { System . out . println ( " [LOG] Block: ans = 1; " ) ; ans = 1 ; } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int L = Integer . parseInt ( sc . next ( ) ) ; int [ ] data = new int [ N ] ; int sum = 0 ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { data [ i ] = L + i ; sum += data [ i ] ; if ( Math . abs ( min ) > Math . abs ( data [ i ] ) ) { System . out . println ( " [LOG] Block: min = data[i]; " ) ; min = data [ i ] ; } } System . out . println ( sum - min ) ; } } +import java . util . HashSet ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 ++ ) { System . out . println ( " [LOG] Block: hs.add(sc.nextInt()); " ) ; hs . add ( sc . nextInt ( ) ) ; } } System . out . println ( n - hs . size ( ) ) ; } } +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 Main { public static long [ ] num = new long [ 1023 ] ; public static int k = 0 ; public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); \n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); \n in.nextToken(); \n int a = (int) in.nval; \n in.nextToken(); \n int b = (int) in.nval; \n out.println(a * b); \n out.flush(); " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n String S = scanner.next(); \n switch(S) { \n case \" Sunny \" : \n System.out.println( \" Cloudy \" ); \n break; \n case \" Rainy \" : \n System.out.println( \" Sunny \" ); \n break; \n case \" Cloudy \" : \n System.out.println( \" Rainy \" ); \n break; \n } " ) ; Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; switch ( S ) { case " Sunny " : System . out . println ( " Cloudy " ) ; break ; case " Rainy " : System . out . println ( " Sunny " ) ; break ; case " Cloudy " : System . out . println ( " Rainy " ) ; break ; } } } +import java . io . * ; class Main { 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 i = 0 ; i < a . length ; i ++ ) { System . out . println ( " [LOG] Block: if (Character.isLowerCase(a[i])) \n System.out.print(Character.toUpperCase(a[i])); \n else if (Character.isUpperCase(a[i])) \n System.out.print(Character.toLowerCase(a[i])); \n else \n System.out.print(a[i]); \n if (i == a.length - 1) \n System.out.println(); " ) ; if ( Character . isLowerCase ( a [ i ] ) ) System . out . print ( Character . toUpperCase ( a [ i ] ) ) ; else if ( Character . isUpperCase ( a [ i ] ) ) System . out . print ( Character . toLowerCase ( a [ i ] ) ) ; else System . out . print ( a [ i ] ) ; if ( i == a . length - 1 ) System . out . println ( ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; do_ ( inp ) ; inp . close ( ) ; } public static void do_ ( Scanner inp ) { System . out . println ( " [LOG] Block: int a = inp.nextInt(); \n int b = inp.nextInt(); \n int c = inp.nextInt(); \n System.out.println(c + \" \" + a + \" \" + b); " ) ; int a = inp . nextInt ( ) ; int b = inp . nextInt ( ) ; int c = inp . nextInt ( ) ; System . out . println ( c + " " + a + " " + b ) ; } } +import java . util . Scanner ; public class Main { 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 idxa = 0 ; int idxb = 0 ; int idxc = 0 ; char temp = 'A' ; while ( true ) { if ( temp == 'A' ) { if ( idxa >= a . length ( ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } temp = a . charAt ( idxa ) ; idxa ++ ; } else if ( temp == 'B' ) { if ( idxb >= b . length ( ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } temp = b . charAt ( idxb ) ; idxb ++ ; } else if ( temp == 'C' ) { if ( idxc >= c . length ( ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } temp = c . charAt ( idxc ) ; idxc ++ ; } } System . out . println ( temp ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int yen = sc . nextInt ( ) ; int s = yen / 1000 - n ; for ( int i = 0 ; i <= Math . min ( s / 9 , n ) ; i ++ ) { for ( int j = 0 ; j <= Math . min ( n - i , s / 4 ) ; j ++ ) { if ( i * 9 + j * 4 == s ) { System . out . println ( i + " " + j + " " + ( n - 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 ) { System . out . println ( " [LOG] Block: if (x < y) \n return gcd(y, x); \n if (y == 0) \n return x; \n return gcd(y, x % y); " ) ; if ( x < y ) return gcd ( y , x ) ; if ( y == 0 ) return x ; return gcd ( y , x % y ) ; } } +import java . util . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String str = sc . next ( ) ; String ans = " " ; if ( str . equals ( " ABC " ) ) ans = " ARC " ; else ans = " ABC " ; System . out . println ( ans ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; sc . close ( ) ; int ans = 0 ; if ( num < 10 ) { ans = num ; } else if ( num < 100 ) { ans = 9 ; } else if ( num < 1000 ) { ans = num - 99 + 9 ; } else if ( num < 10000 ) { ans = 999 - 99 + 9 ; } else if ( num < 100000 ) { ans = num - 9999 + 999 - 99 + 9 ; } else if ( num < 1000000 ) { System . out . println ( " [LOG] Block: ans = 99999 - 9999 + 999 - 99 + 9; " ) ; ans = 99999 - 9999 + 999 - 99 + 9 ; } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; import static java . lang . Character . isUpperCase ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str = in . next ( ) ; if ( str . equals ( " AAA " ) || str . equals ( " BBB " ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner Ent = new Scanner(System.in); \n int P = Ent.nextInt(); \n int Q = Ent.nextInt(); \n int R = Ent.nextInt(); \n int res1 = P + Q; \n int res2 = R + Q; \n int res3 = R + P; \n System.out.println(Math.min(res1, Math.min(res2, res3))); " ) ; Scanner Ent = new Scanner ( System . in ) ; int P = Ent . nextInt ( ) ; int Q = Ent . nextInt ( ) ; int R = Ent . nextInt ( ) ; int res1 = P + Q ; int res2 = R + Q ; int res3 = R + P ; System . out . println ( Math . min ( res1 , Math . min ( res2 , res3 ) ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int x = 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 = x - j ; int max = x + j ; String mi = String . valueOf ( min ) ; String ma = String . valueOf ( max ) ; if ( ! Arrays . asList ( p ) . contains ( mi ) ) { System . out . println ( x - j ) ; return ; } if ( ! Arrays . asList ( p ) . contains ( ma ) ) { System . out . println ( " [LOG] Block: System.out.println(x + j); \n return; " ) ; System . out . println ( x + j ) ; return ; } } scn . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner o = new Scanner(System.in); \n int a = o.nextInt(); \n int b = o.nextInt(); \n int c = o.nextInt(); \n int k = o.nextInt(); \n int ans = 0; \n ans += Math.min(k, a); \n k -= ans; \n a -= ans; \n int x = Math.min(k, b); \n k -= x; \n b -= x; \n int y = Math.min(k, c); \n ans -= y; \n System.out.println(ans); " ) ; Scanner o = new Scanner ( System . in ) ; int a = o . nextInt ( ) ; int b = o . nextInt ( ) ; int c = o . nextInt ( ) ; int k = o . nextInt ( ) ; int ans = 0 ; ans += Math . min ( k , a ) ; k -= ans ; a -= 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n final int N = sc.nextInt(); \n System.out.println((N + 2 - 1) / 2); " ) ; Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; System . out . println ( ( N + 2 - 1 ) / 2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; while ( n > 0 ) { int sum = 0 ; int [ ] s = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = scan . nextInt ( ) ; sum += s [ i ] ; } double ave = ( double ) sum / n ; double HF = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: HF += (ave - s[i]) * (ave - s[i]); " ) ; HF += ( ave - s [ i ] ) * ( ave - s [ i ] ) ; } HF /= ( double ) n ; HF = Math . pow ( HF , 0.5 ) ; System . out . println ( HF ) ; n = scan . nextInt ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num1 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int tap = 0 ; int outlet = 1 ; while ( num2 > outlet ) { System . out . println ( " [LOG] Block: outlet += num1 - 1; \n tap++; " ) ; outlet += num1 - 1 ; tap ++ ; } System . out . println ( tap ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; do { int h = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; if ( h == 0 && l == 0 ) { break ; } else { for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < l ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print('#'); " ) ; System . out . print ( '#' ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } while ( true ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; GrandGarden solver = new GrandGarden ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class GrandGarden { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = in . nextInt ( ) ; } long result = 0 ; int i = 0 ; while ( i < n ) { if ( h [ i ] == 0 ) { i ++ ; continue ; } int v = 1 ; result += 1 ; h [ i ] -= v ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( h [ j ] > 0 ) { h [ j ] = ( h [ j ] >= v ) ? h [ j ] - v : 0 ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } out . print ( result ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] string = br . readLine ( ) . split ( " " ) ; int x = Integer . parseInt ( string [ 0 ] ) ; int y = Integer . parseInt ( string [ 1 ] ) ; int tmp ; if ( x < y ) { tmp = x ; x = y ; y = tmp ; } int r = x % y ; while ( r != 0 ) { System . out . println ( " [LOG] Block: x = y; \n y = r; \n r = x % y; " ) ; x = y ; y = r ; r = x % y ; } System . out . println ( y ) ; } } +import java . util . Scanner ; public class Main { private static Scanner scan ; public static void main ( String [ ] args ) { scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int l = str . length ( ) ; String rts = " " ; for ( int i = l - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: rts = rts + str.charAt(i); " ) ; rts = rts + str . charAt ( i ) ; } System . out . println ( rts ) ; System . exit ( 0 ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] tmp = scanner . nextLine ( ) . split ( " " ) ; int [ ] list = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { list [ i ] = Integer . parseInt ( tmp [ i ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { int r = i ; int min = Integer . MAX_VALUE ; while ( list [ i ] != 0 ) { while ( r < n && list [ r ] != 0 ) { min = Math . min ( min , list [ r ] ) ; r ++ ; } for ( int k = i ; k < r ; k ++ ) { System . out . println ( " [LOG] Block: list[k] -= min; " ) ; list [ k ] -= min ; } ans += min ; r = i ; } } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: InputStreamReader isr = new InputStreamReader(System.in); \n BufferedReader br = new BufferedReader(isr); \n String buf = br.readLine(); \n StringBuffer sb = new StringBuffer(buf); \n System.out.println(sb.reverse()); " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; StringBuffer sb = new StringBuffer ( buf ) ; System . out . println ( sb . reverse ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String a = stdIn . next ( ) ; if ( a . equals ( " Sunny " ) ) { System . out . println ( " Cloudy " ) ; } if ( a . equals ( " Cloudy " ) ) { System . out . println ( " Rainy " ) ; } if ( a . equals ( " Rainy " ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Sunny \" ); " ) ; System . out . println ( " Sunny " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) == '+') \n n++; \n if (s.charAt(i) == '-') \n n--; " ) ; if ( s . charAt ( i ) == '+' ) n ++ ; if ( s . charAt ( i ) == '-' ) n -- ; } System . out . println ( n ) ; } } +import static java . lang . System . out ; import java . io . File ; import java . util . Scanner ; public class Main { 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 ) { System . out . println ( " [LOG] Block: StringBuffer str = new StringBuffer(scan.nextLine()); \n out.println(str.reverse()); " ) ; StringBuffer str = new StringBuffer ( scan . nextLine ( ) ) ; out . println ( str . reverse ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; String b = scan . next ( ) ; if ( a . equals ( b . substring ( 0 , b . length ( ) - 1 ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int digCount = digCount ( i ) ; if ( digCount % 2 != 0 ) { ans ++ ; } } System . out . println ( ans ) ; } static int digCount ( int n ) { int res = 0 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: res++; \n n /= 10; " ) ; res ++ ; n /= 10 ; } return res ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n + 1 ] ; int [ ] x = new int [ n + 1 ] ; int [ ] y = new int [ n + 1 ] ; t [ 0 ] = 0 ; x [ 0 ] = 0 ; y [ 0 ] = 0 ; boolean result = true ; for ( int i = 1 ; i <= n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String n = s . nextLine ( ) ; String s1 = String . valueOf ( n . charAt ( 0 ) ) ; int i1 = 0 ; int i2 = 0 ; String s2 = " " ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { if ( String . valueOf ( n . charAt ( i ) ) . equals ( s1 ) ) { i1 ++ ; } else { if ( s2 . equals ( " " ) || String . valueOf ( n . charAt ( i ) ) . equals ( s2 ) ) { System . out . println ( " [LOG] Block: s2 = String.valueOf(n.charAt(i)); \n i2++; " ) ; s2 = String . valueOf ( n . charAt ( i ) ) ; i2 ++ ; } } } System . out . println ( i1 == 2 && i2 == 2 ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int i = stdIn . nextInt ( ) ; for ( int n = 1 ; i != 0 ; n ++ ) { System . out . println ( " [LOG] Block: System.out.println( \" Case \" + n + \" : \" + i); \n i = stdIn.nextInt(); " ) ; System . out . println ( " Case " + n + " : " + i ) ; i = stdIn . nextInt ( ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; int m = 0 , n = str . length ( ) - 1 ; char [ ] ch = str . toCharArray ( ) ; for ( int i = n ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: System.out.print(ch[i]); " ) ; System . out . print ( ch [ i ] ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n + 1 ] ; long [ ] b = new long [ n ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } long fii1 = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: long fii = Math.min(a[i] - fii1, b[i]); \n fii1 = Math.min(a[i + 1], b[i] - fii); \n sum += fii + fii1; " ) ; 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 ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = 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 = k - sum + first ; if ( saigo > max ) { System . out . println ( " [LOG] Block: max = saigo; " ) ; max = saigo ; } System . out . println ( k - max ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str = br . readLine ( ) ; int N = 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 < N ; 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 . out . println ( " [LOG] Block: System.exit(0); " ) ; System . exit ( 0 ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; s = s . replaceAll ( " eraser " , " " ) ; s = s . replaceAll ( " erase " , " " ) ; s = s . replaceAll ( " dreamer " , " " ) ; s = s . replaceAll ( " dream " , " " ) ; if ( s . equals ( " " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int input_500 = 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 <= input_500 ; 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 ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } } } System . out . println ( result ) ; } } +import java . io . FileNotFoundException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; int [ ] B = A . clone ( ) ; Arrays . sort ( B ) ; int max = B [ N - 1 ] ; int nextmax = B [ N - 2 ] ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] == max ) { System . out . println ( nextmax ) ; } else { System . out . println ( " [LOG] Block: System.out.println(max); " ) ; System . out . println ( max ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long c = n / (a + b); \n long m = n - c * (a + b); \n if (m < a) \n System.out.println(c * a + m); \n else if (m >= a) \n System.out.println(c * a + a); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = n / ( a + b ) ; long m = n - 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String color1 = sc . next ( ) ; sc . next ( ) ; int color1Cnt = sc . nextInt ( ) ; int color2Cnt = sc . nextInt ( ) ; String disposed = sc . next ( ) ; if ( disposed . equals ( color1 ) ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d %d \" , color1Cnt - 1, color2Cnt); \n return; " ) ; System . out . printf ( " %d %d " , color1Cnt - 1 , color2Cnt ) ; return ; } System . out . printf ( " %d %d " , color1Cnt , color2Cnt - 1 ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n + 1 ] , x = new int [ n + 1 ] , y = new int [ n + 1 ] ; boolean flag = true ; t [ 0 ] = 0 ; x [ 0 ] = 0 ; y [ 0 ] = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < n + 1 ; i ++ ) { System . out . println ( " [LOG] Block: 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) \n flag = false; " ) ; 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 . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] a = new Integer [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( a , Collections . reverseOrder ( ) ) ; int A = a [ 0 ] , B = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( i % 2 == 0 ) { A += a [ i ] ; } else { System . out . println ( " [LOG] Block: B += a[i]; " ) ; B += a [ i ] ; } } System . out . println ( A - B ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { sum += sc . nextInt ( ) ; } if ( sum >= 22 ) { System . out . println ( " [LOG] Block: System.out.println( \" bust \" ); \n return; " ) ; System . out . println ( " bust " ) ; return ; } System . out . println ( " win " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int bigTall = a [ 0 ] ; long count = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( bigTall > a [ i ] ) { int sub = bigTall - a [ i ] ; count += sub ; } else { System . out . println ( " [LOG] Block: bigTall = a[i]; " ) ; bigTall = a [ i ] ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; int a = N / 100 ; int b = ( N % 100 ) / 10 ; int c = N % 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 { System . out . println ( " [LOG] Block: ans += 1 * c; " ) ; ans += 1 * c ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long num = sc . nextLong ( ) ; ArrayList < Integer > numList = new ArrayList < Integer > ( ) ; while ( true ) { int digit = ( int ) ( num % 26L ) ; if ( digit == 0 ) { digit = 26 ; } numList . add ( digit + 96 ) ; num = ( num - digit ) / 26L ; if ( num == 0 ) { break ; } } for ( int i = numList . size ( ) - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: int let = (int) numList.get(i); \n char c = (char) let; \n System.out.print(c); " ) ; int let = ( int ) numList . get ( i ) ; char c = ( char ) let ; System . out . print ( c ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int cnt = 0 ; int z ; for ( int i = 0 ; i <= a ; 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 ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } z = z + 50 * k ; } z += 100 * j ; } } System . out . println ( cnt ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int n = gi ( ) ; int c = 0 ; for ( int i = 1 ; i <= n ; i += 2 ) { if ( yakusuC ( i ) == 8 ) { c ++ ; } } System . out . print ( c ) ; } public static int yakusuC ( int n ) { StringBuilder sb = new StringBuilder ( ) ; int c = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( n % i == 0 ) { c ++ ; } } return c ; } public static long d ( long n ) { String a = String . valueOf ( n ) ; return ( long ) a . length ( ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { System . out . println ( " [LOG] Block: return Double.parseDouble(scanner.next()); " ) ; return Double . parseDouble ( scanner . next ( ) ) ; } } +import java . util . * ; public class Main { Scanner sc ; int N , D ; public Main ( ) { sc = new Scanner ( System . in ) ; } void out ( Object o ) { System . out . println ( o ) ; System . out . flush ( ) ; } public void exec ( ) throws Exception { N = sc . nextInt ( ) ; D = sc . nextInt ( ) ; int n = ( N + 2 * D ) / ( 2 * D + 1 ) ; out ( n ) ; } public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Main m = new Main(); \n m.exec(); " ) ; Main m = new Main ( ) ; m . exec ( ) ; } } +import java . util . * ; public final class Main { private static int solution ( int [ ] array ) { int current = 1 ; int score = 1 ; int minimum = array [ 0 ] ; while ( current < array . length ) { if ( array [ current ] < minimum ) { minimum = array [ current ] ; score ++ ; } current ++ ; } return score ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: array[i] = sc.nextInt(); " ) ; array [ i ] = sc . nextInt ( ) ; } System . out . println ( solution ( array ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] strArr = br.readLine().split( \" \" ); \n double r = Double.parseDouble(strArr[0]); \n double area = r * r * Math.PI; \n double length = 2 * Math.PI * r; \n System.out.printf( \" %.6f %.6f \n \" , area, length); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strArr = br . readLine ( ) . split ( " " ) ; double r = Double . parseDouble ( strArr [ 0 ] ) ; double area = r * r * Math . PI ; double length = 2 * Math . PI * r ; System . out . printf ( " %.6f %.6f \n " , area , length ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] argc ) { 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 j = 0 ; j < N ; j ++ ) { int min = j ; for ( int k = j ; k < N ; 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 < N ; m ++ ) { if ( m == N - 1 ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d \" , A[m]); " ) ; System . out . printf ( " %d " , A [ m ] ) ; } else { System . out . println ( " [LOG] Block: System.out.printf( \" %d \" , A[m]); " ) ; System . out . printf ( " %d " , A [ m ] ) ; } } System . out . printf ( " \n " ) ; System . out . println ( count ) ; } } +import java . util . Scanner ; import java . util . Arrays ; import java . util . stream . Stream ; import java . util . stream . IntStream ; import java . lang . StringBuilder ; public class Main { 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 i = 0 ; i < N . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: int tmp = (int) (N.charAt(i) - '0'); \n cubes[tmp] += 1; " ) ; int tmp = ( int ) ( N . charAt ( i ) - '0' ) ; cubes [ tmp ] += 1 ; } System . out . println ( Math . min ( cubes [ 0 ] , cubes [ 1 ] ) * 2 ) ; } } +import java . util . * ; public class Main { public static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; int [ ] stones = new int [ n + 1 ] ; int [ ] dp = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { stones [ i ] = scanner . nextInt ( ) ; } System . out . println ( solve ( stones , dp , n , k ) ) ; } public static int solve ( int [ ] stones , int [ ] dp , int n , int k ) { if ( n <= 1 ) { return 0 ; } for ( int i = 2 ; i <= n ; i ++ ) { dp [ i ] = Integer . MAX_VALUE ; for ( int j = i - 1 ; j >= 1 && ( i - j ) <= k ; j -- ) { System . out . println ( " [LOG] Block: dp[i] = Math.min(dp[i], Math.abs(stones[i] - stones[j]) + dp[j]); " ) ; dp [ i ] = Math . min ( dp [ i ] , Math . abs ( stones [ i ] - stones [ j ] ) + dp [ j ] ) ; } } return dp [ n ] ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { final String [ ] data = sc . nextLine ( ) . split ( " " ) ; final int n = Integer . parseInt ( data [ 0 ] ) ; final int x = Integer . parseInt ( data [ 1 ] ) ; if ( n == 0 && x == 0 ) break ; int count = 0 ; 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 ++ ) { System . out . println ( " [LOG] Block: if ((i + j + k) == x) \n count++; " ) ; if ( ( i + j + k ) == x ) count ++ ; } } } System . out . println ( count ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int a = scan . nextInt ( ) ; String op = scan . next ( ) ; int b = scan . nextInt ( ) ; if ( op . equals ( " ? " ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } switch ( op ) { case " + " : System . out . println ( a + b ) ; break ; case " - " : System . out . println ( a - b ) ; break ; case " * " : System . out . println ( a * b ) ; break ; case " / " : System . out . println ( a / b ) ; break ; } } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { System . out . println ( " [LOG] Block: final Scanner sc = new Scanner(System.in); \n String s = sc.next().replace( \" 2017 \" , \" 2018 \" ); \n System.out.println(s); \n sc.close(); " ) ; final Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) . replace ( " 2017 " , " 2018 " ) ; System . out . println ( s ) ; sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { String [ ] str = scan . nextLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 2 ] ) ; if ( " ? " . equals ( str [ 1 ] ) ) break ; if ( " + " . equals ( str [ 1 ] ) ) { System . out . println ( a + b ) ; } else if ( " - " . equals ( str [ 1 ] ) ) { System . out . println ( a - b ) ; } else if ( " * " . equals ( str [ 1 ] ) ) { System . out . println ( a * b ) ; } else if ( " / " . equals ( str [ 1 ] ) ) { System . out . println ( " [LOG] Block: System.out.println(a / b); " ) ; System . out . println ( a / b ) ; } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . exec ( ) ; } void exec ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = Math . min ( a , b ) ; i >= 1 ; -- i ) { if ( a % i == 0 && b % i == 0 ) { -- k ; if ( k == 0 ) { System . out . println ( " [LOG] Block: System.out.println(i); \n sc.close(); \n return; " ) ; System . out . println ( i ) ; sc . close ( ) ; return ; } } } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; int count1 = 0 ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( a [ i ] == num ) { num ++ ; } else { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int n = sc . nextInt ( ) ; if ( n == 0 ) { break ; } int [ ] scores = new int [ n ] ; 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 ] / n ; } for ( int i = 0 ; i < scores . length ; i ++ ) { System . out . println ( " [LOG] Block: variance += (double) (scores[i] - average) * (scores[i] - average) / n; " ) ; variance += ( double ) ( scores [ i ] - average ) * ( scores [ i ] - average ) / n ; } System . out . println ( Math . sqrt ( variance ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } long a ; long b ; long c ; long k ; long ans ; public void run ( ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextLong ( ) ; b = sc . nextLong ( ) ; c = sc . nextLong ( ) ; k = sc . nextLong ( ) ; sc . close ( ) ; solve ( ) ; } private void solve ( ) { if ( a < k ) { ans = a ; k -= a ; } else { ans = k ; k = 0 ; } if ( b < k && k > 0 ) { k -= b ; } else { k = 0 ; } if ( k > 0 ) { System . out . println ( " [LOG] Block: ans -= k; " ) ; ans -= k ; } System . out . println ( ans ) ; } } +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 Main { static Scanner sc = new Scanner ( in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int [ ] d = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: d[i] = sc.nextInt(); " ) ; d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; ans = max ( 0 , d [ n / 2 ] - d [ n / 2 - 1 ] ) ; out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] kachi = br . readLine ( ) . split ( " " ) ; String [ ] cost = br . readLine ( ) . split ( " " ) ; int k = 0 ; int c = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { k = Integer . parseInt ( kachi [ i ] ) ; c = Integer . parseInt ( cost [ i ] ) ; if ( k - c > 0 ) { System . out . println ( " [LOG] Block: sum += k - c; " ) ; sum += k - c ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; if ( a . matches ( " ^((dreamer)|(eraser)|(dream)|(erase))+$ " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int [ ] dp = new int [ n + 1 ] ; for ( int i = 2 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: dp[i] = dp[i - 1] + Math.abs(a[i - 1] - a[i - 2]); \n if (i >= 3) \n dp[i] = Math.min(dp[i], dp[i - 2] + Math.abs(a[i - 3] - a[i - 1])); " ) ; 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 [ n ] ) ; } } +import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double w = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; double s = w * h / 2.0 ; int e ; if ( x == w / 2 && y == h / 2 && w % 2 == 0 && h % 2 == 0 ) { e = 1 ; } else { System . out . println ( " [LOG] Block: e = 0; " ) ; e = 0 ; } System . out . println ( s ) ; System . out . println ( e ) ; } } +import java . util . * ; public class Main { 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 count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { sChar [ i ] = s . charAt ( i ) ; cChar [ i ] = c . charAt ( i ) ; if ( sChar [ i ] == cChar [ i ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] ar = br . readLine ( ) . split ( " " ) ; int row = Integer . parseInt ( ar [ 0 ] ) ; int col = Integer . parseInt ( ar [ 1 ] ) ; int [ ] [ ] a = new int [ row ] [ 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 ++ ) { System . out . println ( " [LOG] Block: ans += a[i][n] * b[n]; " ) ; ans += a [ i ] [ n ] * b [ n ] ; } System . out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 1 ; int x = i ; int start = 0 ; while ( i <= n ) { 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 ) { System . out . println ( " [LOG] Block: start = 1; \n continue; " ) ; start = 1 ; continue ; } } } i ++ ; start = 0 ; } System . out . println ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastReader f = new FastReader ( ) ; String line = f . nextLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( char ch : line . toCharArray ( ) ) { if ( ! Character . isAlphabetic ( ch ) ) { sb . append ( ch ) ; } else if ( ch < 97 ) { sb . append ( Character . toChars ( ch + 32 ) ) ; } else { sb . append ( Character . toChars ( ch - 32 ) ) ; } } System . out . println ( sb ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = " " ; if ( S . length ( ) <= K ) { T = S ; } else { for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: T += S.charAt(i); " ) ; T += S . charAt ( i ) ; } T += " ... " ; } sc . close ( ) ; System . out . println ( T ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int No = 0 ; int [ ] buka = new int [ N + 1 ] ; while ( sc . hasNext ( ) ) { buka [ sc . nextInt ( ) ] ++ ; } for ( int i = 1 ; i <= N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(buka[i]); " ) ; System . out . println ( buka [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbd = new Scanner ( System . in ) ; int n = kbd . nextInt ( ) ; int d = kbd . nextInt ( ) ; int num = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long x = kbd . nextInt ( ) ; long y = kbd . nextInt ( ) ; if ( Math . sqrt ( x * x + y * y ) <= d ) { System . out . println ( " [LOG] Block: num++; " ) ; num ++ ; } } System . out . println ( num ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n , count = 1 ; String s ; n = sc . nextInt ( ) ; s = sc . next ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) != s.charAt(i + 1)) \n count++; " ) ; if ( s . charAt ( i ) != s . charAt ( i + 1 ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m , l ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; l = sc . nextInt ( ) ; long [ ] [ ] A = new long [ n ] [ m ] ; long [ ] [ ] B = new long [ m ] [ l ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 . println ( " [LOG] Block: System.out.print(sum + \" \" ); " ) ; System . out . print ( sum + " " ) ; } else System . out . println ( sum ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int [ ] h = new int [ K ] ; int landCt = 0 ; int answer = 0 ; for ( int i = 0 ; i < K ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int start = h [ 0 ] ; for ( int i = 0 ; i < 101 ; i ++ ) { landCt = 0 ; for ( int j = 0 ; j < K - 1 ; j ++ ) { if ( ( h [ j ] == 0 && h [ j + 1 ] > 0 ) || ( j == 0 && h [ 0 ] > 0 ) ) { landCt = landCt + 1 ; } } answer = answer + landCt ; oneMinus ( h ) ; } if ( K != 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 ) { System . out . println ( " [LOG] Block: h[i] = h[i] - 1; " ) ; h [ i ] = h [ i ] - 1 ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String input = sc . next ( ) ; String [ ] inputSplit = input . split ( " " ) ; int num0 = 0 ; for ( int i = 0 ; i < inputSplit . length ; i ++ ) { if ( inputSplit [ i ] . equals ( " 0 " ) ) { System . out . println ( " [LOG] Block: num0++; " ) ; num0 ++ ; } } System . out . print ( Math . min ( num0 , inputSplit . length - num0 ) * 2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; if ( N <= 99 ) { System . out . print ( N * ( int ) Math . pow ( 100 , D ) ) ; } else if ( N == 100 ) { System . out . println ( " [LOG] Block: System.out.print(101 * (int) Math.pow(100, D)); " ) ; System . out . print ( 101 * ( int ) Math . pow ( 100 , D ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String st = s . nextLine ( ) ; int cnt = 0 ; for ( int i = 0 ; i < st . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (st.charAt(i) == 'R') \n cnt += 1; \n else if (cnt != 0) \n break; " ) ; if ( st . charAt ( i ) == 'R' ) cnt += 1 ; else if ( cnt != 0 ) break ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; char [ ] chars = s . toCharArray ( ) ; int count = 0 ; for ( int i = 0 ; i < chars . length / 2 ; i ++ ) { if ( chars [ i ] != chars [ chars . length - 1 - i ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] [ ] houses = new int [ 4 ] [ 3 ] [ 10 ] ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: c[i] += a[i][j] * b[j]; " ) ; c [ i ] += a [ i ] [ j ] * b [ j ] ; } System . out . println ( c [ i ] ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int debt = 100000 ; int n = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { debt *= 1.05 ; if ( ( debt - ( ( debt / 1000 ) * 1000 ) ) != 0 ) { debt = ( debt / 1000 ) * 1000 + 1000 ; } else { System . out . println ( " [LOG] Block: debt = (debt / 1000) * 1000; " ) ; debt = ( debt / 1000 ) * 1000 ; } } System . out . println ( debt ) ; } } +import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; ArrayList < String > S = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: S.add(sc.next()); " ) ; S . add ( sc . next ( ) ) ; } Collections . sort ( S ) ; for ( int i = 0 ; i < N ; i ++ ) System . out . print ( S . get ( i ) ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String[] t = { \" eraser \" , \" erase \" , \" dreamer \" , \" dream \" } ; \n for (int i = 0; i < 4; i++) s = s.replace(t[i], \" \" ); \n System.out.println(s.equals( \" \" ) ? \" YES \" : \" NO \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] t = { " eraser " , " erase " , " dreamer " , " dream " } ; for ( int i = 0 ; i < 4 ; i ++ ) s = s . replace ( t [ i ] , " " ) ; System . out . println ( s . equals ( " " ) ? " YES " : " NO " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; in . nextLine ( ) ; int [ ] N = new int [ n ] ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: if (N[i] == 0) \n count++; " ) ; if ( N [ i ] == 0 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final String s = sc . next ( ) ; final String t = sc . next ( ) ; sc . close ( ) ; String result = " No " ; if ( t . length ( ) == s . length ( ) + 1 && t . substring ( 0 , s . length ( ) ) . equals ( s ) ) { System . out . println ( " [LOG] Block: result = \" Yes \" ; " ) ; result = " Yes " ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int min1 = 0 ; int min2 = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( i % 2 == Character . getNumericValue ( str . charAt ( i ) ) ) { min1 += 1 ; } else { System . out . println ( " [LOG] Block: min2 += 1; " ) ; min2 += 1 ; } } System . out . println ( Math . min ( min1 , min2 ) ) ; } } +import java . math . BigInteger ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n BigInteger a = BigInteger.valueOf(sc.nextLong()); \n BigInteger b = BigInteger.valueOf(sc.nextLong()); \n BigInteger c = BigInteger.valueOf(sc.nextLong()); \n BigInteger d = BigInteger.valueOf(sc.nextLong()); \n BigInteger mul = a.multiply(c); \n if (mul.compareTo(a.multiply(d)) < 0) \n mul = a.multiply(d); \n if (mul.compareTo(b.multiply(c)) < 0) \n mul = b.multiply(c); \n if (mul.compareTo(b.multiply(d)) < 0) \n mul = b.multiply(d); \n System.out.println(mul); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; int n = S . length ( ) ; boolean OK = true ; int i = 0 ; int j = ( n - 1 ) / 2 - 1 ; while ( j - i >= 1 ) { if ( s [ i ] == s [ j ] && s [ n - 1 - i ] == s [ n - 1 - j ] ) { i ++ ; j -- ; } else { System . out . println ( " [LOG] Block: OK = false; \n break; " ) ; OK = false ; break ; } } for ( int k = 0 ; k < n / 2 ; k ++ ) { if ( s [ k ] != s [ n - 1 - k ] ) { System . out . println ( " [LOG] Block: OK = false; \n break; " ) ; OK = false ; break ; } } System . out . println ( OK ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { 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 hp = 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 >= hp ) { System . out . println ( " [LOG] Block: result = \" Yes \" ; \n break; " ) ; result = " Yes " ; break ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , x = sc . nextInt ( ) ; int cnt = n <= x ? 1 : 0 , cur = 0 , temp ; for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( " [LOG] Block: temp = sc.nextInt(); \n cur += temp; \n if (cur <= x) \n ++cnt; " ) ; temp = sc . nextInt ( ) ; cur += temp ; if ( cur <= x ) ++ cnt ; } System . out . printf ( " %d \n " , cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int [ ] b = new int [ a ] ; int c = Integer . MAX_VALUE ; int d = Integer . MIN_VALUE ; long e = 0 ; for ( int i = 0 ; i < a ; i ++ ) { System . out . println ( " [LOG] Block: int f = scanner.nextInt(); \n c = Math.min(c, f); \n d = Math.max(d, f); \n e += f; " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int num = 1 ; for ( int i = 0 ; i < 9 ; i ++ ) { if ( N - 111 > 0 ) { N -= 111 ; } else { System . out . println ( " [LOG] Block: num += i; \n break; " ) ; num += i ; break ; } } System . out . println ( num * 111 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int change ; Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 0 && y == 0 ) break ; if ( x > y ) { System . out . println ( " [LOG] Block: change = x; \n x = y; \n y = change; " ) ; change = x ; x = y ; y = change ; } System . out . println ( x + " " + y ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i <= A ; i ++ ) { int ans1 = + 500 * i ; for ( int j = 0 ; j <= B ; j ++ ) { int ans2 = + 100 * j ; for ( int k = 0 ; k <= C ; k ++ ) { int ans3 = + 50 * k ; if ( ans1 + ans2 + ans3 == X ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } } System . out . print ( ans ) ; } } +import java . util . Scanner ; class Main { 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 ( ) ; } boolean flag = true ; int swap ; int count = 0 ; int min ; for ( int i = 0 ; i < n ; i ++ ) { min = i ; for ( int j = i ; j < n ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[i]); \n if (i != n - 1) \n System.out.print( \" \" ); " ) ; System . out . print ( a [ i ] ) ; if ( i != n - 1 ) System . out . print ( " " ) ; } System . out . println ( ) ; System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int first, second; \n first = sc.nextInt(); \n second = sc.nextInt(); \n if (first > 0 && first < 10 && second > 0 && second < 10) \n System.out.println(first * second); \n else \n System.out.println( \" -1 \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int first , second ; first = sc . nextInt ( ) ; second = sc . nextInt ( ) ; if ( first > 0 && first < 10 && second > 0 && second < 10 ) System . out . println ( first * second ) ; else System . out . println ( " -1 " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] num = new int [ 2 * N ] ; int min = 1001 ; for ( int i = 0 ; i < 2 * N ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( num [ 2 * i + 1 ] > T ) { num [ 2 * i ] = 1001 ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( min > num [ 2 * i ] ) { min = num [ 2 * i ] ; } } if ( min == 1001 ) { System . out . println ( " TLE " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(min); " ) ; System . out . println ( min ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; w ++ ) { y = 0 ; for ( int e = 0 ; e < m ; e ++ ) { System . out . println ( " [LOG] Block: y += a[w][e] * b[e]; " ) ; y += a [ w ] [ e ] * b [ e ] ; } System . out . println ( y ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] rate = new int [ 8 ] ; int red = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } min = Math . max ( count , 1 ) ; max = count + red ; System . out . println ( min + " " + max ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; static void p ( String ans ) { System . out . println ( ans ) ; } static void p ( int ans ) { System . out . println ( ans ) ; } static void p ( long ans ) { System . out . println ( ans ) ; } static void p ( double ans ) { System . out . println ( ans ) ; } public static void main ( String [ ] args ) { String s = sc . next ( ) ; int ctn = 0 ; for ( int i = 0 ; i < s . length ( ) / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( s . length ( ) - i - 1 ) ) { System . out . println ( " [LOG] Block: ctn++; " ) ; ctn ++ ; } } p ( ctn ) ; } } +import java . util . * ; public class Main { static String Rort ( String s , String t ) { String ss = s + s ; ss = ss . replaceFirst ( t , " " ) ; if ( ss . equals ( s ) ) return " Yes " ; return " No " ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.next(); \n String T = sc.next(); \n System.out.println(Rort(S, T)); " ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; System . out . println ( Rort ( S , T ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner stdin = new Scanner ( System . in ) ; int N = 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 ) ) ) ) { System . out . println ( " [LOG] Block: copy = S.substring(i, i + 1); \n cnt += 1; " ) ; copy = S . substring ( i , i + 1 ) ; cnt += 1 ; } } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int n = 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 < n ; i ++ ) { count = 0 ; for ( int j = 0 ; j < a . length ; j ++ ) { if ( a [ j ] == i + 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } if ( b [ j ] == i + 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sca = new Scanner(System.in); \n String c = sca.next(); \n char d = c.charAt(0); \n System.out.println((char) (d + 1)); \n sca.close(); " ) ; Scanner sca = new Scanner ( System . in ) ; String c = sca . next ( ) ; char d = c . charAt ( 0 ) ; System . out . println ( ( char ) ( d + 1 ) ) ; sca . close ( ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int w , n , right , left , x ; String str ; w = Integer . parseInt ( bf . readLine ( ) ) ; n = Integer . parseInt ( bf . readLine ( ) ) ; int [ ] order = new int [ w ] ; for ( int i = 0 ; i < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(order[i]); " ) ; System . out . println ( order [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = 0 ; int W = 0 ; while ( true ) { H = sc . nextInt ( ) ; W = sc . nextInt ( ) ; if ( H != 0 && W != 0 ) { for ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . print ( " # " ) ; } System . out . print ( " \n " ) ; } System . out . println ( " " ) ; } else { System . out . println ( " [LOG] Block: return; " ) ; return ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int [ ] num_road = new int [ N ] ; int [ ] a = new int [ M ] ; int [ ] b = new int [ M ] ; int i ; for ( i = 0 ; i < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(num_road[i]); " ) ; System . out . println ( num_road [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; final int NUM = scan . nextInt ( ) ; final int M = scan . nextInt ( ) ; int [ ] [ ] codes = new int [ NUM ] [ 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 < NUM ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { codes [ i ] [ j ] = scan . nextInt ( ) ; } } int count = 0 ; for ( int i = 0 ; i < NUM ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < M ; j ++ ) { sum += codes [ i ] [ j ] * rate [ j ] ; } sum += bonus ; if ( sum > 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean [ ] a = new boolean [ 3 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { a [ sc . nextInt ( ) - 1 ] = true ; } for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: if (!a[i]) \n System.out.println(i + 1); " ) ; if ( ! a [ i ] ) System . out . println ( i + 1 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n sc.nextInt(); \n sc.nextInt(); \n sc.nextInt(); \n int e = sc.nextInt(); \n int k = sc.nextInt(); \n System.out.println(e - a > k ? \" :( \" : \" Yay! \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( e - a > k ? " :( " : " Yay! " ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; Map < String , Long > m = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; 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 ( ) ) { System . out . println ( " [LOG] Block: ans += v * (v - 1) / 2; " ) ; ans += v * ( v - 1 ) / 2 ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; import java . util . Collections ; import java . util . List ; import java . util . ArrayList ; public class Main { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; int count = scan . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; while ( scan . hasNextInt ( ) ) { list . add ( scan . nextInt ( ) ) ; } Collections . sort ( list ) ; double x = 0 ; for ( int num : list ) { System . out . println ( " [LOG] Block: x = x == 0 ? num : (num + x) / 2; " ) ; x = x == 0 ? num : ( num + x ) / 2 ; } System . out . println ( x ) ; } } +import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] b = new int [ n - 1 ] ; int result = 0 ; int pre = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; if ( i == 0 ) result = result + b [ i ] ; if ( i > 0 ) { System . out . println ( " [LOG] Block: result = result + min(pre, b[i]); " ) ; result = result + min ( pre , b [ i ] ) ; } if ( i == n - 2 ) result = result + b [ i ] ; pre = b [ i ] ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double num = sc.nextDouble(); \n double ans; \n ans = Math.ceil(num / 2); \n int a; \n a = (int) ans; \n System.out.println(a); \n return; " ) ; Scanner sc = new Scanner ( System . in ) ; double num = sc . nextDouble ( ) ; double ans ; ans = Math . ceil ( num / 2 ) ; int a ; a = ( int ) ans ; System . out . println ( a ) ; return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N , T , A ; N = sc . nextInt ( ) ; T = sc . nextInt ( ) ; A = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; double max = 99999 ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextInt ( ) ; double t = T - H [ i ] * 0.006 ; if ( max > Math . abs ( A - t ) ) { System . out . println ( " [LOG] Block: ; \n max = Math.abs(A - t); \n ans = i + 1; " ) ; ; max = Math . abs ( A - t ) ; ans = i + 1 ; } } sc . close ( ) ; System . out . println ( ans ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int a = cin . nextInt ( ) , b = cin . nextInt ( ) ; System . out . println ( GCD ( a , b ) ) ; } public static int GCD ( int a , int b ) { System . out . println ( " [LOG] Block: if (b == 0) \n return a; \n return GCD(b, a % b); " ) ; if ( b == 0 ) return a ; return GCD ( b , a % b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String H = sc . next ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; String U = sc . next ( ) ; if ( U . equals ( S ) ) { A -- ; } else if ( U . equals ( H ) ) { System . out . println ( " [LOG] Block: B--; " ) ; B -- ; } System . out . println ( A ) ; System . out . println ( B ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; StringBuilder ans ; int cnt = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { ans = new StringBuilder ( " " + i ) ; if ( ans . length ( ) % 2 != 0 ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } System . out . println ( cnt ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { System . out . println ( " [LOG] Block: char[] charStr = br.readLine().toCharArray(); \n StringBuilder rvsStr = new StringBuilder(); \n for (int i = charStr.length - 1; i > -1; i--) rvsStr.append(charStr[i]); \n System.out.println(rvsStr); " ) ; char [ ] charStr = br . readLine ( ) . toCharArray ( ) ; StringBuilder rvsStr = new StringBuilder ( ) ; for ( int i = charStr . length - 1 ; i > - 1 ; i -- ) rvsStr . append ( charStr [ i ] ) ; System . out . println ( rvsStr ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i ++ ) { c [ i ] = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j ++ ) { c [ i ] [ j ] = stdin . nextInt ( ) ; } } String result = " No " ; int a2 = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; int a3 = c [ 2 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( ( c [ 1 ] [ 1 ] == ( a2 + c [ 0 ] [ 1 ] ) ) && ( c [ 1 ] [ 2 ] == ( a2 + c [ 0 ] [ 2 ] ) ) && ( c [ 2 ] [ 1 ] == ( a3 + c [ 0 ] [ 1 ] ) ) && ( c [ 2 ] [ 2 ] == ( a3 + c [ 0 ] [ 2 ] ) ) ) { System . out . println ( " [LOG] Block: result = \" Yes \" ; " ) ; result = " Yes " ; } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = null ; sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; sc . close ( ) ; String before = " " ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( i == 0 ) { if ( s . substring ( 0 , 1 ) . equals ( " R " ) ) { System . out . println ( " [LOG] Block: ans = 1; " ) ; ans = 1 ; } before = s . substring ( 0 , 1 ) ; } else { if ( s . substring ( i , i + 1 ) . equals ( " R " ) && before . equals ( " R " ) ) { ans += 1 ; } else if ( s . substring ( i , i + 1 ) . equals ( " R " ) && before . equals ( " S " ) ) { System . out . println ( " [LOG] Block: ans = 1; " ) ; ans = 1 ; } before = s . substring ( i , i + 1 ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a != 1 && b != 1 ) { System . out . println ( 1 ) ; } else if ( a != 2 && b != 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(3); " ) ; System . out . println ( 3 ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long min = Integer . MAX_VALUE ; for ( long a = 1 ; a <= Math . sqrt ( ( double ) N ) ; a ++ ) { if ( N % a == 0 ) { System . out . println ( " [LOG] Block: long b = N / a; \n int f = Math.max(String.valueOf(a).length(), String.valueOf(b).length()); \n if (f < min) \n min = f; " ) ; long b = N / 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 . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d ; d = 0 ; while ( a <= b ) { if ( c % a == 0 ) { System . out . println ( " [LOG] Block: d = d + 1; " ) ; d = d + 1 ; } a = a + 1 ; } System . out . println ( d ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] m = new int [ n ] ; int minCost = Integer . MAX_VALUE ; int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: m[i] = sc.nextInt(); \n minCost = Math.min(minCost, m[i]); \n total += m[i]; " ) ; m [ i ] = sc . nextInt ( ) ; minCost = Math . min ( minCost , m [ i ] ) ; total += m [ i ] ; } System . out . println ( ( x - total ) / minCost + n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A == B ) { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } else if ( ( A + B ) % 2 == 0 ) { System . out . println ( ( A + B ) / 2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } sc . close ( ) ; } } +import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n - 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 < n ; i ++ ) { if ( map . containsKey ( i + 1 ) ) { System . out . println ( " [LOG] Block: System.out.println(map.get(i + 1)); " ) ; System . out . println ( map . get ( i + 1 ) ) ; } else System . out . println ( 0 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long m = sc . nextInt ( ) ; long n = sc . nextInt ( ) ; long k = 0 ; boolean stop = false ; if ( m < n ) { k = m ; } else { k = n ; } for ( ; k >= 1 && stop == false ; k -- ) { if ( n % k == 0 && m % k == 0 ) { System . out . println ( " [LOG] Block: stop = true; " ) ; stop = true ; } } long l = n * m / ( k + 1 ) ; System . out . println ( l ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int count = 0 ; String s = br . readLine ( ) ; String t = br . readLine ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) { count ++ ; } } System . out . println ( count ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] arrayA = new int [ N ] ; 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 ++ ) { System . out . println ( " [LOG] Block: wa = seki / arrayA[i] + wa; " ) ; wa = seki / arrayA [ i ] + wa ; } System . out . println ( seki / wa ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class Main { static Scanner sc = new Scanner ( ) ; public static void main ( final String [ ] args ) throws IOException { int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ sc . nextInt ( ) - 1 ] = i + 1 ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] + " " ) ; } } static class Scanner { 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 { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int A = scanner.nextInt(); \n int B = scanner.nextInt(); \n int H = scanner.nextInt(); \n int M = scanner.nextInt(); \n double sita = ((double) H / 12 + (double) M / 12 / 60 - (double) M / 60) * 2 * Math.PI; \n sita = sita < 0 ? -(double) sita : sita; \n double answer = Math.sqrt((double) (Math.pow(A, 2) + Math.pow(B, 2) - (double) ((double) (2 * A * B) * Math.cos(sita)))); \n System.out.print(answer); " ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double sita = ( ( double ) H / 12 + ( double ) M / 12 / 60 - ( double ) M / 60 ) * 2 * Math . PI ; sita = sita < 0 ? - ( double ) sita : sita ; double answer = Math . sqrt ( ( double ) ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( double ) ( ( double ) ( 2 * A * B ) * Math . cos ( sita ) ) ) ) ; System . out . print ( answer ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; int n = Integer . parseInt ( str ) ; int h_point = 0 , t_point = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: t_point++; \n h_point++; " ) ; t_point ++ ; h_point ++ ; } } System . out . println ( t_point + " " + h_point ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int counter = 0 ; int min = Integer . MAX_VALUE ; ArrayList < Integer > pi = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { int numPi = Integer . parseInt ( scan . next ( ) ) ; if ( i == 0 ) { counter ++ ; } else { if ( numPi <= min ) { counter ++ ; } } if ( min > numPi ) { System . out . println ( " [LOG] Block: min = numPi; " ) ; min = numPi ; } } System . out . println ( counter ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int a = 0 ; int b = 0 ; for ( int i = 1 ; i <= n ; i += 2 ) { for ( int j = 1 ; j <= n ; j += 2 ) { if ( i % j == 0 && i >= j ) { a ++ ; if ( a == 8 ) { System . out . println ( " [LOG] Block: b++; " ) ; b ++ ; } } } a = 0 ; } System . out . print ( b ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String s = scn . next ( ) ; int ans = 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 { System . out . println ( " [LOG] Block: ans = Math.max(nans, ans); \n nans = 0; \n i++; " ) ; ans = Math . max ( nans , ans ) ; nans = 0 ; i ++ ; } } ans = Math . max ( nans , ans ) ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; PriorityQueue < Integer > queue = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { queue . add ( sc . nextInt ( ) ) ; } int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: sum += queue.poll(); " ) ; sum += queue . poll ( ) ; } System . out . println ( queue . poll ( ) < sum ? " Yes " : " No " ) ; } } +import java . util . Scanner ; class Main { 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 i = c . length ; i > 0 ; i -- ) { System . out . println ( " [LOG] Block: reverse += c[i - 1]; " ) ; reverse += c [ i - 1 ] ; } System . out . println ( reverse ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n + 1 ] ; int [ ] x = new int [ n + 1 ] ; int [ ] y = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; 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 <= n ; 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 . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int b = 0 ; int [ ] c = new int [ n - 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b += sc . nextInt ( ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { int r = a [ i ] ; int f = a [ i - 1 ] ; if ( ( r - f ) == 1 ) { System . out . println ( " [LOG] Block: b += c[f - 1]; " ) ; b += c [ f - 1 ] ; } } System . out . println ( b ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . next ( ) . length ( ) ; String s = " " ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: s += 'x'; " ) ; s += 'x' ; } out . print ( s ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; 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 [ n + 1 ] ; int [ ] waA = new int [ n + 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 { System . out . println ( " [LOG] Block: ac++; \n wa += waA[a]; \n acA[a] = true; " ) ; ac ++ ; wa += waA [ a ] ; acA [ a ] = true ; } } System . out . println ( ac + " " + wa ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = 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 >= l && temp <= r ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } } System . out . println ( count ) ; } } +import java . io . * ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: double r, s, l; \n InputStreamReader isr = new InputStreamReader(System.in); \n BufferedReader br = new BufferedReader(isr); \n String buf = br.readLine(); \n r = Double.parseDouble(buf); \n s = r * r * Math.PI; \n l = 2 * r * Math.PI; \n System.out.printf( \" %.6f %.6f \n \" , s, l); " ) ; double r , s , l ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; r = Double . parseDouble ( buf ) ; s = r * r * Math . PI ; l = 2 * r * Math . PI ; System . out . printf ( " %.6f %.6f \n " , s , l ) ; } } +import java . util . * ; import java . io . * ; class Main { 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 i = str . length - 1 ; i >= 0 ; i -- ) { System . out . print ( str [ i ] ) ; } } else { System . exit ( 0 ) ; } System . out . println ( " " ) ; System . exit ( 0 ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 100000 ; for ( int i = 0 ; i < n ; i ++ ) { x = ( int ) ( 1.05 * x ) ; if ( x % 1000 != 0 ) { System . out . println ( " [LOG] Block: x = ((x / 1000) + 1) * 1000; " ) ; x = ( ( x / 1000 ) + 1 ) * 1000 ; } } System . out . println ( x ) ; } } +import java . util . * ; import static java . util . Map . Entry . comparingByValue ; import static java . util . stream . Collectors . toMap ; public class Main { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int N = Input . nextInt ( ) ; HashMap < String , Integer > HM = new HashMap ( ) ; for ( int I = 0 ; I < N ; I ++ ) { String S = Input . next ( ) ; if ( ! HM . containsKey ( S ) ) { System . out . println ( " [LOG] Block: HM.put(S, 0); " ) ; HM . put ( S , 0 ) ; } } System . out . println ( HM . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.nextLine(); \n sc.close(); \n System.out.println(s.lastIndexOf( \" Z \" ) - s.indexOf( \" A \" ) + 1); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; sc . close ( ) ; System . out . println ( s . lastIndexOf ( " Z " ) - s . indexOf ( " A " ) + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = Long . parseLong ( sc . next ( ) ) ; int sqrt = ( int ) Math . sqrt ( n ) ; for ( int i = sqrt ; i >= 1 ; i -- ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: System.out.println(i + n / i - 2); \n break; " ) ; System . out . println ( i + n / i - 2 ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; int c = 0 ; int n = scanner . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; if ( c * c == a * a + b * b || b * b == a * a + c * c || a * a == b * b + c * c ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } } +import java . util . Scanner ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; class Main { 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 H , W ; while ( true ) { H = sc . nextInt ( ) ; W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) break ; height . add ( H ) ; 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 ( " [LOG] Block: System.out.println( \" # \" ); " ) ; System . out . println ( " # " ) ; } } } System . out . println ( " " ) ; countW ++ ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; if ( scanner . hasNextLine ( ) ) { String [ ] array = scanner . nextLine ( ) . split ( " " ) ; long a = Integer . parseInt ( array [ 0 ] ) ; long b = Integer . parseInt ( array [ 1 ] ) ; long c = Integer . parseInt ( array [ 2 ] ) ; int k = Integer . parseInt ( scanner . nextLine ( ) ) ; if ( a > b && a > c ) { for ( int i = 0 ; i < k ; ++ i ) { a *= 2 ; } } else if ( b > c ) { for ( int i = 0 ; i < k ; ++ i ) { b *= 2 ; } } else { for ( int i = 0 ; i < k ; ++ i ) { System . out . println ( " [LOG] Block: c *= 2; " ) ; c *= 2 ; } } System . out . println ( a + b + c ) ; } } } +import java . lang . reflect . Array ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; List < Integer > totalList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i <= n ; 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 ) { System . out . println ( " [LOG] Block: sum += i % 10; \n i /= 10; " ) ; sum += i % 10 ; i /= 10 ; } return sum ; } } +import java . lang . reflect . Array ; import java . util . * ; public class Main { class G { int x , 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 ) { System . out . println ( " [LOG] Block: ok = false; \n System.out.println( \" No \" ); \n break; " ) ; 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 Main { public static void main ( String [ ] args ) throws IOException { int a = 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 ( " " ) ; a = Integer . parseInt ( result [ 0 ] ) ; b = Integer . parseInt ( result [ 1 ] ) ; c = Integer . parseInt ( result [ 2 ] ) ; for ( int i = a ; i <= b ; i += 1 ) { if ( c % i == 0 ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n , sum ; n = nextInt ( ) ; sum = 0 ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; 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 ( " [LOG] Block: System.out.println(a); " ) ; System . out . println ( a ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a = 0 ; Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; a += sc . nextInt ( ) ; a += sc . nextInt ( ) ; if ( a > 21 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" win \" ); " ) ; System . out . println ( " win " ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; final int count = in . next ( ) . trim ( ) . length ( ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < count ; i ++ ) { System . out . println ( " [LOG] Block: sb.append( \" x \" ); " ) ; sb . append ( " x " ) ; } System . out . println ( sb ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; boolean bl = false ; for ( int i = 0 ; i < 3 ; i ++ ) { bl |= ( str . charAt ( i ) == str . charAt ( i + 1 ) ) ; } if ( bl ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Good \" ); " ) ; System . out . println ( " Good " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; int ans = 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' ) ) { ans += 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 ) { ans += count0 * 2 ; } else { System . out . println ( " [LOG] Block: ans += count1 * 2; " ) ; ans += count1 * 2 ; } System . out . println ( ans ) ; } } +public class Main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int a , b , c , d , e ; long f ; a = scan . nextInt ( ) ; d = - 1000000 ; e = 1000000 ; f = 0 ; if ( 0 <= a && a <= 10000 ) { for ( b = 1 ; b <= a ; b ++ ) { c = scan . nextInt ( ) ; if ( - 1000000 <= c && c <= 1000000 ) { if ( c >= d ) { d = c ; } if ( c <= e ) { System . out . println ( " [LOG] Block: e = c; " ) ; e = c ; } f += c ; } } } System . out . print ( e + " " ) ; System . out . print ( d + " " ) ; System . out . println ( f ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] strAry = br.readLine().split( \" \" ); \n int x = Integer.parseInt(strAry[0]); \n int y = Integer.parseInt(strAry[1]); \n int z = Integer.parseInt(strAry[2]); \n String result; \n result = x >= y ? \" No \" : y < z ? \" Yes \" : \" No \" ; \n System.out.println(result); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strAry = br . readLine ( ) . split ( " " ) ; int x = Integer . parseInt ( strAry [ 0 ] ) ; int y = Integer . parseInt ( strAry [ 1 ] ) ; int z = Integer . parseInt ( strAry [ 2 ] ) ; String result ; result = x >= y ? " No " : y < z ? " Yes " : " No " ; System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 [ n ] ; int [ ] wa = new int [ n ] ; 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 < n ; i ++ ) { a += cnt [ i ] ; if ( cnt [ i ] > 0 ) { System . out . println ( " [LOG] Block: w += wa[i]; " ) ; w += wa [ i ] ; } } System . out . println ( a + " " + w ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; for ( int i = A ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String info = br.readLine(); \n String[] fight = info.split( \" \" ); \n int strikes = (int) Math.ceil((Double.parseDouble(fight[0]) / Double.parseDouble(fight[1]))); \n System.out.println(strikes); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String info = br . readLine ( ) ; String [ ] fight = info . split ( " " ) ; int strikes = ( int ) Math . ceil ( ( Double . parseDouble ( fight [ 0 ] ) / Double . parseDouble ( fight [ 1 ] ) ) ) ; System . out . println ( strikes ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n ; double ave , d ; while ( ( n = scan . nextInt ( ) ) != 0 ) { int [ ] point = new int [ n ] ; ave = 0 ; for ( int i = 0 ; i < n ; i ++ ) { point [ i ] = scan . nextInt ( ) ; ave += point [ i ] ; } ave /= ( double ) n ; d = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: d += (Math.pow((ave - point[i]), 2)); " ) ; d += ( Math . pow ( ( ave - point [ i ] ) , 2 ) ) ; } d /= ( double ) n ; d = Math . sqrt ( d ) ; System . out . printf ( " %.8f \n " , d ) ; } scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int start = ( int ) s . charAt ( i ) ; int ans = start + n ; if ( ans < 91 ) { System . out . print ( ( char ) ans ) ; } else { System . out . println ( " [LOG] Block: System.out.print((char) (ans - 26)); " ) ; System . out . print ( ( char ) ( ans - 26 ) ) ; } } System . out . println ( ) ; } } +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 Main { 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 i = 0 ; i < intarray . length ; i ++ ) { intarray [ i ] = Integer . parseInt ( strarray [ i ] ) ; } return intarray ; } static Integer [ ] inputvalInteger ( ) throws Exception { String [ ] strarray = br . readLine ( ) . trim ( ) . split ( " " ) ; Integer [ ] intarray = new Integer [ strarray . length ] ; for ( int i = 0 ; i < intarray . length ; i ++ ) { intarray [ i ] = Integer . parseInt ( strarray [ i ] ) ; } return intarray ; } public static void main ( String [ ] args ) throws Exception { int n = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; HashSet < Integer > st = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int d = Integer.parseInt(br.readLine().trim()); \n st.add(d); " ) ; int d = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; st . add ( d ) ; } System . out . println ( st . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int x = Integer . parseInt ( sc . next ( ) ) ; int y = Integer . parseInt ( sc . next ( ) ) ; String ans = " " ; if ( y % 2 != 0 ) { System . out . println ( " [LOG] Block: ans = \" No \" ; " ) ; ans = " No " ; } else { if ( ( y / 2 ) >= x && x >= ( ( y / 4 ) + ( y % 4 / 2 ) ) ) { ans = " Yes " ; } else { System . out . println ( " [LOG] Block: ans = \" No \" ; " ) ; ans = " No " ; } } System . out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int max = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= max ) { System . out . println ( " [LOG] Block: max = a[i]; \n count = count + 1; " ) ; max = a [ i ] ; count = count + 1 ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; String result = " " ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { String s = str . substring ( i , i + 1 ) ; if ( s . equals ( s . toLowerCase ( ) ) ) { result += s . toUpperCase ( ) ; } else { System . out . println ( " [LOG] Block: result += s.toLowerCase(); " ) ; result += s . toLowerCase ( ) ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; int [ ] g = new int [ n ] ; for ( int i = 0 ; i < q ; i ++ ) { int t = scan . nextInt ( ) ; g [ t - 1 ] += 1 ; } for ( int j = 0 ; j < n ; j ++ ) { if ( k - q + g [ j ] > 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; import java . lang . * ; import java . io . * ; import java . util . Scanner ; class Main { 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 c : chars ) { if ( c == '1' ) { System . out . print ( 9 ) ; } else { System . out . println ( " [LOG] Block: System.out.print(1); " ) ; System . out . print ( 1 ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int flg = 0 ; String ans = " NO " ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; if ( p [ i ] != i + 1 ) { flg += 1 ; } } if ( flg == 0 || flg == 2 ) { System . out . println ( " [LOG] Block: ans = \" YES \" ; " ) ; ans = " YES " ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int A = 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 < A ; i ++ ) { bx += b ; } if ( ax . compareTo ( bx ) < 0 ) { System . out . println ( ax ) ; } else { System . out . println ( " [LOG] Block: System.out.println(bx); " ) ; System . out . println ( bx ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < count ; 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } long sqrt = ( long ) Math . sqrt ( a ) ; for ( int i = 3 ; i <= sqrt ; i += 2 ) { if ( a % i == 0 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; if ( Character . isUpperCase ( str . charAt ( 0 ) ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int [ ] card = new int [ num ] ; int alice = 0 ; int bob = 0 ; for ( int i = 0 ; i < num ; i ++ ) { card [ i ] = sc . nextInt ( ) ; } Arrays . sort ( card ) ; for ( int i = ( num - 1 ) ; i >= 0 ; i -= 2 ) { alice += card [ i ] ; } for ( int j = ( num - 2 ) ; j >= 0 ; j -= 2 ) { System . out . println ( " [LOG] Block: bob += card[j]; " ) ; bob += card [ j ] ; } int division = alice - bob ; System . out . println ( division ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; final int NUM = scan . nextInt ( ) ; String [ ] words = new String [ NUM ] ; for ( int i = 0 ; i < NUM ; 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 < NUM ; i ++ ) { if ( memory . equals ( words [ i ] ) ) { count ++ ; } else { answer += count * ( count - 1 ) / 2 ; memory = words [ i ] ; count = 1 ; } } if ( count >= 2 ) { System . out . println ( " [LOG] Block: answer += count * (count - 1) / 2; " ) ; answer += count * ( count - 1 ) / 2 ; } System . out . println ( answer ) ; } } +import java . util . * ; import java . math . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { int num = 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 ) { System . out . println ( " [LOG] Block: out.println(prod); " ) ; out . println ( prod ) ; } } out . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 ++ ) { System . out . println ( " [LOG] Block: sb.append((char) a.charAt(i) + \" \" ).append((char) b.charAt(j) + \" \" ); " ) ; sb . append ( ( char ) a . charAt ( i ) + " " ) . append ( ( char ) b . charAt ( j ) + " " ) ; } System . out . println ( sb ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . lang . Math . * ; import java . util . * ; import java . math . * ; import java . text . * ; public class Main { 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 count = Integer . parseInt ( br . readLine ( ) ) ; if ( count == 0 ) break ; String [ ] line = br . readLine ( ) . split ( " " ) ; double [ ] points = new double [ count ] ; for ( int i = 0 ; i < count ; 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 ) { System . out . println ( " [LOG] Block: return sum(tag) / tag.length; " ) ; return sum ( tag ) / tag . length ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int left = 0 ; int right = N ; 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 ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n int N = in.nextInt(); \n int M = in.nextInt(); \n long sum = 0; \n sum = 1; \n sum *= N; \n sum *= (N - 1); \n sum /= 2; \n int sumM = 1; \n sumM *= (M - 1); \n sumM *= M; \n sumM /= 2; \n System.out.println(sum + sumM); " ) ; Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; long sum = 0 ; sum = 1 ; sum *= N ; sum *= ( N - 1 ) ; sum /= 2 ; int sumM = 1 ; sumM *= ( M - 1 ) ; sumM *= M ; sumM /= 2 ; System . out . println ( sum + sumM ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . Stack ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String [ ] name = new String [ n ] ; 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 < n ; ++ 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 { System . out . println ( " [LOG] Block: now += time.get(queue[head]); \n System.out.println(queue[head] + \" \" + now); \n ++head; " ) ; now += time . get ( queue [ head ] ) ; System . out . println ( queue [ head ] + " " + now ) ; ++ head ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { solve ( ) ; } private static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; char [ ] sCode = sc . next ( ) . toCharArray ( ) ; boolean isExistSameCode = false ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( sCode [ i ] == sCode [ i + 1 ] ) { isExistSameCode = true ; break ; } } if ( isExistSameCode ) { System . out . println ( " [LOG] Block: System.out.print( \" Bad \" ); " ) ; System . out . print ( " Bad " ) ; } else System . out . print ( " Good " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int range = sc . nextInt ( ) ; Set < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < range ; i ++ ) { set . add ( sc . next ( ) ) ; } if ( set . size ( ) < range ) { System . out . println ( " NO " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" YES \" ); " ) ; System . out . println ( " YES " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; String str2 = str . toLowerCase ( ) ; if ( str . equals ( str2 ) ) { System . out . println ( " a " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" A \" ); " ) ; System . out . println ( " A " ) ; } } } +import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) { Integer [ ] input = readInput ( ) ; int a = input [ 0 ] ; int b = input [ 1 ] ; if ( a < b ) { System . out . println ( " a < b " ) ; } else if ( a > 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 ( ) ) { System . out . println ( " [LOG] Block: l.add(sc.nextInt()); " ) ; l . add ( sc . nextInt ( ) ) ; } return l . toArray ( new Integer [ l . size ( ) ] ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] nyu = sc . nextLine ( ) . split ( " " ) ; int A = Integer . parseInt ( nyu [ 0 ] ) ; int B = Integer . parseInt ( nyu [ 1 ] ) ; int C = Integer . parseInt ( nyu [ 2 ] ) ; int [ ] num = { A , B , C } ; Arrays . sort ( num ) ; if ( num [ 0 ] == 5 && num [ 1 ] == 5 && num [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String a = scanner . next ( ) ; String b = scanner . next ( ) ; int length = Math . min ( a . length ( ) , b . length ( ) ) ; int pos = 0 ; while ( pos < length ) { if ( 0 != ( a . charAt ( pos ) ^ b . charAt ( pos ) ) ) { break ; } pos ++ ; } if ( a . substring ( pos ) . length ( ) == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; sc . close ( ) ; int length = S . length ( ) ; boolean flag = true ; for ( int i = 1 ; i <= length ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String circle = sc . next ( ) ; String str = sc . next ( ) ; sc . close ( ) ; circle += circle ; if ( circle . contains ( str ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; Integer [ ] nam = new Integer [ N ] ; int max1 = 0 ; int max2 = 0 ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { if ( nam2 [ i ] != max1 ) { System . out . println ( max1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(max2); " ) ; System . out . println ( max2 ) ; } } } } +import java . util . * ; public class Main { 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 cnt = 0 ; for ( String weather : weathers ) { if ( weather . equals ( today ) ) { System . out . println ( " [LOG] Block: System.out.println(weathers[(cnt + 1) % 3]); \n return; " ) ; System . out . println ( weathers [ ( cnt + 1 ) % 3 ] ) ; return ; } cnt ++ ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int d = stdIn . nextInt ( ) ; int t = stdIn . nextInt ( ) ; int s = stdIn . nextInt ( ) ; if ( d <= t * s ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num1 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( num1 < num2 ) { sum += num2 ; num2 -- ; } else { System . out . println ( " [LOG] Block: sum += num1; \n num1--; " ) ; sum += num1 ; num1 -- ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double ans = 0 ; int times = 0 ; for ( int i = n ; i > 0 ; -- i ) { System . out . println ( " [LOG] Block: while (i * Math.pow(2, times) < k) ++times; \n ans = ans + (1 / (double) n) * Math.pow(0.5, times); " ) ; while ( i * Math . pow ( 2 , times ) < k ) ++ times ; ans = ans + ( 1 / ( double ) n ) * Math . pow ( 0.5 , times ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; if ( n . equals ( " AAA " ) || n . equals ( " BBB " ) ) { System . out . print ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" Yes \" ); " ) ; System . out . print ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] value = new int [ n ] ; int [ ] cost = new int [ n ] ; int [ ] trueValue = new int [ n ] ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { value [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { cost [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { trueValue [ i ] = value [ i ] - cost [ i ] ; if ( trueValue [ i ] > 0 ) { System . out . println ( " [LOG] Block: max += trueValue[i]; " ) ; max += trueValue [ i ] ; } } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n String S = sc.next(); \n String[] ABCList = S.split( \" ABC \" , -1); \n System.out.println(ABCList.length - 1); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; String [ ] ABCList = S . split ( " ABC " , - 1 ) ; System . out . println ( ABCList . length - 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int N = scan.nextInt(); \n System.out.println((double) (N - N / 2) / (double) (N)); " ) ; Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; System . out . println ( ( double ) ( N - N / 2 ) / ( double ) ( N ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; sc . close ( ) ; if ( ( n + 2 ) % 2 != 0 ) { System . out . println ( " No " ) ; return ; } if ( n == 2 ) { System . out . println ( " [LOG] Block: System.out.println(s.charAt(0) == s.charAt(1) ? \" Yes \" : \" No \" ); \n return; " ) ; System . out . println ( s . charAt ( 0 ) == s . charAt ( 1 ) ? " Yes " : " No " ) ; return ; } System . out . println ( s . substring ( 0 , n / 2 - 1 ) . equals ( s . substring ( n / 2 , n - 1 ) ) ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; while ( true ) { int l = n ; int r = n - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( h [ i ] > 0 ) { l = Math . min ( l , i ) ; } else if ( l < i ) { r = i - 1 ; break ; } } if ( l == n ) break ; int min = 110 ; for ( int i = l ; i <= r ; i ++ ) { min = Math . min ( min , h [ i ] ) ; } for ( int i = l ; i <= r ; i ++ ) { System . out . println ( " [LOG] Block: h[i] -= min; " ) ; h [ i ] -= min ; } cnt += min ; } System . out . println ( cnt ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import static java . lang . Math . min ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Map < String , Integer > count = new HashMap < > ( ) ; int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: char[] chars = text.toCharArray(); \n Arrays.sort(chars); \n return new String(chars); " ) ; char [ ] chars = text . toCharArray ( ) ; Arrays . sort ( chars ) ; return new String ( chars ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; PriorityQueue < Double > q = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { q . add ( ( double ) sc . nextInt ( ) ) ; } while ( q . size ( ) > 1 ) { System . out . println ( " [LOG] Block: double x = q.poll(); \n double y = q.poll(); \n q.add((x + y) / 2); " ) ; double x = q . poll ( ) ; double y = q . poll ( ) ; q . add ( ( x + y ) / 2 ) ; } System . out . println ( q . poll ( ) ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; ArrayList < String > shiritoriList = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } if ( checkList . contains ( word ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } checkList . add ( word ) ; } System . out . println ( " Yes " ) ; return ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; long resultA = a * c ; resultA = resultA < a * d ? a * d : resultA ; long resultB = b * c ; resultB = resultB < b * d ? b * d : resultB ; if ( resultA < resultB ) { System . out . println ( resultB ) ; } else { System . out . println ( " [LOG] Block: System.out.println(resultA); " ) ; System . out . println ( resultA ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] array = { 1 , 1 , 1 } ; array [ a - 1 ] = 0 ; array [ b - 1 ] = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == 1 ) { System . out . println ( " [LOG] Block: System.out.println(i + 1); " ) ; System . out . println ( i + 1 ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; long result = 0 ; for ( int i = 1 ; i <= a ; i ++ ) { for ( int j = i ; j <= a ; j ++ ) { for ( int k = j ; k <= a ; 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 { System . out . println ( " [LOG] Block: result += (l * 3); " ) ; result += ( l * 3 ) ; } } } } } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; float sum = 0 ; for ( int y = 0 ; y < n ; y ++ ) { a [ y ] = sc . nextInt ( ) ; sum += a [ y ] ; } int p = Math . round ( sum / n ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: res += (a[i] - p) * (a[i] - p); " ) ; res += ( a [ i ] - p ) * ( a [ i ] - p ) ; } System . out . println ( res ) ; sc . close ( ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String [ ] b = a . split ( " " ) ; List < String > word = new ArrayList < String > ( ) ; List < String > rev_word = new ArrayList < String > ( ) ; for ( int s = 0 ; s < b . length ; s ++ ) { word . add ( b [ s ] ) ; rev_word . add ( b [ s ] ) ; } Collections . reverse ( rev_word ) ; int count = 0 ; for ( int i = 0 ; i < word . size ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (!word.get(i).equals(rev_word.get(i))) \n count++; " ) ; if ( ! word . get ( i ) . equals ( rev_word . get ( i ) ) ) count ++ ; } System . out . println ( count / 2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int total = 0 ; for ( int i = A ; i <= B ; i ++ ) { String s = String . valueOf ( i ) ; StringBuffer sb = new StringBuffer ( s ) ; String r = new String ( sb . reverse ( ) ) ; if ( s . equals ( r ) ) { System . out . println ( " [LOG] Block: total++; " ) ; total ++ ; } } System . out . println ( total ) ; } } +import java . util . Scanner ; public class Main { static float roundUp ( float value ) { float mod = value % 1000 ; if ( mod > 0 ) { value = value + ( 1000 - mod ) ; } 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 ++ ) { System . out . println ( " [LOG] Block: debt = roundUp(debt * 1.05f); " ) ; debt = roundUp ( debt * 1.05f ) ; } System . out . printf ( " %d \n " , Math . round ( debt ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int summer = scanner . nextInt ( ) ; int num = scanner . nextInt ( ) ; int tmp = 0 ; for ( int i = 0 ; i < num ; i ++ ) { tmp += scanner . nextInt ( ) ; } int day = summer - tmp ; if ( day >= 0 ) { System . out . println ( day ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . next ( ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; if ( c [ k - 1 ] == 'A' ) { c [ k - 1 ] = 'a' ; } else if ( c [ k - 1 ] == 'B' ) { c [ k - 1 ] = 'b' ; } else { System . out . println ( " [LOG] Block: c[k - 1] = 'c'; " ) ; c [ k - 1 ] = 'c' ; } System . out . println ( c ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sum = 0 ; int [ ] line = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { line [ i ] = sc . nextInt ( ) ; sum += line [ i ] ; } int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: min = Math.min(min, sum - line[i]); " ) ; min = Math . min ( min , sum - line [ i ] ) ; } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; scanner . close ( ) ; String ans = null ; if ( a < b && b < c ) { ans = " Yes " ; } else { System . out . println ( " [LOG] Block: ans = \" No \" ; " ) ; ans = " No " ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { long a = in . nextLong ( ) ; long b = in . nextLong ( ) ; long c = LCM ( a , b ) ; long d = a * b / c ; System . out . println ( c + " " + d ) ; } } static long LCM ( long a , long b ) { if ( b == 0 ) { return a ; } else { System . out . println ( " [LOG] Block: return LCM(b, a % b); " ) ; return LCM ( b , a % b ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String weather = sc . next ( ) ; if ( weather . equals ( " SSS " ) ) { System . out . println ( 0 ) ; return ; } if ( weather . equals ( " RRR " ) ) { System . out . println ( 3 ) ; return ; } if ( weather . equals ( " RRS " ) || weather . equals ( " SRR " ) ) { System . out . println ( " [LOG] Block: System.out.println(2); \n return; " ) ; System . out . println ( 2 ) ; return ; } System . out . println ( 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double ans = 100001.0 ; double bef ; int answer = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: bef = ans; \n ans = Math.min(ans, Math.abs(a - (t - sc.nextInt() * 0.006))); \n if (bef != ans) \n answer = i + 1; " ) ; 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 . Scanner ; public class Main { 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 t ; t = a ; a = b ; b = t % b ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int a, b; \n Scanner scan = new Scanner(System.in); \n a = scan.nextInt(); \n b = scan.nextInt(); \n System.out.println(gcd_roop(a, b)); \n scan.close(); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int check = 1 ; for ( int i = 1 ; i < 10 ; i ++ ) { int f = N % i ; if ( f == 0 ) { int a = N / i ; if ( a > 0 && a < 10 ) { System . out . println ( " [LOG] Block: check = 2; \n System.out.println( \" Yes \" ); \n return; " ) ; check = 2 ; System . out . println ( " Yes " ) ; return ; } } if ( i == 9 && check == 1 ) System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int d = x % 10 ; int c = x / 10 % 10 ; int b = x / 10 / 10 % 10 ; int a = x / 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 ( " [LOG] Block: System.out.println(a + \" \" + symbol[0] + \" \" + b + \" \" + symbol[1] + \" \" + c + \" \" + symbol[2] + \" \" + d + \" =7 \" ); \n return; " ) ; System . out . println ( a + " " + symbol [ 0 ] + " " + b + " " + symbol [ 1 ] + " " + c + " " + symbol [ 2 ] + " " + d + " =7 " ) ; return ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; String S = sc . next ( ) ; char [ ] cs = S . toCharArray ( ) ; int count = 0 ; for ( int i = 0 ; i < N - 2 ; i ++ ) { if ( cs [ i ] == 'A' && cs [ i + 1 ] == 'B' && cs [ i + 2 ] == 'C' ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner scan = new Scanner ( is ) ; long H = 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 -- ) { System . out . println ( " [LOG] Block: H -= A[i]; \n if (H <= 0) \n break; " ) ; H -= A [ i ] ; if ( H <= 0 ) break ; } if ( H <= 0 ) os . println ( " Yes " ) ; else os . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . next ( ) ; scanner . close ( ) ; int plus = 0 , minus = 0 ; for ( int n = 0 ; n < S . length ( ) ; n ++ ) { String s = S . substring ( n , n + 1 ) ; if ( s . equals ( " + " ) ) { plus ++ ; } else if ( s . equals ( " - " ) ) { System . out . println ( " [LOG] Block: minus++; " ) ; minus ++ ; } } int A = plus - minus ; System . out . println ( A ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int A = scan.nextInt(); \n int B = scan.nextInt(); \n int T = scan.nextInt(); \n int times = T / A; \n int ans = times * B; \n System.out.println(ans); " ) ; Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int times = T / A ; int ans = times * B ; System . out . println ( ans ) ; } } +import java . util . * ; import java . util . stream . Collectors ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int otoshidama = sc . nextInt ( ) ; int x = - 1 ; int y = - 1 ; int z = - 1 ; boolean isFinish = false ; for ( int i = 0 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= n ; j ++ ) { if ( n - i - j >= 0 && i + j + ( n - i - j ) == n ) { if ( i * 10000 + j * 5000 + ( n - i - j ) * 1000 == otoshidama ) { x = i ; y = j ; z = n - i - j ; isFinish = true ; break ; } else if ( n - i - j < 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } if ( isFinish ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( x + " " + y + " " + z ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; long p = 1 ; int r = 0 ; while ( p <= n ) { System . out . println ( " [LOG] Block: p *= k; \n r++; " ) ; p *= k ; r ++ ; } System . out . println ( r ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; if ( ( A == B && A != C ) || ( A == C && A != B ) || ( B == C && B != A ) ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int maxHigh = 0 ; int view = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int High = sc . nextInt ( ) ; if ( maxHigh <= High ) { System . out . println ( " [LOG] Block: maxHigh = High; \n view++; " ) ; maxHigh = High ; view ++ ; } } System . out . println ( view ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int K = sc.nextInt(); \n int ans = ((N + (2 * K + 1) - 1)) / (2 * K + 1); \n System.out.print(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int ans = ( ( N + ( 2 * K + 1 ) - 1 ) ) / ( 2 * K + 1 ) ; System . out . print ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] tmp = scanner . nextLine ( ) . split ( " " ) ; int ans = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( Integer . parseInt ( tmp [ i ] ) == 0 ) { System . out . println ( " [LOG] Block: ans = i + 1; \n break; " ) ; ans = i + 1 ; break ; } } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; Arrays . parallelSort ( a ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: a[2] *= 2; " ) ; a [ 2 ] *= 2 ; } System . out . println ( a [ 0 ] + a [ 1 ] + a [ 2 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; String [ ] strAry = str . split ( " " ) ; int int1 = Integer . parseInt ( strAry [ 0 ] ) ; int int2 = Integer . valueOf ( strAry [ 1 ] ) . intValue ( ) ; int i = 0 ; boolean b = true ; while ( b ) { if ( int1 < Math . pow ( int2 , i ) ) { System . out . println ( " [LOG] Block: System.out.println(i); \n b = false; " ) ; System . out . println ( i ) ; b = false ; } i ++ ; scan . close ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: @SuppressWarnings( \" resource \" ) \n Scanner scanner = new Scanner(System.in); \n int a = scanner.nextInt(); \n int b = scanner.nextInt(); \n int c = a + b; \n switch(c) { \n case 3: \n System.out.println(3); \n break; \n case 4: \n System.out.println(2); \n break; \n case 5: \n System.out.println(1); \n break; \n } " ) ; @ SuppressWarnings ( " resource " ) Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = a + 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 . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader((System.in))); \n StringTokenizer st = new StringTokenizer(br.readLine()); \n int x = Integer.parseInt(st.nextToken()); \n int y = Integer.parseInt(st.nextToken()); \n int z = Integer.parseInt(st.nextToken()); \n int temp = x; \n x = y; \n y = temp; \n temp = x; \n x = z; \n z = temp; \n System.out.println(x + \" \" + y + \" \" + z); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( ( System . in ) ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ; int z = Integer . parseInt ( st . nextToken ( ) ) ; int temp = x ; x = y ; y = temp ; temp = x ; x = z ; z = temp ; System . out . println ( x + " " + y + " " + z ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int seisu = scan . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= seisu ; i ++ ) { String mozi = String . valueOf ( i ) ; if ( mozi . length ( ) % 2 == 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int ninzuu = 0 ; D = D * 2 + 1 ; do { System . out . println ( " [LOG] Block: N = N - D; \n ninzuu++; " ) ; N = N - D ; ninzuu ++ ; } while ( N > 0 ) ; System . out . println ( ninzuu ) ; sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] sequence = new int [ n ] ; double denominator = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: sequence[i] = sc.nextInt(); \n denominator += 1.0 / sequence[i]; " ) ; sequence [ i ] = sc . nextInt ( ) ; denominator += 1.0 / sequence [ i ] ; } System . out . println ( 1 / denominator ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] T = sc . next ( ) . toCharArray ( ) ; int ans = 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 { System . out . println ( " [LOG] Block: now++; \n ans = Math.max(ans, now); " ) ; now ++ ; ans = Math . max ( ans , now ) ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int payment = sc . nextInt ( ) ; int yen = 1000 ; while ( yen < payment ) { System . out . println ( " [LOG] Block: yen = yen + 1000; " ) ; yen = yen + 1000 ; } System . out . println ( yen - payment ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word = input . readLine ( ) ; String WORD = word . toUpperCase ( ) ; int count = 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = in . readLine ( ) ; String t = in . readLine ( ) ; String s_rt = " " ; boolean matchingFlg = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: s_rt = s.substring(s.length() - i, s.length()) + s.substring(0, s.length() - i); \n if (s_rt.equals(t)) \n matchingFlg = true; " ) ; s_rt = s . substring ( s . length ( ) - i , s . length ( ) ) + s . substring ( 0 , s . length ( ) - i ) ; if ( s_rt . equals ( t ) ) matchingFlg = true ; } System . out . println ( matchingFlg == true ? " Yes " : " No " ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static String repeat ( String str , int n ) { return String . join ( " " , Collections . nCopies ( n , str ) ) ; } public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n String[] arr = reader.readLine().split( \" \" ); \n int a = Integer.parseInt(arr[0]); \n int b = Integer.parseInt(arr[1]); \n System.out.println(a < b ? repeat(arr[0], b) : repeat(arr[1], a)); " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( arr [ 0 ] ) ; int b = Integer . parseInt ( arr [ 1 ] ) ; System . out . println ( a < b ? repeat ( arr [ 0 ] , b ) : repeat ( arr [ 1 ] , a ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . Character ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int [ ] cnt = new int [ 26 ] ; int num = 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 ( " [LOG] Block: System.out.println((char) ('a' + i) + \" : \" + cnt[i]); " ) ; System . out . println ( ( char ) ( 'a' + i ) + " : " + cnt [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] W = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { W [ i ] = sc . next ( ) ; } sc . close ( ) ; String result = " Yes " ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( W [ i ] . equals ( W [ j ] ) ) { result = " No " ; break ; } } if ( result == " No " ) { break ; } } String start = " " ; if ( result == " Yes " ) { for ( int i = 0 ; i < N ; i ++ ) { if ( i != 0 ) { String [ ] s_ = W [ i ] . split ( " " ) ; if ( s_ [ 0 ] . equals ( start ) ) { start = s_ [ s_ . length - 1 ] ; } else { result = " No " ; break ; } } else { System . out . println ( " [LOG] Block: String[] s_ = W[i].split( \" \" ); \n start = s_[s_.length - 1]; " ) ; String [ ] s_ = W [ i ] . split ( " " ) ; start = s_ [ s_ . length - 1 ] ; } } } System . out . println ( result ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int sum = 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 ++ ) { System . out . println ( " [LOG] Block: if (c % n == 0) \n sum++; " ) ; if ( c % n == 0 ) sum ++ ; } System . out . println ( " " + sum + " " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } long n ; long k ; long res ; public void run ( ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextLong ( ) ; k = sc . nextLong ( ) ; sc . close ( ) ; solve ( ) ; } private void solve ( ) { a ( n % k ) ; System . out . println ( res ) ; } private void a ( long a ) { if ( Math . abs ( a - k ) <= a ) { a = Math . abs ( a - k ) ; a ( a ) ; } else { System . out . println ( " [LOG] Block: res = a; \n return; " ) ; res = a ; return ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int i = 1 ; i <= x ; i ++ ) { if ( y == ( i * 2 ) + ( ( x - i ) * 4 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } for ( int i = 1 ; i <= x ; i ++ ) { if ( y == ( i * 4 ) + ( ( x - i ) * 2 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } for ( int i = 1 ; i <= x / 2 ; i ++ ) { if ( y == i * 2 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } for ( int i = 1 ; i <= x / 4 ; i ++ ) { if ( y == i * 4 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 ] [ n ] ; 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 < n ; i ++ ) { ac += a [ 1 ] [ i ] ; if ( a [ 1 ] [ i ] == 1 ) { System . out . println ( " [LOG] Block: wa += a[0][i]; " ) ; wa += a [ 0 ] [ i ] ; } } System . out . println ( ac + " " + wa ) ; } } +import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > A = new ArrayList < > ( ) ; int N = sc . nextInt ( ) ; for ( int a = 0 ; a < N ; ++ 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 ) { System . out . println ( " [LOG] Block: ans += 1; " ) ; 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 Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; StringBuilder out ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; 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 . println ( " [LOG] Block: System.out.print(a[i] + \" \" ); " ) ; System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ a . length - 1 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long k = sc . nextLong ( ) ; for ( int i = 0 ; i < Math . min ( k , s . length ( ) ) ; i ++ ) { if ( s . charAt ( i ) != '1' ) { System . out . println ( " [LOG] Block: System.out.println(s.charAt(i)); \n return; " ) ; System . out . println ( s . charAt ( i ) ) ; return ; } } System . out . println ( 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int plus = a + b ; int minus = a - b ; int mult = a * b ; if ( plus > minus ) { if ( plus > mult ) { System . out . println ( " [LOG] Block: System.out.println(plus); " ) ; 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 ( " [LOG] Block: System.out.println(plus); " ) ; System . out . println ( plus ) ; } } } +import java . util . * ; public class Main { 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 i = 0 ; i < weather . length ; ++ i ) { if ( tw . equals ( weather [ i ] ) ) { System . out . println ( " [LOG] Block: System.out.println(weather[(i + 1) % 3]); \n break; " ) ; System . out . println ( weather [ ( i + 1 ) % 3 ] ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int s = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { s = s + l + i - 1 ; } int a = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( l - 1 + i == 0 ) { a = i ; } } if ( a == 0 ) { if ( l * l > ( l + n - 1 ) * ( l + n - 1 ) ) { a = n ; } else { System . out . println ( " [LOG] Block: a = 1; " ) ; a = 1 ; } } System . out . println ( s - l + 1 - a ) ; sc . close ( ) ; } } +import java . io . * ; import java . util . * ; import java . math . * ; import java . util . regex . Pattern ; class Main { public static void main ( String [ ] args ) { int a , b , i , small , sum = 0 ; String s = " " ; Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a < b ) { small = a ; for ( i = b - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: sum = sum + (int) Math.pow(10, i); " ) ; sum = sum + ( int ) Math . pow ( 10 , i ) ; } small = a * sum ; s = " " + small ; } else { small = b ; for ( i = a - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: sum = sum + (int) Math.pow(10, i); " ) ; sum = sum + ( int ) Math . pow ( 10 , i ) ; } small = b * sum ; s = " " + small ; } System . out . println ( s ) ; } } +import java . util . * ; public class Main { 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n double l = scan.nextDouble(); \n double tmp = l / 3; \n System.out.println(tmp * tmp * tmp); " ) ; Scanner scan = new Scanner ( System . in ) ; double l = scan . nextDouble ( ) ; double tmp = l / 3 ; System . out . println ( tmp * tmp * tmp ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; for ( int i = 1 ; i < 2 * Math . abs ( k ) ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(x - k + i + \" \" ); " ) ; System . out . print ( x - k + i + " " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; for ( long j = x ; j < 1000000 ; j ++ ) { int count = 0 ; for ( long i = 2 ; i < x ; i ++ ) { if ( x % i == 0 ) { count ++ ; } } if ( count == 0 ) { System . out . println ( " [LOG] Block: System.out.println(x); \n System.exit(0); " ) ; System . out . println ( x ) ; System . exit ( 0 ) ; } x ++ ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) throws Exception { int number ; 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 ( ) ; number = Integer . parseInt ( line ) ; if ( isPrime ( number ) ) { prime . add ( number ) ; } } System . out . println ( prime . size ( ) ) ; } static boolean isPrime ( int n ) { if ( n == 2 ) { return true ; } if ( n < 2 || n % 2 == 0 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } int i = 3 ; while ( i <= Math . sqrt ( ( double ) n ) ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } i = i + 2 ; } return true ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i = 0 ; Scanner scan = new Scanner ( System . in ) ; ; while ( true ) { i ++ ; int a = scan . nextInt ( ) ; if ( a == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } System . out . println ( " Case " + i + " : " + a ) ; } scan . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] strArray = br . readLine ( ) . split ( " " ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = Integer . parseInt ( strArray [ i ] ) ; } int count = bubbleSor ( array , n ) ; printArray ( array ) ; System . out . println ( count ) ; } static int bubbleSor ( int [ ] array , int n ) { int flag = 1 ; int count = 0 ; while ( flag == 1 ) { flag = 0 ; for ( int j = n - 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 . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = 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 ) { t ++ ; h ++ ; } else { System . out . println ( " [LOG] Block: t += 3; " ) ; t += 3 ; } } System . out . println ( t + " " + h ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > 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 ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; while ( stdIn . hasNext ( ) ) { System . out . println ( " [LOG] Block: System.out.println((int) Math.log10(stdIn.nextInt() + stdIn.nextInt()) + 1); " ) ; System . out . println ( ( int ) Math . log10 ( stdIn . nextInt ( ) + stdIn . nextInt ( ) ) + 1 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] d = new int [ 100001 ] ; for ( int i = 0 ; i < n ; i ++ ) { d [ sc . nextInt ( ) ] ++ ; } int tmp = 0 ; int cnt = 0 ; for ( int i = 0 ; i < 100001 ; i ++ ) { tmp += d [ i ] ; if ( n == tmp * 2 ) { cnt ++ ; } else if ( n < tmp * 2 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( cnt ) ; } } } +import java . util . ArrayList ; import java . util . Iterator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long result = 0 ; long num = sc . nextLong ( ) ; for ( int i = 1 ; i < n ; i ++ ) { long a = sc . nextInt ( ) ; if ( a >= num ) { num = a ; } else { System . out . println ( " [LOG] Block: result = result + num - a; " ) ; result = result + num - a ; } } System . out . println ( result ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 i = charArray . length - 1 ; i >= 0 ; i -- ) { System . out . print ( charArray [ i ] ) ; } System . out . println ( " " ) ; } } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { 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 front = Integer . parseInt ( S . substring ( 0 , 2 ) ) ; int back = Integer . parseInt ( S . substring ( 2 , 4 ) ) ; if ( isMonth ( front ) ) { 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 ( " [LOG] Block: System.out.println(answer); " ) ; System . out . println ( answer ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int max = Math.max(A - B, A + B); \n max = Math.max(max, A * B); \n System.out.println(max); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int max = Math . max ( A - B , A + B ) ; max = Math . max ( max , A * B ) ; System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; for ( int n = N ; n < 1000 ; n ++ ) { if ( n % 111 == 0 ) { System . out . println ( " [LOG] Block: System.out.println(n); \n return; " ) ; System . out . println ( n ) ; return ; } } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int test = i ; int num = 0 ; while ( test > 0 ) { test /= 10 ; num ++ ; } if ( num % 2 != 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] T = new int [ 5 ] ; int [ ] D = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i ++ ) { T [ i ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( T [ i ] % 10 == 0 ) { D [ i ] = T [ i ] ; } else { D [ i ] = ( T [ i ] / 10 ) * 10 + 10 ; } } int max = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( ( D [ i ] - T [ i ] ) > max ) { System . out . println ( " [LOG] Block: max = D[i] - T[i]; " ) ; max = D [ i ] - T [ i ] ; } sum = sum + D [ i ] ; } System . out . println ( sum - max ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 N = Integer . parseInt ( inputsArrays [ 0 ] ) ; int X = Integer . parseInt ( inputsArrays [ 1 ] ) ; int T = Integer . parseInt ( inputsArrays [ 2 ] ) ; int timeTaken = 0 ; while ( N > 0 ) { timeTaken += T ; N -= X ; } System . out . println ( timeTaken ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int a , b , c ; a = N / 100 ; b = ( N - a * 100 ) / 10 ; c = N - a * 100 - b * 10 ; if ( a == 7 || b == 7 || c == 7 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int b = sc.nextInt(); \n int buster = Math.min(a[i], b); \n int secondBuster = Math.min(a[i + 1], b - buster); \n a[i + 1] -= secondBuster; \n sum += buster + secondBuster; " ) ; 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 Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int t , x , y , dis ; String ans = " Yes " ; for ( int i = 0 ; i < n ; i ++ ) { t = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; dis = x + y ; if ( dis > t ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } else { if ( ( t - dis ) % 2 == 1 ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; N = N % 10 ; if ( N == 2 || N == 4 || N == 5 || N == 7 || N == 9 ) { System . out . println ( " hon " ) ; } else if ( N == 0 || N == 1 || N == 6 || N == 8 ) { System . out . println ( " pon " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" bon \" ); " ) ; System . out . println ( " bon " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; int min = 300 , total = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { total += L + i - 1 ; } if ( L >= 0 ) { System . out . println ( total - L ) ; } else if ( L < 0 ) { if ( L + N > 0 ) { System . out . println ( total ) ; } else { System . out . println ( " [LOG] Block: System.out.println(total - (L + N - 1)); " ) ; System . out . println ( total - ( L + N - 1 ) ) ; } } } } +import java . lang . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdId = new Scanner(System.in); \n int x = stdId.nextInt(); \n x = x * x * x; \n System.out.println(String.valueOf(x)); " ) ; Scanner stdId = new Scanner ( System . in ) ; int x = stdId . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; String ans = " " ; int max = n * 5000 ; if ( n * 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 <= ( n - i ) ; j ++ ) { int value = sum ; value += j * 5000 ; int k = n - ( i + j ) ; value += k * 1000 ; if ( value == y ) { ans = i + " " + j + " " + k ; break calc ; } } } } if ( ans . isEmpty ( ) ) { System . out . println ( " [LOG] Block: ans = \" -1 -1 -1 \" ; " ) ; ans = " -1 -1 -1 " ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = 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 ++ ) { if ( A [ i ] >= K ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; char b = a . charAt ( 0 ) ; char c = a . charAt ( 1 ) ; char d = a . charAt ( 2 ) ; char f = 'R' ; if ( b == c && c == d && d == f ) { System . out . println ( " 3 " ) ; } else if ( ( b == c && c == f ) || ( c == d && d == f ) ) { System . out . println ( " 2 " ) ; } else if ( ! ( b == f || c == f || d == f ) ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" 1 \" ); " ) ; System . out . println ( " 1 " ) ; } } } +import java . io . * ; public class Main { static boolean checkKaibun ( String str ) { StringBuilder t = new StringBuilder ( str ) ; return ( str . equals ( t . reverse ( ) . toString ( ) ) ) ; } public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String s = br.readLine(); \n br.close(); \n int n = s.length(); \n boolean ok = checkKaibun(s); \n ok &= checkKaibun(s.substring(0, (n - 1) / 2)); \n ok &= checkKaibun(s.substring((n + 1) / 2)); \n System.out.println(ok ? \" Yes \" : \" No \" ); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; br . close ( ) ; int n = s . length ( ) ; boolean ok = checkKaibun ( s ) ; ok &= checkKaibun ( s . substring ( 0 , ( n - 1 ) / 2 ) ) ; ok &= checkKaibun ( s . substring ( ( n + 1 ) / 2 ) ) ; System . out . println ( ok ? " Yes " : " No " ) ; } } +import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int numberOfProcesses ; 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 ) ; numberOfProcesses = Integer . parseInt ( input . next ( ) ) ; quantum = Integer . parseInt ( input . next ( ) ) ; for ( int i = 0 ; i < numberOfProcesses ; 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 { System . out . println ( " [LOG] Block: clock = clock + currentTime; \n System.out.print(currentTask + \" \" ); \n System.out.println(clock); " ) ; clock = clock + currentTime ; System . out . print ( currentTask + " " ) ; System . out . println ( clock ) ; } } } } +import java . util . * ; import java . io . * ; class Main { static boolean found = 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 { System . out . println ( " [LOG] Block: out.println( \" No \" ); " ) ; out . println ( " No " ) ; } out . close ( ) ; } } +import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { sum += scan . nextInt ( ) ; } if ( n - sum < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(n - sum); " ) ; System . out . println ( n - sum ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] age ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int i = 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 ( i = 1 ; i <= H ; i ++ ) { for ( j = 1 ; j <= W ; j ++ ) { if ( i % 2 == 1 ) { if ( j % 2 == 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } else { System . out . print ( " . " ) ; } } else { if ( j % 2 == 1 ) { System . out . print ( " . " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } } } System . out . print ( " \n " ) ; } System . out . print ( " \n " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: l[i] = Integer.parseInt(sc.next()); " ) ; 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 . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; public class Main { 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 i = 0 ; i < hairetsu . length ; i ++ ) { array . add ( Integer . parseInt ( hairetsu [ i ] ) ) ; } for ( int i = 0 ; i < array . size ( ) ; i ++ ) { array2 . add ( array . get ( array . size ( ) - 1 - i ) ) ; } for ( int i = 0 ; i < array2 . size ( ) ; i ++ ) { System . out . print ( array2 . get ( i ) ) ; if ( i < array2 . size ( ) - 1 ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; 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 Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskBB solver = new TaskBB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskBB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; String a = in . next ( ) ; String b = in . next ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: sb.append(a.charAt(i)); \n sb.append(b.charAt(i)); " ) ; sb . append ( a . charAt ( i ) ) ; sb . append ( b . charAt ( i ) ) ; } out . println ( sb . toString ( ) ) ; } } } +import java . util . Scanner ; import java . lang . Math ; public class Main { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] grid = new int [ 2 ] [ n ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] ans = new int [ 2 ] [ n ] ; ans [ 0 ] [ 0 ] = grid [ 0 ] [ 0 ] ; ans [ 1 ] [ 0 ] = grid [ 1 ] [ 0 ] + ans [ 0 ] [ 0 ] ; for ( int j = 1 ; j < n ; j ++ ) { ans [ 0 ] [ j ] = grid [ 0 ] [ j ] + ans [ 0 ] [ j - 1 ] ; } for ( int j = 1 ; j < n ; j ++ ) { ans [ 1 ] [ j ] = grid [ 1 ] [ j ] + Math . max ( ans [ 1 ] [ j - 1 ] , ans [ 0 ] [ j ] ) ; } System . out . println ( ans [ 1 ] [ n - 1 ] ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; out . println ( a * b % 2 == 1 ? " Odd " : " Even " ) ; } } static class InputReader { 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 ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(nextString()); " ) ; return Integer . parseInt ( nextString ( ) ) ; } } } +import java . util . Scanner ; public class Main { final static long mod = 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 / mod != R / mod ) { 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 ++ ) { System . out . println ( " [LOG] Block: long r = (i * j) % mod; \n min = Math.min(min, r); " ) ; long r = ( i * j ) % mod ; min = Math . min ( min , r ) ; } } System . out . println ( min ) ; } } +import java . util . * ; import java . lang . * ; import java . util . stream . * ; public class Main { 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 ( " [LOG] Block: System.out.println(0 + \" \" + rest_of_aoki_cokie); " ) ; System . out . println ( 0 + " " + rest_of_aoki_cokie ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] dd = new long [ 10000 ] ; int x = 9 ; long r = 0 ; long su ; for ( int i = 0 ; x == 9 ; i ++ ) { su = sc . nextInt ( ) ; if ( su != 0 ) { dd [ i ] = su ; } if ( su == 0 ) { r = i ; break ; } } for ( int y = 0 ; y < r ; y ++ ) { System . out . println ( " [LOG] Block: int l = y + 1; \n System.out.println( \" Case \" + l + \" : \" + dd[y]); " ) ; int l = y + 1 ; System . out . println ( " Case " + l + " : " + dd [ y ] ) ; } } } +import java . util . * ; class Main { Scanner sc ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { String w = sc . next ( ) ; switch ( w ) { 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 ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sn = 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' ; sn = sn + b ; } if ( n % sn == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n long N = scan.nextInt(); \n scan.close(); \n System.out.println(N / 2 + N % 2); " ) ; Scanner scan = new Scanner ( System . in ) ; long N = scan . nextInt ( ) ; scan . close ( ) ; System . out . println ( N / 2 + N % 2 ) ; } } +import java . util . * ; import java . text . DecimalFormat ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.nextLine(); \n if (S.equals( \" SUN \" )) \n System.out.println(7); \n else if (S.equals( \" MON \" )) \n System.out.println(6); \n else if (S.equals( \" TUE \" )) \n System.out.println(5); \n else if (S.equals( \" WED \" )) \n System.out.println(4); \n else if (S.equals( \" THU \" )) \n System.out.println(3); \n else if (S.equals( \" FRI \" )) \n System.out.println(2); \n else \n System.out.println(1); " ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; if ( S . equals ( " SUN " ) ) System . out . println ( 7 ) ; else if ( S . equals ( " MON " ) ) System . out . println ( 6 ) ; else if ( S . equals ( " TUE " ) ) System . out . println ( 5 ) ; else if ( S . equals ( " WED " ) ) System . out . println ( 4 ) ; else if ( S . equals ( " THU " ) ) System . out . println ( 3 ) ; else if ( S . equals ( " FRI " ) ) System . out . println ( 2 ) ; else System . out . println ( 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int sta = d * 2 + 1 ; for ( int i = 0 ; i < 20 ; i ++ ) { if ( sta * i >= n ) { System . out . println ( " [LOG] Block: System.out.println(i); \n break; " ) ; System . out . println ( i ) ; break ; } } } } +import java . util . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ n / 2 - 1 ] != a [ n / 2 ] ) { System . out . println ( " [LOG] Block: res = a[n / 2] - a[n / 2 - 1]; " ) ; res = a [ n / 2 ] - a [ n / 2 - 1 ] ; } System . out . println ( res ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String N = sc . next ( ) ; String ff = N . substring ( 2 , 4 ) ; String ee = N . 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = Integer . parseInt ( sc . next ( ) ) ; int N = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; if ( N != 100 ) { int answer = ( int ) ( N * Math . pow ( 100 , D ) ) ; System . out . println ( answer ) ; return ; } else { System . out . println ( " [LOG] Block: int answer = (int) (101 * Math.pow(100, D)); \n System.out.println(answer); \n return; " ) ; int answer = ( int ) ( 101 * Math . pow ( 100 , D ) ) ; System . out . println ( answer ) ; return ; } } } +public class Main { public static void main ( String ... args ) { System . out . println ( " [LOG] Block: int x = new java.util.Scanner(System.in).nextInt(); \n int sum = x * x * x; \n System.out.println(sum); " ) ; int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; int sum = x * x * x ; System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) , ans = " Yes " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i == ( a ) ) { if ( ! s . substring ( i , i + 1 ) . equals ( " - " ) ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } else { if ( ! s . substring ( i , i + 1 ) . matches ( " 1|2|3|4|5|6|7|8|9|0 " ) ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; Integer [ ] d1 = new Integer [ n ] ; Integer [ ] d2 = new Integer [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( d1 [ i ] == d2 [ i ] ) { renzoku ++ ; } else { renzoku = 0 ; } if ( renzoku == 3 ) { System . out . println ( " [LOG] Block: judge = true; \n break; " ) ; judge = true ; break ; } } String result = judge ? " Yes " : " No " ; System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int a = - 1 ; int b = - 1 ; int c = - 1 ; for ( int i = 0 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= n ; j ++ ) { if ( y / 1000 - 10 * i - 5 * j == n - j - i && n - j - i >= 0 ) { System . out . println ( " [LOG] Block: a = i; \n b = j; \n c = n - i - j; \n break; " ) ; a = i ; b = j ; c = n - i - j ; break ; } } } System . out . println ( a + " " + b + " " + c ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int age = scan . nextInt ( ) ; int price = scan . nextInt ( ) ; if ( age >= 13 ) { System . out . println ( price ) ; } else if ( age >= 6 ) { System . out . println ( price / 2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; int i = 2 ; while ( true ) { if ( i == x ) { System . out . println ( i ) ; return ; } if ( x % i == 0 ) { x ++ ; i = 2 ; continue ; } else { System . out . println ( " [LOG] Block: i++; " ) ; i ++ ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long checkx = 0 ; long x = 0 ; long checky = 0 ; long y = 0 ; for ( checkx = 1 ; checkx <= Math . sqrt ( n ) ; checkx ++ ) { if ( n % checkx == 0 ) { checky = n / checkx ; if ( x == 0 && y == 0 ) { System . out . println ( " [LOG] Block: x = checkx; \n y = checky; " ) ; x = checkx ; y = checky ; } if ( checkx + checky < x + y ) { System . out . println ( " [LOG] Block: x = checkx; \n y = checky; " ) ; x = checkx ; y = checky ; } } } System . out . println ( x + y - 2 ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; ArrayList < Integer > nums = new ArrayList < Integer > ( N ) ; for ( int i = 0 ; i < N ; i ++ ) { nums . add ( Integer . parseInt ( sc . next ( ) ) ) ; } int ans = 0 ; while ( true ) { int max = Collections . max ( nums ) ; if ( max == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } int index = nums . indexOf ( max ) ; while ( true ) { nums . set ( index , max - 1 ) ; if ( index == N - 1 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } else if ( nums . get ( index ) == nums . get ( index + 1 ) - 1 ) { index += 1 ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } ans ++ ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( PNcheck ( sc . nextInt ( ) ) ) c ++ ; } System . out . println ( c ) ; } static boolean PNcheck ( int n ) { if ( n == 2 ) return true ; if ( ( n % 2 ) == 0 ) return false ; for ( int i = 3 ; i * i <= n ; i = i + 2 ) { System . out . println ( " [LOG] Block: if ((n % i) == 0) \n return false; " ) ; if ( ( n % i ) == 0 ) return false ; } return true ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } if ( a [ 0 ] <= a [ 1 ] * a [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Collections ; import java . util . LinkedList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int health1 = sc . nextInt ( ) ; int strength1 = sc . nextInt ( ) ; int health2 = sc . nextInt ( ) ; int strength2 = sc . nextInt ( ) ; while ( true ) { health2 -= strength1 ; if ( health2 <= 0 ) break ; health1 -= strength2 ; if ( health1 <= 0 ) break ; } if ( health1 > health2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int i = 1000 ; while ( i < N ) { System . out . println ( " [LOG] Block: i += 1000; " ) ; i += 1000 ; } System . out . println ( i - N ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N , M , ans = 0 ; int [ ] [ ] Food ; Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; M = scan . nextInt ( ) ; Food = new int [ N + 1 ] [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { Food [ N ] [ i ] = 1 ; } int A , K ; for ( int i = 0 ; i < N ; 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 < N ; j ++ ) { Food [ N ] [ i ] *= Food [ j ] [ i ] ; } } for ( int i = 0 ; i < M ; i ++ ) { System . out . println ( " [LOG] Block: ans += Food[N][i]; " ) ; ans += Food [ N ] [ i ] ; } System . out . print ( ans ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; while ( str != null ) { System . out . println ( " [LOG] Block: String[] arrays = str.split( \" \\ s \" , 0); \n int num = Integer.parseInt(arrays[0]) + Integer.parseInt(arrays[1]); \n System.out.println(Integer.toString(num).length()); \n str = br.readLine(); " ) ; String [ ] arrays = str . split ( " \\ s " , 0 ) ; int num = Integer . parseInt ( arrays [ 0 ] ) + Integer . parseInt ( arrays [ 1 ] ) ; System . out . println ( Integer . toString ( num ) . length ( ) ) ; str = br . readLine ( ) ; } } } +import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int ans = - 1 ; for ( int i = 12 ; i <= 1000 ; i ++ ) { if ( i * 8 / 100 == A && i / 10 == B ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) l [ i ] = sc . nextInt ( ) ; int point = 0 , cnt = 1 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: point += l[i]; \n if (point <= x) \n cnt++; \n else \n break; " ) ; point += l [ i ] ; if ( point <= x ) cnt ++ ; else break ; } System . out . println ( cnt ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int S = sc . nextInt ( ) ; final int W = sc . nextInt ( ) ; sc . close ( ) ; if ( S > W ) { System . out . println ( " safe " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" unsafe \" ); " ) ; System . out . println ( " unsafe " ) ; } } } +import java . util . * ; public class Main { 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 { System . out . println ( " [LOG] Block: arr[1] = 'R'; " ) ; arr [ 1 ] = 'R' ; } System . out . println ( arr ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; while ( a != 0 && b != 0 ) { System . out . println ( " [LOG] Block: int c = b; \n b = a % b; \n a = c; " ) ; int c = b ; b = a % b ; a = c ; } System . out . println ( a + b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] h = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } h [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( h [ i ] > h [ i - 1 ] ) { h [ i ] -- ; } } for ( int i = 1 ; i <= n ; i ++ ) { if ( h [ i ] >= h [ i - 1 ] ) { } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] a = new int [ n ] ; 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 ++ ) { System . out . println ( " [LOG] Block: if (a[i] == 0) \n c++; " ) ; if ( a [ i ] == 0 ) c ++ ; } System . out . println ( c ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , m , i , j ; int [ ] [ ] a = new int [ 100 ] [ 100 ] ; int [ ] b = new int [ 100 ] ; int [ ] c = new int [ 100 ] ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; for ( i = 0 ; i < n ; 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 < n ; i ++ ) { for ( j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: c[i] += a[i][j] * b[j]; " ) ; c [ i ] += a [ i ] [ j ] * b [ j ] ; } System . out . println ( c [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long min = 9999 ; for ( long i = l ; 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 ) { System . out . println ( " [LOG] Block: min = mod; " ) ; min = mod ; } } } System . out . println ( min ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] d ; d = new int [ 100 ] ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n int b = sc.nextInt(); \n d[a]++; \n d[b]++; " ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; d [ a ] ++ ; d [ b ] ++ ; } for ( int i = 1 ; i <= n ; i ++ ) System . out . println ( d [ i ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n > m ) { System . out . println ( " a > b " ) ; } if ( n < m ) { System . out . println ( " a < b " ) ; } if ( n == m ) { System . out . println ( " [LOG] Block: System.out.println( \" a == b \" ); " ) ; System . out . println ( " a == b " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int ans = a + a * a + a * a * a; \n System.out.print(ans); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int ans = a + a * a + a * a * a ; System . out . print ( ans ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String w = scan . nextLine ( ) ; String [ ] wArray = new String [ w . length ( ) ] ; for ( int i = 0 ; i < w . length ( ) ; i ++ ) { wArray [ i ] = w . substring ( i , i + 1 ) ; } List < String > wList = new ArrayList < String > ( Arrays . asList ( wArray ) ) ; List < String > wHashList = new ArrayList < String > ( new HashSet < > ( wList ) ) ; int sum = 0 ; for ( int i = 0 ; i < wHashList . size ( ) ; i ++ ) { for ( int j = 0 ; j < w . length ( ) ; j ++ ) { if ( wHashList . get ( i ) . 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = stdIn . nextInt ( ) ; } Arrays . sort ( d ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i >= 1 && d [ i ] != d [ i - 1 ] ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } else if ( i == 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String in = sc . nextLine ( ) ; int a = 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 = a ; result += ( ( i & 0x01 ) != 0 ) ? b : - b ; result += ( ( i & 0x02 ) != 0 ) ? c : - c ; result += ( ( i & 0x04 ) != 0 ) ? d : - d ; if ( result == 7 ) { System . out . println ( " [LOG] Block: System.out.println(String.format( \" %d%c%d%c%d%c%d=7 \" , a, ((i & 0x01) != 0) ? '+' : '-', b, ((i & 0x02) != 0) ? '+' : '-', c, ((i & 0x04) != 0) ? '+' : '-', d)); \n System.exit(0); " ) ; System . out . println ( String . format ( " %d%c%d%c%d%c%d=7 " , a , ( ( i & 0x01 ) != 0 ) ? '+' : '-' , b , ( ( i & 0x02 ) != 0 ) ? '+' : '-' , c , ( ( i & 0x04 ) != 0 ) ? '+' : '-' , d ) ) ; System . exit ( 0 ) ; } } } } +import java . util . Scanner ; public class Main { 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 a_count = 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 ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String str_a = scan.next(); \n String str_b = scan.next(); \n String str_c = scan.next(); \n System.out.println(abc_ans(str_a, str_b, str_c)); " ) ; 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 Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double s = (double) Integer.parseInt(sc.next()); \n System.out.println(String.format( \" %.12f \" , Math.pow(s / 3, 3))); " ) ; Scanner sc = new Scanner ( System . in ) ; double s = ( double ) Integer . parseInt ( sc . next ( ) ) ; System . out . println ( String . format ( " %.12f " , Math . pow ( s / 3 , 3 ) ) ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] dance = sc . next ( ) . toCharArray ( ) ; boolean bl = true ; for ( int i = 0 ; i < dance . length ; i ++ ) { if ( i % 2 == 0 ) { if ( dance [ i ] == 'L' ) { bl = false ; break ; } } else { if ( dance [ i ] == 'R' ) { bl = false ; break ; } } } if ( bl ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n System.out.println(Math.ceil(n / 2d) / (double) n); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( Math . ceil ( n / 2d ) / ( double ) n ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] b = new int [ N - 1 ] ; int sum = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } sum += b [ 0 ] ; for ( int i = 1 ; i < N - 1 ; i ++ ) { sum += min ( b [ i - 1 ] , b [ i ] ) ; } sum += b [ N - 2 ] ; System . out . println ( sum ) ; } public static int min ( int x , int y ) { if ( x < y ) { return x ; } else { System . out . println ( " [LOG] Block: return y; " ) ; return y ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new java . util . Scanner ( System . in ) ; int D = in . nextInt ( ) ; int N = in . nextInt ( ) ; if ( D == 0 ) { if ( N == 100 ) { System . out . print ( N + 1 ) ; } else { System . out . print ( N ) ; } } else if ( D == 1 ) { if ( N == 100 ) { System . out . print ( 100 * ( N + 1 ) ) ; } else { System . out . print ( 100 * N ) ; } } else if ( D == 2 ) { if ( N == 100 ) { System . out . print ( 100 * 100 * ( N + 1 ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(100 * 100 * N); " ) ; System . out . print ( 100 * 100 * N ) ; } } in . close ( ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { if ( str . equals ( " - " ) ) { break ; } StringBuilder aabc = new StringBuilder ( str ) ; int L = aabc . length ( ) ; str = br . readLine ( ) ; int m = Integer . parseInt ( str ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: str = br.readLine(); \n int h = Integer.parseInt(str); \n String temp = aabc.substring(0, h); \n aabc.append(temp); \n aabc.delete(0, h); " ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; if ( n == 0 ) { System . out . println ( 1 ) ; } else if ( n == 1 ) { System . out . println ( 0 ) ; } else { } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int [ ] x = new int [ 20000 ] ; x [ 0 ] = kb . nextInt ( ) ; int h = 0 ; int i = 0 ; while ( x [ h ] != 0 ) { h ++ ; x [ h ] = kb . nextInt ( ) ; } while ( x [ i ] != 0 ) { System . out . println ( " [LOG] Block: System.out.printf( \" Case %d: %d \n \" , i + 1, x[i]); \n i++; " ) ; System . out . printf ( " Case %d: %d \n " , i + 1 , x [ i ] ) ; i ++ ; } } } +import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ; public class Main { 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 ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } list . add ( Integer . parseInt ( str ) ) ; } int A = list . get ( 0 ) ; int B = list . get ( 1 ) ; if ( ( A == 1 && B == 2 ) || ( A == 2 && B == 1 ) ) System . out . println ( 3 ) ; else if ( ( A == 1 && B == 3 ) || ( A == 3 && B == 1 ) ) System . out . println ( 2 ) ; else if ( ( A == 2 && B == 3 ) || ( A == 3 && B == 2 ) ) System . out . println ( 1 ) ; } } +import java . util . Scanner ; class Main { 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 tempa = Integer . parseInt ( temp ) ; if ( tempa >= 1 && tempa <= 31 ) { System . out . println ( " [LOG] Block: a = a.replace( \" 2017 \" , \" 2018 \" ); \n System.out.println(a); " ) ; a = a . replace ( " 2017 " , " 2018 " ) ; System . out . println ( a ) ; } } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int count = 0 ; if ( n < 105 ) { System . out . println ( 0 ) ; return ; } for ( int i = 105 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) { continue ; } count = 0 ; for ( int j = 1 ; j <= i ; j ++ ) { if ( i % j == 0 ) { count ++ ; } } if ( count == 8 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { static BufferedReader reader ; public static void main ( String [ ] args ) { reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strings = readLine ( ) ; int H = Integer . parseInt ( strings [ 0 ] ) ; int A = Integer . parseInt ( strings [ 1 ] ) ; print ( ( H + 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 ( " [LOG] Block: System.out.println(); " ) ; System . out . println ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; boolean flag = true ; long aa = a , bb = b ; while ( flag ) { if ( aa < bb ) { aa += a ; } else if ( bb < aa ) { bb += b ; } else if ( aa == bb ) { System . out . println ( " [LOG] Block: flag = false; " ) ; flag = false ; } } System . out . println ( aa ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n String[] arr = reader.readLine().split( \" \" ); \n int X, Y, Z; \n X = Integer.parseInt(arr[0]); \n Y = Integer.parseInt(arr[1]); \n Z = Integer.parseInt(arr[2]); \n System.out.println(Z + \" \" + X + \" \" + Y); " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int X , Y , Z ; X = Integer . parseInt ( arr [ 0 ] ) ; Y = Integer . parseInt ( arr [ 1 ] ) ; Z = Integer . parseInt ( arr [ 2 ] ) ; System . out . println ( Z + " " + X + " " + Y ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . nextLine ( ) ; String S = sc . nextLine ( ) ; String [ ] Sarray = S . split ( " " ) ; String before = " " ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! before . equals ( Sarray [ i ] ) ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } before = Sarray [ i ] ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; if ( ! set . contains ( s ) ) { System . out . println ( " [LOG] Block: set.add(s); \n ans++; " ) ; set . add ( s ) ; ans ++ ; } } System . out . print ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { InputStreamReader r = new InputStreamReader ( System . in ) ; String S = nextString ( r ) ; int len = S . length ( ) ; int ans = 0 ; for ( int i = 0 ; i < len / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( len - 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 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } str += ( char ) c ; } return str ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < Integer . parseInt ( b ) ; i ++ ) { A += a ; } for ( int i = 0 ; i < Integer . parseInt ( a ) ; i ++ ) { System . out . println ( " [LOG] Block: B += b; " ) ; B += b ; } System . out . print ( ( A . compareTo ( B ) ) < 0 ? A : B ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int count = 0 ; do { count ++ ; h -= a ; if ( h <= 0 ) { System . out . println ( " [LOG] Block: System.out.println(count); " ) ; System . out . println ( count ) ; } } while ( h > 0 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int A = scanner.nextInt(), B = scanner.nextInt(), C = scanner.nextInt(); \n System.out.println(C / A * B); " ) ; Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) , B = scanner . nextInt ( ) , C = scanner . nextInt ( ) ; System . out . println ( C / A * B ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String T1 = t . substring ( s . length ( ) - 0 ) ; if ( t . equals ( s + T1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int [ ] flag = new int [ 101 ] ; Arrays . fill ( flag , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { int d = stdIn . nextInt ( ) ; flag [ d ] = 1 ; } int ans = 0 ; for ( int i = 0 ; i < 101 ; i ++ ) { System . out . println ( " [LOG] Block: ans += flag[i]; " ) ; ans += flag [ i ] ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < String > list = new ArrayList < String > ( ) ; while ( true ) { String line = sc . nextLine ( ) ; if ( line . equals ( " 0 0 " ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } list . add ( line ) ; } for ( String line : list ) { String [ ] string = line . 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 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; double h = s . nextDouble ( ) ; double n = s . nextDouble ( ) ; double m = 0 ; for ( int i = 0 ; i < n ; i ++ ) { m += s . nextDouble ( ) ; } if ( m >= h ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { 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 k = sc1 . nextInt ( ) ; Arrays . sort ( num ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: num[2] *= 2; " ) ; num [ 2 ] *= 2 ; } System . out . println ( num [ 0 ] + num [ 1 ] + num [ 2 ] ) ; sc1 . close ( ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a ; ArrayList < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print(list.get(list.size() - 1 - i)); " ) ; System . out . print ( list . get ( list . size ( ) - 1 - i ) ) ; } System . out . println ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; for ( int i = n ; i < 1000 ; i ++ ) { int k = i / 10 ; int l = i - ( int ) ( ( i / 100 ) * 100 ) ; if ( k == l ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( ans ) ; } } +import java . io . * ; public class Main { final static long MOD = 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 ) ) { System . out . println ( " [LOG] Block: ans = \" DENIED \" ; \n break; " ) ; ans = " DENIED " ; break ; } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 1 ; for ( int i = 1 ; i <= d ; i ++ ) { System . out . println ( " [LOG] Block: sum = sum * 100; " ) ; sum = sum * 100 ; } System . out . println ( sum * ( n + n / 100 ) ) ; } } +import java . util . * ; public class Main { public static Scanner in = new Scanner ( System . in ) ; public static int n = 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 == n - 1 ) { return 0 ; } else { if ( dp [ idx ] == - 1 ) { long c1 = solve ( idx + 1 ) + Math . abs ( h [ idx ] - h [ idx + 1 ] ) ; long c2 = oo ; if ( n - 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 ; } n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: h[i] = in.nextInt(); " ) ; h [ i ] = in . nextInt ( ) ; } System . out . println ( solve ( 0 ) ) ; } } +import java . util . * ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = 0 ; char p = '.' ; for ( char ch : sc . next ( ) . toCharArray ( ) ) { n = ( ( p == '.' || p == 'S' ) && ch == 'R' ) ? 1 : n ; if ( ch == 'R' && p == 'R' ) n ++ ; p = ch ; } System . out . println ( n ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: solve(); " ) ; solve ( ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: String s = in.next(); \n int a = s.charAt(0); \n char ans = (char) ++a; \n out.println(ans); " ) ; String s = in . next ( ) ; int a = s . charAt ( 0 ) ; char ans = ( char ) ++ a ; out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int hei , wid , cnt_wid ; while ( true ) { hei = scan . nextInt ( ) ; wid = scan . nextInt ( ) ; if ( hei == 0 && wid == 0 ) { break ; } for ( cnt_wid = 0 ; cnt_wid < wid ; cnt_wid ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; for ( int cnt_hei = 0 ; cnt_hei < hei - 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 . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( " \n " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sline = sc . next ( ) ; int n = 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 < n ; ) { boolean can = false ; for ( String w : words ) { int end = w . length ( ) ; if ( i + end > n ) 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; String ans = " YES " ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int [ ] b = Arrays . copyOf ( a , n ) ; Arrays . sort ( b ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != b [ i ] ) cnt ++ ; if ( cnt > 2 ) { System . out . println ( " [LOG] Block: ans = \" NO \" ; \n break; " ) ; ans = " NO " ; break ; } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner Ahmad = new Scanner ( System . in ) ; int x , y ; x = Ahmad . nextInt ( ) ; y = Ahmad . nextInt ( ) ; if ( ( x + y ) % 2 == 0 ) { System . out . println ( ( x + y ) / 2 ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( true ) { int middle = in . nextInt ( ) ; int term_end = in . nextInt ( ) ; int retest = in . nextInt ( ) ; int sum = middle + term_end ; if ( middle == - 1 && term_end == - 1 && retest == - 1 ) { break ; } else if ( middle == - 1 || term_end == - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; 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 ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.next(); \n boolean containsA = S.contains( \" A \" ); \n boolean containsB = S.contains( \" B \" ); \n System.out.println((containsA && containsB) ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; boolean containsA = S . contains ( " A " ) ; boolean containsB = S . contains ( " B " ) ; System . out . println ( ( containsA && containsB ) ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int N = scan.nextInt(); \n int M = scan.nextInt(); \n int ans = 0; \n int p = N + M; \n switch(p) { \n case 3: \n ans = 3; \n break; \n case 5: \n ans = 1; \n break; \n case 4: \n ans = 2; \n break; \n } \n System.out.println(ans); " ) ; Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int ans = 0 ; int p = N + 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 . * ; public class Main { public static void main ( String [ ] args ) throws Exception { String [ ] lines = getStdin ( ) ; String str1 = lines [ 0 ] ; int mult = 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 = mult * i ; if ( multiple >= from && multiple <= till ) { System . out . println ( " OK " ) ; return ; } else { multiple = mult ; } } System . out . println ( " NG " ) ; } private static String [ ] getStdin ( ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < String > lines = new ArrayList < > ( ) ; while ( scanner . hasNext ( ) ) { System . out . println ( " [LOG] Block: lines.add(scanner.nextLine()); " ) ; lines . add ( scanner . nextLine ( ) ) ; } return lines . toArray ( new String [ lines . size ( ) ] ) ; } } +import java . util . * ; import java . io . PrintWriter ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i <= k ; i ++ ) { for ( int j = 1 ; j <= k ; j ++ ) { for ( int t = 1 ; t <= k ; 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 ) { System . out . println ( " [LOG] Block: long tmp = m; \n m = n; \n n = tmp % n; " ) ; long tmp = m ; m = n ; n = tmp % n ; } return m ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String num = scan . nextLine ( ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { char c = num . charAt ( i ) ; if ( c == '1' ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( i == K - 1 ) { System . out . print ( ( char ) ( s . charAt ( i ) - 'A' + 'a' ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(s.charAt(i)); " ) ; System . out . print ( s . charAt ( i ) ) ; } } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; if ( line . contains ( " RRR " ) ) { System . out . println ( " 3 " ) ; } else if ( line . contains ( " RR " ) ) { System . out . println ( " 2 " ) ; } else if ( line . contains ( " R " ) ) { System . out . println ( 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; boolean b = 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 { System . out . println ( " [LOG] Block: b = false; " ) ; b = false ; } } } System . out . println ( b ? po : ( po == 0 ) ? 0 : - 1 ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double a = sc.nextDouble(); \n double calc1 = Math.pow(a, 2); \n double calc2 = Math.pow(a, 3); \n System.out.println((int) a + (int) calc1 + (int) calc2); " ) ; Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double calc1 = Math . pow ( a , 2 ) ; double calc2 = Math . pow ( a , 3 ) ; System . out . println ( ( int ) a + ( int ) calc1 + ( int ) calc2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = s . length ( ) ; String str1 = s . substring ( 0 , ( n - 1 ) / 2 ) ; String str2 = s . substring ( ( ( n + 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 ) ) ) { System . out . println ( " [LOG] Block: return true; " ) ; return true ; } return false ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = 0 ; if ( a <= b ) { x = x + b ; if ( a <= b - 1 ) { x = x + b - 1 ; } else { x = x + a ; } } else { x = x + a ; if ( b <= a - 1 ) { x = x + a - 1 ; } else { System . out . println ( " [LOG] Block: x = x + b; " ) ; x = x + b ; } } System . out . println ( x ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextLong ( ) ; if ( a [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } Arrays . sort ( a ) ; long ans = 1 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( a [ i ] > 1000000000000000000L / ans ) { System . out . println ( - 1 ) ; return ; } else { System . out . println ( " [LOG] Block: ans *= a[i]; " ) ; ans *= a [ i ] ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long num = 0 ; long answer = 0 ; double limit = 0.0 ; num = scan . nextLong ( ) ; answer = num ; limit = Math . sqrt ( num ) ; for ( int i = 1 ; i <= limit ; i ++ ) { if ( num % i == 0 && ( num / i ) + i - 2 < answer ) { System . out . println ( " [LOG] Block: answer = (num / i) + i - 2; " ) ; answer = ( num / i ) + i - 2 ; } } System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; String sTaro ; String sHanako ; int iTaro = 0 ; int iHanako = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sTaro = sc . next ( ) ; sHanako = sc . next ( ) ; if ( sTaro . compareTo ( sHanako ) < 0 ) { iHanako += 3 ; } else if ( sTaro . compareTo ( sHanako ) > 0 ) { iTaro += 3 ; } else { System . out . println ( " [LOG] Block: iTaro++; \n iHanako++; " ) ; iTaro ++ ; iHanako ++ ; } } System . out . println ( iTaro + " " + iHanako ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n double Ad = (double) A; \n int B = sc.nextInt(); \n double Bd = (double) B; \n int H = sc.nextInt(); \n int M = sc.nextInt(); \n sc.close(); \n double arg, C; \n arg = (double) H * 30.0 + (double) M * 0.5 - (double) M * 6.0; \n C = Math.sqrt(Ad * Ad + Bd * Bd - 2.0 * Ad * Bd * Math.cos(Math.toRadians(arg))); \n System.out.println(C); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; double Ad = ( double ) A ; int B = sc . nextInt ( ) ; double Bd = ( double ) B ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double arg , C ; arg = ( double ) H * 30.0 + ( double ) M * 0.5 - ( double ) M * 6.0 ; C = Math . sqrt ( Ad * Ad + Bd * Bd - 2.0 * Ad * Bd * Math . cos ( Math . toRadians ( arg ) ) ) ; System . out . println ( C ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int result = Integer . MAX_VALUE ; for ( int i = 0 ; i <= x ; i ++ ) { int sum = 0 ; sum += i * a ; int rx = x - i ; if ( rx > y ) { sum += c * 2 * rx ; } else { System . out . println ( " [LOG] Block: int diff = y - rx; \n sum += Math.min(c * 2 * rx + diff * b, c * 2 * y); " ) ; 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 . * ; class Main { 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 s = ss [ ss . length - 1 ] ; if ( s == '2' || s == '4' || s == '5' || s == '7' || s == '9' ) { System . out . println ( " hon " ) ; } else if ( s == '0' || s == '1' || s == '6' || s == '8' ) { System . out . println ( " pon " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" bon \" ); " ) ; System . out . println ( " bon " ) ; } } } +import java . util . * ; class Main { 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 top = 0 ; for ( int i = 0 ; i < str_split . length ; i ++ ) { System . out . println ( " [LOG] Block: switch(str_split[i].charAt(0)) { \n case '+': \n top--; \n nums[top - 1] = nums[top - 1] + nums[top]; \n break; \n case '-': \n top--; \n nums[top - 1] = nums[top - 1] - nums[top]; \n break; \n case '*': \n top--; \n nums[top - 1] = nums[top - 1] * nums[top]; \n break; \n default: \n nums[top] = Integer.parseInt(str_split[i]); \n top++; \n break; \n } " ) ; switch ( str_split [ i ] . charAt ( 0 ) ) { case '+' : top -- ; nums [ top - 1 ] = nums [ top - 1 ] + nums [ top ] ; break ; case '-' : top -- ; nums [ top - 1 ] = nums [ top - 1 ] - nums [ top ] ; break ; case '*' : top -- ; nums [ top - 1 ] = nums [ top - 1 ] * nums [ top ] ; break ; default : nums [ top ] = Integer . parseInt ( str_split [ i ] ) ; top ++ ; break ; } } System . out . println ( nums [ 0 ] ) ; } } +import java . util . * ; public class Main { static boolean [ ] targetNumbers ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; printPrimeNumbers2 ( 1000000 ) ; for ( int i = X ; 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 ] ) { System . out . println ( " [LOG] Block: primeNumbers.add(i); " ) ; primeNumbers . add ( i ) ; } } } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { 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 ans = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == t [ i ] ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int odd , even ; if ( n % 2 == 1 ) { odd = n / 2 + 1 ; even = n / 2 ; } else { odd = n / 2 ; even = n / 2 ; } if ( n == 1 ) { System . out . println ( 1 ) ; } else { System . out . println ( " [LOG] Block: double ans = (double) odd / (double) n; \n System.out.println(ans); " ) ; double ans = ( double ) odd / ( double ) n ; System . out . println ( ans ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; } } class Solver { int N ; int cnt ; public void init ( ) { N = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " \\ 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 < N ; } public void readBody ( String str ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } public void solve ( ) { } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . equals ( t ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } s = s . charAt ( s . length ( ) - 1 ) + s . substring ( 0 , s . length ( ) - 1 ) ; } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static long gcd ( long a , long b ) { while ( a % b != 0 ) { long tmp = a % b ; a = b ; b = tmp ; } 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 ( " [LOG] Block: System.out.println(b - a + 1 - divnum(a, b, c) - divnum(a, b, d) + divnum(a, b, lcm(c, d))); " ) ; System . out . println ( b - a + 1 - divnum ( a , b , c ) - divnum ( a , b , d ) + divnum ( a , b , lcm ( c , d ) ) ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = reader . readLine ( ) ; int n = Integer . parseInt ( s ) ; String t = reader . readLine ( ) ; String [ ] u = t . split ( " " ) ; int [ ] m = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { m [ i ] = Integer . parseInt ( u [ i ] ) ; } for ( int j = n - 1 ; j > - 1 ; j -- ) { System . out . print ( m [ j ] ) ; if ( j != 0 ) { System . out . print ( " " ) ; } } System . out . println ( ) ; } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: final Scanner sc = new Scanner(System.in); \n StringBuilder sb = new StringBuilder(sc.next()); \n sb.setCharAt(3, '8'); \n System.out.println(sb); " ) ; final Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( sc . next ( ) ) ; sb . setCharAt ( 3 , '8' ) ; System . out . println ( sb ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { final static Long MAX = 1000000000000000000L ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; List < Long > l = new ArrayList < Long > ( ) ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(-1); \n return; " ) ; System . out . println ( - 1 ) ; return ; } sum *= l2 ; } System . out . println ( sum ) ; } } } +import java . util . * ; public class Main { 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 i = 0 ; i < str . length ; i ++ ) { sb . setLength ( 0 ) ; for ( int j = i ; j < i + 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 ( i == str . length - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int b = sc.nextInt(); \n System.out.println(b * 2 * 3.14); " ) ; Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; System . out . println ( b * 2 * 3.14 ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] ab = scanner . nextLine ( ) . split ( " " , 2 ) ; int a = Integer . parseInt ( ab [ 0 ] ) ; int b = Integer . parseInt ( ab [ 1 ] ) ; String s = scanner . nextLine ( ) ; if ( a + b + 1 != s . length ( ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } for ( int i = 0 ; i <= a + b ; i ++ ) { char ch = s . charAt ( i ) ; if ( i == a ) { if ( ch != '-' ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } else { if ( ! ( '0' <= ch && ch <= '9' ) ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int 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 [ N ] [ 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 { System . out . println ( " [LOG] Block: resCorr++; \n pena += qa[input[i][0] - 1][0]; \n qa[input[i][0] - 1][1] = 1; " ) ; resCorr ++ ; pena += qa [ input [ i ] [ 0 ] - 1 ] [ 0 ] ; qa [ input [ i ] [ 0 ] - 1 ] [ 1 ] = 1 ; } } System . out . print ( resCorr + " " + pena ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; String s = sca . next ( ) ; String t = sca . next ( ) ; int a = sca . nextInt ( ) ; int b = sca . nextInt ( ) ; String u = sca . next ( ) ; if ( u . equals ( s ) ) { a -- ; } else { System . out . println ( " [LOG] Block: b--; " ) ; b -- ; } System . out . print ( a ) ; System . out . print ( " " ) ; System . out . println ( b ) ; sca . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner nine = new Scanner ( System . in ) ; int number1 = nine . nextInt ( ) ; int number2 = nine . nextInt ( ) ; if ( 1 <= number1 && number1 <= 9 && 1 <= number2 && number2 <= 9 ) { int answer = number1 * number2 ; System . out . println ( answer ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { 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 n = Integer . parseInt ( br . readLine ( ) ) ; if ( n == 0 ) break ; int [ ] s = new int [ n ] ; String [ ] dataset = br . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = Integer . parseInt ( dataset [ i ] ) ; } int goukei = 0 ; for ( int i : s ) { goukei += i ; } double m = ( double ) goukei / ( double ) n ; double alfa2 = 0.0 ; for ( int i : s ) { System . out . println ( " [LOG] Block: alfa2 += (i - m) * (i - m); " ) ; alfa2 += ( i - m ) * ( i - m ) ; } alfa2 = alfa2 / n ; double alfa = Math . sqrt ( alfa2 ) ; System . out . println ( alfa ) ; } } } +import java . util . Scanner ; class Main { static final long MOD = 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 Pair implements Comparable { int from ; int end ; int num ; int bango ; @ Override public int compareTo ( Object other ) { System . out . println ( " [LOG] Block: Pair otherpair = (Pair) other; \n return end - otherpair.end; " ) ; Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; String tmp = sc . nextLine ( ) ; for ( int i = 0 ; i < n ; ++ 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 ( " [LOG] Block: System.out.println(ele); " ) ; System . out . println ( ele ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = " " ; String [ ] data = a . split ( " " ) ; for ( int i = 0 ; data . length > i ; i ++ ) { if ( i == 3 ) { data [ i ] = " 8 " ; b = b + data [ i ] ; } else { System . out . println ( " [LOG] Block: b = b + data[i]; " ) ; b = b + data [ i ] ; } } System . out . println ( b ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { final Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; long [ ] arr = new long [ n ] ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print(-1); \n System.exit(0); " ) ; System . out . print ( - 1 ) ; System . exit ( 0 ) ; } mul = mul * a ; } System . out . print ( mul > ( long ) 1e18 ? - 1 : mul ) ; } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Integer [ ] nums = new Integer [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { nums [ i ] = scanner . nextInt ( ) ; } int diff = 0 ; boolean isEven = ( N % 2 ) == 0 ; Arrays . sort ( nums , Collections . reverseOrder ( ) ) ; int pairLastIndex = isEven ? N - 1 : N - 2 ; for ( int i = 0 ; i < pairLastIndex ; i = i + 2 ) { System . out . println ( " [LOG] Block: diff += nums[i] - nums[i + 1]; " ) ; diff += nums [ i ] - nums [ i + 1 ] ; } if ( ! isEven ) diff += nums [ N - 1 ] ; System . out . println ( diff ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int c = 0 ; for ( int x = 0 ; x <= K ; x ++ ) { for ( int y = 0 ; y <= K ; y ++ ) { int z = S - x - y ; if ( 0 <= z && z <= K ) { System . out . println ( " [LOG] Block: c += 1; " ) ; c += 1 ; } } } System . out . println ( c ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { String [ ] inputs = str . split ( " " ) ; int a = 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 ( a > b && a > c ) { a *= 2 ; } else if ( b > c ) { b *= 2 ; } else { System . out . println ( " [LOG] Block: c *= 2; " ) ; c *= 2 ; } } System . out . println ( a + b + c ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] Args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = new String [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { s [ i ] = sc . next ( ) ; } int p = 0 ; while ( s [ p ] . length ( ) != 0 ) { System . out . println ( " [LOG] Block: int np = s[p].charAt(0) - 'a'; \n s[p] = s[p].substring(1, s[p].length()); \n p = np; " ) ; 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 . * ; import java . text . * ; class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double r = sc.nextDouble(); \n double a = 3.14159265358979323846 * r * r; \n double l = 3.14159265358979323846 * r * 2; \n NumberFormat format = NumberFormat.getInstance(); \n format.setMaximumFractionDigits(5); \n format.setMinimumFractionDigits(5); \n format.setGroupingUsed(false); \n System.out.println( \" \" + format.format(a) + \" \" + format.format(l)); " ) ; Scanner sc = new Scanner ( System . in ) ; double r = sc . nextDouble ( ) ; double a = 3.14159265358979323846 * r * r ; double l = 3.14159265358979323846 * r * 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 . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; if ( S < 0 ) { System . out . println ( " NA " ) ; return ; } if ( S % 100 < 13 && S % 100 != 0 ) { if ( S / 100 < 13 && S / 100 != 0 ) { System . out . println ( " AMBIGUOUS " ) ; return ; } System . out . println ( " YYMM " ) ; return ; } if ( S / 100 < 13 && S / 100 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" MMYY \" ); \n return; " ) ; System . out . println ( " MMYY " ) ; return ; } System . out . println ( " NA " ) ; } } +import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try { int page ; int paper ; Scanner scan = new Scanner ( System . in ) ; String N = scan . next ( ) ; page = Integer . parseInt ( N ) ; if ( page % 2 == 0 ) { paper = page / 2 ; } else { paper = page / 2 + 1 ; } System . out . println ( paper ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.out.println( \" error \" ); " ) ; System . out . println ( " error " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double A = scan . nextDouble ( ) ; double B = scan . nextDouble ( ) ; double H = scan . nextDouble ( ) ; double M = scan . nextDouble ( ) ; double hour , minute , c , co , ans ; hour = H * 30 + M * 0.5 ; minute = M * 6 ; c = hour - minute ; if ( c > 180 ) { c = 360 - c ; } else if ( c < 0 ) { System . out . println ( " [LOG] Block: c = 360 + c; " ) ; c = 360 + c ; } co = Math . cos ( Math . toRadians ( c ) ) ; ans = A * A + B * B - 2 * A * B * co ; System . out . println ( Math . sqrt ( ans ) ) ; } } +import java . io . * ; import java . util . * ; class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public class Main { public static PrintWriter out ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int s = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; if ( w >= s ) { out . println ( " unsafe " ) ; } else { System . out . println ( " [LOG] Block: out.println( \" safe \" ); " ) ; out . println ( " safe " ) ; } out . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] values = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { values [ i ] [ j ] = sc . nextInt ( ) ; } } boolean ok = false ; for ( int i = 0 ; i < 101 ; i ++ ) { for ( int j = 0 ; j < 101 ; j ++ ) { for ( int k = 0 ; k < 101 ; k ++ ) { int b1 = values [ 0 ] [ 0 ] - i ; int b2 = values [ 0 ] [ 1 ] - i ; int b3 = values [ 0 ] [ 2 ] - i ; 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 ) ) { System . out . println ( " [LOG] Block: ok = true; " ) ; ok = true ; } } } } System . out . println ( ok ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long n = in . nextLong ( ) , c = 0 , s = 0 ; long k = in . nextLong ( ) ; long [ ] arr = new long [ ( int ) n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = in . nextInt ( ) ; s = s + arr [ i ] ; } if ( k >= n ) { System . out . println ( " 0 " ) ; System . exit ( 0 ) ; } Arrays . sort ( arr ) ; long mid = n - 1 ; while ( c != k ) { System . out . println ( " [LOG] Block: s = s - arr[(int) mid]; \n mid--; \n c++; " ) ; s = s - arr [ ( int ) mid ] ; mid -- ; c ++ ; } System . out . println ( s ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int break_count = 0 ; int next = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( sc . nextInt ( ) == next ) { next ++ ; } else { break_count ++ ; } } if ( next == 1 ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(break_count); " ) ; System . out . println ( break_count ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Integer [ ] p = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( Math . max ( p [ i - 1 ] , p [ i + 1 ] ) >= p [ i ] && Math . min ( p [ i - 1 ] , p [ i + 1 ] ) <= p [ i ] ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } System . out . println ( result ) ; } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . util . Vector ; public class Main { public static void main ( String [ ] arg ) { Scanner ob = new Scanner ( System . in ) ; int n = 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' ) { System . out . println ( " [LOG] Block: k++; " ) ; k ++ ; } } System . out . println ( k ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= K ; i ++ ) { for ( int j = 1 ; j <= K ; 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 <= K ; 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 ) { System . out . println ( " [LOG] Block: sum += d; \n break; " ) ; sum += d ; break ; } } } } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextLong(); \n String b = sc.next(); \n b = b.replace( \" . \" , \" \" ); \n int bb = Integer.parseInt(b); \n System.out.println(a * bb / 100); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; String b = sc . next ( ) ; b = b . replace ( " . " , " " ) ; int bb = Integer . parseInt ( b ) ; System . out . println ( a * bb / 100 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String str = sc.next(); \n int len = str.length(); \n String leftStr = str.substring(0, (len - 1) / 2); \n String rightStr = str.substring((len + 1) / 2, len); \n boolean isStrongPalindrome = new StringBuffer(leftStr).reverse().toString().equals(leftStr) && new StringBuffer(rightStr).reverse().toString().equals(rightStr) && new StringBuffer(str).reverse().toString().equals(str); \n System.out.println(isStrongPalindrome ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int len = str . length ( ) ; String leftStr = str . substring ( 0 , ( len - 1 ) / 2 ) ; String rightStr = str . substring ( ( len + 1 ) / 2 , len ) ; 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 Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { S [ i ] = sc . next ( ) ; } int [ ] C = new int [ 4 ] ; for ( int i = 0 ; i < N ; ++ 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 " ) ) { System . out . println ( " [LOG] Block: C[3]++; " ) ; 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 Main { public static void main ( String [ ] args ) { solve_149_B ( ) ; return ; } private static void solve_149_B ( ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; if ( A >= K ) { A = A - K ; } else { if ( B >= ( K - A ) ) { B = B - ( K - A ) ; } else { System . out . println ( " [LOG] Block: B = 0; " ) ; B = 0 ; } A = 0 ; } System . out . println ( A + " " + B ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] An = new int [ N ] ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: An[i] = s.nextInt(); " ) ; An [ i ] = s . nextInt ( ) ; } Arrays . sort ( An ) ; ans = An [ N - 1 ] - An [ 0 ] ; System . out . print ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String ans = " No " ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = 1 ; j < 10 ; j ++ ) { if ( i * j == N ) { System . out . println ( " [LOG] Block: ans = \" Yes \" ; \n break; " ) ; ans = " Yes " ; break ; } } } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int high = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; b [ i ] = a [ i ] ; high = Math . max ( high , a [ i ] ) ; } Arrays . sort ( b ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != high ) { System . out . println ( high ) ; } else { System . out . println ( " [LOG] Block: System.out.println(b[n - 2]); " ) ; System . out . println ( b [ n - 2 ] ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] d = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } Arrays . sort ( d ) ; int ans = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( d [ i - 1 ] != d [ i ] ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int flag = 1 ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; String s = scan . next ( ) ; if ( s . length ( ) != a + b + 1 ) { flag = 0 ; } for ( int i = 0 ; i < a ; i ++ ) { if ( '0' <= s . charAt ( i ) && s . charAt ( i ) <= '9' ) { } else { flag = 0 ; } } if ( s . charAt ( a ) != '-' ) { flag = 0 ; } for ( int i = a + 1 ; i < s . length ( ) ; i ++ ) { if ( '0' <= s . charAt ( i ) && s . charAt ( i ) <= '9' ) { } else { flag = 0 ; } } if ( flag == 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) != null ) { int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } stdReader . close ( ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: e.getStackTrace(); \n System.exit(0); " ) ; e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int c = 0 ; while ( N > c ) { System . out . println ( " [LOG] Block: c = c + 1000; " ) ; c = c + 1000 ; } c = c - N ; System . out . println ( c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String s = scanner . nextLine ( ) ; if ( n % 2 == 1 || n == 0 ) { System . out . println ( " No " ) ; return ; } String s1 = s . substring ( 0 , n / 2 ) ; String s2 = s . substring ( n / 2 , n ) ; if ( s1 . startsWith ( s2 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scanner . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int weekNum = sc . nextInt ( ) ; int debt = 100000 ; int roundUpNum = 1000 ; for ( int i = 0 ; i < weekNum ; i ++ ) { System . out . println ( " [LOG] Block: debt *= 1.05; \n debt = (int) Math.ceil((double) debt / roundUpNum) * roundUpNum; " ) ; debt *= 1.05 ; debt = ( int ) Math . ceil ( ( double ) debt / roundUpNum ) * roundUpNum ; } System . out . println ( debt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; String a = scanner . next ( ) ; String b = scanner . next ( ) ; if ( ( a . length ( ) + 1 == b . length ( ) ) && b . startsWith ( a ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; class Main { 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 x = Integer . parseInt ( line [ 0 ] ) ; int y = Integer . parseInt ( line [ 1 ] ) ; if ( x == 0 && y == 0 ) { break ; } else { System . out . println ( " [LOG] Block: sb.append(Integer.toString(x < y ? x : y)).append( \" \" ).append(Integer.toString(x < y ? y : x)).append( \" \n \" ); " ) ; sb . append ( Integer . toString ( x < y ? x : y ) ) . append ( " " ) . append ( Integer . toString ( x < y ? y : x ) ) . append ( " \n " ) ; } } System . out . print ( sb ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < String > ( ) ; char last = 'X' ; boolean flag = true ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] matrix = new int [ n ] [ m ] ; int [ ] vector = new int [ m ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: sum += matrix[i][j] * vector[j]; " ) ; sum += matrix [ i ] [ j ] * vector [ j ] ; } System . out . println ( sum ) ; } } } +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 Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; long k = 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 >= k ) { System . out . println ( " 1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(str[(int) one]); " ) ; System . out . println ( str [ ( int ) one ] ) ; } } } +import java . io . * ; import java . util . StringTokenizer ; public class Main { 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 num = read . readLine ( ) ; if ( num . charAt ( 0 ) == '7' ) { prnt . println ( " Yes " ) ; } else if ( num . charAt ( 1 ) == '7' ) { prnt . println ( " Yes " ) ; } else if ( num . charAt ( 2 ) == '7' ) { prnt . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: prnt.println( \" No \" ); " ) ; prnt . println ( " No " ) ; } prnt . close ( ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] str = ( sc . next ( ) ) . split ( " " ) ; sc . close ( ) ; List < String > list = new ArrayList < String > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( list . contains ( str [ i ] ) ) { cnt ++ ; } else { list . add ( str [ i ] ) ; } } if ( list . size ( ) > 2 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } else { if ( cnt == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.nextLine(); \n String[] S1 = S.split( \" / \" , 0); \n int year, month, day; \n year = Integer.parseInt(S1[0]); \n month = Integer.parseInt(S1[1]); \n day = Integer.parseInt(S1[2]); \n if (month >= 5) \n System.out.println( \" TBD \" ); \n else \n System.out.println( \" Heisei \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String [ ] S1 = S . split ( " / " , 0 ) ; int year , month , day ; year = 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = Integer . parseInt ( s . next ( ) ) ; int k = Integer . parseInt ( s . next ( ) ) ; int count = 1 ; for ( int i = 1 ; i < n ; ) { i = i * k ; if ( n / i >= 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int numx = s . nextInt ( ) ; int numn = s . nextInt ( ) ; if ( numn == 0 ) { System . out . println ( numx ) ; 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 ( numx ) ) { ans = numx ; flg_con = false ; } int count = 0 ; while ( flg_con ) { count ++ ; int mnx = numx - count ; int plx = numx + count ; if ( ! listNum . contains ( mnx ) ) { ans = mnx ; flg_con = false ; } else if ( ! listNum . contains ( plx ) ) { System . out . println ( " [LOG] Block: ans = plx; \n flg_con = false; " ) ; ans = plx ; flg_con = false ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int n = kb . nextInt ( ) , k = kb . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = kb . nextInt ( ) ; } int [ ] dp = new int [ n ] ; boolean [ ] visited = new boolean [ n ] ; dp [ 0 ] = 0 ; visited [ 0 ] = true ; for ( int i = 1 ; i < n ; 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 ] ) { System . out . println ( " [LOG] Block: dp[i] = ksteps; \n visited[i] = true; " ) ; dp [ i ] = ksteps ; visited [ i ] = true ; } else dp [ i ] = Math . min ( dp [ i ] , ksteps ) ; } } System . out . println ( dp [ n - 1 ] ) ; } } +import java . util . * ; import static java . lang . System . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int g = n / 2; \n double ans = (double) (n - g) / n; \n out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int g = n / 2 ; double ans = ( double ) ( n - g ) / n ; out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long num1 = scn . nextInt ( ) ; long num2 = scn . nextInt ( ) ; System . out . println ( CommonMultipleNum . cmn ( num1 , num2 ) ) ; } } class CommonMultipleNum { static long cmn ( long num1 , long num2 ) { long tmp ; long num3 = num1 ; num3 *= num2 ; while ( ( tmp = num1 % num2 ) != 0 ) { System . out . println ( " [LOG] Block: num1 = num2; \n num2 = tmp; " ) ; num1 = num2 ; num2 = tmp ; } return ( long ) ( num3 / num2 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int plus = A + B ; int minus = A - B ; int kakeru = A * B ; if ( B > - B ) { if ( plus < kakeru ) System . out . println ( kakeru ) ; else System . out . println ( plus ) ; } else { System . out . println ( " [LOG] Block: if (minus < kakeru) \n System.out.println(kakeru); \n else \n System.out.println(minus); " ) ; if ( minus < kakeru ) System . out . println ( kakeru ) ; else System . out . println ( minus ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int w = stdIn . nextInt ( ) ; int [ ] a = new int [ w + 1 ] ; for ( int i = 1 ; i <= w ; i ++ ) a [ i ] = i ; int s = stdIn . nextInt ( ) ; for ( ; s != 0 ; s -- ) { System . out . println ( " [LOG] Block: String[] S = stdIn.next().split( \" , \" ); \n int l = Integer.parseInt(S[0]); \n int r = Integer.parseInt(S[1]); \n int t = a[l]; \n a[l] = a[r]; \n a[r] = t; " ) ; 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 <= w ; i ++ ) System . out . println ( a [ i ] ) ; } } +import java . util . * ; import java . io . * ; class Main { static PrintStream out = System . out ; static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; int i = 1 ; do { int x = i ; if ( x % 3 == 0 ) { out . print ( " " + i ) ; } else { do { if ( x % 10 == 3 ) { System . out . println ( " [LOG] Block: out.print( \" \" + i); \n break; " ) ; out . print ( " " + i ) ; break ; } x /= 10 ; } while ( x != 0 ) ; } } while ( ++ i <= n ) ; out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; for ( int i = 1 ; i < 10000 ; i ++ ) { if ( ( int ) Math . floor ( i * 0.08 ) == A && ( int ) Math . floor ( i * 0.1 ) == B ) { System . out . println ( " [LOG] Block: System.out.println(i); \n return; " ) ; System . out . println ( i ) ; return ; } } System . out . println ( - 1 ) ; return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; boolean bl = true ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z ; while ( true ) { z = x % y ; x = y ; y = z ; if ( y == 0 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . printf ( " %d%n " , x ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; char [ ] c = ob . next ( ) . toCharArray ( ) ; int sum = 0 ; for ( int i = 0 ; i < c . length ; i ++ ) { sum = sum + Character . getNumericValue ( c [ i ] ) ; } if ( sum % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) array [ i ] = sc . nextInt ( ) ; Arrays . sort ( array ) ; for ( int i = n - 1 ; i >= n - k ; i -- ) { System . out . println ( " [LOG] Block: if (i >= 0) \n array[i] = 0; \n else \n break; " ) ; if ( i >= 0 ) array [ i ] = 0 ; else break ; } long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += array [ i ] ; System . out . println ( sum ) ; } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; int count = 0 ; int len = s . length ; for ( int i = 0 ; i < len ; i ++ ) { System . out . println ( " [LOG] Block: if (s[i] != t[i]) \n count++; " ) ; if ( s [ i ] != t [ i ] ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long ans = 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 ) { ans = 0 ; ans2 = 0 ; } else { if ( k <= n ) { ans = n - k ; ans2 = m ; } else { System . out . println ( " [LOG] Block: ans = 0; \n ans2 = m - (k - n); " ) ; ans = 0 ; ans2 = m - ( k - n ) ; } } System . out . println ( ans ) ; System . out . println ( ans2 ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long K = sc . nextLong ( ) ; int Q = sc . nextInt ( ) ; long lim = K - Q ; int [ ] winCon = new int [ N + 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int ans = - 1000000000 ; int min = stdIn . nextInt ( ) ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int r = stdIn.nextInt(); \n ans = Math.max(ans, r - min); \n min = Math.min(min, r); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] d = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int ans = 0 ; for ( int a = 0 ; a < n - 1 ; a ++ ) { for ( int b = 0 ; b < n - 1 - a ; b ++ ) { System . out . println ( " [LOG] Block: ans += d[a] * d[a + 1 + b]; " ) ; ans += d [ a ] * d [ a + 1 + b ] ; } } System . out . println ( ans ) ; } } +import java . util . * ; import java . util . Map . Entry ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { S [ i ] = sc . next ( ) ; } sc . close ( ) ; 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 ( " [LOG] Block: System.out.println(s); " ) ; System . out . println ( s ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String str = scan.next(); \n System.out.println(str.equals( \" ABC \" ) ? \" ARC \" : \" ABC \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; System . out . println ( str . equals ( " ABC " ) ? " ARC " : " ABC " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String S = in . next ( ) ; String res ; if ( S . equals ( " Sunny " ) ) { res = " Cloudy " ; } else if ( S . equals ( " Cloudy " ) ) { res = " Rainy " ; } else { System . out . println ( " [LOG] Block: res = \" Sunny \" ; " ) ; res = " Sunny " ; } System . out . println ( res ) ; in . close ( ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; List < Integer > nums = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: nums.add(sc.nextInt()); " ) ; nums . add ( sc . nextInt ( ) ) ; } Collections . sort ( nums ) ; int n1 = nums . get ( n / 2 - 1 ) ; int n2 = nums . get ( n / 2 ) ; System . out . println ( n2 - n1 ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { static int height = 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]+ " ) ; height = Integer . parseInt ( nyuryokuStr [ 0 ] ) ; weight = Integer . parseInt ( nyuryokuStr [ 1 ] ) ; if ( height == 0 && weight == 0 ) { zeroFlag = false ; } else { for ( int h = 0 ; h < height ; h ++ ) { for ( int w = 0 ; w < weight ; w ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } line = br . readLine ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double D = sc . nextDouble ( ) ; int cnt = 0 ; double [ ] X = new double [ N ] ; double [ ] Y = new double [ N ] ; for ( int i = 0 ; i < N ; 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 ( N == 0 || d > D ) { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { int j = scan . nextInt ( ) ; a [ j ] ++ ; } for ( int i = 1 ; i < n + 1 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(a[i]); " ) ; System . out . println ( a [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] a = new char [ 10 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { a [ i ] = s . charAt ( i ) ; } a [ 3 ] = '8' ; for ( int i = 0 ; i < a . length ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(a[i]); " ) ; System . out . print ( a [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > vList = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { vList . add ( sc . nextInt ( ) ) ; } Collections . sort ( vList ) ; double ans = ( double ) vList . get ( 0 ) ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: double sum = ans + (double) vList.get(i); \n ans = sum / 2; " ) ; double sum = ans + ( double ) vList . get ( i ) ; ans = sum / 2 ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < c . length ; i ++ ) { for ( int m = 0 ; m < c . length ; m ++ ) { if ( c [ i ] == c [ m ] ) { count [ i ] ++ ; } } } for ( int i = 0 ; i < c . length ; i ++ ) { if ( count [ i ] % 2 != 0 ) { show = " No " ; break ; } else { System . out . println ( " [LOG] Block: show = \" Yes \" ; " ) ; show = " Yes " ; } } System . out . println ( show ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long l = Long . parseLong ( sc . next ( ) ) ; while ( l % 2 == 0 ) { System . out . println ( " [LOG] Block: l /= 2; \n count++; " ) ; l /= 2 ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; import java . util . Stack ; public class Main { 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 v1 = stack . pop ( ) ; int v2 = stack . pop ( ) ; stack . push ( v2 + v1 ) ; break ; } case " - " : { int v1 = stack . pop ( ) ; int v2 = stack . pop ( ) ; stack . push ( v2 - v1 ) ; break ; } case " * " : { int v1 = stack . pop ( ) ; int v2 = stack . pop ( ) ; stack . push ( v2 * v1 ) ; break ; } default : { stack . push ( Integer . valueOf ( token ) ) ; break ; } } } System . out . println ( stack . pop ( ) ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . Scanner ; class Main { 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 limit = scn . nextInt ( ) ; if ( anntena [ 4 ] - anntena [ 0 ] > limit ) { System . out . println ( " :( " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yay! \" ); " ) ; System . out . println ( " Yay! " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double tturn = Math . ceil ( c / b ) ; double aturn = Math . ceil ( a / d ) ; if ( tturn <= aturn ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int numData = 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 < numData ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int hoge ; for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { if ( a [ i ] < a [ j ] ) { System . out . println ( " [LOG] Block: hoge = a[i]; \n a[i] = a[j]; \n a[j] = hoge; " ) ; hoge = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = hoge ; } } } hoge = a [ 1 ] - a [ 0 ] ; hoge += a [ 2 ] - a [ 1 ] ; System . out . println ( hoge ) ; } } +import java . util . * ; public class Main { 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 N = sortedString . length ( ) ; int cnt = 0 ; char tmpVal = sortedString . charAt ( 0 ) ; if ( N <= 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } for ( int i = 0 ; i < N ; i ++ ) { char val = sortedString . charAt ( i ) ; if ( val == tmpVal ) { cnt ++ ; } else { if ( cnt % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } cnt = 1 ; tmpVal = val ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; scanner . close ( ) ; int c = a * b ; if ( c % 2 == 1 ) { System . out . println ( " Odd " ) ; } else if ( c % 2 == 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" Even \" ); " ) ; System . out . println ( " Even " ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { static int getMorePrime ( int n ) { if ( n == 2 ) return n ; ArrayList < Integer > primes = new ArrayList < Integer > ( ) ; primes . add ( 2 ) ; int i = 2 ; while ( true ) { for ( int j = 0 ; j < primes . size ( ) ; j ++ ) if ( i % primes . get ( j ) == 0 ) { ++ i ; j = 0 ; } if ( i >= n ) return i ; primes . add ( i ) ; ++ i ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n System.out.println(getMorePrime(n)); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( getMorePrime ( n ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int ans = 2000 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int c = sc.nextInt(); \n int t2 = sc.nextInt(); \n if (t2 > t) \n continue; \n ans = Math.min(ans, c); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int cnt = 0 , tmp = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = N - 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 < N ; i ++ ) { if ( i == N - 1 ) { System . out . print ( A [ i ] ) ; } else { System . out . println ( " [LOG] Block: System.out.print(A[i] + \" \" ); " ) ; System . out . print ( A [ i ] + " " ) ; } } System . out . println ( ) ; System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int powk = ( ( int ) Math . pow ( 2 , k ) ) ; int answer = 0 ; if ( a > b && a > c ) { answer = a * powk + b + c ; } else if ( b > a && b > c ) { answer = b * powk + a + c ; } else { System . out . println ( " [LOG] Block: answer = c * powk + a + b; " ) ; answer = c * powk + a + b ; } System . out . println ( answer ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; if ( n <= m ) { System . out . println ( " unsafe " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" safe \" ); " ) ; System . out . println ( " safe " ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { 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 flag = true ; int size = sc . nextInt ( ) ; if ( size > 100 ) { flag = 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 ) { flag = true ; } else { flag = false ; break ; } } if ( ! slist . contains ( word ) ) { if ( flag ) { slist . add ( word ) ; beforeWord = word ; } } else { flag = false ; break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; 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 < n ; i ++ ) { String value = sc . next ( ) ; if ( list . contains ( value ) ) { System . out . println ( " [LOG] Block: ruled = false; \n break; " ) ; ruled = false ; break ; } else if ( ! value . substring ( 0 , 1 ) . equals ( lastWord ) ) { System . out . println ( " [LOG] Block: ruled = false; \n break; " ) ; ruled = false ; break ; } lastWord = value . split ( " " ) [ value . length ( ) - 1 ] ; list . add ( value ) ; } System . out . println ( ruled ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += l + i ; } if ( n + l <= 0 ) { System . out . println ( sum - ( n + l - 1 ) ) ; } else if ( l < 0 ) { System . out . println ( sum ) ; } else { System . out . println ( " [LOG] Block: System.out.println(sum - l); " ) ; System . out . println ( sum - l ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; 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 ) { System . out . println ( " [LOG] Block: a = b; \n b = tmp; " ) ; a = b ; b = tmp ; } return c / b ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " No " ; String s = sc . next ( ) ; String t = sc . next ( ) ; int n = s . length ( ) ; int temp = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( s . charAt ( j ) != t . charAt ( ( j + temp ) % n ) ) { temp ++ ; count = 0 ; break ; } else { count ++ ; } } if ( count == n ) { System . out . println ( " [LOG] Block: ans = \" Yes \" ; \n break; " ) ; ans = " Yes " ; break ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int n = scanner.nextInt(); \n int input = scanner.nextInt(); \n String str = new Integer(n).toString(n, input); \n System.out.println(str.length()); " ) ; Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int input = scanner . nextInt ( ) ; String str = new Integer ( n ) . toString ( n , input ) ; System . out . println ( str . length ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; boolean flag = true ; int before = Integer . parseInt ( lines [ 0 ] ) ; for ( int i = 1 ; i < lines . length ; i ++ ) { int after = Integer . parseInt ( lines [ i ] ) ; if ( before == after ) { flag = false ; break ; } before = after ; } if ( flag ) { System . out . println ( " Good " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Bad \" ); " ) ; System . out . println ( " Bad " ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String seedStr = stdReader . readLine ( ) ; String [ ] inputStr = seedStr . 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 . out . println ( " [LOG] Block: System.exit(-1); " ) ; System . exit ( - 1 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; 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 ] ) { System . out . println ( " [LOG] Block: return -1; " ) ; return - 1 ; } visited [ index ] = true ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int h = 0 ; h < 241 ; h ++ ) { if ( n >= 3600 ) { n = n - 3600 ; } else { System . out . print ( h + " : " ) ; break ; } } for ( int m = 0 ; m < 60 ; m ++ ) { if ( n >= 60 ) { n = n - 60 ; } else { System . out . println ( " [LOG] Block: System.out.println(m + \" : \" + n); \n break; " ) ; System . out . println ( m + " : " + n ) ; break ; } } } } +import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > b ) { System . out . println ( 2 * a - 1 ) ; } else if ( a == b ) { System . out . println ( 2 * a ) ; } else { System . out . println ( " [LOG] Block: System.out.println(2 * b - 1); " ) ; System . out . println ( 2 * b - 1 ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader sb = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Integer [ ] hList = new Integer [ 10 ] ; for ( int num = 0 ; num < 10 ; num ++ ) { int h = Integer . parseInt ( sb . readLine ( ) ) ; hList [ num ] = h ; } Arrays . sort ( hList , Collections . reverseOrder ( ) ) ; for ( int rank = 0 ; rank < 3 ; rank ++ ) { System . out . println ( " [LOG] Block: System.out.println(hList[rank]); " ) ; System . out . println ( hList [ rank ] ) ; } } } +import java . util . * ; public class Main { 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 flag = 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 " ) ) { flag = 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 " ) ) { flag = false ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] sunuke = new int [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; h ++ ) { if ( sunuke [ h ] == 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) ; long a = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long c = a + b ; long d = n % c ; if ( ( a == 0 ) || ( c == 0 ) ) { System . out . println ( " 0 " ) ; return ; } long g = ( long ) ( n - d ) / c ; if ( g == 0 ) { if ( n <= a ) { System . out . println ( n ) ; } else { System . out . println ( a ) ; } } else { long other = 0 ; if ( d <= a ) { other = d ; } else { System . out . println ( " [LOG] Block: other = a; " ) ; other = a ; } System . out . println ( g * a + other ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { n [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; Arrays . sort ( n ) ; for ( int i = 0 ; i < k ; i ++ ) { n [ 2 ] *= 2 ; } int a = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: a += n[i]; " ) ; a += n [ i ] ; } System . out . println ( a ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] p = new int [ N ] ; int check = 0 ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = scan . nextInt ( ) ; if ( p [ i ] != i + 1 ) { check ++ ; } } if ( check == 0 || check == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; boolean b = true ; int i ; for ( i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } Arrays . sort ( array ) ; for ( i = 0 ; i < n ; i ++ ) { if ( i != 0 ) { if ( array [ i - 1 ] == array [ i ] ) { System . out . println ( " [LOG] Block: b = false; \n break; " ) ; b = false ; break ; } } } System . out . println ( b ? " YES " : " NO " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ary = new int [ n ] ; 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 ++ ) { System . out . println ( " [LOG] Block: sum += ary[i]; " ) ; sum += ary [ i ] ; } System . out . printf ( " %d %d %d%n " , ary [ 0 ] , ary [ n - 1 ] , sum ) ; } } +import java . util . Scanner ; public class Main { 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 a = Integer . parseInt ( String . valueOf ( sA ) ) ; int b = Integer . parseInt ( String . valueOf ( sB ) ) ; if ( a == 0 && b == 0 ) { System . out . println ( " [LOG] Block: answer = \" NA \" ; " ) ; answer = " NA " ; } else if ( a == 0 ) { if ( b <= 12 ) { answer = " YYMM " ; } else { System . out . println ( " [LOG] Block: answer = \" NA \" ; " ) ; answer = " NA " ; } } else if ( b == 0 ) { if ( a <= 12 ) { answer = " MMYY " ; } else { System . out . println ( " [LOG] Block: answer = \" NA \" ; " ) ; answer = " NA " ; } } else if ( a <= 12 ) { if ( b <= 12 ) { answer = " AMBIGUOUS " ; } else { answer = " MMYY " ; } } else { if ( b <= 12 ) { answer = " YYMM " ; } else { System . out . println ( " [LOG] Block: answer = \" NA \" ; " ) ; answer = " NA " ; } } System . out . println ( answer ) ; } } +import java . io . * ; import java . util . * ; import java . math . * ; import java . lang . * ; class Main { public static void PrintIntArray ( int [ ] Arr ) { for ( int i = 0 ; i < Arr . length ; i ++ ) { System . out . print ( Arr [ i ] + " " ) ; } 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 Reader { 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 { System . out . println ( " [LOG] Block: return Double.parseDouble(next()); " ) ; return Double . parseDouble ( next ( ) ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; ArrayList < Integer > d = new ArrayList < Integer > ( ) ; for ( int i = Math . max ( A , B ) ; i >= 1 ; i -- ) { System . out . println ( " [LOG] Block: if (A % i == 0 && B % i == 0) \n d.add(i); " ) ; if ( A % i == 0 && B % i == 0 ) d . add ( i ) ; } System . out . println ( d . get ( K - 1 ) ) ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d , e , f , k , l , m , n , x , y , z ; int ans ; String [ ] S ; Main ( ) { n = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; System . out . println ( Math . min ( a * n , b ) ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main(); " ) ; new Main ( ) ; } } +import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int i = 0 , count = 0 ; ; while ( i + A <= ( T + 0.5 ) ) { System . out . println ( " [LOG] Block: count++; \n i += A; " ) ; count ++ ; i += A ; } System . out . println ( B * count ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = 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 ( x - i ) < abs ) { abs = Math . abs ( x - i ) ; ans = i ; } } } if ( n == 0 || ! ( list . contains ( x ) ) ) { System . out . println ( x ) ; } else { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String someString = sc . next ( ) ; char rChar = 'R' ; int rCount = 0 ; for ( int i = 0 ; i < someString . length ( ) ; i ++ ) { if ( rCount == 0 && someString . charAt ( i ) == rChar ) { rCount = 1 ; } if ( someString . charAt ( i ) == rChar ) { if ( i > 0 && someString . charAt ( i - 1 ) == rChar ) { System . out . println ( " [LOG] Block: rCount++; " ) ; rCount ++ ; } } } System . out . println ( rCount ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; if ( x == 0 ) { pw . println ( 1 ) ; } else { System . out . println ( " [LOG] Block: pw.println(0); " ) ; pw . println ( 0 ) ; } br . close ( ) ; pw . close ( ) ; } } +import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; String [ ] A = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . next ( ) ; } Arrays . sort ( A ) ; StringBuilder B = new StringBuilder ( ) ; for ( int i = 0 ; i < A . length ; i ++ ) { System . out . println ( " [LOG] Block: B.append(A[i]); " ) ; B . append ( A [ i ] ) ; } System . out . println ( B ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { int num = 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 ++ ) { System . out . println ( " [LOG] Block: sum += (array.get(j) - i) * (array.get(j) - i); " ) ; sum += ( array . get ( j ) - i ) * ( array . get ( j ) - i ) ; } min = Math . min ( sum , min ) ; } out . println ( min ) ; out . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] a = sc . nextLine ( ) . split ( " " ) ; int [ ] array = new int [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { array [ i ] = Integer . parseInt ( a [ i ] ) ; } int changeCount = 0 ; int minj ; for ( int i = 0 ; i < num ; i ++ ) { minj = i ; for ( int j = i ; j < num ; 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 . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; System . out . println ( changeCount ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . nextLine ( ) ; if ( s . equals ( " SUN " ) ) { System . out . println ( " 7 " ) ; } else if ( s . equals ( " MON " ) ) { System . out . println ( " 6 " ) ; } else if ( s . equals ( " TUE " ) ) { System . out . println ( " 5 " ) ; } else if ( s . equals ( " WED " ) ) { System . out . println ( " 4 " ) ; } else if ( s . equals ( " THU " ) ) { System . out . println ( " 3 " ) ; } else if ( s . equals ( " FRI " ) ) { System . out . println ( " 2 " ) ; } else if ( s . equals ( " SAT " ) ) { System . out . println ( " [LOG] Block: System.out.println( \" 1 \" ); " ) ; System . out . println ( " 1 " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] H = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) H [ i ] = sc . nextInt ( ) ; int maxMove = 0 ; int currentMove = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( H [ i ] >= H [ i + 1 ] ) { currentMove ++ ; if ( currentMove > maxMove ) maxMove = currentMove ; } else { System . out . println ( " [LOG] Block: currentMove = 0; " ) ; currentMove = 0 ; } } System . out . println ( maxMove ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String result = " Yay! " ; out : for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = i + 1 ; j < 5 ; j ++ ) { if ( Math . abs ( num [ i ] - num [ j ] ) > k ) { System . out . println ( " [LOG] Block: result = \" :( \" ; \n break out; " ) ; result = " :( " ; break out ; } } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] cities = new int [ n ] ; 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 < n ; j ++ ) { System . out . println ( " [LOG] Block: System.out.println(cities[j]); " ) ; System . out . println ( cities [ j ] ) ; } } } +import java . util . LinkedList ; import java . util . Scanner ; public class Main { 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 op1 ; int op2 ; for ( String item : items ) { switch ( item ) { case " + " : op2 = stack . pop ( ) ; op1 = stack . pop ( ) ; stack . push ( op1 + op2 ) ; break ; case " - " : op2 = stack . pop ( ) ; op1 = stack . pop ( ) ; stack . push ( op1 - op2 ) ; break ; case " * " : op2 = stack . pop ( ) ; op1 = stack . pop ( ) ; stack . push ( op1 * op2 ) ; break ; default : stack . push ( Integer . parseInt ( item ) ) ; } } System . out . println ( stack . pop ( ) ) ; } } class Stack { private LinkedList < Integer > stack ; public Stack ( ) { stack = new LinkedList < Integer > ( ) ; } public void push ( int item ) { stack . addLast ( item ) ; } public int pop ( ) { System . out . println ( " [LOG] Block: int ret = stack.getLast(); \n stack.removeLast(); \n return ret; " ) ; int ret = stack . getLast ( ) ; stack . removeLast ( ) ; return ret ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int [ ] arr = new int [ 100 ] ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } for ( int j = n - 1 ; j > 0 ; j -- ) { System . out . println ( " [LOG] Block: System.out.print(arr[j] + \" \" ); " ) ; System . out . print ( arr [ j ] + " " ) ; } System . out . println ( arr [ 0 ] ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; String S = stdIn . next ( ) ; String [ ] s = S . split ( " S " ) ; int ans = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { System . out . println ( " [LOG] Block: ans = Math.max(ans, s[i].length()); " ) ; ans = Math . max ( ans , s [ i ] . length ( ) ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; String str ; for ( int i = A ; i <= B ; i ++ ) { str = " " + A ; if ( str . charAt ( 0 ) == str . charAt ( 4 ) && str . charAt ( 1 ) == str . charAt ( 3 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } A ++ ; } System . out . println ( count ) ; } } +import java . util . * ; class Main { public void yatary ( ) { Scanner sc = new Scanner ( System . in ) ; int i ; int x = sc . nextInt ( ) ; int [ ] num = new int [ x ] ; for ( i = 0 ; i < x ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } for ( i = x - 1 ; i >= 0 ; i -- ) { if ( i != 0 ) { System . out . print ( num [ i ] + " " ) ; } else { System . out . println ( num [ i ] ) ; } } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().yatary(); " ) ; new Main ( ) . yatary ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int K = Integer.parseInt(sc.next()); \n String S = sc.next(); \n if (S.length() <= K) \n System.out.println(S); \n else \n System.out.println(S.substring(0, K) + \" ... \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; if ( S . length ( ) <= K ) System . out . println ( S ) ; else System . out . println ( S . substring ( 0 , K ) + " ... " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n + 2 ] ; int maxh = 0 ; int zero1 = 0 ; int zero2 = n ; int ret = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { h [ i ] = sc . nextInt ( ) ; maxh = Math . max ( maxh , h [ i ] ) ; } h [ 0 ] = 0 ; h [ n + 1 ] = 0 ; for ( int i = 1 ; i <= maxh ; i ++ ) { zero1 = 0 ; zero2 = n ; for ( int j = 0 ; j < n + 2 ; j ++ ) { if ( h [ j ] == 0 ) { zero2 = j ; if ( zero2 - zero1 > 1 ) { ret ++ ; } zero1 = zero2 ; } } for ( int k = 0 ; k < n + 2 ; k ++ ) { if ( h [ k ] > 0 ) { System . out . println ( " [LOG] Block: h[k]--; " ) ; h [ k ] -- ; } } } System . out . println ( ret ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { final int n = sc . nextInt ( ) ; while ( sc . hasNext ( ) ) { System . out . println ( " [LOG] Block: int[] x = new int[3]; \n x[0] = sc.nextInt(); \n x[1] = sc.nextInt(); \n x[2] = sc.nextInt(); \n Arrays.sort(x); \n boolean isTriangle = (x[0] * x[0]) + (x[1] * x[1]) == (x[2] * x[2]); \n System.out.println(isTriangle ? \" YES \" : \" NO \" ); " ) ; 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 . * ; import java . io . * ; public class Main { 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 n = Integer . parseInt ( br . readLine ( ) ) ; int a = 0 ; int b = 0 ; String [ ] input = br . readLine ( ) . split ( " " ) ; Integer [ ] numbers = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { numbers [ i ] = Integer . valueOf ( input [ i ] ) ; } Arrays . sort ( numbers , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { a += numbers [ i ] ; } else { System . out . println ( " [LOG] Block: b += numbers[i]; " ) ; b += numbers [ i ] ; } } out . println ( a - b ) ; out . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ sc . nextInt ( ) ] ++ ; } long [ ] cmb = new long [ n + 1 ] ; cmb [ 0 ] = 1 ; cmb [ 1 ] = a [ 1 ] ^ 1 ; final long mod = 1_000_000_007 ; for ( int i = 2 ; i <= n ; i ++ ) { System . out . println ( " [LOG] Block: cmb[i] = (a[i] ^ 1) * (cmb[i - 2] + cmb[i - 1]) % mod; " ) ; cmb [ i ] = ( a [ i ] ^ 1 ) * ( cmb [ i - 2 ] + cmb [ i - 1 ] ) % mod ; } System . out . println ( cmb [ n ] ) ; } } +import java . util . * ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] a ) { Scanner scan = new Scanner ( System . in ) ; int stuNum = scan . nextInt ( ) ; Map < Integer , Integer > numMap = new HashMap < > ( ) ; for ( int i = 1 ; i < stuNum + 1 ; i ++ ) { int s = scan . nextInt ( ) ; int dis = stuNum - s ; numMap . put ( stuNum - dis , i ) ; } for ( int j = 1 ; j < numMap . size ( ) + 1 ; j ++ ) { System . out . println ( " [LOG] Block: System.out.printf( \" %d \" , numMap.get(j)); " ) ; System . out . printf ( " %d " , numMap . get ( j ) ) ; } } } +import java . util . Scanner ; public class Main { void run ( ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ 100 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } System . out . print ( a [ n - 1 ] ) ; for ( int i = n - 2 ; i >= 0 ; i -- ) { System . out . print ( " " + a [ i ] ) ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Main m = new Main(); \n m.run(); " ) ; Main m = new Main ( ) ; m . run ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int size = kb . nextInt ( ) ; int [ ] [ ] a = new int [ size ] [ 3 ] ; int x , y , z ; for ( int i = 0 ; i < size ; i ++ ) { a [ i ] [ 0 ] = kb . nextInt ( ) ; a [ i ] [ 1 ] = kb . nextInt ( ) ; a [ i ] [ 2 ] = kb . nextInt ( ) ; } for ( int i = 0 ; i < size ; 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.nextLine(); \n int ab = Integer.parseInt(s.replaceAll( \" \" , \" \" )); \n int sqrt = (int) Math.sqrt(ab); \n System.out.println((sqrt * sqrt == ab) ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int ab = Integer . parseInt ( s . replaceAll ( " " , " " ) ) ; int sqrt = ( int ) Math . sqrt ( ab ) ; System . out . println ( ( sqrt * sqrt == ab ) ? " Yes " : " No " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . Stream ; public class Main { public static void main ( final String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: final Scanner sc = new Scanner(System.in); \n final String S = sc.next(); \n StringBuffer sb = new StringBuffer(S); \n sb.setCharAt(3, '8'); \n System.out.println(sb.toString()); " ) ; final Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; StringBuffer sb = new StringBuffer ( S ) ; sb . setCharAt ( 3 , '8' ) ; System . out . println ( sb . toString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int result = n ; if ( d == 0 && n == 100 ) { result ++ ; } else if ( 0 < d ) { for ( int i = 0 ; i < d ; i ++ ) { result *= 100 ; } if ( n == 100 ) { int add = 1 ; for ( int i = 0 ; i < d ; i ++ ) { System . out . println ( " [LOG] Block: add *= 100; " ) ; add *= 100 ; } result += add ; } } System . out . println ( result ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; long k = sc . nextLong ( ) ; int ans = 0 ; int n = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: n = s.charAt(i) - '0'; \n k--; \n if (k == 0 || n > 1) \n break; " ) ; n = s . charAt ( i ) - '0' ; k -- ; if ( k == 0 || n > 1 ) break ; } System . out . println ( n ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 [ n ] [ 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 ) { System . out . println ( " [LOG] Block: counter++; " ) ; counter ++ ; } } System . out . println ( counter ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int len = String . valueOf ( n ) . length ( ) ; int res = 0 ; for ( int i = 1 ; i < len ; i += 2 ) { res += 9 * ( int ) Math . pow ( 10 , i - 1 ) ; } if ( len % 2 == 1 ) { System . out . println ( " [LOG] Block: res += n - (int) Math.pow(10, len - 1) + 1; " ) ; res += n - ( int ) Math . pow ( 10 , len - 1 ) + 1 ; } System . out . println ( res ) ; } } +import java . util . * ; class Main { Scanner sc ; void calc ( ) { sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . charAt ( 2 ) == s . charAt ( 3 ) && s . charAt ( 4 ) == s . charAt ( 5 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int i = 10 , res = 0 , sign = 1 ; while ( A >= i ) { System . out . println ( " [LOG] Block: res += (i - 1) * sign; \n sign *= -1; \n i *= 10; " ) ; res += ( i - 1 ) * sign ; sign *= - 1 ; i *= 10 ; } if ( res <= 0 ) res += A ; System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; Boolean bool = true ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { if ( ! ( ( S . charAt ( i ) == 'R' ) || ( S . charAt ( i ) == 'U' ) || ( S . charAt ( i ) == 'D' ) ) ) { bool = false ; } } if ( i % 2 == 1 ) { if ( ! ( ( S . charAt ( i ) == 'L' ) || ( S . charAt ( i ) == 'U' ) || ( S . charAt ( i ) == 'D' ) ) ) { bool = false ; } } } if ( bool == true ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int[] r = new int[n]; \n for (int i = 1; i <= n; i++) r[sc.nextInt() - 1] = i; \n for (int rr : r) System.out.print(rr + \" \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] r = new int [ n ] ; for ( int i = 1 ; i <= n ; i ++ ) r [ sc . nextInt ( ) - 1 ] = i ; for ( int rr : r ) System . out . print ( rr + " " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String numbers = " 1 " ; int sum ; while ( true ) { numbers = scanner . nextLine ( ) ; if ( numbers . equals ( " 0 " ) ) break ; sum = 0 ; for ( int i = 0 ; i < numbers . length ( ) ; ++ i ) { System . out . println ( " [LOG] Block: sum += Character.getNumericValue(numbers.charAt(i)); " ) ; sum += Character . getNumericValue ( numbers . charAt ( i ) ) ; } System . out . println ( sum ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; int [ ] v = new int [ count ] ; int [ ] c = new int [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { v [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < count ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int i = 0 ; i < count ; i ++ ) { if ( v [ i ] > c [ i ] ) { System . out . println ( " [LOG] Block: result += v[i] - c[i]; " ) ; result += v [ i ] - c [ i ] ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int m = 0 ; int flag = 0 ; if ( y <= x * 2 || y <= x * 4 ) { for ( int i = 1 ; i <= x ; i ++ ) { int j = i * 2 ; m = i * 4 ; int h = y - j ; int h1 = y - m ; if ( ( h1 % 2 == 0 && h1 / 2 == x - i ) || ( h % 4 == 0 && h / 4 == x - i ) ) { System . out . println ( " [LOG] Block: flag = 1; \n break; " ) ; flag = 1 ; break ; } } } if ( flag == 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int H = Integer.parseInt(sc.next()); \n int A = Integer.parseInt(sc.next()); \n int remainder = H % A; \n int n = H / A; \n System.out.println(remainder > 0 ? n + 1 : n); " ) ; Scanner sc = new Scanner ( System . in ) ; int H = Integer . parseInt ( sc . next ( ) ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int remainder = H % A ; int n = H / A ; System . out . println ( remainder > 0 ? n + 1 : n ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner ob = new Scanner ( System . in ) ; int n = ob . nextInt ( ) ; int k = ob . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ob . nextInt ( ) ; } int min = 0 ; int [ ] arr = new int [ n ] ; 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 ) { System . out . println ( " [LOG] Block: min = Math.min(arr[i - j] + Math.abs(a[i] - a[i - j]), min); " ) ; min = Math . min ( arr [ i - j ] + Math . abs ( a [ i ] - a [ i - j ] ) , min ) ; } } arr [ i ] = min ; } System . out . println ( arr [ n - 1 ] ) ; ob . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int count = 0 ; uncode : while ( true ) { for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 != 0 ) { System . out . println ( " [LOG] Block: break uncode; " ) ; break uncode ; } a [ i ] = a [ i ] / 2 ; } count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long n , 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 ) { System . out . println ( " [LOG] Block: sum = 0; " ) ; sum = 0 ; } } System . out . println ( sum + " " + mal ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int s = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( a > b ) { s += a -- ; } else { System . out . println ( " [LOG] Block: s += b--; " ) ; s += b -- ; } } System . out . print ( s ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] key = new int [ N ] ; 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 ( " [LOG] Block: System.out.println( \" 0 \" ); " ) ; System . out . println ( " 0 " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { private void solve ( ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; System . out . println ( Math . max ( A + B , Math . max ( A - B , A * B ) ) ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int i = 0 ; for ( i = X ; 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 ) { System . out . println ( " [LOG] Block: re = true; \n break; " ) ; re = true ; break ; } } } } return re ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( solve ( A , B ) ) ; sc . close ( ) ; } static int solve ( int A , int B ) { if ( A >= 13 ) { return B ; } else if ( A >= 6 ) { return B / 2 ; } else { System . out . println ( " [LOG] Block: return 0; " ) ; return 0 ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner entrada = new Scanner ( System . in ) ; char letter = entrada . next ( ) . charAt ( 0 ) ; if ( Character . isUpperCase ( letter ) ) { System . out . println ( " A " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N + 1 ] ; int [ ] B = new int [ N ] ; long jizenSum = 0 ; for ( int i = 0 ; i < N + 1 ; i ++ ) { A [ i ] = sc . nextInt ( ) ; jizenSum += A [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } int tmp = 0 ; for ( int i = 0 ; i < N ; 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 < N + 1 ; i ++ ) { System . out . println ( " [LOG] Block: sum += A[i]; " ) ; sum += A [ i ] ; } System . out . println ( jizenSum - sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int count = 1 ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tmp == count ) { ans ++ ; count ++ ; } list . add ( tmp ) ; } if ( ans == 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(N - ans); " ) ; System . out . println ( N - ans ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { System . out . println ( " [LOG] Block: int n = in.nextInt(); \n if (n == 0) \n break; \n int[] numbers = new int[n]; \n for (int i = 0; i < n; i++) numbers[i] = in.nextInt(); \n long double_sum = 0; \n for (int i = 0; i < n; i++) double_sum += numbers[i]; \n double_sum = double_sum * double_sum; \n long sum_double = 0; \n for (int i = 0; i < n; i++) sum_double += (numbers[i] * numbers[i]); \n double sd = Math.sqrt((sum_double - double_sum / (double) n) / (double) n); \n System.out.printf( \" %5.8f \" , sd); \n System.out.println(); " ) ; int n = in . nextInt ( ) ; if ( n == 0 ) break ; int [ ] numbers = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) numbers [ i ] = in . nextInt ( ) ; long double_sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) double_sum += numbers [ i ] ; double_sum = double_sum * double_sum ; long sum_double = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum_double += ( numbers [ i ] * numbers [ i ] ) ; double sd = Math . sqrt ( ( sum_double - double_sum / ( double ) n ) / ( double ) n ) ; System . out . printf ( " %5.8f " , sd ) ; System . out . println ( ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] t = new int [ N + 1 ] ; t [ 0 ] = 0 ; int [ ] x = new int [ N + 1 ] ; x [ 0 ] = 0 ; int [ ] y = new int [ N + 1 ] ; x [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { t [ i ] = sc . nextInt ( ) ; x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } printArray ( a ) ; for ( int i = 1 ; i < n ; 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 . println ( " [LOG] Block: System.out.print(a[i] + \" \" ); " ) ; System . out . print ( a [ i ] + " " ) ; } System . out . println ( a [ a . length - 1 ] ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int 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 . println ( " [LOG] Block: System.out.print( \" \" + i); \n break; " ) ; System . out . print ( " " + i ) ; break ; } x /= 10 ; } } if ( ++ i > n ) break ; } System . out . print ( " \n " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int max = h [ 0 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( max <= h [ i + 1 ] ) { System . out . println ( " [LOG] Block: cnt++; \n max = h[i + 1]; " ) ; cnt ++ ; max = h [ i + 1 ] ; } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String C = sc.next(); \n char[] c = C.toCharArray(); \n System.out.println((char) (c[0] + 0x01)); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; String C = sc . next ( ) ; char [ ] c = C . toCharArray ( ) ; System . out . println ( ( char ) ( c [ 0 ] + 0x01 ) ) ; sc . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; for ( int i = 0 ; i <= N ; i ++ ) { int x = i * 10000 ; if ( x > Y ) break ; for ( int j = 0 ; j <= N - i ; j ++ ) { int y = j * 5000 ; if ( ( x + y ) > Y ) break ; if ( ( Y - x - y ) / 1000 == ( N - i - j ) ) { System . out . println ( " [LOG] Block: System.out.println(i + \" \" + j + \" \" + (Y - x - y) / 1000); \n return; " ) ; System . out . println ( i + " " + j + " " + ( Y - x - y ) / 1000 ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n String[] arr = reader.readLine().split( \" \" ); \n int N = Integer.parseInt(arr[0]); \n int K = Integer.parseInt(arr[1]); \n int cnt = 1; \n while (Math.pow(K, cnt) <= N) cnt++; \n System.out.println(cnt); " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int N = Integer . parseInt ( arr [ 0 ] ) ; int K = Integer . parseInt ( arr [ 1 ] ) ; int cnt = 1 ; while ( Math . pow ( K , cnt ) <= N ) cnt ++ ; System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean ok = false ; LOOP : for ( int i = 0 ; i <= n ; i += 4 ) { for ( int j = 0 ; i + j <= n ; j += 7 ) { if ( i + j == n ) { ok = true ; break LOOP ; } } } if ( ok ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; String s = scan . next ( ) ; char [ ] a = s . toCharArray ( ) ; if ( a [ k - 1 ] >= 'A' && a [ k - 1 ] <= 'Z' ) { System . out . println ( " [LOG] Block: a[k - 1] = (char) (a[k - 1] - 'A' + 'a'); " ) ; a [ k - 1 ] = ( char ) ( a [ k - 1 ] - 'A' + 'a' ) ; } System . out . println ( a ) ; } } +import java . util . Scanner ; public class Main { 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 con = 0 ; for ( int i = 0 ; i < line_S . length ; i ++ ) { if ( line_S [ i ] . compareTo ( line_T [ i ] ) != 0 ) { System . out . println ( " [LOG] Block: con++; " ) ; con ++ ; } } System . out . println ( con ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; int [ ] dp = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { dp [ i ] = dp [ i - 1 ] ; if ( S . substring ( i - 1 , i + 1 ) . equals ( " AC " ) ) { dp [ i ] ++ ; } } for ( int i = 0 ; i < q ; i ++ ) { System . out . println ( " [LOG] Block: int L = Integer.parseInt(sc.next()); \n int R = Integer.parseInt(sc.next()); \n System.out.println((dp[R - 1] - dp[L - 1])); " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int N = scanner.nextInt(); \n int K = scanner.nextInt(); \n String S = scanner.next(); \n String[] sArray = S.split( \" \" ); \n sArray[K - 1] = sArray[K - 1].toLowerCase(); \n System.out.println(String.join( \" \" , sArray)); \n scanner.close(); " ) ; Scanner scanner = new Scanner ( System . in ) ; int N = 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int codeNum = 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 [ codeNum ] [ num ] ; for ( int i = 0 ; i < codeNum ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } sum = 0 ; } System . out . println ( count ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int H = sc.nextInt(); \n int M = sc.nextInt(); \n sc.close(); \n double h = (double) H / 12.0; \n h += (double) M / 60.0 / 12.0; \n double m = (double) M / 60.0; \n double rad = Math.PI * 2 * (h - m); \n double rsq = (A * A) + (B * B) - (2 * A * B * Math.cos(rad)); \n System.out.println(Math.sqrt(rsq)); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double h = ( double ) H / 12.0 ; h += ( double ) M / 60.0 / 12.0 ; double m = ( double ) M / 60.0 ; double rad = Math . PI * 2 * ( h - m ) ; double rsq = ( A * A ) + ( B * B ) - ( 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; int [ ] Nmonster = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { Nmonster [ i ] = scn . nextInt ( ) ; } long Nbeaten = 0 ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: Nbeaten += Nbeatble; \n Nmonster[i + 1] -= Nbeatble; " ) ; Nbeaten += Nbeatble ; Nmonster [ i + 1 ] -= Nbeatble ; } } } System . out . println ( Nbeaten ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String N = sc.next(); \n System.out.println(N.contains( \" 7 \" ) ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String N = sc . next ( ) ; System . out . println ( N . contains ( " 7 " ) ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int [ ] c = new int [ N ] ; int [ ] t = new int [ N ] ; int cmin = 1001 ; int twithin = 1001 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(cmin); " ) ; System . out . println ( cmin ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int [ ] flag = new int [ 101 ] ; for ( int i = 0 ; i < N ; i ++ ) { int d = sc . nextInt ( ) ; flag [ d ] = 1 ; } for ( int i = 1 ; i < 101 ; i ++ ) { System . out . println ( " [LOG] Block: count += flag[i]; " ) ; count += flag [ i ] ; } System . out . println ( count ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer s = Integer . parseInt ( sc . next ( ) ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( s ) ; int result = 0 ; boolean doContinue = true ; for ( int i = 0 ; doContinue ; i ++ ) { if ( s % 2 == 0 ) { if ( list . contains ( s / 2 ) ) { result = i + 2 ; doContinue = false ; } else { s = s / 2 ; list . add ( s ) ; } } else { if ( list . contains ( 3 * s + 1 ) ) { result = i + 2 ; doContinue = false ; } else { System . out . println ( " [LOG] Block: s = 3 * s + 1; \n list.add(s); " ) ; s = 3 * s + 1 ; list . add ( s ) ; } } } System . out . println ( result ) ; sc . close ( ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String [ ] input = br . readLine ( ) . split ( " " ) ; int N = Integer . parseInt ( input [ 0 ] ) ; int M = Integer . parseInt ( input [ 1 ] ) ; int result = 0 ; if ( N > 1 ) { result += ( N * ( N - 1 ) ) / 2 ; } if ( M > 1 ) { System . out . println ( " [LOG] Block: result += (M * (M - 1)) / 2; " ) ; result += ( M * ( M - 1 ) ) / 2 ; } System . out . println ( result ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; sc . close ( ) ; int bb = ( Y - 2 * X ) ; if ( bb % 2 != 0 || bb < 0 ) { System . out . println ( " No " ) ; return ; } int b = bb / 2 ; int a = X - b ; if ( a >= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; int [ ] love = new int [ m ] ; int k , a ; for ( int i = 0 ; i < n ; 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 ] == n ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; List < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: list.add(sc.next()); " ) ; list . add ( sc . next ( ) ) ; } List < String > L = new ArrayList < String > ( new HashSet < > ( list ) ) ; System . out . println ( L . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long K = sc . nextLong ( ) ; if ( S . length ( ) == 1 ) { System . out . println ( S ) ; return ; } int i = 0 ; while ( i < S . length ( ) && S . charAt ( i ) == '1' ) { i ++ ; } if ( K <= i ) { System . out . println ( " [LOG] Block: System.out.println(1); \n return; " ) ; System . out . println ( 1 ) ; return ; } System . out . print ( S . charAt ( i ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long ans = 100 ; long sum = 0 ; while ( ans < N ) { System . out . println ( " [LOG] Block: ans = ans + (long) (ans / 100); \n sum++; " ) ; ans = ans + ( long ) ( ans / 100 ) ; sum ++ ; } System . out . println ( sum ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n String line = reader.readLine(); \n int x = Integer.parseInt(line); \n int answer = (int) Math.pow(x, 3); \n System.out.println(answer); " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int answer = ( int ) Math . pow ( x , 3 ) ; System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int yoke = 0 ; int count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: count += a % 10; \n a -= a % 10; \n a /= 10; " ) ; count += a % 10 ; a -= a % 10 ; a /= 10 ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { int count = 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 count = 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 ) { System . out . println ( " [LOG] Block: int tmp = array[index]; \n array[index] = array[i]; \n array[i] = tmp; \n count++; " ) ; int tmp = array [ index ] ; array [ index ] = array [ i ] ; array [ i ] = tmp ; count ++ ; } } return count ; } } +import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = Integer . parseInt ( stdIn . next ( ) ) ; if ( x != 2 && x % 2 == 0 ) x ++ ; while ( true ) { int i ; double sqrtNum = Math . sqrt ( x ) ; for ( i = 3 ; i <= sqrtNum ; i += 2 ) { System . out . println ( " [LOG] Block: if (x % i == 0) \n break; " ) ; if ( x % i == 0 ) break ; } if ( i > sqrtNum ) break ; x += 2 ; } System . out . println ( x ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int[] abc = { sc.nextInt(), sc.nextInt(), sc.nextInt() } ; \n int k = sc.nextInt(); \n Arrays.sort(abc); \n for (int i = 0; i < k; i++) abc[2] *= 2; \n System.out.println(abc[0] + abc[1] + abc[2]); " ) ; Scanner sc = new Scanner ( System . in ) ; int [ ] abc = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int k = sc . nextInt ( ) ; Arrays . sort ( abc ) ; for ( int i = 0 ; i < k ; i ++ ) abc [ 2 ] *= 2 ; System . out . println ( abc [ 0 ] + abc [ 1 ] + abc [ 2 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; int n ; if ( " RRR " . equals ( S ) ) { n = 3 ; } else if ( " RRS " . equals ( S ) || " SRR " . equals ( S ) ) { n = 2 ; } else if ( S . contains ( " R " ) ) { n = 1 ; } else { System . out . println ( " [LOG] Block: n = 0; " ) ; n = 0 ; } System . out . println ( n ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st; \n PrintWriter pw = new PrintWriter(System.out); \n int a = Integer.parseInt(br.readLine()); \n int b = Integer.parseInt(br.readLine()); \n int x = 1 ^ 2 ^ 3; \n x ^= a; \n x ^= b; \n pw.println(x); \n pw.flush(); \n pw.close(); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st ; PrintWriter pw = new PrintWriter ( System . out ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int x = 1 ^ 2 ^ 3 ; x ^= a ; x ^= b ; pw . println ( x ) ; pw . flush ( ) ; pw . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] list = scanner . next ( ) . split ( " " ) ; int count = 0 ; for ( String s : list ) { if ( Integer . parseInt ( s ) == 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; scanner . close ( ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: if (ar[i] == 0) \n s++; " ) ; if ( ar [ i ] == 0 ) s ++ ; } System . out . println ( s ) ; } catch ( Exception e ) { } } } +import java . util . * ; import java . io . * ; public class Main { 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 strNum = str . split ( " " ) . length ; if ( strNum > 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" YES \" ); " ) ; System . out . println ( " YES " ) ; } } } +import java . util . Scanner ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int s = scn . nextInt ( ) ; ArrayList < Integer > element = new ArrayList < Integer > ( ) ; for ( int i = 1 ; ; ) { if ( i == 1 ) { element . add ( s ) ; } else { if ( s % 2 == 1 ) { s = odd ( s ) ; } else { s = even ( s ) ; } if ( element . indexOf ( s ) == - 1 ) { element . add ( s ) ; } else { System . out . println ( i ) ; break ; } } i ++ ; } } public static int even ( int n ) { return n / 2 ; } public static int odd ( int n ) { System . out . println ( " [LOG] Block: return 3 * n + 1; " ) ; return 3 * n + 1 ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int i = 0 ; String [ ] line ; line = new String [ 10000 ] ; try { while ( i < 10000 ) { line [ i ] = reader . readLine ( ) ; if ( line [ i ] . equals ( " 0 " ) ) break ; i ++ ; } i = 0 ; while ( i < 10000 ) { if ( line [ i ] . equals ( " 0 " ) ) break ; System . out . println ( " Case " + ( i + 1 ) + " : " + line [ i ] ) ; i ++ ; } } catch ( IOException e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } } } +import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdin = new Scanner(System.in); \n List<Long> s = stdin.nextLine().chars().boxed().collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).values().stream().collect(Collectors.toList()); \n String ans = s.equals(Arrays.asList(2L, 2L)) ? \" Yes \" : \" No \" ; \n System.out.println(ans); " ) ; 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 ans = s . equals ( Arrays . asList ( 2L , 2L ) ) ? " Yes " : " No " ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int[] A = new int[3]; \n A[0] = sc.nextInt(); \n A[1] = sc.nextInt(); \n A[2] = sc.nextInt(); \n Arrays.sort(A); \n System.out.print(A[2] - A[0]); " ) ; 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 . io . * ; class Main { 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 x = Integer . parseInt ( a [ 0 ] ) ; int y = Integer . parseInt ( a [ 1 ] ) ; if ( x > y ) { sb . append ( y + " " + x + " \n " ) ; } else { System . out . println ( " [LOG] Block: sb.append(x + \" \" + y + \" \n \" ); " ) ; sb . append ( x + " " + y + " \n " ) ; } } System . out . print ( sb ) ; } } +import java . util . Scanner ; import java . util . Deque ; import java . util . ArrayDeque ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Deque < Integer > deq = new ArrayDeque < Integer > ( ) ; String str = " " ; int a = 0 , b = 0 ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; if ( str . equals ( " + " ) ) { a = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( a + b ) ; } else if ( str . equals ( " - " ) ) { a = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( b - a ) ; } else if ( str . equals ( " * " ) ) { a = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( a * b ) ; } else if ( str . equals ( " / " ) ) { a = deq . pollLast ( ) ; b = deq . pollLast ( ) ; deq . addLast ( b / a ) ; } else { System . out . println ( " [LOG] Block: deq.addLast(Integer.parseInt(str)); " ) ; deq . addLast ( Integer . parseInt ( str ) ) ; } } System . out . println ( deq . peekLast ( ) ) ; } } +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 Main { static long MOD = 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 ) { System . out . println ( " [LOG] Block: a = b; \n b = temp; " ) ; a = b ; b = temp ; } return ( c / b ) ; } } +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 Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long a , b = 0 ; long n = Long . parseLong ( br . readLine ( ) ) ; int digits , mindigits = 11 ; for ( a = 1 ; a <= Math . sqrt ( n ) ; a ++ ) { if ( n % a == 0 ) { System . out . println ( " [LOG] Block: b = n / a; \n digits = String.valueOf(Math.max(a, b)).length(); \n if (digits < mindigits) \n mindigits = digits; " ) ; b = n / a ; digits = String . valueOf ( Math . max ( a , b ) ) . length ( ) ; if ( digits < mindigits ) mindigits = digits ; } } System . out . println ( mindigits ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int yusha = s . nextInt ( ) ; long [ ] monsters = new long [ yusha + 1 ] ; long [ ] strength = new long [ yusha ] ; long count = 0 ; for ( int i = 0 ; i < yusha + 1 ; i ++ ) { monsters [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < yusha ; i ++ ) { strength [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < yusha ; 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 { System . out . println ( " [LOG] Block: count += monsters[j + i]; \n strength[i] = strength[i] - monsters[i + j]; \n monsters[i + j] = 0; " ) ; count += monsters [ j + i ] ; strength [ i ] = strength [ i ] - monsters [ i + j ] ; monsters [ i + j ] = 0 ; } } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; for ( int i = 0 ; i < w . length ( ) ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < w . length ( ) ; j ++ ) { if ( w . charAt ( i ) == w . charAt ( j ) ) sum = sum + 1 ; } if ( sum % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int sum = 0 ; boolean flag = true ; while ( flag ) { flag = false ; boolean ed = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( h [ i ] != 0 ) { h [ i ] = h [ i ] - 1 ; if ( ! ed ) { ed = true ; flag = true ; sum ++ ; } } else { System . out . println ( " [LOG] Block: ed = false; " ) ; ed = false ; } } } System . out . println ( sum ) ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Long > hs = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { hs . add ( sc . nextLong ( ) ) ; } String ans = hs . size ( ) == n ? " 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 ( " [LOG] Block: System.out.println(info); " ) ; System . out . println ( info ) ; } static void out ( int info ) { System . out . println ( " [LOG] Block: System.out.println(info); " ) ; System . out . println ( info ) ; } static void out ( double info ) { System . out . println ( " [LOG] Block: System.out.println(info); " ) ; System . out . println ( info ) ; } static void out ( long info ) { System . out . println ( " [LOG] Block: System.out.println(info); " ) ; System . out . println ( info ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int x = n ; int num = 0 ; while ( x > 0 ) { num += x % 10 ; x /= 10 ; } if ( n % num == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; String S = sc . next ( ) ; int [ ] count = new int [ N ] ; Arrays . fill ( count , 0 ) ; for ( int i = 1 ; i < N ; 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 ++ ) { System . out . println ( " [LOG] Block: int l = sc.nextInt() - 1; \n int r = sc.nextInt() - 1; \n System.out.println(count[r] - count[l]); " ) ; int l = sc . nextInt ( ) - 1 ; int r = sc . nextInt ( ) - 1 ; System . out . println ( count [ r ] - count [ l ] ) ; } } } +import java . util . Scanner ; import java . util . InputMismatchException ; class Main { public static void main ( String [ ] args ) { int x = 0 , y = 0 , z = 0 ; int sum = 0 ; try { Scanner scanner = new Scanner ( System . in ) ; x = scanner . nextInt ( ) ; y = scanner . nextInt ( ) ; z = scanner . nextInt ( ) ; scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( " error " ) ; } for ( int i = x ; i < z + 1 ; i = i + x ) { System . out . println ( " [LOG] Block: sum = sum + y; " ) ; sum = sum + y ; } System . out . println ( sum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long min = sc . nextInt ( ) ; long ret = - 1000000001 ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: long r = sc.nextInt(); \n if (r - min > ret) \n ret = r - min; \n if (r < min) \n min = r; " ) ; long r = sc . nextInt ( ) ; if ( r - min > ret ) ret = r - min ; if ( r < min ) min = r ; } System . out . println ( ret ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static boolean debug = 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 ( ) ) { System . out . println ( " [LOG] Block: count += c * (c - 1) / 2; " ) ; count += c * ( c - 1 ) / 2 ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = Integer.parseInt(sc.next()); \n int d = Integer.parseInt(sc.next()); \n int range = 2 * d + 1; \n System.out.println((n + range - 1) / range); \n System.out.flush(); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int range = 2 * d + 1 ; System . out . println ( ( n + range - 1 ) / range ) ; System . out . flush ( ) ; sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = Integer.parseInt(sc.next()); \n int B = Integer.parseInt(sc.next()); \n int C = Integer.parseInt(sc.next()); \n System.out.println(C - (A - B) > 0 ? C - (A - B) : 0); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( C - ( A - B ) > 0 ? C - ( A - B ) : 0 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String S = scanner . nextLine ( ) ; long K = scanner . nextLong ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < K ; i ++ ) { if ( S . charAt ( i ) == '1' ) { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } System . out . println ( S . charAt ( i ) ) ; return ; } System . out . println ( 1 ) ; scanner . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String h = sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int k = Integer . parseInt ( h ) ; int len = String . valueOf ( s ) . length ( ) ; if ( len <= k ) { System . out . println ( s ) ; } else { for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(s.charAt(i)); " ) ; System . out . print ( s . charAt ( i ) ) ; } System . out . print ( " ... " ) ; } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int d = Integer . parseInt ( in . next ( ) ) ; int ans = 0 ; if ( n % ( 2 * d + 1 ) == 0 ) { ans = n / ( 2 * d + 1 ) ; } else { System . out . println ( " [LOG] Block: ans = n / (2 * d + 1) + 1; " ) ; ans = n / ( 2 * d + 1 ) + 1 ; } out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int tmp , 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 ] ) { tmp = next [ 1 ] ; next [ 1 ] = next [ 0 ] ; next [ 0 ] = tmp ; } 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 ) { System . out . println ( " [LOG] Block: int remainder = big % small; \n return remainder; " ) ; int remainder = big % small ; return remainder ; } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; while ( IsPrime ( X ) == false ) { X ++ ; } System . out . println ( X ) ; } 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String buff = " " ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double count = 1 , flag = 0 ; double count1 = 0 , count2 = 0 ; int count3 = 9999999 ; int [ ] [ ] array1 = new int [ m ] [ k ] ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < k ; j ++ ) { array1 [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < m - 1 ; i ++ ) { for ( int j = i + 1 ; j < m ; 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 ) { System . out . println ( " [LOG] Block: count1++; " ) ; count1 ++ ; } count2 = 0 ; } } System . out . println ( ( int ) count1 ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int [ ] num = new int [ 26 ] ; char c ; while ( ( s = br . readLine ( ) ) != null ) { if ( s . length ( ) >= 1200 ) break ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { c = s . charAt ( j ) ; if ( c >= 0x41 && c <= 0x5a ) { c -= 0x41 ; num [ c ] += 1 ; } else if ( c >= 0x61 && c <= 0x7a ) { c -= 0x61 ; num [ c ] += 1 ; } } } for ( int i = 0 ; i < 26 ; i ++ ) { System . out . println ( " [LOG] Block: c = (char) (0x61 + i); \n System.out.println(c + \" : \" + num[i]); " ) ; c = ( char ) ( 0x61 + i ) ; System . out . println ( c + " : " + num [ i ] ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: int b = Integer.parseInt(line[i]); \n if (max < b) \n max = b; \n if (min > b) \n min = b; \n total = total + b; " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int target = 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 ) { target = 48 ; } else { target = 49 ; } if ( tile [ i ] != target ) { changedCntFrm0 ++ ; } } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { target = 49 ; } else { target = 48 ; } if ( tile [ i ] != target ) { changedCntFrm1 ++ ; } } if ( changedCntFrm0 >= changedCntFrm1 ) { System . out . println ( changedCntFrm1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(changedCntFrm0); " ) ; System . out . println ( changedCntFrm0 ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N + 1 ] ; for ( int i = 1 ; i <= N ; 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 ( " [LOG] Block: System.out.println(-1); \n return; " ) ; System . out . println ( - 1 ) ; return ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; boolean isWin = false ; for ( int i = 0 ; i < n ; i ++ ) { int d1 = sc . nextInt ( ) ; int d2 = sc . nextInt ( ) ; if ( d1 == d2 ) { cnt ++ ; if ( cnt == 3 ) { isWin = true ; } } else { System . out . println ( " [LOG] Block: cnt = 0; " ) ; cnt = 0 ; } } System . out . println ( isWin ? " Yes " : " No " ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int k = 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 < k - arr [ n - 1 ] + arr [ 0 ] ) { System . out . println ( k - ( k - arr [ n - 1 ] + arr [ 0 ] ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(k - maxdiff); " ) ; System . out . println ( k - maxdiff ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; boolean [ ] judge = new boolean [ n ] ; 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 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . print ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int m , f , r ; while ( true ) { m = scan . nextInt ( ) ; f = scan . nextInt ( ) ; r = scan . nextInt ( ) ; if ( m + f + r == - 3 ) break ; int s = m + f ; if ( m == - 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 ) { System . out . println ( " [LOG] Block: if (r >= 50) \n System.out.println( \" C \" ); \n else \n System.out.println( \" D \" ); " ) ; if ( r >= 50 ) System . out . println ( " C " ) ; else System . out . println ( " D " ) ; } if ( s < 30 ) System . out . println ( " F " ) ; } } } +import java . util . * ; class Main { Scanner sc ; Main ( ) { sc = new Scanner ( System . in ) ; } void calc ( ) { int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) d [ i ] = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { sum += d [ i ] * d [ j ] ; } } System . out . println ( sum ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().calc(); " ) ; new Main ( ) . calc ( ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; boolean [ ] rate = new boolean [ 8 ] ; int free = 0 ; int a ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: ans = 1; " ) ; ans = 1 ; } System . out . println ( ans + " " + max ) ; } } +import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String result = " No " ; int n = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: n += s.charAt(i) - '0'; " ) ; n += s . charAt ( i ) - '0' ; } if ( Integer . valueOf ( s ) % n == 0 ) result = " Yes " ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n ] ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } if ( tmpT % 2 != ( tmpX + tmpY ) % 2 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } tt = t [ i ] ; xx = x [ i ] ; yy = y [ i ] ; } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int count = 0 ; boolean [ ] flag = new boolean [ n + 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 ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] num = new int [ N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } int number = 1 ; int count = 0 ; boolean key = false ; for ( int i = 1 ; i <= N ; i ++ ) { int tmp = num [ number ] ; if ( tmp == - 1 ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } num [ number ] = - 1 ; number = tmp ; count ++ ; if ( number == 2 ) { System . out . println ( " [LOG] Block: key = true; \n break; " ) ; key = true ; break ; } } System . out . println ( true ? count : - 1 ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; public class Main { 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 ) { System . out . println ( " [LOG] Block: mylist.add(strinput); \n strinput = reader.readLine(); " ) ; mylist . add ( strinput ) ; strinput = 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 . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int res = 0 ; for ( int a = 1 ; a <= N ; ++ a ) { for ( int b = 1 ; b <= N ; ++ b ) { for ( int c = 1 ; c <= N ; ++ 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 ) ) { System . out . println ( " [LOG] Block: return n; " ) ; return n ; } } return 1 ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , count = 0 ; for ( int i = 1 ; i <= n ; i += 2 ) { if ( divisorEnum ( i ) . size ( ) == 8 ) count ++ ; } System . out . println ( count ) ; } public static List < Long > divisorEnum ( long n ) { List < Long > l = new ArrayList < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: l.add(i); \n if (i != Math.sqrt(n)) \n l.add(n / i); " ) ; l . add ( i ) ; if ( i != Math . sqrt ( n ) ) l . add ( n / i ) ; } } l . sort ( null ) ; return l ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long ansA , ansB ; if ( a - k >= 0 ) { ansA = a - k ; } else { ansA = 0 ; } k -= a ; if ( k > 0 ) { if ( b - k >= 0 ) { ansB = b - k ; } else { ansB = 0 ; } } else { System . out . println ( " [LOG] Block: ansB = b; " ) ; ansB = b ; } System . out . println ( ansA + " " + ansB ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a ; int b ; try ( Scanner scanner = new Scanner ( System . in ) ) { a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; } if ( ( a & b & 1 ) == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Odd \" ); " ) ; System . out . println ( " Odd " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } int ans = 0 ; int len = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( h [ i ] >= h [ i + 1 ] ) { len ++ ; } else { System . out . println ( " [LOG] Block: ans = Math.max(ans, len); \n len = 0; " ) ; ans = Math . max ( ans , len ) ; len = 0 ; } } ans = Math . max ( ans , len ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { 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 pLength = p . length ( ) ; String doubleS = s + s ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { String word = doubleS . substring ( i , i + pLength ) ; if ( word . equals ( p ) ) { System . out . println ( " [LOG] Block: return true; " ) ; return true ; } } return false ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { boolean flag = 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; import java . util . Scanner ; public class Main { public static boolean range ( int a , int b , int c ) { if ( a >= b ) return false ; if ( b >= c ) return false ; return true ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( range ( a , b , c ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int max = 0 ; int tmp = 0 ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) { System . out . println ( " [LOG] Block: char ch = s.charAt(i); \n if (ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T') \n ++tmp; \n else \n tmp = 0; \n if (tmp > max) \n max = tmp; " ) ; char ch = s . charAt ( i ) ; if ( ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T' ) ++ tmp ; else tmp = 0 ; if ( tmp > max ) max = tmp ; } System . out . println ( max ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { System . out . println ( " [LOG] Block: if (String.valueOf(i).length() % 2 == 1) \n count++; " ) ; if ( String . valueOf ( i ) . length ( ) % 2 == 1 ) count ++ ; } System . out . println ( count ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String W = br . readLine ( ) ; String [ ] T ; int c = 0 ; while ( true ) { T = br . readLine ( ) . split ( " " ) ; if ( T [ 0 ] . equals ( " END_OF_TEXT " ) ) break ; for ( String str : T ) { System . out . println ( " [LOG] Block: if (str.equalsIgnoreCase(W)) \n c++; " ) ; if ( str . equalsIgnoreCase ( W ) ) c ++ ; } } System . out . println ( c ) ; } } +import java . util . Scanner ; import java . util . TreeSet ; public class Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'A' ) { A . add ( i ) ; } else if ( s . charAt ( i ) == 'Z' ) { System . out . println ( " [LOG] Block: Z.add(i); " ) ; Z . add ( i ) ; } } System . out . println ( Z . last ( ) - A . first ( ) + 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) , m = scan . nextLong ( ) ; for ( int i = 0 ; i < m ; i ++ ) { n -= scan . nextLong ( ) ; if ( n < 0 ) { System . out . println ( " [LOG] Block: System.out.println(-1); \n scan.close(); \n return; " ) ; System . out . println ( - 1 ) ; scan . close ( ) ; return ; } } System . out . println ( n ) ; scan . close ( ) ; return ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] nt = line . split ( " " ) ; int n = Integer . parseInt ( nt [ 0 ] ) ; int t = Integer . parseInt ( nt [ 1 ] ) ; String rel = " TLE " ; for ( int i = 0 ; i < n ; i ++ ) { String keiro = sc . nextLine ( ) ; String [ ] k = keiro . split ( " " ) ; if ( Integer . parseInt ( k [ 1 ] ) <= t ) { if ( rel . equals ( " TLE " ) ) { System . out . println ( " [LOG] Block: rel = String.valueOf(k[0]); " ) ; rel = String . valueOf ( k [ 0 ] ) ; } else if ( Integer . parseInt ( rel ) > Integer . parseInt ( k [ 0 ] ) ) { System . out . println ( " [LOG] Block: rel = String.valueOf(k[0]); " ) ; rel = String . valueOf ( k [ 0 ] ) ; } } } System . out . println ( rel ) ; sc . close ( ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 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 ++ ) { System . out . println ( " [LOG] Block: if (g[i] == 2) \n cnt++; " ) ; if ( g [ i ] == 2 ) cnt ++ ; } System . out . print ( cnt ) ; System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] H = new long [ N ] ; int counter = 0 ; int countMax = 0 ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = sc . nextLong ( ) ; if ( i > 0 ) { if ( H [ i - 1 ] >= H [ i ] ) { counter ++ ; } if ( H [ i - 1 ] < H [ i ] ) { if ( counter > countMax ) { System . out . println ( " [LOG] Block: countMax = counter; " ) ; countMax = counter ; } counter = 0 ; } } } if ( counter > countMax ) { System . out . println ( " [LOG] Block: countMax = counter; " ) ; countMax = counter ; } System . out . println ( countMax ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.nextLine(); \n if (s.charAt(1) == 'R') \n System.out.println( \" ABC \" ); \n else \n System.out.println( \" ARC \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . charAt ( 1 ) == 'R' ) System . out . println ( " ABC " ) ; else System . out . println ( " ARC " ) ; } } +import java . util . * ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long ans = sc . nextLong ( ) ; BigDecimal x = BigDecimal . valueOf ( ans ) ; 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 ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } } +import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 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 " ) ) { ans ++ ; } else if ( i == 1 && ans == 1 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( ans ) ; } } +import java . util . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean [ ] sunukes = new boolean [ n ] ; 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 ) { System . out . println ( " [LOG] Block: if (hasSweets) \n continue; \n ans++; " ) ; if ( hasSweets ) continue ; ans ++ ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int count = 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 ( count < tmp ) count = tmp ; } else { System . out . println ( " [LOG] Block: if (count < tmp) \n count = tmp; \n tmp = 0; " ) ; if ( count < tmp ) count = tmp ; tmp = 0 ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n System.out.println((a <= 9) && (b <= 9) ? a * b : \" -1 \" ); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( a <= 9 ) && ( b <= 9 ) ? a * b : " -1 " ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; int a = X ; int ans1 = X ; int ans2 = X ; 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 ] != X ) { s ++ ; } } if ( s == N ) { ans1 = X ; break ; } s = 0 ; X = X - 1 ; } X = a ; s = 0 ; for ( int i = 0 ; i < N + 1 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( p [ j ] != X ) { s ++ ; } } if ( s == N ) { ans2 = X ; break ; } s = 0 ; X = X + 1 ; } X = a - ans1 ; N = ans2 - a ; if ( X <= N ) { System . out . println ( ans1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(ans2); " ) ; System . out . println ( ans2 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] str = new String [ 2 ] ; int count = 0 ; while ( in . hasNext ( ) ) { String buf = in . nextLine ( ) ; str [ count ] = 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 ) { System . out . println ( " [LOG] Block: r = x % y; \n x = y; \n y = r; " ) ; r = x % y ; x = y ; y = r ; } System . out . println ( x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int min = x - k + 1 ; int max = x + k - 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 { System . out . println ( " [LOG] Block: sb.append( \" \" + i); " ) ; sb . append ( " " + i ) ; } } System . out . println ( sb . toString ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; String strings = sc . nextLine ( ) ; if ( strings . length ( ) <= num ) { System . out . println ( strings ) ; } else { System . out . println ( " [LOG] Block: System.out.println(strings.substring(0, num) + \" ... \" ); " ) ; System . out . println ( strings . substring ( 0 , num ) + " ... " ) ; } } } +import java . util . Scanner ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; sc . close ( ) ; long res1 = Math . max ( 0 , a - k ) ; long res2 = Math . max ( 0 , Math . min ( a + b - k , b ) ) ; System . out . println ( res1 + " " + res2 ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: solve(); " ) ; solve ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int count = 0 ; int valLen = String . valueOf ( a ) . length ( ) ; for ( int i = valLen ; i > 0 ; i -- ) { if ( i % 2 == 1 ) { if ( i == valLen ) { count += a % Math . pow ( 10 , i - 1 ) + 1 ; count += ( ( a / ( int ) Math . pow ( 10 , i - 1 ) ) - 1 ) * ( int ) Math . pow ( 10 , i - 1 ) ; } else if ( i == 1 ) { count += 9 ; } else { System . out . println ( " [LOG] Block: count += 9 * (int) Math.pow(10, i - 1); " ) ; count += 9 * ( int ) Math . pow ( 10 , i - 1 ) ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int k = sc.nextInt(); \n String[] s = sc.next().split( \" \" ); \n s[k - 1] = s[k - 1].toLowerCase(); \n System.out.println(String.join( \" \" , s)); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = 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 . io . FileNotFoundException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] p = new int [ N + 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 <= N ; i ++ ) { if ( p [ i ] > border ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String input = scan . nextLine ( ) ; int n = Integer . parseInt ( input . split ( " " ) [ 0 ] ) ; double d = Integer . parseInt ( input . split ( " " ) [ 1 ] ) ; int c = 0 ; int [ ] [ ] x = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; 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 ) ) ) { System . out . println ( " [LOG] Block: c += 1; " ) ; c += 1 ; } } System . out . println ( c ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] natural = stdReader . readLine ( ) . split ( " " , 0 ) ; int x = Integer . parseInt ( natural [ 0 ] ) ; int y = Integer . parseInt ( natural [ 1 ] ) ; if ( x < y ) { x = x ^ y ; y = x ^ y ; x = x ^ y ; } while ( y > 0 ) { System . out . println ( " [LOG] Block: int r = x % y; \n x = y; \n y = r; " ) ; int r = x % y ; x = y ; y = r ; } System . out . println ( x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( A < 1 || A > 9 || B < 1 || B > 9 ) { System . out . println ( " [LOG] Block: System.out.println(-1); \n return; " ) ; System . out . println ( - 1 ) ; return ; } System . out . println ( A * B ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int tmp = 9999 ; int min = 9999 ; int [ ] ci = new int [ n ] ; int [ ] ti = new int [ n ] ; int i = 0 ; for ( i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" TLE \" ); " ) ; System . out . println ( " TLE " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String ... nui ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = ( int ) 1e9 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int cnt = 0 ; while ( a % 2 == 0 ) { System . out . println ( " [LOG] Block: a /= 2; \n cnt++; " ) ; a /= 2 ; cnt ++ ; } min = Math . min ( min , cnt ) ; } System . out . println ( min ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String s = scan . next ( ) ; int out = s . length ( ) ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) == s.charAt(i + 1)) \n out--; " ) ; if ( s . charAt ( i ) == s . charAt ( i + 1 ) ) out -- ; } System . out . println ( out ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int N = scanner.nextInt(); \n System.out.println(N / 2 + N % 2); " ) ; Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; System . out . println ( N / 2 + N % 2 ) ; } } +import java . io . PrintStream ; import java . util . Scanner ; public class Main { private static final PrintStream so = System . out ; private static final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x <= K ; x ++ ) { for ( int y = 0 ; y <= K ; y ++ ) { int z = S - ( x + y ) ; if ( 0 <= z && z <= K ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } so . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; int a = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int h = scanner . nextInt ( ) ; if ( h >= K ) { a ++ ; } else { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } } System . out . println ( a ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; boolean [ ] broken = new boolean [ n + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { broken [ sc . nextInt ( ) ] = true ; } int [ ] dp = new int [ n + 1 ] ; Arrays . fill ( dp , 0 ) ; dp [ 0 ] = 1 ; dp [ 1 ] = broken [ 1 ] ? 0 : 1 ; for ( int i = 2 ; i <= n ; 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 ( " [LOG] Block: System.out.println(dp[dp.length - 1]); " ) ; System . out . println ( dp [ dp . length - 1 ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; String W = scan . nextLine ( ) . toLowerCase ( ) ; int ans = 0 ; while ( scan . hasNext ( ) ) { System . out . println ( " [LOG] Block: String t = scan.next(); \n if (t.equals( \" END_OF_TEXT \" )) \n break; \n t = t.toLowerCase(); \n if (t.equals(W)) \n ans++; " ) ; String t = scan . next ( ) ; if ( t . equals ( " END_OF_TEXT " ) ) break ; t = t . toLowerCase ( ) ; if ( t . equals ( W ) ) ans ++ ; } System . out . println ( ans ) ; System . exit ( 0 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextLong ( ) ; long bank = 100 ; long count = 0 ; for ( long i = bank ; i < X ; bank += bank / 100 , count ++ ) { if ( bank >= X ) { System . out . println ( " [LOG] Block: System.out.println(count); \n break; " ) ; System . out . println ( count ) ; break ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int ans = 10000 ; for ( int i = 0 ; i < n ; i ++ ) { int k = s . nextInt ( ) ; int b = s . nextInt ( ) ; if ( b <= m && k < ans ) { ans = k ; } } if ( ans == 10000 ) { System . out . println ( " [LOG] Block: System.out.println( \" TLE \" ); " ) ; System . out . println ( " TLE " ) ; } else System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; sc . close ( ) ; if ( S . substring ( 0 , N / 2 ) . equals ( S . substring ( N / 2 , N ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int S = sc.nextInt(); \n int s = S % 60; \n int M = S / 60; \n int m = M % 60; \n int H = M / 60; \n int h = H; \n System.out.println(h + \" : \" + m + \" : \" + s); " ) ; Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int s = S % 60 ; int M = S / 60 ; int m = M % 60 ; int H = M / 60 ; int h = H ; System . out . println ( h + " : " + m + " : " + s ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { try { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double t, d, s; \n d = sc.nextDouble(); \n t = sc.nextDouble(); \n s = sc.nextDouble(); \n if ((d / s) <= t) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; double t , d , s ; d = sc . nextDouble ( ) ; t = sc . nextDouble ( ) ; s = sc . nextDouble ( ) ; if ( ( d / s ) <= t ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } catch ( Exception e ) { } } } +import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] ints = new int [ n ] [ m ] ; int [ ] line = new int [ n ] ; int [ ] row = new int [ m ] ; int sum = 0 ; for ( int i = 0 ; i < n ; 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 < n + 1 ; i ++ ) { for ( int j = 0 ; j < m + 1 ; j ++ ) { if ( i == n && j == m ) { System . out . print ( sum ) ; } else if ( j == m ) { System . out . print ( line [ i ] ) ; } else if ( i == n ) { System . out . print ( row [ j ] ) ; } else { System . out . print ( ints [ i ] [ j ] ) ; } if ( j != m ) { System . out . println ( " [LOG] Block: System.out.print( \" \" ); " ) ; System . out . print ( " " ) ; } } System . out . println ( ) ; } } } +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 Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); \n StringTokenizer st = new StringTokenizer(br.readLine()); \n int N = Integer.parseInt(st.nextToken()); \n int K = Integer.parseInt(st.nextToken()); \n int[] prices = new int[N]; \n st = new StringTokenizer(br.readLine()); \n for (int i = 0; i < prices.length; i++) prices[i] = Integer.parseInt(st.nextToken()); \n Arrays.sort(prices); \n int sum = 0; \n for (int i = 0; i < K; i++) sum += prices[i]; \n bw.write(sum + \" \n \" ); \n bw.flush(); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int K = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] prices = new int [ N ] ; 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 . util . ArrayDeque ; import java . lang . reflect . Array ; import java . util . Arrays ; import sun . tools . jar . resources . jar ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long N = sc.nextInt(); \n long a = N / 500; \n N %= 500; \n long b = N / 5; \n System.out.println(1000 * a + (5 * b)); " ) ; Scanner sc = new Scanner ( System . in ) ; long N = sc . nextInt ( ) ; long a = N / 500 ; N %= 500 ; long b = N / 5 ; System . out . println ( 1000 * a + ( 5 * b ) ) ; } } +import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n + 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 <= n ; i ++ ) { System . out . println ( " [LOG] Block: if (arr[i] == 0) \n count++; " ) ; if ( arr [ i ] == 0 ) count ++ ; } count -- ; System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String val = S . substring ( 0 , 4 ) ; int yyyy = Integer . parseInt ( val ) ; String val2 = S . substring ( 5 , 7 ) ; int mm = Integer . parseInt ( val2 ) ; if ( ( yyyy == 2019 && mm < 5 ) || yyyy <= 2018 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" TBD \" ); " ) ; System . out . println ( " TBD " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] str = sc . next ( ) . toCharArray ( ) ; int count = 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' ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count == 1 ? " AC " : " WA " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int slen = s . length ( ) ; int tlen = t . length ( ) ; int min = 10000 ; for ( int i = 0 ; i < slen - 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 ) { System . out . println ( " [LOG] Block: min = tlen - count; " ) ; min = tlen - count ; } } System . out . println ( min ) ; } } +import java . io . IOException ; import java . util . Scanner ; class Main { 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 targetLength = 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 < ( targetLength - shuffleBegin [ i ] ) ; j ++ ) { answer = answer + targetChar [ j + shuffleBegin [ i ] ] ; } for ( int j = 0 ; j < shuffleBegin [ i ] ; j ++ ) { System . out . println ( " [LOG] Block: answer = answer + targetChar[j]; " ) ; answer = answer + targetChar [ j ] ; } targetChar = answer . toCharArray ( ) ; } System . out . println ( answer ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; 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 < N - 1 ; i ++ ) { if ( a . get ( i + 1 ) == flg + 1 ) { flg ++ ; } else { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] monsters = new int [ n + 1 ] ; int [ ] heroes = new int [ n ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) monsters [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) heroes [ i ] = sc . nextInt ( ) ; int rem = 0 ; long totalKilled = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int killedPrev = Math.min(rem, monsters[i]); \n int killedNow = Math.min(monsters[i] - killedPrev, heroes[i]); \n totalKilled += killedPrev + killedNow; \n rem = Math.max(heroes[i] - killedNow, 0); " ) ; 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 [ n ] ) ; System . out . println ( totalKilled ) ; } } +import java . awt . * ; import java . awt . geom . * ; import java . io . * ; import java . util . * ; class Main { static char [ ] xx = new char [ ] { 'S' , 'H' , 'C' , 'D' } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean [ ] [ ] l = new boolean [ 4 ] [ 13 ] ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(xx[i] + \" \" + (j + 1)); " ) ; System . out . println ( xx [ i ] + " " + ( j + 1 ) ) ; } } } } } +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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; int max = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(name); " ) ; System . out . println ( name ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; long quo = n / 15 ; long rem = n % 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 { System . out . println ( " [LOG] Block: fraction += i; \n valid++; \n i++; " ) ; fraction += i ; valid ++ ; i ++ ; } } return lapBottom * valid + fraction ; } } } +import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String [ ] S2 = S . 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int w = scan . nextInt ( ) ; int [ ] x = new int [ w ] ; for ( int i = 0 ; i < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(x[i]); " ) ; System . out . println ( x [ i ] ) ; } } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; String S ; S = sc . next ( ) ; solve ( S ) ; } static void solve ( String S ) { System . out . println ( calc ( S ) ) ; } static int calc ( String S ) { System . out . println ( " [LOG] Block: switch(S) { \n case \" SUN \" : \n return 7; \n case \" MON \" : \n return 6; \n case \" TUE \" : \n return 5; \n case \" WED \" : \n return 4; \n case \" THU \" : \n return 3; \n case \" FRI \" : \n return 2; \n case \" SAT \" : \n return 1; \n } \n return 0; " ) ; switch ( S ) { 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int N = cin . nextInt ( ) ; int [ ] list = new int [ N ] ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: result = j + 1; \n break; " ) ; result = j + 1 ; break ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; int n = a - b ; int m = c - n ; if ( m > 0 ) { System . out . println ( m ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . util . Scanner ; public class Main { private static int gcd ( int a , int b ) { if ( ( a % b ) == 0 ) return b ; return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int tmp ; int count = 0 ; for ( int i = 1 ; i < a + 1 ; i ++ ) { for ( int j = 1 ; j < a + 1 ; j ++ ) { tmp = gcd ( i , j ) ; for ( int k = 1 ; k < a + 1 ; k ++ ) { System . out . println ( " [LOG] Block: count += gcd(k, tmp); " ) ; count += gcd ( k , tmp ) ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; while ( n -- > 0 ) { int num = sc . nextInt ( ) ; if ( isPrime ( num ) ) cnt ++ ; } System . out . println ( cnt ) ; } public static boolean isPrime ( int num ) { System . out . println ( " [LOG] Block: for (int i = 2; i * i <= num; i++) if (num % i == 0) \n return false; \n return true; " ) ; for ( int i = 2 ; i * i <= num ; i ++ ) if ( num % i == 0 ) return false ; return true ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; String A = Input . next ( ) ; String B = Input . next ( ) ; int Count = 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 ) ) { System . out . println ( " [LOG] Block: Count++; " ) ; Count ++ ; } } System . out . println ( Count ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { 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 judge = 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 ) ) { judge = true ; break ; } } if ( judge ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n double a = scan.nextDouble(); \n double b = scan.nextDouble(); \n double h = scan.nextDouble(); \n double m = scan.nextDouble(); \n double naga = m * 360 / 60; \n double miji = (h * 60 + m) * 360 / (12 * 60); \n double kaku = miji - naga; \n double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(Math.toRadians(kaku))); \n System.out.println(result); " ) ; Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double naga = m * 360 / 60 ; double miji = ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double kaku = miji - naga ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( kaku ) ) ) ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int ans = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String search = scanner . nextLine ( ) ; boolean Judge = true ; int count = 0 ; String end = " END_OF_TEXT " ; while ( Judge ) { String word = scanner . next ( ) ; int result = word . lastIndexOf ( end ) ; if ( result != - 1 ) { Judge = false ; } else { word = word . toLowerCase ( ) ; } if ( word . equals ( search ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; scanner . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; for ( ; ; x ++ ) { if ( isPrime ( x ) ) break ; } System . out . println ( x ) ; } public static boolean isPrime ( int x ) { if ( ( x % 2 == 0 && x != 2 || x == 1 ) ) return false ; for ( int i = 3 ; i <= Math . sqrt ( x ) ; i += 2 ) { System . out . println ( " [LOG] Block: if (x % i == 0) \n return false; " ) ; if ( x % i == 0 ) return false ; } return true ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { 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 ) { System . out . println ( " [LOG] Block: int longestP = longest * longest; \n int other1P = other1 * other1; \n int other2P = other2 * other2; \n return longestP == other2P + other1P; " ) ; int longestP = longest * longest ; int other1P = other1 * other1 ; int other2P = other2 * other2 ; return longestP == other2P + other1P ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; int result = 0 ; boolean flag = false ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( str . charAt ( i ) == 'R' ) { result ++ ; flag = true ; } else { System . out . println ( " [LOG] Block: if (flag == true) \n break; " ) ; if ( flag == true ) break ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n , a , b ; n = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int sum = 0 , ans = 0 ; for ( int i = 0 ; i <= n ; 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 ) { System . out . println ( " [LOG] Block: ans += i; " ) ; ans += i ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { static int r = 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 ( r ) ; } static void solve ( int D , int [ ] [ ] X , int idx1 , int idx2 ) { int sum = 0 ; for ( int i = 0 ; i < D ; i ++ ) { System . out . println ( " [LOG] Block: int yx = Math.abs(X[idx1][i] - X[idx2][i]); \n sum += yx * yx; " ) ; 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 ) r ++ ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class Main { public static void main ( String [ ] args ) { 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 cardNum = Integer . parseInt ( reader . readLine ( ) ) ; int cnt = 0 ; while ( true ) { inputData = reader . readLine ( ) ; cardMap . put ( String . valueOf ( cnt ) , inputData ) ; cnt ++ ; if ( cnt == cardNum ) { 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; import java . lang . * ; import java . io . * ; public final class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) sum += in . nextInt ( ) ; int re = n - sum ; if ( re < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(re); " ) ; System . out . println ( re ) ; } } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] str = new String [ N ] ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( " a " + ( a == b ? " == " : ( a < b ? " < " : " > " ) ) + " b " ) ; } finally { System . out . println ( " [LOG] Block: sc.close(); " ) ; sc . close ( ) ; } } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner scan = new Scanner ( is ) ; long X = scan . nextLong ( ) ; long depo = 100 ; int ans = 0 ; while ( X > depo ) { System . out . println ( " [LOG] Block: depo *= 1.01; \n ans++; " ) ; depo *= 1.01 ; ans ++ ; } os . println ( ans ) ; } } +import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int count = 0 ; int count2 = 0 ; if ( a == 1 ) count -- ; if ( a == 2 ) count -= 2 ; while ( count2 < 2 ) { System . out . println ( " [LOG] Block: count++; \n if (a == 4) \n count2++; \n if (a % 2 == 0) \n a /= 2; \n else \n a = a * 3 + 1; " ) ; count ++ ; if ( a == 4 ) count2 ++ ; if ( a % 2 == 0 ) a /= 2 ; else a = a * 3 + 1 ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int x = sc.nextInt(); \n int t = sc.nextInt(); \n int count = n / x; \n int answer = 0; \n if (n % x == 0) \n answer = count; \n else \n answer = count + 1; \n System.out.println(answer * t); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int count = n / x ; int answer = 0 ; if ( n % x == 0 ) answer = count ; else answer = count + 1 ; System . out . println ( answer * t ) ; } } +import java . util . Scanner ; import java . util . regex . Pattern ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) throws Exception { new Main ( ) . run ( ) ; } void run ( ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n int b = sc.nextInt(); \n Pattern ptn = Pattern.compile( \" \\ d { \" + a + \" } - \\ d { \" + b + \" } \" ); \n String s = sc.next(); \n System.out.println(ptn.matcher(s).matches() ? \" Yes \" : \" No \" ); " ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Pattern ptn = Pattern . compile ( " \\ d { " + a + " } - \\ d { " + b + " } " ) ; String s = sc . next ( ) ; System . out . println ( ptn . matcher ( s ) . matches ( ) ? " Yes " : " No " ) ; } } +import java . util . * ; import java . lang . * ; import java . awt . * ; class Main { 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 i = 0 ; i < s . length ( ) ; i ++ ) { int countval = s . toLowerCase ( ) . codePointAt ( i ) - 97 ; if ( countval >= 0 ) t [ countval ] ++ ; } } for ( int a = 0 ; a < t . length ; a ++ ) { System . out . println ( " [LOG] Block: System.out.println(String.format( \" %s : %d \" , (char) (a + 97), t[a])); " ) ; System . out . println ( String . format ( " %s : %d " , ( char ) ( a + 97 ) , t [ a ] ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] s = S . toCharArray ( ) ; boolean flag = false ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] == s [ i + 1 ] ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " Bad " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Good \" ); " ) ; System . out . println ( " Good " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int N = in . nextInt ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < d . length ; ++ i ) { System . out . println ( " [LOG] Block: d[i] = in.nextInt(); " ) ; d [ i ] = in . nextInt ( ) ; } Arrays . sort ( d ) ; int mid1 = d [ N / 2 - 1 ] ; int mid2 = d [ N / 2 ] ; System . out . println ( mid2 - mid1 ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader bis = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = bis . readLine ( ) ; int l = s . length ( ) ; int ans = 0 ; for ( int i = 0 ; i < l ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '+' ) { ans += 1 ; } if ( c == '-' ) { System . out . println ( " [LOG] Block: ans -= 1; " ) ; ans -= 1 ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String s, t; \n int a, b; \n String u; \n s = scan.next(); \n t = scan.next(); \n a = scan.nextInt(); \n b = scan.nextInt(); \n u = scan.next(); \n if (u.equals(s)) \n a -= 1; \n else \n b -= 1; \n System.out.printf(a + \" \" + b); " ) ; Scanner scan = new Scanner ( System . in ) ; String s , t ; int a , b ; String u ; s = scan . next ( ) ; t = scan . next ( ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; u = scan . next ( ) ; if ( u . equals ( s ) ) a -= 1 ; else b -= 1 ; System . out . printf ( a + " " + b ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { static class Solution { public void find ( int perimeter , int [ ] arr ) { arr [ arr . length - 1 ] = perimeter ; int res = Integer . MAX_VALUE ; int antiClock = ( arr [ 0 ] + perimeter ) % perimeter ; res = Math . min ( res , perimeter - ( perimeter - arr [ arr . length - 2 ] ) - antiClock ) ; res = Math . min ( res , perimeter - ( arr [ 1 ] - arr [ 0 ] ) ) ; for ( int i = 1 ; i < arr . length - 1 ; i ++ ) { res = Math . min ( res , perimeter - ( arr [ i + 1 ] - arr [ i ] ) ) ; res = Math . min ( res , perimeter - ( arr [ i ] - arr [ i - 1 ] ) ) ; } System . out . println ( res ) ; } } 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 ++ ) { System . out . println ( " [LOG] Block: arr[i] = sc.nextInt(); " ) ; arr [ i ] = sc . nextInt ( ) ; } sol . find ( perimeter , arr ) ; } } +import java . util . * ; import java . lang . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int variety = sc . nextInt ( ) ; int [ ] k = new int [ n ] ; int [ ] preference = new int [ variety ] ; int ans = 0 ; for ( int i = 0 ; i < n ; 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 ] == n ) { ans ++ ; } } System . out . println ( ans ) ; sc . close ( ) ; } private static int gcd ( int m , int n ) { if ( m < n ) { return gcd ( n , m ) ; } if ( n == 0 ) { System . out . println ( " [LOG] Block: return m; " ) ; return m ; } return gcd ( n , m % n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; int migi = 0 ; int hidari = 0 ; for ( int i = 0 ; i < M ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] < X ) { hidari ++ ; } else { System . out . println ( " [LOG] Block: migi++; " ) ; migi ++ ; } } System . out . println ( Math . min ( migi , hidari ) ) ; } } +import java . util . Scanner ; import java . util . Stack ; public class Main { Scanner sc = new Scanner ( System . in ) ; void solve ( ) { String [ ] rawInputs = sc . nextLine ( ) . split ( " " ) ; Stack < String > stack = new Stack < > ( ) ; for ( String input : rawInputs ) { switch ( input ) { 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 ( input ) ; } } } String result = stack . pop ( ) ; System . out . println ( result ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Diagram diagram = new Diagram ( ) ; try ( Scanner stdin = new Scanner ( System . in ) ) { int h , w ; while ( stdin . hasNext ( ) ) { h = Integer . parseInt ( stdin . next ( ) ) ; w = Integer . parseInt ( stdin . next ( ) ) ; if ( h < 0 || h > 300 || w < 0 || w > 300 ) { throw new RuntimeException ( " Input Error:Range 0 to 300 " ) ; } if ( h == 0 && w == 0 ) { break ; } diagram . draw ( h , w ) ; System . out . println ( " " ) ; } } catch ( RuntimeException e ) { e . printStackTrace ( ) ; } } } abstract class AbstractDiagram { abstract void draw ( int height , int width ) ; } class Diagram extends AbstractDiagram { @ Override void draw ( int h , int w ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= h ; i ++ ) { for ( int j = 1 ; j <= w ; j ++ ) { if ( ( i == 1 || i == h ) || ( j == 1 || j == w ) ) { sb . append ( '#' ) ; } else { System . out . println ( " [LOG] Block: sb.append('.'); " ) ; sb . append ( '.' ) ; } } System . out . println ( sb ) ; sb . setLength ( 0 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; long sum = 0 ; for ( int i = 1 ; i <= k ; i ++ ) { for ( int j = 1 ; j <= k ; j ++ ) { for ( int l = 1 ; l <= k ; 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 { System . out . println ( " [LOG] Block: return gcd(b, r); " ) ; return gcd ( b , r ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int h = 0 ; int m = 0 ; int s = 0 ; while ( S >= 3600 ) { S = S - 3600 ; h ++ ; } while ( S >= 60 ) { System . out . println ( " [LOG] Block: S = S - 60; \n m++; " ) ; S = S - 60 ; m ++ ; } s = S ; System . out . println ( h + " : " + m + " : " + s ) ; } } +import java . io . PrintWriter ; import java . util . Scanner ; class Main { 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 ) { System . out . println ( " [LOG] Block: final int m = Integer.parseInt(sc.next()); \n final int f = Integer.parseInt(sc.next()); \n final int r = Integer.parseInt(sc.next()); \n if (m == -1 && f == -1 && r == -1) \n break; \n if (m == -1 || f == -1) \n out.println('F'); \n else if (m + f >= 80) \n out.println('A'); \n else if (m + f >= 65) \n out.println('B'); \n else if (m + f >= 50) \n out.println('C'); \n else if (m + f < 30) \n out.println('F'); \n else if (r >= 50) \n out.println('C'); \n else \n out.println('D'); " ) ; final int m = Integer . parseInt ( sc . next ( ) ) ; final int f = Integer . parseInt ( sc . next ( ) ) ; final int r = Integer . parseInt ( sc . next ( ) ) ; if ( m == - 1 && f == - 1 && r == - 1 ) break ; if ( m == - 1 || f == - 1 ) out . println ( 'F' ) ; else if ( m + f >= 80 ) out . println ( 'A' ) ; else if ( m + f >= 65 ) out . println ( 'B' ) ; else if ( m + f >= 50 ) out . println ( 'C' ) ; else if ( m + f < 30 ) out . println ( 'F' ) ; else if ( r >= 50 ) out . println ( 'C' ) ; else out . println ( 'D' ) ; } out . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int S1 = Integer . parseInt ( S . substring ( 5 , 7 ) ) ; if ( S1 < 5 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" TBD \" ); " ) ; System . out . println ( " TBD " ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int m = sc . nextInt ( ) ; b [ i ] = m ; } int w ; for ( int h = 0 ; h < ( n / 2 ) ; h ++ ) { w = b [ h ] ; b [ h ] = b [ n - 1 - h ] ; b [ n - 1 - h ] = w ; } for ( int j = 0 ; j < n - 1 ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print(b[j] + \" \" ); " ) ; System . out . print ( b [ j ] + " " ) ; } System . out . print ( b [ n - 1 ] ) ; System . out . println ( " " ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] ss = sc . next ( ) . split ( " [^ACGT] " ) ; if ( ss . length == 0 ) { out . println ( " 0 " ) ; } else { Integer [ ] a = new Integer [ ss . length ] ; for ( int i = 0 ; i < ss . length ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = ss[i].length(); " ) ; a [ i ] = ss [ i ] . length ( ) ; } Arrays . sort ( a , Collections . reverseOrder ( ) ) ; out . println ( a [ 0 ] ) ; } 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 Main { public static void main ( final String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] route = new int [ 2 ] [ N ] ; for ( int i = 0 ; i < 2 ; i ++ ) { route [ i ] = new int [ N ] ; for ( int j = 0 ; j < N ; j ++ ) { route [ i ] [ j ] = sc . nextInt ( ) ; } } int maxCandy = Integer . MIN_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { int tmp = 0 ; int h = 0 ; for ( int j = 0 ; j < N ; j ++ ) { tmp += route [ h ] [ j ] ; if ( i == j ) { System . out . println ( " [LOG] Block: h++; \n tmp += route[h][j]; " ) ; h ++ ; tmp += route [ h ] [ j ] ; } } maxCandy = Math . max ( maxCandy , tmp ) ; } System . out . println ( maxCandy ) ; } } +import java . util . * ; public class Main { 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 count = 0 ; for ( int i = 0 ; i < S1 . length ; i ++ ) { if ( S1 [ i ] == S2 [ i ] ) { count ++ ; } } if ( count == S1 . length ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) { int m = 0 , f = 0 , r = 0 ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String [ ] strAry = br . readLine ( ) . split ( " " ) ; m = Integer . parseInt ( strAry [ 0 ] ) ; f = Integer . parseInt ( strAry [ 1 ] ) ; r = Integer . parseInt ( strAry [ 2 ] ) ; if ( m == - 1 && f == - 1 && r == - 1 ) break ; System . out . printf ( " %s \n " , judge ( m , f , r ) ) ; } } catch ( Exception e ) { System . err . println ( e ) ; } } private static String judge ( int m , int f , int r ) { if ( ( m == - 1 || f == - 1 ) || m + f < 30 ) return " F " ; else if ( m + f < 50 ) { System . out . println ( " [LOG] Block: if (r >= 50) \n return \" C \" ; \n else \n return \" D \" ; " ) ; if ( r >= 50 ) return " C " ; else return " D " ; } else if ( m + f < 65 ) return " C " ; else if ( m + f < 80 ) return " B " ; else return " A " ; } } +import java . util . Scanner ; import java . util . regex . * ; class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) . useDelimiter ( " [ \t , \n ] " ) ; int n = stdin . nextInt ( ) ; int line = stdin . nextInt ( ) ; int [ ] nums = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; 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 <= n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(nums[i]); " ) ; System . out . println ( nums [ i ] ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String tmp = br . readLine ( ) ; if ( tmp == null ) { break ; } String [ ] tmpArray = tmp . split ( " " ) ; int a = Integer . parseInt ( tmpArray [ 0 ] ) ; int b = Integer . parseInt ( tmpArray [ 1 ] ) ; System . out . println ( GCD ( a , b ) + " " + LCM ( a , b ) ) ; } } static long GCD ( long a , long b ) { long candidate = a ; while ( b % a != 0 ) { candidate = b % a ; b = a ; a = candidate ; } return candidate ; } static long LCM ( long a , long b ) { System . out . println ( " [LOG] Block: long GCD = GCD(a, b); \n return GCD * (a / GCD) * (b / GCD); " ) ; long GCD = GCD ( a , b ) ; return GCD * ( a / GCD ) * ( b / GCD ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: double calc = Math.sqrt(Math.pow(sc.nextInt(), 2) + Math.pow(sc.nextInt(), 2)); \n if (calc <= d) \n result++; " ) ; 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String str = sc.nextLine(); \n StringBuffer sb = new StringBuffer(str); \n String rv = sb.reverse().toString(); \n System.out.println(rv); " ) ; Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; StringBuffer sb = new StringBuffer ( str ) ; String rv = sb . reverse ( ) . toString ( ) ; System . out . println ( rv ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) , b = scan . nextInt ( ) , c = scan . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= c ; i ++ ) { if ( a <= i && i <= b ) { if ( c % i == 0 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n String s = stdIn.next(); \n int idx = s.indexOf( \" 7 \" ); \n if (idx == -1) \n System.out.println( \" No \" ); \n else \n System.out.println( \" Yes \" ); " ) ; Scanner stdIn = new Scanner ( System . in ) ; String s = stdIn . next ( ) ; int idx = s . indexOf ( " 7 " ) ; if ( idx == - 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String number ; char [ ] ca ; int num ; for ( ; ; ) { number = scan . next ( ) ; ca = number . toCharArray ( ) ; num = 0 ; if ( ca [ 0 ] == '0' ) { break ; } for ( int i = 0 ; i < ca . length ; i ++ ) { System . out . println ( " [LOG] Block: num += ca[i] - '0'; " ) ; num += ca [ i ] - '0' ; } System . out . println ( num ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int number = sc . nextInt ( ) ; int [ ] n = new int [ number ] ; int [ ] m = new int [ number ] ; for ( int i = 0 ; i < number ; i ++ ) { n [ i ] = sc . nextInt ( ) ; m [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; for ( int i = 0 ; i < number ; i ++ ) { if ( n [ i ] == m [ i ] ) { cnt ++ ; } else if ( n [ i ] != m [ i ] ) { cnt = 0 ; } if ( cnt == 3 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int i = 1 ; int sum = 0 ; while ( a * i <= t ) { System . out . println ( " [LOG] Block: sum += b; \n i += 1; " ) ; sum += b ; i += 1 ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] list = new int [ 9 ] ; int n = scanner . nextInt ( ) ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: minAns = Math.max(minAns, 1); \n maxAns += list[8]; " ) ; minAns = Math . max ( minAns , 1 ) ; maxAns += list [ 8 ] ; } System . out . println ( minAns + " " + maxAns ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; if ( s . equals ( " ABC " ) ) { s = s . replace ( " ABC " , " ARC " ) ; } else { System . out . println ( " [LOG] Block: s = s.replace( \" ARC \" , \" ABC \" ); " ) ; s = s . replace ( " ARC " , " ABC " ) ; } System . out . println ( s ) ; } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; final String S = sc . next ( ) ; sc . close ( ) ; String ans = null ; switch ( S ) { case " Sunny " : ans = " Cloudy " ; break ; case " Cloudy " : ans = " Rainy " ; break ; case " Rainy " : ans = " Sunny " ; break ; } out . println ( ans ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main()._main(args); " ) ; new Main ( ) . _main ( args ) ; } } +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 Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i <= a ; i ++ ) { for ( int j = 0 ; j <= b ; j ++ ) { for ( int k = 0 ; k <= c ; k ++ ) { if ( x == ( i * 500 + j * 100 + k * 50 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } } System . out . println ( count ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int s = sc.nextInt(); \n System.out.println((s / 3600) + \" : \" + (s % 3600 / 60) + \" : \" + (s % 60)); " ) ; Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; System . out . println ( ( s / 3600 ) + " : " + ( s % 3600 / 60 ) + " : " + ( s % 60 ) ) ; } } +import java . util . * ; public class Main { 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 ( ) ; } long sum = 0 ; while ( true ) { boolean flag = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 0 ) { if ( flag == false ) { break ; } } else { a [ i ] -= 1 ; flag = false ; } } if ( flag == true ) { System . out . println ( " [LOG] Block: System.out.println(sum); \n return; " ) ; System . out . println ( sum ) ; return ; } sum += 1 ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int [ ] q = new int [ n ] ; Arrays . fill ( q , 0 ) ; q [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: 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]))); " ) ; 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 [ n - 1 ] ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String name ; int num ; 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 . out . println ( " [LOG] Block: System.exit(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 . out . println ( " [LOG] Block: System.exit(0); " ) ; System . exit ( 0 ) ; } } } } +import java . io . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n ArrayList<Integer> intArr = new ArrayList<Integer>(); \n for (int i = 0; i < 3; i++) intArr.add(in.nextInt()); \n Collections.sort(intArr); \n System.out.printf( \" %d %d %d \n \" , intArr.get(0), intArr.get(1), intArr.get(2)); " ) ; Scanner in = new Scanner ( System . in ) ; ArrayList < Integer > intArr = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String S = sc.nextLine(); \n int date = Integer.parseInt(String.join( \" \" , S.split( \" / \" ))); \n System.out.println(date <= 20190430 ? \" Heisei \" : \" TBD \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; int date = Integer . parseInt ( String . join ( " " , S . split ( " / " ) ) ) ; System . out . println ( date <= 20190430 ? " Heisei " : " TBD " ) ; } } +import java . util . * ; import java . text . * ; class Main { 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 l1 = s1 . length ( ) ; int l2 = s2 . length ( ) ; int l = Math . min ( l1 , l2 ) ; for ( int i = 0 ; i < l ; i ++ ) { int d = s1 . charAt ( i ) - s2 . charAt ( i ) ; if ( d != 0 ) return d ; } return l1 - 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 { System . out . println ( " [LOG] Block: c2++; \n c1++; " ) ; c2 ++ ; c1 ++ ; } } System . out . println ( " " + c1 + " " + c2 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char [ ] strArray = str . toCharArray ( ) ; for ( int i = 0 ; i < strArray . length ; i ++ ) { if ( Character . isUpperCase ( strArray [ i ] ) ) { strArray [ i ] = Character . toLowerCase ( strArray [ i ] ) ; } else if ( Character . isLowerCase ( strArray [ i ] ) ) { strArray [ i ] = Character . toUpperCase ( strArray [ i ] ) ; } else { strArray [ i ] = strArray [ i ] ; } } for ( int i = 0 ; i < strArray . length - 1 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(strArray[i]); " ) ; System . out . print ( strArray [ i ] ) ; } System . out . println ( strArray [ strArray . length - 1 ] ) ; } } +import java . math . BigInteger ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; scan . close ( ) ; String [ ] substr = str . 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 ) { System . out . println ( " [LOG] Block: if (m.compareTo(a) >= 0) \n buf = a; \n if (m.compareTo(a) < 0) \n buf = m; " ) ; 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 ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int min = 0 ; int max = 0 ; long amount = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = scan . nextInt ( ) ; if ( i == 0 ) { min = x ; max = x ; amount = x ; } else { if ( x < min ) { min = x ; } else if ( x > max ) { System . out . println ( " [LOG] Block: max = x; " ) ; max = x ; } amount = amount + x ; } } System . out . println ( min + " " + max + " " + amount ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } boolean f = true ; for ( int i = n - 1 ; i > 0 ; i -- ) { if ( a [ i - 1 ] - a [ i ] >= 2 ) { f = false ; } else if ( a [ i - 1 ] - a [ i ] == 1 ) { System . out . println ( " [LOG] Block: a[i - 1]--; " ) ; a [ i - 1 ] -- ; } } if ( f ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } } +import java . util . Scanner ; public class Main { static int [ ] insertSort ( int [ ] x ) { int v , j ; for ( int i = 0 ; i < x . length ; i ++ ) { v = x [ i ] ; j = i - 1 ; while ( j >= 0 && x [ j ] > v ) { x [ j + 1 ] = x [ j ] ; j -- ; } x [ j + 1 ] = v ; 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 ++ ) { System . out . println ( " [LOG] Block: x[i] = number.nextInt(); " ) ; x [ i ] = number . nextInt ( ) ; } insertSort ( x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int k = sc . nextInt ( ) ; if ( k == 10 ) { System . out . println ( s . length ( ) ) ; } else { long n = 0 ; while ( Math . pow ( k , n ) < Long . valueOf ( s ) + 1 ) { System . out . println ( " [LOG] Block: n++; " ) ; n ++ ; } System . out . println ( n ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; boolean ch = true ; for ( int i = 0 ; i < 5 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; out : for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = i + 1 ; j < 5 ; j ++ ) { if ( a [ j ] - a [ i ] <= k ) ch = true ; else { System . out . println ( " [LOG] Block: ch = false; \n break out; " ) ; ch = false ; break out ; } } } if ( ch == true ) System . out . print ( " Yay! " ) ; else System . out . print ( " :( " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int input = scan . nextInt ( ) ; int [ ] num = new int [ input ] ; boolean t ; int count = 0 ; for ( int i = 0 ; i < input ; 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 ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } } return true ; } } +import java . util . * ; public class Main { 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 i = 0 ; i < Q ; i ++ ) { l [ i ] = sc . nextInt ( ) ; r [ i ] = sc . nextInt ( ) ; } int [ ] a = new int [ N ] ; int count = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( S . charAt ( i - 1 ) == 'A' && S . charAt ( i ) == 'C' ) { count ++ ; a [ i ] = count ; } else { a [ i ] = count ; } } for ( int i = 0 ; i < Q ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(a[r[i] - 1] - a[l[i] - 1]); " ) ; System . out . println ( a [ r [ i ] - 1 ] - a [ l [ i ] - 1 ] ) ; } } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { S [ i ] = sc . next ( ) ; } HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: set.add(S[i]); " ) ; set . add ( S [ i ] ) ; } System . out . println ( set . size ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; int i = 0 ; char [ ] Schar = S . toCharArray ( ) ; char [ ] Tchar = T . toCharArray ( ) ; for ( i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(Schar[i]); \n System.out.print(Tchar[i]); " ) ; System . out . print ( Schar [ i ] ) ; System . out . print ( Tchar [ i ] ) ; } return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String S = scan.next(); \n scan.close(); \n boolean isTrue = true; \n if (S.charAt(2) != S.charAt(3)) \n isTrue = false; \n else if (S.charAt(4) != S.charAt(5)) \n isTrue = false; \n if (isTrue) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; String S = scan . next ( ) ; scan . close ( ) ; boolean isTrue = true ; if ( S . charAt ( 2 ) != S . charAt ( 3 ) ) isTrue = false ; else if ( S . charAt ( 4 ) != S . charAt ( 5 ) ) isTrue = false ; if ( isTrue ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] mArray = new int [ m + 1 ] ; for ( int i = 0 ; i < n ; 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 ++ ) { System . out . println ( " [LOG] Block: if (mArray[i] == n) \n result++; " ) ; if ( mArray [ i ] == n ) result ++ ; } System . out . println ( result ) ; sc . close ( ) ; } } +import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] hills = new int [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { hills [ i ] = in . nextInt ( ) * - 1 ; } Arrays . sort ( hills ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(hills[i] * -1); " ) ; System . out . println ( hills [ i ] * - 1 ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = 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 ) == a && ( int ) ( pc * 0.1 ) == b ) { while ( ( int ) ( pc * 0.08 ) == a && ( int ) ( pc * 0.1 ) == b ) { pc -- ; } pc ++ ; System . out . println ( pc ) ; return ; } else if ( ( int ) ( pc * 0.08 ) < a || ( int ) ( pc * 0.1 ) < b ) { pl = pc + 1 ; } else if ( ( int ) ( pc * 0.08 ) > a || ( int ) ( pc * 0.1 ) > b ) { System . out . println ( " [LOG] Block: pr = pc - 1; " ) ; pr = pc - 1 ; } } while ( pl <= pr ) ; System . out . println ( - 1 ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n String ans; \n if ((a == b && b == c) || (a != b && b != c && c != a)) \n ans = \" No \" ; \n else \n ans = \" Yes \" ; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String ans ; if ( ( a == b && b == c ) || ( a != b && b != c && c != a ) ) ans = " No " ; else ans = " Yes " ; System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int c = scn . nextInt ( ) ; int [ ] arr = { a , b , c } ; Arrays . parallelSort ( arr ) ; if ( arr [ 0 ] == 5 && arr [ 1 ] == 5 && arr [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { 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 i = 0 ; i < inStr . length ( ) ; i ++ ) { if ( target . charAt ( 0 ) == ring . charAt ( i ) ) { if ( target . equals ( ring . substring ( i , i + target . length ( ) ) ) ) { System . out . println ( " [LOG] Block: result = \" Yes \" ; \n break; " ) ; result = " Yes " ; break ; } } } System . out . println ( result ) ; } } } +import java . util . Scanner ; public class Main { private static double r ; public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n r = stdIn.nextDouble(); \n double Pi = Math.PI; \n System.out.printf( \" %.6f %.6f \n \" , (r * r * Pi), (2 * Pi * r)); " ) ; Scanner stdIn = new Scanner ( System . in ) ; r = stdIn . nextDouble ( ) ; double Pi = Math . PI ; System . out . printf ( " %.6f %.6f \n " , ( r * r * Pi ) , ( 2 * Pi * r ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 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 ) { System . out . println ( " [LOG] Block: end = true; \n break; " ) ; end = true ; break ; } numbers [ i ] = numbers [ i ] / 2 ; } if ( end ) break ; count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int turtle = 0 ; turtle <= x ; ++ turtle ) { int crane = x - turtle ; int feet = 4 * turtle + 2 * crane ; if ( feet == y ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int a ; Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; int c = 0 ; int [ ] b = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } Arrays . sort ( b ) ; for ( int j = 0 ; j < a - 1 ; j ++ ) { if ( b [ j ] == b [ j + 1 ] ) { c = c + 1 ; } } if ( c > 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" YES \" ); " ) ; System . out . println ( " YES " ) ; } } } +import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int [ ] dp = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Arrays . fill ( dp , 0 ) ; if ( n == 1 ) { System . out . println ( arr [ 0 ] ) ; return ; } dp [ 1 ] = Math . abs ( arr [ 1 ] - arr [ 0 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int a = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]); \n int b = dp[i - 2] + Math.abs(arr[i] - arr[i - 2]); \n dp[i] = Math.min(a, b); " ) ; 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 [ n - 1 ] ) ; return ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; char chr ; StringBuilder build = new StringBuilder ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { chr = str . charAt ( i ) ; if ( Character . isLowerCase ( chr ) ) { build . append ( Character . toUpperCase ( chr ) ) ; } else { System . out . println ( " [LOG] Block: build.append(Character.toLowerCase(chr)); " ) ; build . append ( Character . toLowerCase ( chr ) ) ; } } System . out . print ( build . toString ( ) + " \n " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException , Exception { BufferedReader st = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] data1 = getIntArry ( st ) ; int n = data1 [ 0 ] ; int k = data1 [ 1 ] ; int [ ] data2 = getIntArry ( st ) ; int ans = 0 ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println(num); " ) ; System . out . println ( num ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 26 ] ; while ( sc . hasNextLine ( ) ) { char [ ] c = sc . nextLine ( ) . toCharArray ( ) ; for ( int i = 0 , l = c . length ; i < l ; ++ i ) { System . out . println ( " [LOG] Block: char _c = c[i]; \n if (97 <= _c && _c <= 122) \n ++a[_c - 'a']; \n else if (65 <= _c && _c <= 90) \n ++a[_c - 'A']; " ) ; char _c = c [ i ] ; if ( 97 <= _c && _c <= 122 ) ++ a [ _c - 'a' ] ; else if ( 65 <= _c && _c <= 90 ) ++ a [ _c - 'A' ] ; } } for ( int i = 0 ; i < 26 ; ++ i ) System . out . printf ( " %c : %d \n " , 'a' + i , a [ i ] ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st = new StringTokenizer(br.readLine()); \n String s = st.nextToken(); \n System.out.println(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5) ? \" Yes \" : \" No \" ); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; String s = st . nextToken ( ) ; System . out . println ( s . charAt ( 2 ) == s . charAt ( 3 ) && s . charAt ( 4 ) == s . charAt ( 5 ) ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] B = new int [ N ] ; for ( int i = 1 ; i < N ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int [ ] A = new int [ N + 1 ] ; A [ 1 ] = B [ 1 ] ; for ( int i = 1 ; i < N ; i ++ ) { if ( B [ i ] < A [ i ] ) { A [ i ] = B [ i ] ; } A [ i + 1 ] = B [ i ] ; } int max = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { System . out . println ( " [LOG] Block: max += A[i]; " ) ; max += A [ i ] ; } System . out . println ( max ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int X = 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 = X - i ; if ( tmp2 < 0 ) { tmp2 = i - X ; } if ( tmp2 < min ) { System . out . println ( " [LOG] Block: min = tmp2; \n result = i; " ) ; min = tmp2 ; result = i ; } } } System . out . println ( result ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] problems = new int [ N ] ; int [ ] was = new int [ N ] ; 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 < N ; i ++ ) { if ( problems [ i ] == 1 ) { System . out . println ( " [LOG] Block: wa += was[i]; " ) ; wa += was [ i ] ; } } System . out . println ( Arrays . stream ( problems ) . sum ( ) + " " + wa ) ; } } +import java . util . * ; public class Main { static void swap ( int [ ] A , int i , int j ) { int tmp = A [ i ] ; A [ i ] = A [ j ] ; A [ j ] = tmp ; } 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 ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int[] a = new int[n]; \n for (int i = 0; i < n; i++) a[i] = sc.nextInt(); \n int c = selectionSort(a, n); \n System.out.print(a[0]); \n for (int i = 1; i < n; i++) System.out.print( \" \" + a[i]); \n System.out.println(); \n System.out.println(c); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { check = false ; if ( i == 0 ) { t = list . get ( i ) ; count ++ ; continue ; } u = list . get ( i ) ; if ( t . equals ( u ) && i < N - 1 ) { count ++ ; } else if ( t . equals ( u ) && i == N - 1 ) { count ++ ; check = true ; } else { t = u ; check = true ; } if ( check ) { System . out . println ( " [LOG] Block: ans += (count * (count - 1)) / 2; \n t = u; \n count = 1; " ) ; ans += ( count * ( count - 1 ) ) / 2 ; t = u ; count = 1 ; } } System . out . println ( ans ) ; } } +import java . io . * ; import java . util . StringTokenizer ; public class Main { 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 n = nin ( ) ; boolean res = false ; int c = 0 ; for ( int i = 0 ; i < n ; ++ 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 ( ) { System . out . println ( " [LOG] Block: return st.nextToken(); " ) ; return st . nextToken ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int d = 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 = d - s ; if ( f >= 0 ) { System . out . println ( f ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int taro = 0 ; int hanako = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: taro++; \n hanako++; " ) ; taro ++ ; hanako ++ ; } } System . out . printf ( " %d %d \n " , taro , hanako ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( a == 0 ) { a = 1 ; } else if ( a == 1 ) { a = 100 ; } else { a = 10000 ; } for ( int i = 1 ; i <= b ; i ++ ) { ans = a * i ; if ( i >= 100 ) { System . out . println ( " [LOG] Block: ans = a * (i + 1); " ) ; ans = a * ( i + 1 ) ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; loop : while ( true ) { System . out . println ( " [LOG] Block: long a = scanner.nextInt(); \n String op = scanner.next(); \n long b = scanner.nextInt(); \n switch(op) { \n case \" + \" : \n System.out.println(a + b); \n break; \n case \" - \" : \n System.out.println(a - b); \n break; \n case \" * \" : \n System.out.println(a * b); \n break; \n case \" / \" : \n System.out.println(a / b); \n break; \n case \" ? \" : \n break loop; \n } " ) ; long a = scanner . nextInt ( ) ; String op = scanner . next ( ) ; long b = scanner . nextInt ( ) ; switch ( op ) { case " + " : System . out . println ( a + b ) ; break ; case " - " : System . out . println ( a - b ) ; break ; case " * " : System . out . println ( a * b ) ; break ; case " / " : System . out . println ( a / b ) ; break ; case " ? " : break loop ; } } scanner . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( b == 1 ) { System . out . println ( 0 ) ; return ; } if ( b <= a ) { System . out . println ( 1 ) ; return ; } int sum = 0 ; for ( int i = 1 ; ; i ++ ) { sum += a ; if ( sum >= b ) { System . out . println ( " [LOG] Block: System.out.println(i); \n return; " ) ; System . out . println ( i ) ; return ; } sum -= 1 ; } } } +import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . HashMap ; import java . util . Scanner ; public class Main { 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 ) { System . out . println ( " [LOG] Block: BigDecimal totalLength = new BigDecimal(value); \n BigDecimal sideLength = totalLength.divide(BigDecimal.valueOf(3), 7, RoundingMode.HALF_EVEN); \n return sideLength.multiply(sideLength).multiply(sideLength); " ) ; 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 . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc165_b solver = new abc165_b ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class abc165_b { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long X = in . nextLong ( ) ; long base = 100 ; long year = 1 ; while ( true ) { base += Math . floor ( base / 100 ) ; if ( X <= base ) { out . println ( year ) ; return ; } else { System . out . println ( " [LOG] Block: year++; " ) ; year ++ ; } } } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { System . out . println ( " [LOG] Block: String[] array = reader.readLine().split( \" \" ); \n int A = Integer.parseInt(array[0]); \n int B = Integer.parseInt(array[1]); \n int C = Integer.parseInt(array[2]); \n System.out.println(Math.max(B + C - A, 0)); " ) ; String [ ] array = reader . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( array [ 0 ] ) ; int B = Integer . parseInt ( array [ 1 ] ) ; int C = Integer . parseInt ( array [ 2 ] ) ; System . out . println ( Math . max ( B + C - A , 0 ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int[] nums = new int[3]; \n for (int i = 0; i < 3; i++) nums[i] = sc.nextInt(); \n Arrays.sort(nums); \n int cost = 0; \n for (int i = 1; i < 3; i++) cost += nums[i] - nums[i - 1]; \n System.out.println(cost); " ) ; Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) nums [ i ] = sc . nextInt ( ) ; Arrays . sort ( nums ) ; int cost = 0 ; for ( int i = 1 ; i < 3 ; i ++ ) cost += nums [ i ] - nums [ i - 1 ] ; System . out . println ( cost ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintStream ; class Main { 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 w = Integer . parseInt ( reader . readLine ( ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] numbers = new int [ w ] ; for ( int i = 0 ; i < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: out.println(numbers[i]); " ) ; out . println ( numbers [ i ] ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { InputStreamReader r = new InputStreamReader ( System . in ) ; long A = nextInt ( r ) ; long B = nextInt ( r ) ; long ans = A > B ? calcLCM ( A , B ) : calcLCM ( B , A ) ; 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 { System . out . println ( " [LOG] Block: small += tmp; " ) ; small += tmp ; } } return result ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; double d = 0 ; int ans = 0 ; double ans1 = 1000 ; int j = 0 ; for ( int i = 0 ; i != a ; i ++ ) { d = scan . nextInt ( ) ; d = b - ( d * 0.006 ) ; d -= c ; if ( d < 0 ) { d *= - 1 ; } if ( d < ans1 ) { System . out . println ( " [LOG] Block: ans1 = d; \n ans = i + 1; " ) ; ans1 = d ; ans = i + 1 ; } } System . out . println ( ans ) ; } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int m = 1 ; Set < Integer > used = new HashSet < > ( ) ; for ( ; ! used . contains ( s ) ; m ++ ) { used . add ( s ) ; if ( s % 2 == 0 ) { s /= 2 ; } else { s = s * 3 + 1 ; } } System . out . println ( m ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; public class Main { 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 intCard = 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 = intCard ; for ( int i = 0 ; i < intGate ; i ++ ) { System . out . println ( " [LOG] Block: strData = br.readLine(); \n strDat = strData.split( \" \" , -1); \n intL[i] = Integer.parseInt(strDat[0]); \n intR[i] = Integer.parseInt(strDat[1]); \n if (intL[i] > intSt) \n intSt = intL[i]; \n if (intR[i] < intEd) \n intEd = intR[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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; int count0 = 0 ; int count1 = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (S.charAt(i) == '1') \n count1++; \n if (S.charAt(i) == '0') \n count0++; " ) ; if ( S . charAt ( i ) == '1' ) count1 ++ ; if ( S . charAt ( i ) == '0' ) count0 ++ ; } System . out . println ( 2 * Math . min ( count1 , count0 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; if ( N <= ( 2 * D + 1 ) ) { System . out . println ( 1 ) ; } else { int num = 0 ; while ( N > 0 ) { System . out . println ( " [LOG] Block: N -= (2 * D + 1); \n num++; " ) ; N -= ( 2 * D + 1 ) ; num ++ ; } System . out . println ( num ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " No " ; int jdg = n % 28 ; if ( jdg == 0 ) { ans = " Yes " ; } else { while ( jdg >= 3 ) { if ( jdg % 4 == 0 || jdg % 7 == 0 ) { ans = " Yes " ; break ; } else { System . out . println ( " [LOG] Block: jdg -= 7; " ) ; jdg -= 7 ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long t1 = (n / (a + b)) * a; \n long t2 = n % (a + b) > a ? a : n % (a + b); \n sc.close(); \n System.out.println(t1 + t2); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long t1 = ( n / ( a + b ) ) * a ; long t2 = n % ( a + b ) > a ? a : n % ( a + b ) ; sc . close ( ) ; System . out . println ( t1 + t2 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i + 1 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . 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 { System . out . println ( " [LOG] Block: FastReader s = new FastReader(); \n int n = s.nextInt(); \n int v = (int) (n + Math.pow(n, 2) + Math.pow(n, 3)); \n System.out.println(v); " ) ; FastReader s = new FastReader ( ) ; int n = s . nextInt ( ) ; int v = ( int ) ( n + Math . pow ( n , 2 ) + Math . pow ( n , 3 ) ) ; System . out . println ( v ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; int r = Integer . parseInt ( line [ 0 ] ) ; int c = Integer . parseInt ( line [ 1 ] ) ; int [ ] [ ] sheet = new int [ r + 1 ] [ c + 1 ] ; for ( int i = 0 ; i < r ; 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 [ r ] [ c ] += a [ j ] ; sheet [ i ] [ c ] += a [ j ] ; sheet [ r ] [ j ] += a [ j ] ; } } for ( int i = 0 ; i <= r ; i ++ ) { for ( int j = 0 ; j <= c ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print(sheet[i][j]); \n if (j != c) \n System.out.print( \" \" ); " ) ; System . out . print ( sheet [ i ] [ j ] ) ; if ( j != c ) System . out . print ( " " ) ; } System . out . print ( " \n " ) ; } } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner scan = new Scanner ( is ) ; int N = scan . nextInt ( ) ; int K = scan . nextInt ( ) ; int ans = 0 ; while ( N >= K ) { System . out . println ( " [LOG] Block: N /= K; \n ans++; " ) ; N /= K ; ans ++ ; } if ( N != 0 ) ans ++ ; os . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int count = 0 ; if ( b != 1 ) { count = 1 ; } int sum = a ; while ( b > sum ) { System . out . println ( " [LOG] Block: sum += a - 1; \n count++; " ) ; sum += a - 1 ; count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] [ ] [ ] OffHouse = new int [ 4 ] [ 3 ] [ 10 ] ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print( \" \" + OffHouse[i][s][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 Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double degree = calculateAngle ( H , M ) ; double side = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( side ) ; } static double calculateAngle ( double h , double m ) { System . out . println ( " [LOG] Block: double hour_angle = (0.5 * (h * 60 + m)); \n double minute_angle = (6 * m); \n double angle = Math.abs(hour_angle - minute_angle); \n angle = Math.min(360 - angle, angle); \n return angle; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . nextLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" x \" ); " ) ; System . out . print ( " x " ) ; } } } +import java . util . Scanner ; public class Main { public static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int max = a ; int max_index = 0 ; if ( max < b ) { max = b ; max_index = 1 ; } if ( max < c ) { System . out . println ( " [LOG] Block: max = c; \n max_index = 2; " ) ; max = c ; max_index = 2 ; } switch ( max_index ) { case 0 : a *= 2 ; break ; case 1 : b *= 2 ; break ; case 2 : c *= 2 ; break ; } } System . out . println ( a + b + c ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( n > k ) { n -= k * ( n / k ) ; if ( k - n < n ) { System . out . println ( k - n ) ; } else { System . out . println ( " [LOG] Block: System.out.println(n); " ) ; System . out . println ( n ) ; } } else { if ( k - n < n ) { System . out . println ( k - n ) ; } else { System . out . println ( " [LOG] Block: System.out.println(n); " ) ; System . out . println ( n ) ; } } } } +import java . util . Scanner ; public class Main { public static int g ( long x ) { int res = 0 ; while ( x > 0 ) { ++ res ; x /= 10 ; } return res ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; int res = Integer . MAX_VALUE ; for ( long i = 1 ; i * i <= N ; ++ i ) { if ( N % i == 0 ) { System . out . println ( " [LOG] Block: long a = N / i; \n res = Math.min(res, Math.max(g(i), g(a))); " ) ; long a = N / i ; res = Math . min ( res , Math . max ( g ( i ) , g ( a ) ) ) ; } } System . out . println ( res ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n String ans = \" NO \" ; \n if (a * b * c == 5 * 7 * 5) \n ans = \" YES \" ; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String ans = " NO " ; if ( a * b * c == 5 * 7 * 5 ) ans = " YES " ; System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 n = sc . nextInt ( ) ; double d = 0.0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: return gcd(b % a, a); " ) ; return gcd ( b % a , a ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < n - 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 ( " [LOG] Block: System.out.println(obj); " ) ; System . out . println ( obj ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int result = 100000 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: result += result * 0.05; \n result = (int) Math.ceil((double) result / 1000) * 1000; " ) ; result += result * 0.05 ; result = ( int ) Math . ceil ( ( double ) result / 1000 ) * 1000 ; } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int n = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '+' ) { n = n + 1 ; } else { System . out . println ( " [LOG] Block: n = n - 1; " ) ; n = n - 1 ; } } System . out . println ( n ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: PriorityQueue<String> caca = new PriorityQueue<String>(); \n Scanner scn = new Scanner(System.in); \n int n = scn.nextInt(); \n int n2 = scn.nextInt(); \n for (int i = 0; i < n; i++) caca.add(scn.next()); \n for (int i = 0; i < n; i++) System.out.print(caca.poll()); \n System.out.println(); \n scn.close(); " ) ; PriorityQueue < String > caca = new PriorityQueue < String > ( ) ; Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int n2 = scn . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) caca . add ( scn . next ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( caca . poll ( ) ) ; System . out . println ( ) ; scn . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; int d = 0 ; int i = 0 ; for ( int cnt = 0 ; cnt < n ; cnt ++ ) { l [ cnt ] = sc . nextInt ( ) ; d += l [ cnt ] ; if ( d > x ) { i = cnt + 1 ; break ; } else { System . out . println ( " [LOG] Block: i = n + 1; " ) ; i = n + 1 ; } } System . out . println ( i ) ; sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . * ; import java . math . * ; import java . util . * ; class Main { 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 min = 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 >= min ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } min = Math . min ( min , count ) ; } System . out . print ( min ) ; } } +import java . util . Scanner ; public class Main { 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 ( ) ; long lcm = c * d / gcd ( c , d ) ; long u = b - a + 1 ; long cs = b / c - ( a - 1 ) / c ; long ds = b / d - ( a - 1 ) / d ; long lcms = b / lcm - ( a - 1 ) / lcm ; sc . close ( ) ; System . out . println ( u - cs - ds + lcms ) ; } public static long gcd ( long num1 , long num2 ) { System . out . println ( " [LOG] Block: if (num2 == 0) \n return num1; \n else \n return gcd(num2, num1 % num2); " ) ; if ( num2 == 0 ) return num1 ; else return gcd ( num2 , num1 % num2 ) ; } } +import java . util . * ; public class Main { long INF = 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 . println ( " [LOG] Block: System.out.print(ans); " ) ; System . out . print ( ans ) ; } System . out . println ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong(); \n long sum = a * (n / (a + b)); \n sum += a < n % (a + b) ? a : n % (a + b); \n System.out.println(sum); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) , a = sc . nextLong ( ) , b = sc . nextLong ( ) ; long sum = a * ( n / ( a + b ) ) ; sum += a < n % ( a + b ) ? a : n % ( a + b ) ; System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int kR = Integer . parseInt ( sc . next ( ) ) ; int q = Integer . parseInt ( sc . next ( ) ) ; int [ ] np = new int [ n ] ; 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 < n ; j ++ ) { if ( kR - q + np [ j ] > 0 ) { sb . append ( " Yes " ) ; } else { sb . append ( " No " ) ; } if ( j < n - 1 ) { System . out . println ( " [LOG] Block: sb.append( \" \n \" ); " ) ; sb . append ( " \n " ) ; } } System . out . println ( sb ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , t = 0 ; while ( n -- > 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 ) { System . out . println ( " [LOG] Block: solve(); " ) ; solve ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { String S = sc . next ( ) ; for ( int i = 1 ; i <= S . length ( ) ; i ++ ) { char c = S . charAt ( i - 1 ) ; if ( i % 2 == 1 ) { if ( c == 'R' || c == 'U' || c == 'D' ) { } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } else { if ( c == 'L' || c == 'U' || c == 'D' ) { } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n System.exit(0); " ) ; System . out . println ( " No " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String t = scanner . next ( ) ; int diffCount = 0 ; for ( int i = 0 ; i < s . length ( ) && i < t . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) == t.charAt(i)) \n diffCount++; " ) ; if ( s . charAt ( i ) == t . charAt ( i ) ) diffCount ++ ; } System . out . println ( diffCount ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AChangingACharacter solver = new AChangingACharacter ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AChangingACharacter { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = 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 InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = Long . parseLong ( sc . next ( ) ) ; long B = Long . parseLong ( sc . next ( ) ) ; long n = Math . abs ( A - ( A - B ) / 2 ) ; if ( Math . abs ( A - n ) == Math . abs ( B - n ) ) { System . out . println ( n ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" IMPOSSIBLE \" ); " ) ; System . out . println ( " IMPOSSIBLE " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double shortA = sc . nextInt ( ) ; double longB = sc . nextInt ( ) ; double time = sc . nextInt ( ) ; double minute = sc . nextInt ( ) ; double all = 360 ; double ans = 0.0 ; double timeMinute = 60.0 * time + minute ; double shortaa = ( timeMinute / 720.0 ) * 360 ; double longaa = minute * 6 ; double angle = 0.0 ; if ( shortaa < longaa ) { angle = longaa - shortaa ; } else { angle = shortaa - longaa ; } if ( angle == 360.0 ) { angle = 0.0 ; } else if ( angle > 180.0 ) { System . out . println ( " [LOG] Block: angle = 360.0 - angle; " ) ; angle = 360.0 - angle ; } double cos = Math . cos ( Math . toRadians ( angle ) ) ; ans = Math . sqrt ( Math . pow ( shortA , 2 ) + Math . pow ( longB , 2 ) - 2.0 * shortA * longB * cos ) ; System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; String newWord ; for ( int i = 0 ; i < N ; 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 { System . out . println ( " [LOG] Block: list.add(newWord); " ) ; list . add ( newWord ) ; } } System . out . println ( " Yes " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; int X = scanner . nextInt ( ) ; int s = X - ( K - 1 ) ; int e = X + ( K - 1 ) ; for ( int i = s ; i <= e ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } +import java . io . * ; class Main { public static int prime ( int x ) { int k = 0 ; if ( x == 1 ) { k = 1 ; } else if ( x % 2 == 0 ) { k = 1 ; } for ( int i = 3 ; i <= Math . sqrt ( x ) ; i += 2 ) { if ( x % i == 0 ) { k = 1 ; break ; } } if ( x == 2 ) { k = 0 ; } return k ; } 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 ( " [LOG] Block: System.out.println(e); " ) ; System . out . println ( e ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; if ( x == 1 || x == 2 || x == 3 ) { System . out . println ( " [LOG] Block: System.out.println(x); \n return; " ) ; System . out . println ( x ) ; return ; } while ( true ) { boolean prime = true ; for ( int i = 2 ; i <= x / 2 ; i ++ ) { if ( x % i == 0 ) { prime = false ; break ; } } if ( prime ) { System . out . println ( " [LOG] Block: System.out.println(x); \n return; " ) ; System . out . println ( x ) ; return ; } x ++ ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " Yes " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 && s . charAt ( i ) == 'L' ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } else if ( i % 2 == 1 && s . charAt ( i ) == 'R' ) { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st; \n PrintWriter pw = new PrintWriter(System.out); \n char[] c = br.readLine().toCharArray(); \n for (int i = 0; i < c.length; i++) c[i] = 'x'; \n pw.println(c); \n pw.flush(); \n pw.close(); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st ; PrintWriter pw = new PrintWriter ( System . out ) ; char [ ] c = br . readLine ( ) . toCharArray ( ) ; for ( int i = 0 ; i < c . length ; i ++ ) c [ i ] = 'x' ; pw . println ( c ) ; pw . flush ( ) ; pw . close ( ) ; } } +import java . util . * ; public class Main { 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 ( " [LOG] Block: System.out.println( \" bon \" ); " ) ; System . out . println ( " bon " ) ; } scan . close ( ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int [ ] numbers = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: numbers[i] = a.nextInt(); " ) ; numbers [ i ] = 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n - 1 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int lastV = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( i == 0 ) { System . out . println ( " [LOG] Block: ans += list[i]; " ) ; ans += list [ i ] ; } else if ( list [ i ] > lastV ) { ans += lastV ; } else { System . out . println ( " [LOG] Block: ans += list[i]; " ) ; ans += list [ i ] ; } if ( i == n - 2 ) { System . out . println ( " [LOG] Block: ans += list[i]; " ) ; ans += list [ i ] ; } lastV = list [ i ] ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n char[] a = s.toCharArray(); \n for (int i = a.length - 1; i >= 0; i--) System.out.print(a[i]); \n System.out.println(); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] a = s . toCharArray ( ) ; for ( int i = a . length - 1 ; i >= 0 ; i -- ) System . out . print ( a [ i ] ) ; System . out . println ( ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int resultCount = 0 ; for ( int i = 0 ; i < n ; i ++ ) { final int num = sc . nextInt ( ) ; if ( num % 2 == 0 ) { list . add ( num ) ; } else { break ; } } if ( list . size ( ) != n ) { System . out . print ( resultCount ) ; return ; } boolean continueFlag = true ; while ( continueFlag ) { int count = 0 ; for ( int j = 0 ; j < n ; j ++ ) { int num = list . get ( j ) ; if ( num % 2 == 0 ) { list . set ( j , num / 2 ) ; count ++ ; } else { continueFlag = false ; break ; } } if ( count == n ) { System . out . println ( " [LOG] Block: resultCount++; " ) ; resultCount ++ ; } } System . out . print ( resultCount ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int[] array = new int[n]; \n for (int i = 1; i < n; i++) array[sc.nextInt() - 1]++; \n sc.close(); \n for (int i = 0; i < n; i++) System.out.println(array[i]); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) array [ sc . nextInt ( ) - 1 ] ++ ; sc . close ( ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . println ( array [ i ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int d = Math.min(a * b, c); \n System.out.println(d); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = Math . min ( a * b , c ) ; System . out . println ( d ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; while ( n > 0 ) { System . out . println ( " [LOG] Block: n /= k; \n count++; " ) ; n /= k ; count ++ ; } System . out . println ( count ) ; } } +import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] omkar ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st = new StringTokenizer(infile.readLine()); \n int N = Integer.parseInt(st.nextToken()); \n int res = N / 500; \n res *= 1000; \n int lol = N % 500 - N % 5; \n System.out.println(res + lol); " ) ; BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int res = N / 500 ; res *= 1000 ; int lol = N % 500 - N % 5 ; System . out . println ( res + lol ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String [ ] s = S . split ( " / " ) ; int year = 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 ( " [LOG] Block: System.out.println( \" Heisei \" ); " ) ; System . out . println ( " Heisei " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = 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 ) { System . out . println ( " [LOG] Block: int l = sc.nextInt(); \n int r = sc.nextInt(); \n l--; \n r--; \n int val = dp[r] - dp[l]; \n System.out.println(val); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; while ( sc . hasNext ( ) ) { String s = sc . next ( ) ; if ( s . equals ( " 0 " ) ) { break ; } count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: char c = s.charAt(i); \n int digit = c - '0'; \n count += digit; " ) ; char c = s . charAt ( i ) ; int digit = c - '0' ; count += digit ; } System . out . printf ( " %d \n " , count ) ; } } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; String [ ] ac = new String [ N + 1 ] ; int [ ] wa = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 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 < N + 1 ; i ++ ) { if ( ac [ i ] . equals ( " AC " ) ) { count1 ++ ; } else { System . out . println ( " [LOG] Block: wa[i] = 0; " ) ; wa [ i ] = 0 ; } count2 += wa [ i ] ; } System . out . println ( count1 + " " + count2 ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . LinkedHashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < String > box = new ArrayList < > ( ) ; int amount = sc . nextInt ( ) ; String each = null ; for ( int i = 0 ; i < amount ; i ++ ) { System . out . println ( " [LOG] Block: box.add(sc.next()); " ) ; box . add ( sc . next ( ) ) ; } List < String > list = new ArrayList < String > ( new LinkedHashSet < > ( box ) ) ; System . out . println ( list . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int x = sc.nextInt(); \n int th = x / 500; \n int g = (x - (th * 500)) / 5; \n int ans = (th * 1000) + (g * 5); \n System.out.println(ans); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int th = x / 500 ; int g = ( x - ( th * 500 ) ) / 5 ; int ans = ( th * 1000 ) + ( g * 5 ) ; System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] nlist = new int [ n ] ; for ( int i = 1 ; i <= n ; i ++ ) { int a = sc . nextInt ( ) ; nlist [ a - 1 ] = i ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(nlist[i] + \" \" ); " ) ; System . out . print ( nlist [ i ] + " " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] h = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int max = h [ 0 ] ; boolean b = true ; for ( int i = 0 ; i < N ; i ++ ) { if ( h [ i ] < max - 1 ) { b = false ; break ; } if ( h [ i ] > max ) { System . out . println ( " [LOG] Block: max = h[i]; " ) ; max = h [ i ] ; } } System . out . println ( b ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sum = Integer . parseInt ( sc . next ( ) ) ; sum += Integer . parseInt ( sc . next ( ) ) ; sum += Integer . parseInt ( sc . next ( ) ) ; if ( sum > 21 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" win \" ); " ) ; System . out . println ( " win " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long seisu = scan . nextLong ( ) ; long syou = 0 ; long a = 0 , b = 0 ; long re = Long . MAX_VALUE ; for ( int i = 1 ; i <= Math . sqrt ( seisu ) ; i ++ ) { if ( seisu % i == 0 ) { System . out . println ( " [LOG] Block: a = i; \n b = seisu / i; " ) ; a = i ; b = seisu / i ; } re = Math . min ( re , a + b - 2 ) ; } System . out . println ( re ) ; scan . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; int zero = 0 ; int one = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) == '0' ) { zero ++ ; } else { System . out . println ( " [LOG] Block: one++; " ) ; one ++ ; } } System . out . println ( 2 * Math . min ( zero , one ) ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; if ( n <= 100 ) { List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; 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 . println ( " [LOG] Block: System.out.print(list.get(i) + \" \" ); " ) ; System . out . print ( list . get ( i ) + " " ) ; } } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = Integer . parseInt ( std . next ( ) ) ; int [ ] line = new int [ n ] ; int temp = 0 ; int exchange = 0 ; for ( int i = 0 ; i < n ; i ++ ) { line [ i ] = Integer . parseInt ( std . next ( ) ) ; } boolean flag = true ; while ( flag ) { flag = false ; for ( int j = ( n - 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: outsd += \" \" + line[i]; " ) ; outsd += " " + line [ i ] ; } System . out . println ( outsd ) ; System . out . println ( exchange ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int yen = scanner . nextInt ( ) ; int divValue , modValue , totalHp ; divValue = yen / 500 ; totalHp = divValue * 1000 ; modValue = yen % 500 ; if ( modValue != 0 ) { System . out . println ( " [LOG] Block: divValue = modValue / 5; \n totalHp = totalHp + divValue * 5; " ) ; divValue = modValue / 5 ; totalHp = totalHp + divValue * 5 ; } System . out . println ( totalHp ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int w = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] lots = new int [ w ] ; for ( int i = 1 ; i <= w ; ++ 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 < w ; ++ i ) { System . out . println ( String . valueOf ( lots [ i ] ) ) ; } } } private static void swapVerticalLines ( int [ ] lots , int line1 , int line2 ) { System . out . println ( " [LOG] Block: int tmp = lots[line1]; \n lots[line1] = lots[line2]; \n lots[line2] = tmp; " ) ; int tmp = lots [ line1 ] ; lots [ line1 ] = lots [ line2 ] ; lots [ line2 ] = tmp ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int [ ] array = new int [ N ] ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } sc . close ( ) ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int s = 0 ; if ( a < b ) { for ( ; a < b ; a ++ ) { if ( c % a == 0 ) s ++ ; } } else if ( a > b ) ; { for ( ; b < a ; b ++ ) { System . out . println ( " [LOG] Block: if (c % b == 0) \n s++; " ) ; if ( c % b == 0 ) s ++ ; } } if ( a == b ) if ( c % a == 0 ) s ++ ; System . out . println ( s ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scn = new Scanner(System.in); \n int a, b, c; \n a = scn.nextInt(); \n b = scn.nextInt(); \n c = scn.nextInt(); \n System.out.printf((a + b + c) <= 21 ? \" win \" : \" bust \" ); " ) ; Scanner scn = new Scanner ( System . in ) ; int a , b , c ; a = scn . nextInt ( ) ; b = scn . nextInt ( ) ; c = scn . nextInt ( ) ; System . out . printf ( ( a + b + c ) <= 21 ? " win " : " bust " ) ; } } +import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner sc = new Scanner ( is ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int h = sc.nextInt(); \n if (k <= h) \n ans++; " ) ; int h = sc . nextInt ( ) ; if ( k <= h ) ans ++ ; } os . println ( ans ) ; } } +import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int n = sc . nextInt ( ) ; for ( int i = 0 ; 4 * i <= 100 ; i ++ ) { for ( int j = 0 ; 4 * i + 7 * j <= 100 ; j ++ ) { if ( 4 * i + 7 * j == n ) { 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 Printer extends PrintWriter { Printer ( OutputStream out ) { System . out . println ( " [LOG] Block: super(out); " ) ; super ( out ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int cnt = 0 ; int tmp = i ; while ( tmp != 0 ) { System . out . println ( " [LOG] Block: tmp /= 10; \n cnt++; " ) ; tmp /= 10 ; cnt ++ ; } if ( cnt % 2 == 1 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int [ ] arr = new int [ N ] ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = reader . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = N - 1 ; i >= 0 ; i -= 2 ) { a += arr [ i ] ; if ( i > 0 ) { System . out . println ( " [LOG] Block: b += arr[i - 1]; " ) ; b += arr [ i - 1 ] ; } } System . out . print ( a - b ) ; reader . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { static int A ; static int B ; public static void main ( String [ ] args ) throws NumberFormatException , IOException { read ( ) ; } private static void read ( ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] word = br.readLine().split( \" \\ s+ \" ); \n A = Integer.parseInt(word[0]); \n B = Integer.parseInt(word[1]); \n System.out.println(A * B); \n br.close(); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] word = br . readLine ( ) . split ( " \\ s+ " ) ; A = Integer . parseInt ( word [ 0 ] ) ; B = Integer . parseInt ( word [ 1 ] ) ; System . out . println ( A * B ) ; br . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] h = new int [ n ] ; int i ; for ( i = 0 ; i < n ; i ++ ) { h [ i ] = scan . nextInt ( ) ; } for ( i = n - 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] list = sc . next ( ) . toCharArray ( ) ; boolean flag = 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 ( ! flag ) { flag = true ; tmp = 0 ; } tmp ++ ; } else { if ( flag ) { System . out . println ( " [LOG] Block: flag = false; \n max = Math.max(max, tmp); " ) ; flag = false ; max = Math . max ( max , tmp ) ; } } } System . out . println ( Math . max ( max , tmp ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String line = sc.nextLine(); \n String[] lines = line.split( \" \" ); \n int A = Integer.parseInt(lines[0]); \n int B = Integer.parseInt(lines[1]); \n System.out.println(A * B); " ) ; Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; int A = Integer . parseInt ( lines [ 0 ] ) ; int B = Integer . parseInt ( lines [ 1 ] ) ; System . out . println ( A * B ) ; } } +import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int x = scanner . nextInt ( ) ; int max = 1 ; for ( int i = 2 ; i <= x ; i ++ ) { int j = i ; while ( true ) { j *= i ; if ( j > x ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } max = Math . max ( max , j ) ; } } System . out . println ( max ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String x = sc . next ( ) ; if ( x . equals ( " 0 " ) ) break ; int sum = 0 , i ; for ( i = 0 ; i < x . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: sum = sum + x.charAt(i) - 48; " ) ; sum = sum + x . charAt ( i ) - 48 ; } System . out . printf ( " %d \n " , sum ) ; } } } +import java . util . * ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; s = " 2018 " + s . substring ( 4 , s . length ( ) ) ; System . out . println ( s ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: solve(); " ) ; solve ( ) ; } } +import java . text . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; try { DateFormat sdf = new SimpleDateFormat ( " yyyy/MM/dd " ) ; Date date1 = sdf . parse ( a ) ; Date date2 = sdf . parse ( " 2019/04/30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; import java . io . * ; import static java . lang . Character . isUpperCase ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; int [ ] h = new int [ N ] ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { h [ i ] = in . nextInt ( ) ; if ( h [ i ] >= K ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . next ( ) ) ; int s = Integer . parseInt ( scanner . next ( ) ) ; if ( n < 10 && s < 10 ) { System . out . println ( n * s ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } scanner . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner reader = new Scanner(System.in); \n int A = reader.nextInt(); \n int B = reader.nextInt(); \n int ans = Math.max(A + A - 1, B + B - 1); \n ans = Math.max(ans, A + B); \n System.out.print(ans); \n reader.close(); " ) ; Scanner reader = new Scanner ( System . in ) ; int A = reader . nextInt ( ) ; int B = reader . nextInt ( ) ; int ans = Math . max ( A + A - 1 , B + B - 1 ) ; ans = Math . max ( ans , A + B ) ; System . out . print ( ans ) ; reader . close ( ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(), K = sc.nextInt(); \n double[] dp = new double[K + 1]; \n Arrays.fill(dp, 0); \n for (int i = 1; i <= Math.min(N, K); ++i) dp[i] = 1.0 / N; \n dp[K] += (double) Math.max(0, N - K) / N; \n for (int i = 1; i < K; ++i) dp[Math.min(i * 2, K)] += dp[i] / 2; \n System.out.println(dp[K]); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , K = sc . nextInt ( ) ; double [ ] dp = new double [ K + 1 ] ; Arrays . fill ( dp , 0 ) ; for ( int i = 1 ; i <= Math . min ( N , K ) ; ++ i ) dp [ i ] = 1.0 / N ; dp [ K ] += ( double ) Math . max ( 0 , N - K ) / N ; for ( int i = 1 ; i < K ; ++ i ) dp [ Math . min ( i * 2 , K ) ] += dp [ i ] / 2 ; System . out . println ( dp [ K ] ) ; } } +import java . util . * ; import java . lang . * ; public class Main { static class pair { double f , s ; pair ( double f , double s ) { this . f = f ; 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 ++ ) { System . out . println ( " [LOG] Block: sum += B[A[i]]; \n if (h + 1 == A[i]) \n sum += C[h]; \n h = A[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 . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int leg = sc . nextInt ( ) ; if ( leg % 2 == 1 ) { System . out . println ( " No " ) ; } else if ( leg < 2 * n ) { System . out . println ( " No " ) ; } else if ( leg > 4 * n ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n char ch = sc.next().trim().charAt(0); \n StringBuilder sb = new StringBuilder(); \n if (ch >= 'A' && ch <= 'Z') \n sb.append('A' + \" \n \" ); \n else if (ch >= 'a' && ch <= 'z') \n sb.append('a' + \" \n \" ); \n sc.close(); \n System.out.println(sb); " ) ; Scanner sc = new Scanner ( System . in ) ; char ch = sc . next ( ) . trim ( ) . charAt ( 0 ) ; StringBuilder sb = new StringBuilder ( ) ; if ( ch >= 'A' && ch <= 'Z' ) sb . append ( 'A' + " \n " ) ; else if ( ch >= 'a' && ch <= 'z' ) sb . append ( 'a' + " \n " ) ; sc . close ( ) ; System . out . println ( sb ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; String T = sc . next ( ) ; sc . close ( ) ; int cnt = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (S.substring(i, i + 1).equals(T.substring(i, i + 1))) \n cnt++; " ) ; if ( S . substring ( i , i + 1 ) . equals ( T . substring ( i , i + 1 ) ) ) cnt ++ ; } System . out . println ( cnt ) ; } } +import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) ; String ans = " " ; String x = " 1 " ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( n . charAt ( i ) == x . charAt ( 0 ) ) { ans += " 9 " ; } else { System . out . println ( " [LOG] Block: ans += \" 1 \" ; " ) ; ans += " 1 " ; } } System . out . println ( ans ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static int solve ( int n , int k , int [ ] arr ) { int [ ] dp = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { int ans = Integer . MAX_VALUE ; for ( int j = i - 1 ; j >= 0 && ( i - j ) <= k ; j -- ) { int diff = Math . abs ( arr [ i ] - arr [ j ] ) ; ans = Math . min ( ans , diff + dp [ j ] ) ; } dp [ i ] = 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 i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: arr[i] = s.nextInt(); " ) ; arr [ i ] = s . nextInt ( ) ; } System . out . println ( solve ( n , k , arr ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < ( n - 1 ) ; i ++ ) { if ( ( h [ i + 1 ] - h [ i ] ) < 0 ) { System . out . println ( " No " ) ; return ; } else if ( h [ i + 1 ] > h [ i ] ) { System . out . println ( " [LOG] Block: h[i + 1]--; " ) ; h [ i + 1 ] -- ; } } System . out . println ( " Yes " ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; if ( S . matches ( " (dream|dreamer|erase|eraser)+? " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ sc . nextInt ( ) - 1 ] = i + 1 ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i != 0 ) { System . out . println ( " [LOG] Block: sb.append( \" \" ); " ) ; sb . append ( " " ) ; } sb . append ( arr [ i ] ) ; } System . out . println ( sb ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n double x; \n if (N % 2 == 0) \n x = 1.0 / 2.0; \n else \n x = (double) (N / 2 + 1) / (double) N; \n System.out.println(x); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double x ; if ( N % 2 == 0 ) x = 1.0 / 2.0 ; else x = ( double ) ( N / 2 + 1 ) / ( double ) N ; System . out . println ( x ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } bubbleSort ( A , N ) ; } public static void bubbleSort ( int [ ] A , int N ) { int flag = 1 , count = 0 ; while ( flag == 1 ) { flag = 0 ; int i = 0 ; for ( int j = i ; j < N - 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(A[i]); \n if (i != N - 1) \n System.out.print( \" \" ); " ) ; System . out . print ( A [ i ] ) ; if ( i != N - 1 ) System . out . print ( " " ) ; } System . out . printf ( " \n %d \n " , count ) ; } } +import java . awt . * ; import java . awt . geom . * ; import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] list = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { list [ i ] = sc . nextInt ( ) ; } Arrays . sort ( list ) ; System . out . print ( list [ 0 ] ) ; for ( int i = 1 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" \" + list[i]); " ) ; System . out . print ( " " + list [ i ] ) ; } System . out . println ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] [ ] mat = new int [ N ] [ M ] ; for ( int i = 0 ; i < N ; 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 , N , M ) ) { answer = answer + 1 ; } } System . out . println ( answer ) ; } public static boolean isAllLike ( int [ ] [ ] mat , int x , int N , int M ) { boolean isLike = false ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( mat [ i ] [ j ] == x ) { isLike = true ; } } if ( ! isLike ) { System . out . println ( " [LOG] Block: return false; " ) ; return false ; } isLike = false ; } return true ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] result = new int [ 26 ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = 0 ; } while ( sc . hasNext ( ) ) { String input = sc . nextLine ( ) ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { char ch = input . charAt ( i ) ; 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 i = 0 ; i < result . length ; i ++ ) { System . out . println ( " [LOG] Block: char alphabet = (char) (i + 'a'); \n System.out.println(alphabet + \" : \" + result[i]); " ) ; char alphabet = ( char ) ( i + 'a' ) ; System . out . println ( alphabet + " : " + result [ i ] ) ; } sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int n = Integer . parseInt ( line ) ; int tarouScore = 0 ; int hanakoScore = 0 ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: tarouScore += 3; " ) ; tarouScore += 3 ; } } System . out . println ( tarouScore + " " + hanakoScore ) ; } } +import java . util . Scanner ; class Main { int n , m , x , y ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; sc . useDelimiter ( " \\ s " ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; int [ ] [ ] A = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; int [ ] c = new int [ n ] ; for ( x = 0 ; x < n ; 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 < n ; x ++ ) { for ( y = 0 ; y < m ; y ++ ) { c [ x ] = c [ x ] + A [ x ] [ y ] * b [ y ] ; } } for ( x = 0 ; x < n ; x ++ ) { System . out . println ( c [ x ] ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n Integer a = scanner.nextInt(); \n Integer b = scanner.nextInt(); \n Integer h = scanner.nextInt(); \n Integer m = scanner.nextInt(); \n double result; \n double rad = Math.PI * 2 * ((double) h / 12 + ((double) m / 60) / 12 - (double) m / 60); \n result = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(rad)); \n System.out.printf( \" %.20f \" , result); " ) ; Scanner scanner = new Scanner ( System . in ) ; Integer a = scanner . nextInt ( ) ; Integer b = scanner . nextInt ( ) ; Integer h = scanner . nextInt ( ) ; Integer m = scanner . nextInt ( ) ; double result ; double rad = Math . PI * 2 * ( ( double ) h / 12 + ( ( double ) m / 60 ) / 12 - ( double ) m / 60 ) ; result = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( rad ) ) ; System . out . printf ( " %.20f " , result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String strn = sc . next ( ) ; sc . close ( ) ; String [ ] str = strn . split ( " " ) ; int sum = 0 ; for ( int i = 0 ; i < strn . length ( ) ; i ++ ) { sum += Integer . parseInt ( str [ i ] ) ; } String ans = " No " ; if ( sum % 9 == 0 ) { System . out . println ( " [LOG] Block: ans = \" Yes \" ; " ) ; ans = " Yes " ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str , str2 ; while ( true ) { str = sc . next ( ) ; if ( str . equals ( " - " ) ) break ; str2 = " " ; int shuffulNum = sc . nextInt ( ) ; for ( int i = 0 ; i < shuffulNum ; i ++ ) { int n = sc . nextInt ( ) ; for ( int j = n ; j < str . length ( ) ; j ++ ) { System . out . println ( " [LOG] Block: str2 += str.charAt(j); " ) ; str2 += str . charAt ( j ) ; } for ( int j = 0 ; j < n ; j ++ ) { System . out . println ( " [LOG] Block: str2 += str.charAt(j); " ) ; str2 += str . charAt ( j ) ; } str = str2 ; str2 = " " ; } System . out . println ( str ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] array = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { array [ i ] = sc . nextInt ( ) ; sum += array [ i ] ; } int sum2 = 0 ; int dif = 0 ; int min = 10000 ; for ( int i = 0 ; i < N ; i ++ ) { sum -= array [ i ] ; sum2 += array [ i ] ; dif = Math . abs ( sum - sum2 ) ; if ( min > dif ) { System . out . println ( " [LOG] Block: min = dif; " ) ; min = dif ; } } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdin = new Scanner(System.in); \n int a = stdin.nextInt(); \n int b = stdin.nextInt(); \n System.out.printf( \" %d %d %f \" , a / b, a % b, (double) a / b); " ) ; Scanner stdin = new Scanner ( System . in ) ; int a = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; System . out . printf ( " %d %d %f " , a / b , a % b , ( double ) a / b ) ; } } +public class Main { protected static String calc ( String input ) { final int data = Integer . parseInt ( input ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= data ; 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 ) { System . out . println ( " [LOG] Block: s.close(); " ) ; s . close ( ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int n = s . length ( ) ; int sum1 = 0 ; int sum2 = 0 ; sum1 = 0 ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) { if ( i % 2 == 0 ) { System . out . println ( " [LOG] Block: sum2 += 1; " ) ; sum2 += 1 ; } } else { if ( i % 2 == 1 ) { System . out . println ( " [LOG] Block: sum2 += 1; " ) ; sum2 += 1 ; } } } System . out . println ( Math . min ( sum1 , sum2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int w = sc.nextInt(); \n int l = sc.nextInt(); \n int product = w * l; \n int around = 2 * (w + l); \n System.out.println(product + \" \" + around); " ) ; Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int product = w * l ; int around = 2 * ( w + l ) ; System . out . println ( product + " " + around ) ; } } +import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } Arrays . sort ( A ) ; long ans = 1 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ans == 0 ) break ; if ( A [ i ] > ( long ) Math . pow ( 10 , 18 ) / ans ) { System . out . println ( " [LOG] Block: ans = -1; \n break; " ) ; ans = - 1 ; break ; } ans *= A [ i ] ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String temp = String . valueOf ( n / 100 ) ; int tem = Integer . parseInt ( temp + temp + temp ) ; if ( n <= tem ) { System . out . println ( tem ) ; } else { System . out . println ( " [LOG] Block: System.out.println(tem + 111); " ) ; System . out . println ( tem + 111 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int empty = a - b ; if ( c - empty < 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(c - empty); " ) ; System . out . println ( c - empty ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == k - 1 ) { sb . appendCodePoint ( s . charAt ( i ) + 32 ) ; } else { System . out . println ( " [LOG] Block: sb.append(s.charAt(i)); " ) ; sb . append ( s . charAt ( i ) ) ; } } System . out . println ( sb . toString ( ) ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; System . out . println ( solve ( n , k ) ) ; in . close ( ) ; } private static double solve ( int n , int k ) { double r = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int p = i ; double x = 1 ; x /= n ; while ( p < k ) { System . out . println ( " [LOG] Block: p *= 2; \n x /= 2; " ) ; p *= 2 ; x /= 2 ; } r += x ; } return r ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] b = new int [ n ] ; 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 ) { System . out . println ( " [LOG] Block: count = count + 1; " ) ; count = count + 1 ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int elements = sc . nextInt ( ) ; int [ ] value = new int [ elements ] ; for ( int i = 0 ; i < elements ; i ++ ) { value [ i ] = sc . nextInt ( ) ; } solve ( value ) ; } public static void solve ( int [ ] value ) { double result = 0 ; for ( int an : value ) { System . out . println ( " [LOG] Block: result += (double) 1 / an; " ) ; result += ( double ) 1 / an ; } result = 1 / result ; System . out . println ( result ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String info = br . readLine ( ) ; Integer witdh = Integer . parseInt ( info . split ( " " ) [ 0 ] ) ; Integer height = Integer . parseInt ( info . split ( " " ) [ 1 ] ) ; Integer x = Integer . parseInt ( info . split ( " " ) [ 2 ] ) ; Integer y = Integer . parseInt ( info . split ( " " ) [ 3 ] ) ; Integer r = Integer . parseInt ( info . split ( " " ) [ 4 ] ) ; if ( witdh >= ( x + r ) && ( x - r ) >= 0 && height >= ( y + r ) && ( y - r ) >= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) break ; for ( int i = 1 ; i <= H ; i ++ ) { if ( i == 1 || i == H ) { for ( int j = 1 ; j <= W ; j ++ ) { System . out . print ( " # " ) ; } } else { for ( int j = 1 ; j <= W ; j ++ ) { System . out . println ( " [LOG] Block: if (j == 1 || j == W) \n System.out.print( \" # \" ); \n else \n System.out.print( \" . \" ); " ) ; if ( j == 1 || j == W ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . * ; public class Main { private static final Scanner sc = new Scanner ( System . in ) ; private void solve ( ) { int N = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; ++ i ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . io . FileNotFoundException ; import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int W = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; boolean flg = false ; BigDecimal S = BigDecimal . valueOf ( W ) ; S = S . multiply ( BigDecimal . valueOf ( H ) ) ; S = S . divide ( BigDecimal . valueOf ( 2 ) , 10 , RoundingMode . HALF_UP ) ; if ( 2 * x == W && 2 * y == H ) { flg = true ; } System . out . print ( S + " " ) ; if ( flg ) { System . out . println ( " 1 " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" 0 \" ); " ) ; System . out . println ( " 0 " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long a = 0 ; for ( int i = 0 ; i <= N ; 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 ) { System . out . println ( " [LOG] Block: a += i; " ) ; a += i ; } } System . out . println ( a ) ; } } +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 Main { static final Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static long [ ] a = new long [ N ] ; public static void main ( String [ ] args ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long x = 0 ; for ( int i = 0 ; i < N ; i ++ ) { x = a [ i ] ; for ( ; ; ) { if ( x % 2 == 0 ) { sum ++ ; x = x / 2 ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; boolean hasNextInt = scanner . hasNextInt ( ) ; 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 ( " [LOG] Block: System.out.println(sum); \n break; " ) ; System . out . println ( sum ) ; break ; } } scanner . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] price = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { price [ i ] = sc . nextInt ( ) ; } Arrays . sort ( price ) ; int money = 0 ; for ( int i = 0 ; i < K ; i ++ ) { System . out . println ( " [LOG] Block: money = money + price[i]; " ) ; money = money + price [ i ] ; } System . out . println ( String . valueOf ( money ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int answer = 0 ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: answer++; " ) ; answer ++ ; } } System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tap = sc . nextInt ( ) ; int over = sc . nextInt ( ) ; int outlet = 1 ; int ans = 0 ; while ( outlet < over ) { System . out . println ( " [LOG] Block: --outlet; \n outlet += tap; \n ans++; " ) ; -- outlet ; outlet += tap ; ans ++ ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; if ( B <= C || D <= A ) { } else if ( ( B > C ) && ( A < C ) ) { ans = B <= D ? B - C : D - C ; } else { System . out . println ( " [LOG] Block: ans = D <= B ? D - A : B - A; " ) ; ans = D <= B ? D - A : B - A ; } System . out . println ( ans ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { 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 ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } Map < Character , Integer > map = new HashMap < > ( ) ; for ( char c : w ) { if ( map . containsKey ( c ) ) { map . put ( c , map . get ( c ) + 1 ) ; } else { map . put ( c , 1 ) ; } } for ( Integer v : map . values ( ) ) { if ( v % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +class Main { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int L = sc . nextInt ( ) ; int output = 0 ; if ( - 1 <= L - 1 ) { output -= L ; } else if ( L - 1 <= - N ) { System . out . println ( " [LOG] Block: output -= L + N - 1; " ) ; output -= L + N - 1 ; } output += N * ( L - 1 ) + N * ( N + 1 ) / 2 ; System . out . println ( output ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] Alph = new int [ 26 ] ; for ( int j = 0 ; j < 26 ; j ++ ) { Alph [ j ] = 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 ( " [LOG] Block: System.out.println((char) ('a' + i) + \" : \" + Alph[i]); " ) ; System . out . println ( ( char ) ( 'a' + i ) + " : " + Alph [ i ] ) ; } } } +import java . util . Scanner ; public class Main { 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 N = sc . nextInt ( ) ; N > 0 ; N -- ) { 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 ( " [LOG] Block: System.out.println(s[i] + \" x \" + ans[i]); " ) ; System . out . println ( s [ i ] + " x " + ans [ i ] ) ; } } } +import java . io . * ; import java . util . * ; public class Main { 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 N = Integer . parseInt ( st . nextToken ( ) ) ; int K = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( input . readLine ( ) ) ; int [ ] arr = new int [ N ] ; int [ ] dp = new int [ N + 1 ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int k = 1 ; k < K + 1 ; k ++ ) { System . out . println ( " [LOG] Block: if (i + k < N) \n dp[i + k] = Math.min(dp[i + k], dp[i] + Math.abs(arr[i] - arr[i + k])); " ) ; if ( i + k < N ) dp [ i + k ] = Math . min ( dp [ i + k ] , dp [ i ] + Math . abs ( arr [ i ] - arr [ i + k ] ) ) ; } } output . println ( dp [ N - 1 ] ) ; output . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = sc . nextInt ( ) ; String [ ] s = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = N - 1 ; j > i ; j -- ) { if ( s [ j ] . compareTo ( s [ j - 1 ] ) < 0 ) { System . out . println ( " [LOG] Block: String exc = s[j]; \n s[j] = s[j - 1]; \n s[j - 1] = exc; " ) ; 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 Main { 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 flag = 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 ] ) { flag = false ; break ; } flag = true ; } if ( flag == true ) { System . out . println ( " [LOG] Block: msg = \" Yes \" ; \n break; " ) ; msg = " Yes " ; break ; } } System . out . println ( msg ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long t = ( long ) Math . sqrt ( n ) ; long a = 1 ; for ( long i = t ; 1 <= i ; i -- ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: a = n / i; \n break; " ) ; a = n / i ; break ; } } System . out . print ( ( n / a ) + a - 2 ) ; } } +import java . io . File ; import java . io . FileNotFoundException ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int K = s . nextInt ( ) ; Set set = new HashSet ( ) ; for ( int i = 1 ; i <= N ; 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 ) ) { System . out . println ( " [LOG] Block: set.remove(num); " ) ; set . remove ( num ) ; } } } System . out . println ( set . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int hp = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { hp -= sc . nextInt ( ) ; } if ( hp <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] arg ) { 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 t = a [ 0 ] ; long sum = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( t > a [ i ] ) sum = sum + ( t - a [ i ] ) ; else { System . out . println ( " [LOG] Block: t = a[i]; \n continue; " ) ; t = a [ i ] ; continue ; } } System . out . println ( sum ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int t = 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 ++ ) { System . out . println ( " [LOG] Block: if (a[i] >= x) \n cnt++; " ) ; if ( a [ i ] >= x ) cnt ++ ; } System . out . println ( cnt >= m ? " Yes " : " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int num = in . nextInt ( ) ; int [ ] value = new int [ num ] ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < num ; 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 < num ; i ++ ) { if ( a == value [ i ] ) { System . out . println ( b ) ; } else { System . out . println ( " [LOG] Block: System.out.println(a); " ) ; System . out . println ( a ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i ; String str ; while ( true ) { str = sc . next ( ) ; if ( str . equals ( " - " ) ) { break ; } String str1 ; String str2 ; int m ; m = sc . nextInt ( ) ; int h ; for ( i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: h = sc.nextInt(); \n str1 = str.substring(0, h); \n str2 = str.substring(h); \n str = str2 + str1; " ) ; h = sc . nextInt ( ) ; str1 = str . substring ( 0 , h ) ; str2 = str . substring ( h ) ; str = str2 + str1 ; } System . out . println ( str ) ; } sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = stdIn . nextInt ( ) ; } int max = 0 ; int max2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > max ) { max2 = max ; max = a [ i ] ; } else if ( a [ i ] > max2 ) { max2 = a [ i ] ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < max ) { System . out . println ( max ) ; } else { System . out . println ( " [LOG] Block: System.out.println(max2); " ) ; System . out . println ( max2 ) ; } } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int n = 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 ++ ) { System . out . println ( " [LOG] Block: str = in.readLine().split( \" \" ); \n l[i] = Integer.parseInt(str[0]); \n l_max = Math.max(l[i], l_max); \n r[i] = Integer.parseInt(str[1]); \n r_min = Math.min(r[i], r_min); " ) ; 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; long min = Long . MAX_VALUE ; for ( int i = 0 ; i <= 100000 ; i ++ ) { System . out . println ( " [LOG] Block: long amount = 0; \n amount = i * 2 * C + Math.max(0, X - i) * A + Math.max(0, Y - i) * B; \n min = Math.min(min, amount); " ) ; long amount = 0 ; amount = i * 2 * C + Math . max ( 0 , X - i ) * A + Math . max ( 0 , Y - i ) * B ; min = Math . min ( min , amount ) ; } System . out . println ( min ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n double probability = (double) (N - (N / 2)); \n System.out.print(probability / 1.0 / N); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double probability = ( double ) ( N - ( N / 2 ) ) ; System . out . print ( probability / 1.0 / N ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , i , t , min , s1 , s2 ; int [ ] w ; n = sc . nextInt ( ) ; w = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } min = 99999 ; for ( t = 1 ; t < n ; t ++ ) { s1 = 0 ; s2 = 0 ; for ( i = 0 ; i < t ; i ++ ) { s1 += w [ i ] ; } for ( ; i < n ; i ++ ) { s2 += w [ i ] ; } if ( s1 > s2 ) { if ( min > s1 - s2 ) { min = s1 - s2 ; } } else { if ( min > s2 - s1 ) { System . out . println ( " [LOG] Block: min = s2 - s1; " ) ; min = s2 - s1 ; } } } System . out . println ( min ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputDeckNum = sc . nextInt ( ) ; ArrayList < Integer > deckList = new ArrayList < > ( ) ; for ( int i = 1 ; i <= inputDeckNum ; 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 { System . out . println ( " [LOG] Block: second_player += deckList.get(i); " ) ; second_player += deckList . get ( i ) ; } } sc . close ( ) ; System . out . println ( first_player - second_player ) ; } } +import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { static int [ ] h ; static int [ ] dp ; public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int sz = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; h = new int [ sz ] ; dp = new int [ sz ] ; for ( int i = 0 ; i < sz ; i ++ ) h [ i ] = scan . nextInt ( ) ; dp [ 0 ] = 0 ; dp [ 1 ] = Math . abs ( h [ 1 ] - h [ 0 ] ) ; for ( int i = 2 ; i < sz ; i ++ ) { System . out . println ( " [LOG] Block: int min = Integer.MAX_VALUE; \n for (int j = 1; i - j >= 0 && j <= k; j++) min = Math.min(dp[i - j] + Math.abs(h[i] - h[i - j]), min); \n dp[i] = min; " ) ; 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 [ sz - 1 ] ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner tan = new Scanner ( System . in ) ; while ( tan . hasNext ( ) ) { int n , k , sum = 0 ; n = tan . nextInt ( ) ; k = tan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = tan . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: sum = sum + a[i]; " ) ; sum = sum + a [ i ] ; } System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int t = scanner.nextInt(); \n int ans = t + (int) Math.pow(t, 2) + (int) Math.pow(t, 3); \n System.out.println(ans); " ) ; Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; int ans = t + ( int ) Math . pow ( t , 2 ) + ( int ) Math . pow ( t , 3 ) ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n List<Integer> list = new ArrayList<>(); \n list.add(sc.nextInt()); \n list.add(sc.nextInt()); \n list.add(sc.nextInt()); \n Collections.sort(list); \n System.out.println(list.get(2) - list.get(0)); " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ w ] ; int swap1 , swap2 ; byte garbage ; for ( int i = 0 ; i < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(array[i]); " ) ; System . out . println ( array [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , x , ans ; while ( true ) { n = scan . nextInt ( ) ; x = scan . nextInt ( ) ; ans = 0 ; if ( n == 0 && x == 0 ) break ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { for ( int k = j + 1 ; k <= n ; k ++ ) { if ( i + j + k == x ) { ans ++ ; break ; } if ( x < i + j + k ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } if ( x <= i + j ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } if ( x <= i ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( ans ) ; } scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String word = sc . next ( ) ; String mae = " " ; String usiro = " " ; while ( ! word . equals ( " - " ) ) { int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int a = sc.nextInt(); \n usiro = word.substring(a); \n mae = word.substring(0, a); \n word = usiro + mae; " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String t ; String h ; int t_point = 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 ) { t_point += 3 ; } else if ( t . compareTo ( h ) < 0 ) { h_point += 3 ; } else { System . out . println ( " [LOG] Block: t_point += 1; \n h_point += 1; " ) ; t_point += 1 ; h_point += 1 ; } } System . out . println ( t_point + " " + h_point ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String inputId = sc . nextLine ( ) ; String inputAddId = sc . nextLine ( ) ; int flag = 0 ; for ( int i = 0 ; i < inputId . length ( ) ; i ++ ) { if ( inputId . charAt ( i ) != inputAddId . charAt ( i ) ) { flag ++ ; } } if ( flag == 0 && ( inputAddId . length ( ) - inputId . length ( ) == 1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; double area = 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 { System . out . println ( " [LOG] Block: var = 0; " ) ; var = 0 ; } sta = Math . sqrt ( var ) ; System . out . println ( sta ) ; } scanner . close ( ) ; } } +import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int sub = 0 ; int count = 0 ; for ( int i = 0 ; i <= K ; i ++ ) { if ( i != S ) { for ( int j = 0 ; j <= K ; j ++ ) { if ( i + j != S ) { sub = S - ( i + j ) ; if ( sub >= 0 && sub <= K ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } else if ( i + j == S ) { count ++ ; break ; } } } else if ( i == S ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; char Si = S . charAt ( 0 ) ; int count = 1 ; for ( int i = 1 ; i < N ; i ++ ) { if ( S . charAt ( i ) == Si ) ; else { System . out . println ( " [LOG] Block: count++; \n Si = S.charAt(i); " ) ; count ++ ; Si = S . charAt ( i ) ; } } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: a[i] = sc.nextInt(); \n sum += a[i]; " ) ; a [ i ] = sc . nextInt ( ) ; sum += a [ i ] ; } Arrays . parallelSort ( a ) ; sum -= a [ n - 1 ] ; if ( sum > a [ n - 1 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] nums = new long [ N ] ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { ans *= nums [ i ] ; if ( 1000000000000000000L < ans || ans <= 0 ) { System . out . println ( - 1 ) ; over = true ; break ; } } if ( ! over ) { System . out . println ( " [LOG] Block: System.out.println(ans); " ) ; System . out . println ( ans ) ; } } } } +import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int result = 0 ; for ( int i = a ; 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 ) ) { System . out . println ( " [LOG] Block: chk = false; \n break; " ) ; chk = false ; break ; } } if ( chk ) result ++ ; } System . out . println ( result ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n String[] arr = reader.readLine().split( \" \" ); \n int X, Y; \n X = Integer.parseInt(arr[0]); \n Y = Integer.parseInt(arr[1]); \n int C, T; \n C = 2 * X - Y / 2; \n T = -X + Y / 2; \n System.out.println(0 <= C && 0 <= T && 2 * C + 4 * T == Y && C + T == X ? \" Yes \" : \" No \" ); \n return; " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = reader . readLine ( ) . split ( " " ) ; int X , Y ; X = Integer . parseInt ( arr [ 0 ] ) ; Y = Integer . parseInt ( arr [ 1 ] ) ; int C , T ; C = 2 * X - Y / 2 ; T = - X + Y / 2 ; System . out . println ( 0 <= C && 0 <= T && 2 * C + 4 * T == Y && C + T == X ? " Yes " : " No " ) ; return ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int result = 0 ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = scanner . nextInt ( ) ; if ( a >= max ) { System . out . println ( " [LOG] Block: max = a; \n result++; " ) ; max = a ; result ++ ; } } System . out . println ( result ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int output = 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 ++ ) { System . out . println ( " [LOG] Block: output += input[i + 1] - input[i]; " ) ; output += input [ i + 1 ] - input [ i ] ; } System . out . println ( output ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < q ; i ++ ) p [ sc . nextInt ( ) - 1 ] ++ ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: if (k - q + p[i] > 0) \n System.out.println( \" Yes \" ); \n else \n System.out.println( \" No \" ); " ) ; if ( k - q + p [ i ] > 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { 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 a1 = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int a2 = Integer . parseInt ( s . substring ( 2 , 4 ) ) ; boolean m1 = false ; if ( 1 <= a1 && a1 <= 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 { System . out . println ( " [LOG] Block: ans = \" NA \" ; " ) ; ans = " NA " ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int kind = sc . nextInt ( ) ; int [ ] di = new int [ kind ] ; int [ ] count = new int [ n ] ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( count [ i ] == 0 ) { System . out . println ( " [LOG] Block: trickCount++; " ) ; trickCount ++ ; } } System . out . println ( trickCount ) ; } } +import java . util . Scanner ; public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int a , b , seki , syu ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; seki = a * b ; syu = ( a * 2 ) + ( b * 2 ) ; System . out . println ( seki + " " + syu ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Main obj = new Main(); \n obj.solve(); " ) ; Main obj = new Main ( ) ; obj . solve ( ) ; } } +import java . util . Scanner ; class Solver { private final int K ; Solver ( Scanner in ) { int N = in . nextInt ( ) ; K = in . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( in . nextInt ( ) >= K ) count ++ ; } System . out . println ( count ) ; } void solve ( ) { } } class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n new Solver(in).solve(); \n in.close(); " ) ; Scanner in = new Scanner ( System . in ) ; new Solver ( in ) . solve ( ) ; in . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long N = sc . nextLong ( ) ; int sq = ( int ) Math . floor ( Math . sqrt ( ( double ) N ) ) ; for ( int i = sq ; i > 0 ; i -- ) { if ( N % i == 0 ) { if ( i > ( N / i ) ) { System . out . println ( String . valueOf ( i ) . length ( ) ) ; return ; } else { System . out . println ( " [LOG] Block: Long ans = (long) (N / i); \n System.out.println(String.valueOf(ans).length()); \n return; " ) ; Long ans = ( long ) ( N / i ) ; System . out . println ( String . valueOf ( ans ) . length ( ) ) ; return ; } } } System . out . println ( String . valueOf ( N ) . length ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( final Scanner sc = new Scanner ( System . in ) ) { Resolver resolver = new Resolver ( sc ) ; resolver . resolve ( ) ; } } private static class Resolver { private final int a , b , t ; private Resolver ( final Scanner sc ) { this . a = sc . nextInt ( ) ; this . b = sc . nextInt ( ) ; this . t = sc . nextInt ( ) ; } private void resolve ( ) { System . out . println ( " [LOG] Block: int k = t / a; \n System.out.println(b * k); " ) ; int k = t / a ; System . out . println ( b * k ) ; } } } +import java . io . * ; import java . util . * ; public class Main { private static int [ ] heights ; private static int n , ans = Integer . MAX_VALUE , k ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; heights = new int [ n + 3 ] ; dp = new int [ n + 3 ] ; for ( int i = 1 ; i <= n ; 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 == n ) return 0 ; if ( dp [ ind ] != - 1 ) { return dp [ ind ] ; } int min = Integer . MAX_VALUE ; for ( int i = ind + 1 ; i <= Math . min ( n , ind + k ) ; i ++ ) { System . out . println ( " [LOG] Block: min = Math.min(min, Math.abs(heights[i] - heights[ind]) + findJumpCost(i)); " ) ; min = Math . min ( min , Math . abs ( heights [ i ] - heights [ ind ] ) + findJumpCost ( i ) ) ; } return dp [ ind ] = min ; } } +import java . util . * ; public class Main { long INF = Long . MAX_VALUE ; long [ ] [ ] dp ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n System.out.println(N * A < B ? N * A : B); " ) ; 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int n = Integer . parseInt ( a + b ) ; boolean bl = false ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( i * i == n ) { System . out . println ( " [LOG] Block: bl = true; \n break; " ) ; bl = true ; break ; } } System . out . println ( bl == true ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; for ( String n : line ) { if ( n . equals ( " 5 " ) ) { count5 ++ ; } if ( n . equals ( " 7 " ) ) { count7 ++ ; } } if ( count5 == 2 && count7 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int kosuu = sc . nextInt ( ) ; int [ ] arrayOishi = new int [ kosuu ] ; for ( int i = 0 ; i < arrayOishi . length ; i ++ ) { arrayOishi [ i ] = sc . nextInt ( ) ; } int result = 0 ; for ( int j = 0 ; j < kosuu ; j ++ ) { for ( int k = j + 1 ; k < kosuu ; k ++ ) { System . out . println ( " [LOG] Block: result += arrayOishi[j] * arrayOishi[k]; " ) ; result += arrayOishi [ j ] * arrayOishi [ k ] ; } } System . out . println ( result ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; String S = scan . next ( ) ; int S_length = S . length ( ) ; if ( K < S_length ) { for ( int i = 0 ; i < K ; i ++ ) { System . out . print ( S . charAt ( i ) ) ; } System . out . print ( " ... " ) ; } else { System . out . println ( " [LOG] Block: System.out.print(S); " ) ; System . out . print ( S ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String input = s . nextLine ( ) ; if ( input . charAt ( 0 ) == input . charAt ( 1 ) && input . charAt ( 0 ) == input . charAt ( 2 ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } s . close ( ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int s = Integer . parseInt ( sc . next ( ) ) ; List < Integer > a = new ArrayList < > ( ) ; a . add ( s ) ; 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 ) ) { System . out . println ( " [LOG] Block: ans = i + 2; \n break; " ) ; ans = i + 2 ; break ; } a . add ( ai ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: buf.append(s.charAt(i)); " ) ; buf . append ( s . charAt ( i ) ) ; } } String new_s = buf . toString ( ) ; System . out . println ( new_s ) ; } } +import java . util . * ; public class Main { 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 min = Integer . MAX_VALUE ; for ( int i = 0 ; i <= s . length ( ) - t . length ( ) ; i ++ ) { if ( min > helper ( s . substring ( i , i + t . length ( ) ) , t ) ) { min = helper ( s . substring ( i , i + t . length ( ) ) , t ) ; } } System . out . println ( min ) ; } } 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } return count ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] v = new int [ N ] ; int [ ] c = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { v [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < N ; i ++ ) { c [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( c [ i ] < v [ i ] ) { System . out . println ( " [LOG] Block: count += v[i] - c[i]; " ) ; count += v [ i ] - c [ i ] ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { sC ( ) ; } void sC ( ) { String s = sc . next ( ) ; int zero = 0 , one = 0 ; char [ ] c = s . toCharArray ( ) ; for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ i ] == '0' ) zero ++ ; else one ++ ; } if ( one > zero ) { System . out . println ( zero * 2 ) ; } else System . out . println ( one * 2 ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().doIt(); " ) ; new Main ( ) . doIt ( ) ; } } +import java . util . * ; public class Main { 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 count = 0 ; for ( int i = 0 ; i < s_arr . length ; i ++ ) { if ( s_arr [ i ] . equals ( t_arr [ i ] ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; sc . close ( ) ; int tk = ( c + b - 1 ) / b ; int ao = ( d + a - 1 ) / d ; if ( tk <= ao ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; import java . util . ArrayDeque ; import java . util . Queue ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Queue < Integer > queue = new ArrayDeque < > ( ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String [ ] name = new String [ n ] ; int [ ] time = new int [ n ] ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: x += q; \n time[y] -= q; \n queue.add(y); " ) ; x += q ; time [ y ] -= q ; queue . add ( y ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double l = sc.nextDouble(); \n double ans = l / 3; \n System.out.printf( \" %.12f \n \" , ans * ans * ans); " ) ; Scanner sc = new Scanner ( System . in ) ; double l = sc . nextDouble ( ) ; double ans = l / 3 ; System . out . printf ( " %.12f \n " , ans * ans * ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int n = N / X ; if ( N % X > 0 ) { System . out . println ( " [LOG] Block: n++; " ) ; n ++ ; } int result = n * T ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] townmonster = new long [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { townmonster [ i ] = sc . nextLong ( ) ; } long [ ] yusha = new long [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { yusha [ i ] = sc . nextLong ( ) ; } yusha [ n ] = 0 ; long count = 0 ; long yojou = 0 ; for ( int i = 0 ; i < n + 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 { System . out . println ( " [LOG] Block: yojou = yusha_yoryoku; " ) ; yojou = yusha_yoryoku ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Map ; import java . util . HashMap ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( scanner . next ( ) ) ; } scanner . close ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; for ( String val : list ) { System . out . println ( " [LOG] Block: map.put(val, 0); " ) ; map . put ( val , 0 ) ; } System . out . println ( map . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count = 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 ++ ) { System . out . println ( " [LOG] Block: x = Integer.parseInt(sc.next()); \n y = Integer.parseInt(sc.next()); \n if (d >= Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))) \n count++; " ) ; x = Integer . parseInt ( sc . next ( ) ) ; y = Integer . parseInt ( sc . next ( ) ) ; if ( d >= Math . sqrt ( Math . pow ( x , 2 ) + Math . pow ( y , 2 ) ) ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: A[i] = Integer.parseInt(sc.next()); " ) ; A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( A ) ; System . out . println ( Math . abs ( A [ 0 ] - A [ N - 1 ] ) ) ; } } +import java . util . * ; import java . io . * ; class Main { int A , 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 ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; S = sc . next ( ) ; cS = S . toCharArray ( ) ; len = cS . length ; } public void solve ( ) { if ( len == A + B + 1 ) { if ( cS [ A ] == '-' ) { for ( int i = 0 ; i < A ; i ++ ) { if ( cS [ i ] >= '0' && cS [ i ] <= '9' ) { flg = true ; } else { flg = false ; break ; } } if ( flg == true ) { for ( int i = A + 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } sc . close ( ) ; long result = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( A [ i - 1 ] <= A [ i ] ) { } else { System . out . println ( " [LOG] Block: result = result + (A[i - 1] - A[i]); \n A[i] = A[i - 1]; " ) ; result = result + ( A [ i - 1 ] - A [ i ] ) ; A [ i ] = A [ i - 1 ] ; } } System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { sb . append ( '0' ) ; } else { sb . append ( '1' ) ; } } String zero = sb . toString ( ) ; sb = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 1 ) { sb . append ( '0' ) ; } else { sb . append ( '1' ) ; } } String one = sb . toString ( ) ; int z = 0 ; int o = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == zero . charAt ( i ) ) { z ++ ; } else { System . out . println ( " [LOG] Block: o++; " ) ; o ++ ; } } System . out . println ( Math . min ( z , o ) ) ; } } +import java . util . Scanner ; import static java . lang . Math . ceil ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner input = new Scanner(System.in); \n int a = input.nextInt(); \n int b = input.nextInt(); \n System.out.println((int) ceil((1.0 * a) / (1.0 * b))); " ) ; Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; System . out . println ( ( int ) ceil ( ( 1.0 * a ) / ( 1.0 * b ) ) ) ; } } +import java . io . IOException ; import java . io . InputStreamReader ; import java . io . BufferedReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int w = Integer . parseInt ( br . readLine ( ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] array = new int [ w ] ; for ( int i = 0 ; i < w ; 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 ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } +import java . util . * ; public class Main { 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 num_times = sArray . length - tArray . length + 1 ; String part = new String ( ) ; int count = 9999 ; for ( int i = 0 ; i < num_times ; 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 ] ) ) { System . out . println ( " [LOG] Block: currentCount++; " ) ; currentCount ++ ; } } count = currentCount < count ? currentCount : count ; } System . out . println ( count ) ; sc . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long min = l * ( l + 1 ) % 2019 ; if ( ( r - l ) >= 2018 ) { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } else if ( ( r - l ) < ( 2019 - l % 2019 ) ) { for ( long e = l ; 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 ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ! ( ( str = br . readLine ( ) ) . equals ( " - " ) ) ) { int M = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arrH = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { arrH [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } shuff ( str , arrH , M ) ; } } 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 ++ ) { System . out . println ( " [LOG] Block: sb.append(sb.substring(0, h[i])); \n sb.delete(0, h[i]); " ) ; sb . append ( sb . substring ( 0 , h [ i ] ) ) ; sb . delete ( 0 , h [ i ] ) ; } System . out . println ( sb . toString ( ) ) ; } } +import java . util . * ; public class Main { Scanner sc ; int a , 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 { a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int k = ( a + b ) / 2 ; if ( k * 2 != a + b ) out ( " IMPOSSIBLE " ) ; else out ( k ) ; } public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Main m = new Main(); \n m.exec(); " ) ; Main m = new Main ( ) ; m . exec ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } double ansDiff = 1000000 ; int ansNum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double diff = Math . abs ( t - h [ i ] * 0.006 - a ) ; if ( diff < ansDiff ) { System . out . println ( " [LOG] Block: ansDiff = diff; \n ansNum = i + 1; " ) ; ansDiff = diff ; ansNum = i + 1 ; } } System . out . println ( ansNum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = 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 [ n ] ; for ( i = 0 ; i < n ; i ++ ) { count = 0 ; for ( j = 0 ; j < 2 * m ; j ++ ) { if ( ary1 [ j ] == i + 1 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } ary [ i ] = count ; System . out . println ( ary [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; char [ ] ss = S . toCharArray ( ) ; if ( ss [ 0 ] + 0 >= 65 && ss [ 0 ] + 0 <= 90 ) { System . out . println ( " A " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans = getKth ( getGcd ( a , b ) , k ) ; System . out . println ( ans ) ; } static int getGcd ( int a , int b ) { if ( a == 0 ) { return b ; } return getGcd ( b % a , a ) ; } static int getKth ( int n , int k ) { ArrayList < Integer > divisors = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n / 2 ; i ++ ) { if ( n % i == 0 ) { System . out . println ( " [LOG] Block: divisors.add(i); " ) ; divisors . add ( i ) ; } } divisors . add ( n ) ; return ( divisors . get ( divisors . size ( ) - k ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < 5 ; i ++ ) { System . out . println ( " [LOG] Block: int n = sc.nextInt(); \n min = Math.min(min, n); \n max = Math.max(max, n); " ) ; int n = sc . nextInt ( ) ; min = Math . min ( min , n ) ; max = Math . max ( max , n ) ; } int k = sc . nextInt ( ) ; if ( max - min > k ) System . out . println ( " :( " ) ; else System . out . println ( " Yay! " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] X = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { X [ i ] = sc . nextInt ( ) ; } boolean flag = true ; for ( int i = N - 2 ; i >= 0 ; i -- ) { if ( X [ i ] > X [ i + 1 ] ) { if ( X [ i ] - X [ i + 1 ] == 1 ) X [ i ] -- ; else { System . out . println ( " [LOG] Block: flag = false; \n break; " ) ; flag = false ; break ; } } } System . out . println ( ( flag ) ? " Yes " : " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int l = 1 ; int r = 1_000_000_007 ; for ( int i = X ; 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 ) { System . out . println ( " [LOG] Block: isPrime = false; \n break; " ) ; isPrime = false ; break ; } } return isPrime ; } } +import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; double xDouble = Double . valueOf ( x ) ; int ans = 0 ; double tot = 100 ; while ( tot < xDouble ) { System . out . println ( " [LOG] Block: tot = Math.floor(tot * 1.01); \n ans++; " ) ; tot = Math . floor ( tot * 1.01 ) ; ans ++ ; } System . out . println ( ans ) ; } } +import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] w = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } int ans = 100000000 ; for ( int i = 0 ; i < N ; i ++ ) { int sum1 = 0 ; int sum2 = 0 ; for ( int j = 0 ; j < i ; j ++ ) { sum1 += w [ j ] ; } for ( int k = i ; k < N ; k ++ ) { System . out . println ( " [LOG] Block: sum2 += w[k]; " ) ; sum2 += w [ k ] ; } ans = Math . min ( ans , ( int ) Math . abs ( sum1 - sum2 ) ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; if ( N != 1 && M != 1 ) { System . out . print ( 1 ) ; } else if ( N != 2 && M != 2 ) { System . out . print ( 2 ) ; } else if ( N != 3 && M != 3 ) { System . out . println ( " [LOG] Block: System.out.print(3); " ) ; System . out . print ( 3 ) ; } return ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { System . out . println ( " [LOG] Block: int in = Integer.parseInt(br.readLine()); \n System.out.println(in * 2 * Math.PI); " ) ; int in = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( in * 2 * Math . PI ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] ag ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int st = 0 ; int gl = a . length ( ) - 1 ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) == 'A' ) { st = i + 1 ; break ; } } for ( int i = a . length ( ) - 1 ; i >= 0 ; i -- ) { if ( a . charAt ( i ) == 'Z' ) { System . out . println ( " [LOG] Block: gl = i + 1; \n break; " ) ; gl = i + 1 ; break ; } } System . out . println ( gl - st + 1 ) ; } } +import java . util . * ; import java . io . * ; public class Main { 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 n = Integer . parseInt ( input [ 0 ] ) ; int a = Integer . parseInt ( input [ 1 ] ) ; int b = Integer . parseInt ( input [ 2 ] ) ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int num = i ; int total = 0 ; while ( num > 0 ) { total += num % 10 ; num /= 10 ; } if ( a <= total && total <= b ) { System . out . println ( " [LOG] Block: ans += i; " ) ; ans += i ; } } out . println ( ans ) ; out . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] values = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { values [ i ] = sc . nextInt ( ) ; } int count = 0 ; hoge : while ( true ) { for ( int i = 0 ; i < N ; i ++ ) { if ( values [ i ] % 2 != 0 ) { System . out . println ( " [LOG] Block: break hoge; " ) ; break hoge ; } values [ i ] = values [ i ] / 2 ; } count ++ ; } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) ; } Arrays . sort ( s ) ; String ans = " " ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: ans += s[i]; " ) ; ans += s [ i ] ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner read = new Scanner ( System . in ) ; int n = read . nextInt ( ) ; int [ ] d = new int [ n ] ; d [ 0 ] = read . nextInt ( ) - 1 ; boolean ban = true ; for ( int i = 1 ; i < n ; i ++ ) { d [ i ] = read . nextInt ( ) ; if ( d [ i - 1 ] > d [ i ] ) { System . out . println ( " [LOG] Block: ban = false; \n break; " ) ; ban = false ; break ; } if ( d [ i - 1 ] < d [ i ] ) -- d [ i ] ; } if ( ban ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int ans = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int hako = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == b ) { ans ++ ; if ( ans == 3 ) { hako = 1 ; } } else { ans = 0 ; } } if ( hako == 1 ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" No \" ); " ) ; System . out . print ( " No " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String input = br . readLine ( ) ; int num = Integer . parseInt ( input ) ; int i , x ; String ret = " " ; for ( i = 2 ; i <= num ; i ++ ) { x = i ; if ( x % 3 == 0 ) { ret = ret + " " + i ; } else { System . out . println ( " [LOG] Block: ret = INCLUDE3(ret, i, x); " ) ; 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 ) { System . out . println ( " [LOG] Block: ret = INCLUDE3(ret, i, x); " ) ; ret = INCLUDE3 ( ret , i , x ) ; } } return ret ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] array = sc . nextLine ( ) . split ( " " ) ; int sum = 0 ; for ( String s : array ) { if ( Integer . parseInt ( s ) == 1 ) { System . out . println ( " [LOG] Block: sum++; " ) ; sum ++ ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 < n ; 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 ) { System . out . println ( " [LOG] Block: min = 1; " ) ; min = 1 ; } System . out . println ( min + " " + max ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int answer = ( int ) ( Math . ceil ( n / 1000.0 ) ) ; out . println ( answer * 1000 - n ) ; out . flush ( ) ; out . close ( ) ; } static class pair { long x1 ; long x2 ; public pair ( long x1 , long x2 ) { System . out . println ( " [LOG] Block: this.x1 = x1; \n this.x2 = x2; " ) ; this . x1 = x1 ; this . x2 = x2 ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String C = sc.next(); \n char charC = C.charAt(0); \n System.out.println(++charC); " ) ; Scanner sc = new Scanner ( System . in ) ; String C = sc . next ( ) ; char charC = C . charAt ( 0 ) ; System . out . println ( ++ charC ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = Integer.parseInt(sc.next()); \n System.out.println(6 - a - b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( 6 - a - b ) ; } } +import java . io . * ; public class Main { 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 a = Integer . parseInt ( x [ 0 ] ) ; int b = Integer . parseInt ( x [ 1 ] ) ; int c = Integer . parseInt ( x [ 2 ] ) ; if ( b > a && c > b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int sum = 1 ; for ( int i = 0 ; i < D ; i ++ ) { sum = sum * 100 ; } if ( N == 100 ) { System . out . println ( " [LOG] Block: System.out.println(101 * sum); \n return; " ) ; System . out . println ( 101 * sum ) ; return ; } System . out . println ( N * sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long K = sc . nextLong ( ) ; int x = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { x ++ ; if ( S . charAt ( i ) == '1' && x < K ) { continue ; } else { System . out . println ( " [LOG] Block: System.out.println(S.charAt(i)); \n break; " ) ; System . out . println ( S . charAt ( i ) ) ; break ; } } } } +import java . io . * ; import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String[] s = br.readLine().split( \" \" ); \n String S = s[0]; \n String T = s[1]; \n s = br.readLine().split( \" \" ); \n int A = Integer.parseInt(s[0]); \n int B = Integer.parseInt(s[1]); \n String U = br.readLine(); \n if (U.equals(S)) \n out.println((A - 1) + \" \" + B); \n else \n out.println(A + \" \" + (B - 1)); " ) ; 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 A = Integer . parseInt ( s [ 0 ] ) ; int B = Integer . parseInt ( s [ 1 ] ) ; String U = br . readLine ( ) ; if ( U . equals ( S ) ) out . println ( ( A - 1 ) + " " + B ) ; else out . println ( A + " " + ( B - 1 ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { String temp = s . substring ( i , i + 1 ) ; if ( temp . equals ( " 0 " ) ) { ans += " 0 " ; } else if ( temp . equals ( " 1 " ) ) { ans += " 1 " ; } else { if ( ans . length ( ) > 0 ) { System . out . println ( " [LOG] Block: ans = ans.substring(0, ans.length() - 1); " ) ; ans = ans . substring ( 0 , ans . length ( ) - 1 ) ; } } } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; List < Integer > cList = new ArrayList < > ( ) ; List < Integer > tList = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { cList . add ( sc . nextInt ( ) ) ; tList . add ( sc . nextInt ( ) ) ; } Integer minCost = null ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" TLE \" ); \n return; " ) ; System . out . println ( " TLE " ) ; return ; } System . out . println ( minCost ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n int a = Integer.parseInt(br.readLine()); \n int sum = (int) (a + Math.pow((double) a, 2.0) + Math.pow((double) a, 3.0)); \n System.out.println(sum); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int sum = ( int ) ( a + Math . pow ( ( double ) a , 2.0 ) + Math . pow ( ( double ) a , 3.0 ) ) ; System . out . println ( sum ) ; } } +import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] a = new int [ 2 ] [ n + 1 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { a [ i ] [ j ] = a [ i ] [ j - 1 ] + sc . nextInt ( ) ; } } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { System . out . println ( " [LOG] Block: ans = max(ans, a[0][i] + (a[1][n] - a[1][i - 1])); " ) ; ans = max ( ans , a [ 0 ] [ i ] + ( a [ 1 ] [ n ] - a [ 1 ] [ i - 1 ] ) ) ; } } out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= N ; j ++ ) { for ( int k = 1 ; k <= N ; 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 ) { System . out . println ( " [LOG] Block: temp = x; \n x = y % x; \n y = temp; " ) ; temp = x ; x = y % x ; y = temp ; } return y ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; final int MOD = 1000000007 ; final int MAX = Integer . MAX_VALUE ; final long LMAX = Long . MAX_VALUE ; int LEN = 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 ) { System . out . println ( " [LOG] Block: new Main().doIt(); " ) ; new Main ( ) . doIt ( ) ; } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; arr . add ( a ) ; } for ( int i = 1 ; i < ( n - 1 ) ; i ++ ) { if ( arr . get ( i ) > arr . get ( i - 1 ) && ( arr . get ( i ) < arr . get ( i + 1 ) ) ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } else if ( arr . get ( i ) < arr . get ( i - 1 ) && ( arr . get ( i ) > arr . get ( i + 1 ) ) ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: char[] arr = str.toCharArray(); \n Arrays.sort(arr); \n return new String(arr); " ) ; char [ ] arr = str . toCharArray ( ) ; Arrays . sort ( arr ) ; return new String ( arr ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int intW = scan . nextInt ( ) ; int intH = scan . nextInt ( ) ; int intX = scan . nextInt ( ) ; int intY = scan . nextInt ( ) ; int intR = scan . nextInt ( ) ; if ( intX <= intW - intR && intR <= intX && intY <= intH - intR && intR <= intY ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . io . * ; import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; long A = 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 > A && flag == true ) { K -= A ; sum += A ; } else if ( K <= A && 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 ) { System . out . println ( " [LOG] Block: sum -= K; \n K = 0; \n flag = false; " ) ; sum -= K ; K = 0 ; flag = false ; } out . println ( sum ) ; } } +import java . util . * ; public class Main { 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 n = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; if ( ( n == 0 ) && ( x == 0 ) ) { break ; } listN . add ( n ) ; listX . add ( x ) ; } for ( int i = 0 ; i < listN . size ( ) ; i ++ ) { int n = listN . get ( i ) ; int x = listX . get ( i ) ; int cnt = 0 ; for ( int a = 1 ; a <= n ; a ++ ) { for ( int b = a + 1 ; b <= n ; b ++ ) { for ( int c = b + 1 ; c <= n ; c ++ ) { int sum = a + b + c ; if ( sum == x ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } } } System . out . println ( cnt ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long a1 , b1 , r1 , r2 , temp , a2 , b2 ; while ( scan . hasNext ( ) ) { a1 = scan . nextInt ( ) ; a2 = a1 ; b1 = scan . nextInt ( ) ; b2 = b1 ; while ( a2 % b2 != 0 ) { if ( a2 < b2 ) { System . out . println ( " [LOG] Block: temp = a2; \n a2 = b2; \n b2 = temp; " ) ; temp = a2 ; a2 = b2 ; b2 = temp ; } a2 = a2 % b2 ; } r1 = b2 ; r2 = ( a1 * b1 ) / r1 ; System . out . println ( r1 + " " + r2 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; String s = sc . nextLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '+' ) { ans ++ ; } else if ( s . charAt ( i ) == '-' ) { System . out . println ( " [LOG] Block: ans--; " ) ; ans -- ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long k = sc.nextLong(); \n if (n % k < k - (n % k)) \n k = n % k; \n else \n k = k - (n % k); \n System.out.println(k); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( n % k < k - ( n % k ) ) k = n % k ; else k = k - ( n % k ) ; System . out . println ( k ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n long b = a * a * a; \n System.out.println((double) b / 27); " ) ; Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; long b = a * a * a ; System . out . println ( ( double ) b / 27 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final long A = 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 ) - ( ( A - 1 ) - ( A - 1 ) / C - ( A - 1 ) / D + ( A - 1 ) / L ) ) ; } private static long lcm ( long a , long b ) { return a * b / gcd ( a , b ) ; } private static long gcd ( long a , long b ) { System . out . println ( " [LOG] Block: if (b == 0) \n return a; \n return gcd(b, a % b); " ) ; if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean [ ] isZorome = new boolean [ n ] ; for ( int i = 0 ; i < n ; 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 < n - 2 ; i ++ ) { boolean sanren = isZorome [ i ] && isZorome [ i + 1 ] && isZorome [ i + 2 ] ; if ( sanren ) { System . out . println ( " [LOG] Block: ans = \" Yes \" ; " ) ; ans = " Yes " ; } } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] v = new int [ n ] ; for ( int c = 0 ; c < n ; c ++ ) { v [ c ] = sc . nextInt ( ) ; } Arrays . sort ( v ) ; double ans = ( double ) v [ 0 ] ; for ( int d = 1 ; d < n ; d ++ ) { System . out . println ( " [LOG] Block: ans = (ans + v[d]) / 2; " ) ; ans = ( ans + v [ d ] ) / 2 ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int steps1 = 0 ; int steps2 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { if ( s . charAt ( i ) != '1' ) steps1 ++ ; else steps2 ++ ; } else { System . out . println ( " [LOG] Block: if (s.charAt(i) != '1') \n steps2++; \n else \n steps1++; " ) ; if ( s . charAt ( i ) != '1' ) steps2 ++ ; else steps1 ++ ; } } System . out . println ( Math . min ( steps1 , steps2 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < N - 2 ; i ++ ) { if ( S . substring ( i , i + 3 ) . equals ( " ABC " ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int count = 0 ; for ( int i = A ; 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 ] ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( p [ i ] != i + 1 ) { count ++ ; } } if ( count == 0 || count == 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int x_500 = n / 500; \n n = n - n / 500 * 500; \n int x_5 = n / 5; \n int ans = x_500 * 1000 + x_5 * 5; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x_500 = n / 500 ; n = n - n / 500 * 500 ; int x_5 = n / 5 ; int ans = x_500 * 1000 + x_5 * 5 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = null ; try { sc = new Scanner ( System . in ) ; int leng = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] numBox = new int [ leng ] ; 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 ) { System . out . println ( " [LOG] Block: sc.close(); " ) ; sc . close ( ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int n , a , b , digitsSum = 0 , totalSum = 0 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { int tmp = i ; for ( int j = 0 ; j < 5 ; j ++ ) { System . out . println ( " [LOG] Block: digitsSum += tmp % 10; \n tmp /= 10; " ) ; digitsSum += tmp % 10 ; tmp /= 10 ; } if ( a <= digitsSum && digitsSum <= b ) totalSum += i ; digitsSum = 0 ; } System . out . println ( totalSum ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n int N; \n int result; \n String readLine = br.readLine(); \n N = Integer.parseInt(readLine); \n result = N * N * N; \n System.out.println(result); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N ; int result ; String readLine = br . readLine ( ) ; N = Integer . parseInt ( readLine ) ; result = N * N * N ; System . out . println ( result ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int number = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; long total = 0 ; for ( int i = 0 ; i < number ; 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 ++ ) { System . out . println ( " [LOG] Block: total += list.get(i); " ) ; total += list . get ( i ) ; } System . out . println ( total ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String tiles = input . readLine ( ) ; System . out . println ( Math . min ( getCount ( tiles , '0' ) , getCount ( tiles , '1' ) ) ) ; } public static int getCount ( String tiles , char tile ) { int count = 0 ; for ( int i = 0 ; i < tiles . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: if (tile != tiles.charAt(i)) \n count++; \n tile = tile == '0' ? '1' : '0'; " ) ; if ( tile != tiles . charAt ( i ) ) count ++ ; tile = tile == '0' ? '1' : '0' ; } return count ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Multiplication3 solver = new Multiplication3 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Multiplication3 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: String[] inputs = in.nextLine().split( \" \" ); \n long a = Long.parseLong(inputs[0]); \n long b = Long.parseLong(inputs[1].replaceAll( \" \\ . \" , \" \" )); \n out.append(String.valueOf(a * b / 100)); " ) ; String [ ] inputs = in . nextLine ( ) . split ( " " ) ; long a = Long . parseLong ( inputs [ 0 ] ) ; long b = Long . parseLong ( inputs [ 1 ] . replaceAll ( " \\ . " , " " ) ) ; out . append ( String . valueOf ( a * b / 100 ) ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double [ ] v = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { v [ i ] = sc . nextDouble ( ) ; } sc . close ( ) ; Arrays . sort ( v ) ; double s = ( v [ 0 ] + v [ 1 ] ) / 2 ; if ( n >= 3 ) { for ( int i = 2 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: s = (s + v[i]) / 2; " ) ; s = ( s + v [ i ] ) / 2 ; } } System . out . println ( s ) ; } } +import java . util . * ; import java . util . Map . Entry ; class Main { static int mod = ( 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 { System . out . println ( " [LOG] Block: ans1 = ans1 + A; \n ans2 = ans2 + N % (A + B) - A; " ) ; ans1 = ans1 + A ; ans2 = ans2 + N % ( A + B ) - A ; } System . out . println ( ans1 ) ; return ; } } +import java . util . Scanner ; public class Main { public static void swap ( int [ ] A , int a , int b ) { int s = A [ a ] ; A [ a ] = A [ b ] ; A [ b ] = s ; } 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 ) { System . out . println ( " [LOG] Block: swap(a, i, min); \n cnt++; " ) ; 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 Main { private static Scanner sc ; public static void main ( final String [ ] args ) { sc = new Scanner ( System . in ) ; String ans = sc . next ( ) ; if ( ans . equals ( " ABC " ) ) System . out . println ( " ARC " ) ; else { System . out . println ( " [LOG] Block: System.out.println( \" ABC \" ); " ) ; System . out . println ( " ABC " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; ++ i ) { int high = sc . nextInt ( ) ; if ( high >= K ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . println ( count ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { static long mod = 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 ++ ) { System . out . println ( " [LOG] Block: ans += P[i]; " ) ; ans += P [ i ] ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i , 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 ( i = 0 ; i < n ; i ++ ) { name [ i ] = sc . next ( ) ; time [ i ] = 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 { System . out . println ( " [LOG] Block: tail++; " ) ; tail ++ ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int b = 1 ; int p = 2 ; double max = 0 ; double result ; Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; while ( b < 1000 ) { while ( p < 1000 ) { System . out . println ( " [LOG] Block: result = Math.pow(b, p); \n if (result > x) \n break; \n if (result >= max) \n max = result; \n p++; " ) ; result = Math . pow ( b , p ) ; if ( result > x ) break ; if ( result >= max ) max = result ; p ++ ; } p = 2 ; b ++ ; } System . out . println ( ( int ) max ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = in . nextInt ( ) ; int [ ] value = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { value [ i ] = in . nextInt ( ) ; } int [ ] cost = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { cost [ j ] = in . nextInt ( ) ; } int result = solve ( n , value , cost ) ; System . out . println ( result ) ; in . close ( ) ; } public static int solve ( int n , int [ ] value , int [ ] cost ) { int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( value [ i ] - cost [ i ] ) > 0 ) { System . out . println ( " [LOG] Block: result += value[i] - cost[i]; " ) ; result += value [ i ] - cost [ i ] ; } } return result ; } } +import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n ; double [ ] ans = new double [ 1000 ] ; int k = 0 ; while ( true ) { n = scan . nextInt ( ) ; if ( n == 0 ) break ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; sum += a [ i ] ; } double ave = ( double ) sum / n ; double var = 0 ; for ( int i = 0 ; i < n ; i ++ ) { var = var + ( ( a [ i ] - ave ) * ( a [ i ] - ave ) / n ) ; } ans [ k ] = Math . sqrt ( var ) ; k ++ ; } for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( " [LOG] Block: System.out.printf( \" %.5f \n \" , ans[i]); " ) ; System . out . printf ( " %.5f \n " , ans [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String a = sc . next ( ) ; String b = sc . next ( ) ; int ab = Integer . parseInt ( a + b ) ; int tmp = ( int ) Math . sqrt ( ab ) ; if ( Math . pow ( tmp , 2 ) == ab ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n double a = sc.nextDouble(); \n sc.close(); \n long ret = (long) (a + Math.pow(a, 2) + Math.pow(a, 3)); \n System.out.println(ret); " ) ; Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; sc . close ( ) ; long ret = ( long ) ( a + Math . pow ( a , 2 ) + Math . pow ( a , 3 ) ) ; System . out . println ( ret ) ; } } +import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int hoge = sc . nextInt ( ) ; String sura = sc . next ( ) ; ArrayList < Character > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < hoge ; 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 ) ) { System . out . println ( " [LOG] Block: list.remove(list.size() - 1); " ) ; list . remove ( list . size ( ) - 1 ) ; } } } System . out . println ( list . size ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = 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 ] ) ) { System . out . println ( " [LOG] Block: R[i + 1] = R[i] + Q[(j + N) % 26]; " ) ; R [ i + 1 ] = R [ i ] + Q [ ( j + N ) % 26 ] ; } } } System . out . println ( R [ s ] ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > asiba = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: int MAX = Math.abs(asiba.get(i) - asiba.get(i - 1)) + cost.get(i - 1); \n int MAX2 = Math.abs(asiba.get(i) - asiba.get(i - 2)) + cost.get(i - 2); \n if (MAX > MAX2) \n MAX = MAX2; \n cost.add(MAX); " ) ; 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 ( N - 1 ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int week = scan . nextInt ( ) ; double debt = 100000 ; for ( int i = 0 ; i < week ; i ++ ) { System . out . println ( " [LOG] Block: debt = debt * 1.05 / 1000; \n debt = Math.ceil(debt); \n debt = debt * 1000; " ) ; debt = debt * 1.05 / 1000 ; debt = Math . ceil ( debt ) ; debt = debt * 1000 ; } int ans = ( int ) debt ; System . out . println ( ans ) ; } } +import java . io . * ; import java . util . * ; import java . util . function . * ; final class Solver { static final Solver INSTANCE = new Solver ( ) ; void solve ( Supplier < String > sc ) { String S = sc . get ( ) ; int left = Integer . parseInt ( S . substring ( 0 , 2 ) , 10 ) ; int right = Integer . parseInt ( S . substring ( 2 ) , 10 ) ; if ( isYear ( left ) && isYear ( right ) ) { System . out . println ( " NA " ) ; } else if ( isYear ( left ) ) { 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 Main { 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 ) { System . out . println ( " [LOG] Block: throw new UncheckedIOException(e); " ) ; throw new UncheckedIOException ( e ) ; } } } ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { long m = sc . nextLong ( ) ; long n = sc . nextLong ( ) ; System . out . printf ( " %d %d \n " , gcd ( m , n ) , lcm ( m , 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 ) { System . out . println ( " [LOG] Block: return a * b / gcd(a, b); " ) ; return a * b / gcd ( a , b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { char [ ] S = sc . next ( ) . toCharArray ( ) ; int result = 0 ; for ( int i = 0 ; i < S . length ; i ++ ) { if ( S [ i ] == '+' ) { result ++ ; } else { System . out . println ( " [LOG] Block: result--; " ) ; result -- ; } } System . out . println ( result ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { int n = in . NI ( ) ; if ( n % 2 == 0 ) out . println ( n / 2 ) ; else out . println ( n / 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 InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int NI ( ) { return Integer . parseInt ( next ( ) ) ; } public long NL ( ) { System . out . println ( " [LOG] Block: return Long.parseLong(next()); " ) ; return Long . parseLong ( next ( ) ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String a = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { switch ( s . charAt ( i ) ) { case '0' : a += " 0 " ; break ; case '1' : a += " 1 " ; break ; case 'B' : if ( a . length ( ) > 0 ) { System . out . println ( " [LOG] Block: a = a.substring(0, a.length() - 1); " ) ; a = a . substring ( 0 , a . length ( ) - 1 ) ; } break ; } } System . out . println ( a ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; String dummy = sc . nextLine ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; for ( int i = 0 ; i < n ; 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 < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int sum = 0 ; for ( int k = 0 ; k < d ; k ++ ) { System . out . println ( " [LOG] Block: sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][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 . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int ans1 = 0 , ans2 = 0 ; if ( a % d == 0 ) { ans1 = a / d ; } else { ans1 = a / 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " " ; int f = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int l = Integer . parseInt ( s . substring ( 2 , 4 ) ) ; if ( f < 1 || 12 < f ) { if ( l < 1 || 12 < l ) { ans = " NA " ; } else { ans = " YYMM " ; } } else { if ( l < 1 || 12 < l ) { ans = " MMYY " ; } else { System . out . println ( " [LOG] Block: ans = \" AMBIGUOUS \" ; " ) ; ans = " AMBIGUOUS " ; } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { 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 n = scn . nextInt ( ) ; n > 0 ; n -- ) { 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 . println ( " [LOG] Block: System.out.format( \" %2d \" , elm); " ) ; System . out . format ( " %2d " , elm ) ; } System . out . println ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int 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 ( ) ; int count = 0 ; double distance = 0.0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i ; j < N ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] data = sc . nextLine ( ) . split ( " " ) ; int a = Integer . parseInt ( data [ 0 ] ) ; int b = Integer . parseInt ( data [ 1 ] ) ; int c = Integer . parseInt ( data [ 2 ] ) ; if ( a + b + c >= 22 ) { System . out . println ( " bust " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" win \" ); " ) ; System . out . println ( " win " ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n String strNum = br.readLine(); \n Integer num = Integer.parseInt(strNum); \n System.out.println(num * num * num); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String strNum = br . readLine ( ) ; Integer num = Integer . parseInt ( strNum ) ; System . out . println ( num * num * num ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long k = sc.nextLong(); \n b = Math.max(Math.min(a + b - k, b), 0); \n a = Math.max(a - k, 0); \n System.out.println(a + \" \" + b); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; b = Math . max ( Math . min ( a + b - k , b ) , 0 ) ; a = Math . max ( a - k , 0 ) ; System . out . println ( a + " " + b ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; sc . close ( ) ; char [ ] ans = new char [ S . length ( ) ] ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: int c = (int) S.charAt(i) - 'A'; \n c = (c + N) % 26; \n ans[i] = (char) ('A' + c); " ) ; int c = ( int ) S . charAt ( i ) - 'A' ; c = ( c + N ) % 26 ; ans [ i ] = ( char ) ( 'A' + c ) ; } System . out . println ( new String ( ans ) ) ; } } +import java . util . * ; public class Main { 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 result = 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 ) ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } return result ; } } +import java . lang . Math ; import java . util . ArrayList ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int a = sn . nextInt ( ) ; int b = sn . nextInt ( ) ; int c = sn . nextInt ( ) ; int co = 0 ; for ( int i = a ; i <= b ; i ++ ) { if ( c % i != 0 ) { System . out . println ( " [LOG] Block: continue; " ) ; continue ; } co ++ ; } System . out . println ( co ) ; } } +import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; final int N = Integer . parseInt ( sc . next ( ) ) ; long [ ] a = new long [ N + 1 ] ; long [ ] b = new long [ N ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { a [ i ] = Long . parseLong ( sc . next ( ) ) ; } for ( int i = 0 ; i < N ; i ++ ) { b [ i ] = Long . parseLong ( sc . next ( ) ) ; } long ans = 0 ; for ( int i = 0 ; i < N ; 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 ] ) { System . out . println ( " [LOG] Block: ans += (a[i] + a[i + 1]); \n a[i + 1] = 0; " ) ; ans += ( a [ i ] + a [ i + 1 ] ) ; a [ i + 1 ] = 0 ; } } out . println ( ans ) ; out . flush ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int aInt = sc . nextInt ( ) ; int bInt = sc . nextInt ( ) ; int seki = aInt * bInt ; if ( ( seki % 2 ) == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Odd \" ); " ) ; System . out . println ( " Odd " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double n = sc . nextDouble ( ) ; double odd = 0 ; double notOdd = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) { notOdd ++ ; } else { System . out . println ( " [LOG] Block: odd++; " ) ; odd ++ ; } } System . out . println ( odd / n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int A = 10000 ; int B = 5000 ; int C = 1000 ; for ( int ai = 0 ; ai <= N ; ai ++ ) { for ( int bi = 0 ; bi <= N - ai ; bi ++ ) { int ci = N - ai - bi ; int sum = ai * A + bi * B + ci * 1000 ; if ( sum == Y ) { System . out . println ( " [LOG] Block: System.out.println(ai + \" \" + bi + \" \" + ci); \n return; " ) ; System . out . println ( ai + " " + bi + " " + ci ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tH = sc . nextInt ( ) ; int tA = sc . nextInt ( ) ; int aH = sc . nextInt ( ) ; int aA = sc . nextInt ( ) ; int tCount = 0 ; while ( tH > 0 ) { tH -= 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 ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner cs = new Scanner ( System . in ) ) { String line = cs . nextLine ( ) ; String answer = " " ; int length = line . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char ch = line . charAt ( i ) ; if ( Character . isLowerCase ( ch ) ) { System . out . print ( Character . toUpperCase ( ch ) ) ; } else { System . out . println ( " [LOG] Block: System.out.print(Character.toLowerCase(ch)); " ) ; System . out . print ( Character . toLowerCase ( ch ) ) ; } } System . out . printf ( " \n " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } System . out . print ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } int tmp = 0 ; int tmp2 = 10 - ( array [ 0 ] % 10 ) ; for ( int i = 0 ; i < n ; 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 < n ; i ++ ) { if ( tmp == i ) continue ; if ( array [ i ] % 10 != 0 ) { System . out . println ( " [LOG] Block: array[i] += 10 - (array[i] % 10); " ) ; array [ i ] += 10 - ( array [ i ] % 10 ) ; } count += array [ i ] ; } count += array [ tmp ] ; System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { 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 ( ) ) { System . out . println ( " [LOG] Block: if (ring.indexOf(target) != -1) \n result = \" Yes \" ; " ) ; if ( ring . indexOf ( target ) != - 1 ) result = " Yes " ; } System . out . println ( result ) ; } } } +import java . util . * ; class Main { 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 flag1 = 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 ) { System . out . println ( " [LOG] Block: flag1 = false; \n break; " ) ; flag1 = false ; break ; } } System . out . println ( flag1 ? " YES " : " NO " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String s = sc.next(); \n String t = sc.next(); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n String u = sc.next(); \n if (s.equals(u)) \n a--; \n if (t.equals(u)) \n b--; \n System.out.println(a + \" \" + b); " ) ; Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String u = sc . next ( ) ; if ( s . equals ( u ) ) a -- ; if ( t . equals ( u ) ) b -- ; System . out . println ( a + " " + b ) ; } } +import java . math . BigDecimal ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int x = scan.nextInt(); \n int y = scan.nextInt(); \n double f = 1.0 * x / y; \n BigDecimal g = new BigDecimal(f); \n g = g.setScale(5, BigDecimal.ROUND_HALF_UP); \n System.out.printf(x / y + \" \" + x % y + \" \" + \" %.5f \" , g); " ) ; Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; double f = 1.0 * x / y ; BigDecimal g = new BigDecimal ( f ) ; g = g . setScale ( 5 , BigDecimal . ROUND_HALF_UP ) ; System . out . printf ( x / y + " " + x % y + " " + " %.5f " , g ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] h = new int [ n ] ; int [ ] curH = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = scanner . nextInt ( ) ; } int count = 0 ; outer : while ( true ) { int start = 0 , end = 0 ; for ( start = 0 ; start < n ; start ++ ) { if ( curH [ start ] < h [ start ] ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } if ( start >= n ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } count ++ ; int i ; for ( i = start ; i < n ; i ++ ) { if ( curH [ i ] < h [ i ] ) { curH [ i ] ++ ; } else { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int X = scan.nextInt(); \n System.out.println(X / 500 * 1000 + X % 500 / 5 * 5); " ) ; Scanner scan = new Scanner ( System . in ) ; int X = scan . nextInt ( ) ; System . out . println ( X / 500 * 1000 + X % 500 / 5 * 5 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] argv ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n String line = scanner.nextLine(); \n String[] mn = line.split( \" \" ); \n int m = Integer.parseInt(mn[0]); \n int n = Integer.parseInt(mn[1]); \n int ans = m * (m - 1) / 2 + n * (n - 1) / 2; \n System.out.println(ans); " ) ; Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; String [ ] mn = line . split ( " " ) ; int m = Integer . parseInt ( mn [ 0 ] ) ; int n = Integer . parseInt ( mn [ 1 ] ) ; int ans = m * ( m - 1 ) / 2 + n * ( n - 1 ) / 2 ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; double d = a / 0.08 ; int x = ( int ) ( a / 0.08 ) ; if ( d != x ) x ++ ; System . err . println ( x ) ; int min = a ; int max = a ; int xmin = x ; int xmax = x ; int i = 0 ; while ( min == a ) { xmin -- ; min = ( int ) ( xmin * 0.08 ) ; } while ( max == a ) { 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 ( " [LOG] Block: System.out.println(j); \n return; " ) ; System . out . println ( j ) ; return ; } } System . out . println ( - 1 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { int w = Integer . parseInt ( reader . readLine ( ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] x = new int [ w ] ; for ( int i = 0 ; i < w ; 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 < w ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(x[i]); " ) ; System . out . println ( x [ i ] ) ; } } catch ( IOException e ) { } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner stdIn = new Scanner(System.in); \n int a = stdIn.nextInt(); \n int b = stdIn.nextInt(); \n int c = stdIn.nextInt(); \n int d = stdIn.nextInt(); \n if (c >= b || a >= d) \n System.out.println(0); \n else if ((a <= c && b >= d) || (c <= a && d >= b)) \n System.out.println((b - a) < (d - c) ? b - a : d - c); \n else \n System.out.println((b > c && c >= a) ? b - c : d - a); " ) ; Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int d = stdIn . nextInt ( ) ; if ( c >= b || a >= d ) System . out . println ( 0 ) ; else if ( ( a <= c && b >= d ) || ( c <= a && d >= b ) ) System . out . println ( ( b - a ) < ( d - c ) ? b - a : d - c ) ; else System . out . println ( ( b > c && c >= a ) ? b - c : d - a ) ; } } +import java . util . Scanner ; public class Main { public static int Int ( int a ) { int i = 0 ; if ( a == 9 ) { i = 1 ; } else { i = 9 ; } return i ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int a = scan.nextInt(); \n int b = Int(a % 10); \n a /= 10; \n int c = Int(a % 10); \n a /= 10; \n int d = Int(a % 10); \n System.out.println(d + \" \" + c + \" \" + b); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String w = scan . nextLine ( ) ; int count = 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 ) ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a , b , g , l ; while ( sc . hasNext ( ) ) { a = sc . nextLong ( ) ; b = sc . nextLong ( ) ; g = gcd ( a , b ) ; l = ( a * b ) / g ; System . out . println ( g + " " + l ) ; } } private static long gcd ( long a , long b ) { System . out . println ( " [LOG] Block: if (a == 0) \n return b; \n else if (b == 0) \n return a; \n return gcd(b, a % b); " ) ; if ( a == 0 ) return b ; else if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner kb = new Scanner(System.in); \n String i = kb.next(); \n String j = kb.next(); \n kb.close(); \n String k = \" 123 \" .replace(i, \" \" ); \n k = k.replace(j, \" \" ); \n System.out.println(k); " ) ; Scanner kb = new Scanner ( System . in ) ; String i = kb . next ( ) ; String j = kb . next ( ) ; kb . close ( ) ; String k = " 123 " . replace ( i , " " ) ; k = k . replace ( j , " " ) ; System . out . println ( k ) ; } } +import java . util . Scanner ; public class Main { public static int count = 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 ( count ) ; } 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 ] ; count ++ ; } } } } public static void printArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { System . out . println ( " [LOG] Block: if (i > 0) \n System.out.print( \" \" ); \n System.out.print(array[i]); " ) ; if ( i > 0 ) System . out . print ( " " ) ; System . out . print ( array [ i ] ) ; } System . out . print ( " \n " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N + 1 ] ; int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) B [ i ] = sc . nextInt ( ) ; int [ ] AC = A . clone ( ) ; long cnt = 0 ; for ( int i = 0 ; i < N ; 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 < N + 1 ; i ++ ) { System . out . println ( " [LOG] Block: cnt += AC[i] - A[i]; " ) ; cnt += AC [ i ] - A [ i ] ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long L = sc . nextLong ( ) ; long R = sc . nextLong ( ) ; final int divide = 2019 ; long ans = 1000000000 ; if ( R - L >= 2019 ) System . out . println ( 0 ) ; else { for ( long i = L ; i < R ; i ++ ) { for ( long j = i + 1 ; j <= R ; j ++ ) { System . out . println ( " [LOG] Block: ans = Math.min(ans, (i * j) % divide); " ) ; ans = Math . min ( ans , ( i * j ) % divide ) ; } } System . out . println ( ans ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int y = 0 ; for ( int x = a ; x <= b ; x ++ ) { if ( c % x == 0 ) { System . out . println ( " [LOG] Block: y++; " ) ; y ++ ; } } System . out . println ( y ) ; } } +import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i = 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 == '+' ) { i ++ ; } else { System . out . println ( " [LOG] Block: i--; " ) ; i -- ; } if ( b == '+' ) { i ++ ; } else { System . out . println ( " [LOG] Block: i--; " ) ; i -- ; } if ( c == '+' ) { i ++ ; } else { System . out . println ( " [LOG] Block: i--; " ) ; i -- ; } if ( d == '+' ) { i ++ ; } else { System . out . println ( " [LOG] Block: i--; " ) ; i -- ; } System . out . println ( i ) ; } } +import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( scan . hasNext ( ) ) { String input = scan . nextLine ( ) ; String [ ] inputs = input . split ( " " ) ; int height = Integer . parseInt ( inputs [ 0 ] ) ; int width = Integer . parseInt ( inputs [ 1 ] ) ; if ( height == 0 && width == 0 ) { break ; } for ( int i = 0 ; i < height ; i ++ ) { for ( int j = 0 ; j < width ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans ; if ( s . equals ( " Sunny " ) ) { ans = " Cloudy " ; } else if ( s . equals ( " Cloudy " ) ) { ans = " Rainy " ; } else { System . out . println ( " [LOG] Block: ans = \" Sunny \" ; " ) ; ans = " Sunny " ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCount = 0 ; int maxNum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int count = 0 ; int num = i + 1 ; while ( true ) { if ( num % 2 != 0 ) { break ; } num /= 2 ; count ++ ; } if ( i == 0 || count > maxCount ) { System . out . println ( " [LOG] Block: maxCount = count; \n maxNum = i + 1; " ) ; maxCount = count ; maxNum = i + 1 ; } } System . out . println ( maxNum ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] S = sc . next ( ) . toCharArray ( ) ; String output = " Good " ; for ( int i = 0 ; i < S . length - 1 ; i ++ ) { if ( S [ i ] == S [ i + 1 ] ) { System . out . println ( " [LOG] Block: output = \" Bad \" ; \n break; " ) ; output = " Bad " ; break ; } } System . out . println ( output ) ; } } +import java . util . Scanner ; public class Main { private static long WARU = 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 ] % WARU ; } if ( steps [ i + 1 ] != - 1 ) { System . out . println ( " [LOG] Block: steps[i + 1] += steps[i] % WARU; " ) ; steps [ i + 1 ] += steps [ i ] % WARU ; } } System . out . println ( steps [ count ] % WARU ) ; } } +import java . io . * ; public class Main { public static void main ( String ... args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String [ ] line = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int k = Integer . parseInt ( line [ 1 ] ) ; int q = Integer . parseInt ( line [ 2 ] ) ; int [ ] point = new int [ n ] ; for ( int i = 0 ; i < q ; i ++ ) { point [ Integer . parseInt ( br . readLine ( ) ) - 1 ] += 1 ; } for ( int i = 0 ; i < n ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int be = sc . nextInt ( ) ; int ans = 0 ; boolean check1 = false , check2 = false ; for ( int i = 1 ; i < N ; 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 { System . out . println ( " [LOG] Block: check1 = false; \n check2 = false; " ) ; check1 = false ; check2 = false ; } be = ch ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int d = sc.nextInt(); \n int ans = 0; \n ans = (n + (d * 2 + 1) - 1) / (d * 2 + 1); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ans = 0 ; ans = ( n + ( d * 2 + 1 ) - 1 ) / ( d * 2 + 1 ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( n >= 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 . println ( " [LOG] Block: System.out.print( \" \" + i); " ) ; System . out . print ( " " + i ) ; } } } System . out . println ( ) ; } } +import java . util . * ; import java . lang . Integer ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double x = sc . nextInt ( ) ; double y = sc . nextInt ( ) ; double crane = - ( y / 2 ) + 2 * x ; double turtle = x - crane ; if ( turtle < 0 || crane < 0 || turtle % 1 != 0 || crane % 1 != 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n final int A = sc.nextInt(); \n final int B = sc.nextInt(); \n final int C = sc.nextInt(); \n final int X = sc.nextInt(); \n final int Y = sc.nextInt(); \n final int min = Math.min(X, Y); \n final int max = Math.max(X, Y); \n System.out.println(Math.min(Math.min(A + B, 2 * C) * min + A * (X - min) + B * (Y - min), max * 2 * C)); " ) ; Scanner sc = new Scanner ( System . in ) ; final int A = 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 ( A + B , 2 * C ) * min + A * ( X - min ) + B * ( Y - min ) , max * 2 * C ) ) ; } } +import java . util . * ; public class Main { 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 ( ) ; } int output = 0 ; flag2 : while ( true ) { for ( int i = 0 ; i < n ; i ++ ) { if ( nums [ i ] > 0 ) { output ++ ; for ( int j = 0 ; j < n - i ; j ++ ) { if ( nums [ i + j ] == 0 ) { System . out . println ( " [LOG] Block: continue flag2; " ) ; continue flag2 ; } nums [ i + j ] -= 1 ; } continue flag2 ; } } break flag2 ; } System . out . println ( output ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int cap1 = A - B ; int use = 0 ; if ( cap1 < C ) { use = cap1 ; } else { System . out . println ( " [LOG] Block: use = C; " ) ; use = C ; } System . out . println ( C - use ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int W , H , x , y , r ; Scanner sc = new Scanner ( System . in ) ; W = sc . nextInt ( ) ; H = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; r = sc . nextInt ( ) ; if ( x + r > W || x - r < 0 ) { System . out . println ( " No " ) ; } else if ( y + r > H || y - r < 0 ) { System . out . println ( " No " ) ; } else if ( x > W || y > H ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . * ; import java . io . * ; public class Main { 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 N = " " + nextInt ( ) ; if ( N . 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 { System . out . println ( " [LOG] Block: while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine().trim()); \n return st.nextToken(); " ) ; while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] monsters = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { monsters [ i ] = sc . nextInt ( ) ; } Arrays . sort ( monsters ) ; long hp = 0 ; if ( k >= n ) { System . out . println ( hp ) ; } else { for ( int j = 0 ; j < n - k ; j ++ ) { System . out . println ( " [LOG] Block: hp += monsters[j]; " ) ; hp += monsters [ j ] ; } System . out . println ( hp ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) break ; for ( int i = 1 ; i <= H ; i ++ ) { for ( int j = 1 ; j <= W ; j ++ ) { if ( i % 2 == 1 ) { if ( j % 2 == 1 ) System . out . print ( " # " ) ; else System . out . print ( " . " ) ; } else { System . out . println ( " [LOG] Block: if (j % 2 == 1) \n System.out.print( \" . \" ); \n else \n System.out.print( \" # \" ); " ) ; if ( j % 2 == 1 ) System . out . print ( " . " ) ; else System . out . print ( " # " ) ; } } System . out . println ( ) ; } System . out . println ( ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String ans = " Yes " ; int l = s . length ( ) ; for ( int i = 0 ; i < ( l - 1 ) / 2 ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) != s.charAt(l - 1 - i)) \n ans = \" No \" ; " ) ; if ( s . charAt ( i ) != s . charAt ( l - 1 - i ) ) ans = " No " ; } l = l / 2 ; if ( ! ans . equals ( " No " ) ) { for ( int i = 0 ; i < l / 2 ; i ++ ) { System . out . println ( " [LOG] Block: if (s.charAt(i) != s.charAt(l - 1 - i)) \n ans = \" No \" ; " ) ; if ( s . charAt ( i ) != s . charAt ( l - 1 - i ) ) ans = " No " ; } } System . out . print ( ans ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String input = br . readLine ( ) ; int result = 0 ; if ( input . contains ( " A " ) ) { result ++ ; } if ( input . contains ( " B " ) ) { result ++ ; } if ( result == 2 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int n = s . length ; int res = 0 ; for ( int i = 0 ; i < ( n - 1 - i ) ; i ++ ) { if ( s [ i ] != s [ n - 1 - i ] ) { System . out . println ( " [LOG] Block: res++; " ) ; res ++ ; } } System . out . println ( res ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { System . out . println ( " [LOG] Block: int x = scanner.nextInt(), y = scanner.nextInt(); \n System.out.println(((x * 2 <= y) && (x * 4 >= y) && (0 == (y & 1))) ? \" Yes \" : \" No \" ); " ) ; int x = scanner . nextInt ( ) , y = scanner . nextInt ( ) ; System . out . println ( ( ( x * 2 <= y ) && ( x * 4 >= y ) && ( 0 == ( y & 1 ) ) ) ? " Yes " : " No " ) ; } } } +import java . util . * ; public class Main { 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 max = Long . MIN_VALUE ; for ( int i = 0 ; i < 2 ; ++ i ) { for ( int j = 0 ; j < 2 ; ++ j ) { System . out . println ( " [LOG] Block: long tmp = a[i] * b[j]; \n max = Math.max(tmp, max); " ) ; long tmp = a [ i ] * b [ j ] ; max = Math . max ( tmp , max ) ; } } System . out . println ( max ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; while ( true ) { int n = Integer . parseInt ( std . next ( ) ) ; if ( n == 0 ) { break ; } double [ ] score = new double [ n ] ; double ave = 0 ; for ( int i = 0 ; i < n ; i ++ ) { score [ i ] = Double . parseDouble ( std . next ( ) ) ; ave += score [ i ] ; } ave /= n ; double sd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: sd += Math.pow((score[i] - ave), 2); " ) ; sd += Math . pow ( ( score [ i ] - ave ) , 2 ) ; } sd /= n ; sd = Math . pow ( sd , 0.5 ) ; System . out . println ( String . format ( " %.5f " , sd ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 ( " [LOG] Block: System.out.println(0); \n return; " ) ; System . out . println ( 0 ) ; return ; } System . out . println ( max - min + 1 ) ; } } +import java . util . * ; class Main { public static int getCvalue ( int n , int m ) { if ( n < 2 ) { return 0 ; } else { int k = n - m ; int a = 1 ; while ( n > k ) { a *= ( n -- ) ; } return a / 2 ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n = sc.nextInt(); \n int m = sc.nextInt(); \n int res = 0; \n res += getCvalue(n, 2); \n res += getCvalue(m, 2); \n System.out.println(res); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int iRes = 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 ] ) ) { System . out . println ( " [LOG] Block: iRes++; " ) ; iRes ++ ; } } System . out . println ( iRes ) ; } } +import java . util . Scanner ; public class Main { 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 i ; for ( i = 0 ; i < 25 ; i ++ ) { if ( alp [ i ] . equals ( str ) ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } System . out . println ( alp [ i + 1 ] ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String F = sc . nextLine ( ) ; String C = sc . nextLine ( ) ; int count = 0 ; for ( int i = 0 ; i < F . length ( ) ; i ++ ) { System . out . println ( " [LOG] Block: Character c1 = F.charAt(i); \n Character c2 = C.charAt(i); \n if (c1 == c2) \n count++; " ) ; Character c1 = F . charAt ( i ) ; Character c2 = C . charAt ( i ) ; if ( c1 == c2 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i <= a ; i ++ ) { 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 ) { System . out . println ( " [LOG] Block: new Main().run(); " ) ; new Main ( ) . run ( ) ; } } +import java . util . Scanner ; public class Main { static String str ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; str = sc . next ( ) ; int n = str . length ( ) ; boolean [ ] dp = new boolean [ n + 1 ] ; dp [ 0 ] = true ; for ( int i = 5 ; i <= n ; 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 [ n ] ) { System . out . println ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( a >= k ) { System . out . println ( ( a - k ) + " " + b ) ; } else if ( b >= k - a ) { System . out . println ( " 0 " + " " + ( b - ( k - a ) ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" 0 0 \" ); " ) ; System . out . println ( " 0 0 " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] m = new int [ n ] ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { m [ i ] = sc . nextInt ( ) ; x -= m [ i ] ; if ( min > m [ i ] ) { min = m [ i ] ; } } int count = m . length ; while ( x >= 0 ) { System . out . println ( " [LOG] Block: x -= min; \n count++; " ) ; x -= min ; count ++ ; } System . out . println ( count - 1 ) ; sc . close ( ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; int y = stdIn . nextInt ( ) ; int z = stdIn . nextInt ( ) ; int temp ; if ( x > y ) { temp = x ; x = y ; y = temp ; } if ( x > z ) { temp = x ; x = z ; z = temp ; } if ( y > z ) { System . out . println ( " [LOG] Block: temp = z; \n z = y; \n y = temp; " ) ; temp = z ; z = y ; y = temp ; } System . out . printf ( " %d %d %d \n " , x , y , z ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { int a = 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 ) a = Integer . parseInt ( current ) ; if ( i == 1 ) b = Integer . parseInt ( current ) ; if ( i == 2 ) c = Integer . parseInt ( current ) ; i ++ ; } if ( a > c ) { tmp = a ; a = c ; c = tmp ; } if ( a > b ) { tmp = a ; a = b ; b = tmp ; } if ( b > c ) { System . out . println ( " [LOG] Block: tmp = b; \n b = c; \n c = tmp; " ) ; tmp = b ; b = c ; c = tmp ; } System . out . println ( a + " " + b + " " + c ) ; } } +import java . util . * ; class Main { static int n ; 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 ; n = scanner . nextInt ( ) ; a = new int [ n ] ; 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 . println ( " [LOG] Block: System.out.print(array[i]); \n continue; " ) ; System . out . print ( array [ i ] ) ; continue ; } System . out . print ( array [ i ] + " " ) ; } System . out . println ( ) ; } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( ; ; ) { String [ ] str = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 2 ] ) ; if ( str [ 1 ] . equals ( " ? " ) ) break ; switch ( str [ 1 ] ) { case " + " : System . out . println ( a + b ) ; break ; case " - " : System . out . println ( a - b ) ; break ; case " * " : System . out . println ( a * b ) ; break ; case " / " : System . out . println ( a / b ) ; break ; default : break ; } } br . close ( ) ; } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.exit(-1); " ) ; System . exit ( - 1 ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c ; int k = scanner . nextInt ( ) ; if ( a > b ) c = a ; else c = b ; for ( int i = c ; i >= 1 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { -- k ; if ( k == 0 ) { System . out . println ( " [LOG] Block: System.out.println(i); " ) ; System . out . println ( i ) ; } } } } } +import java . util . * ; public class Main { 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 color1_n = sc . nextInt ( ) ; int color2_n = sc . nextInt ( ) ; final String target = sc . next ( ) ; if ( target . equals ( color1 ) ) { color1_n -- ; } else if ( target . equals ( color2 ) ) { System . out . println ( " [LOG] Block: color2_n--; " ) ; color2_n -- ; } System . out . println ( color1_n + " " + color2_n ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , sum ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; sum = 0 ; if ( ( a == 1 || a == 2 ) && ( b == 1 || b == 2 ) ) { sum = 3 ; System . out . println ( sum ) ; } else if ( ( a == 1 || a == 3 ) && ( b == 1 || b == 3 ) ) { sum = 2 ; System . out . println ( sum ) ; } else { System . out . println ( " [LOG] Block: sum = 1; \n System.out.println(sum); " ) ; sum = 1 ; System . out . println ( sum ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Integer [ ] array = new Integer [ m ] ; for ( int i = 0 ; m > i ; i ++ ) { array [ i ] = 0 ; } for ( int i = 0 ; n > 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 ++ ) { System . out . println ( " [LOG] Block: if (array[i] > n - 1) \n count++; " ) ; if ( array [ i ] > n - 1 ) count ++ ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . answer ( ) ; } private Scanner scan = new Scanner ( System . in ) ; private int a ; private int b ; public Main ( ) { a = Integer . parseInt ( scan . next ( ) ) ; b = Integer . parseInt ( scan . next ( ) ) ; scan . close ( ) ; } public final void answer ( ) { System . out . println ( " [LOG] Block: String ans = a * b % 2 == 0 ? \" Even \" : \" Odd \" ; \n System.out.println(ans); " ) ; String ans = a * b % 2 == 0 ? " Even " : " Odd " ; System . out . println ( ans ) ; } } +import java . io . InputStream ; import java . io . IOException ; import java . util . HashSet ; class MyScanner { InputStream stream ; public MyScanner ( ) { stream = System . in ; } public int nextInt ( ) { int ret = 0 ; try { while ( true ) { char readed = ( char ) stream . read ( ) ; if ( readed < '0' || readed > '9' ) { break ; } ret = ret * 10 + ( readed - '0' ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { return ret ; } } } class Main { 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 ] ) { System . out . println ( " [LOG] Block: set.remove(j); " ) ; set . remove ( j ) ; } } } System . out . println ( set . size ( ) ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out , true ) ; String str = sc . nextLine ( ) ; int max = 0 ; int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == 'R' ) { count ++ ; max = Math . max ( count , max ) ; } else { System . out . println ( " [LOG] Block: count = 0; " ) ; count = 0 ; } } out . println ( max ) ; } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABC121_2 solver = new ABC121_2 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABC121_2 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = 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 < N ; i ++ ) { int ttl = 0 ; for ( int b : B ) { int A = in . nextInt ( ) * b ; ttl += A ; } if ( ( ttl + C ) > 0 ) { System . out . println ( " [LOG] Block: accnt++; " ) ; accnt ++ ; } } out . println ( accnt ) ; } } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) list . add ( sc . nextInt ( ) ) ; sc . close ( ) ; List < Integer > bloks = new ArrayList < > ( ) ; int target = Collections . min ( list ) ; for ( int idx = list . indexOf ( target ) ; idx <= n ; idx ++ ) { int index = list . subList ( idx , n ) . 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 ( " [LOG] Block: System.out.println(n - bloks.size()); " ) ; System . out . println ( n - bloks . size ( ) ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { 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 a , b , t , gdc ; long lcm ; StringBuilder result = new StringBuilder ( ) ; while ( true ) { if ( ( ( line = br . readLine ( ) ) == null ) || line . isEmpty ( ) ) break ; num = line . split ( " " ) ; a = Integer . parseInt ( num [ 0 ] ) ; b = Integer . parseInt ( num [ 1 ] ) ; if ( a < b ) { t = a ; a = b ; b = t ; } gdc = gdc ( a , b ) ; lcm = lcm ( a , 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 ) { System . out . println ( " [LOG] Block: return x * y / gdc; " ) ; return x * y / gdc ; } } +import java . io . BufferedInputStream ; import java . math . BigInteger ; import java . util . Scanner ; public class Main { 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 ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(new BufferedInputStream(System.in)); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = 0; \n c += Main.combination(a, 2); \n c += Main.combination(b, 2); \n System.out.println(c); " ) ; Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = 0 ; c += Main . combination ( a , 2 ) ; c += Main . combination ( b , 2 ) ; System . out . println ( c ) ; } } +import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long a = sc.nextInt(); \n long b = sc.nextInt(); \n long c = (b * b) - (a * a); \n long d = 2 * b - 2 * a; \n if (c % d == 0) \n System.out.println(c / d); \n else \n System.out.println( \" IMPOSSIBLE \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = ( b * b ) - ( a * a ) ; long d = 2 * b - 2 * a ; if ( c % d == 0 ) System . out . println ( c / d ) ; else System . out . println ( " IMPOSSIBLE " ) ; } } +import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF_8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { System . out . println ( " [LOG] Block: String[] tok = in.readLine().split( \" \" ); \n int A = Integer.parseInt(tok[0]); \n int B = Integer.parseInt(tok[1]); \n System.out.println(A * B); " ) ; String [ ] tok = in . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( tok [ 0 ] ) ; int B = Integer . parseInt ( tok [ 1 ] ) ; System . out . println ( A * B ) ; } void calc ( ) { } void showResult ( ) { } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int ac = 0 , wa = 0 , tle = 0 , re = 0 ; while ( t -- > 0 ) { String s = sc . next ( ) ; if ( s . equals ( " WA " ) ) { wa ++ ; } if ( s . equals ( " AC " ) ) { ac ++ ; } if ( s . equals ( " TLE " ) ) { tle ++ ; } if ( s . equals ( " RE " ) ) { System . out . println ( " [LOG] Block: 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 Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 != 0 ) { for ( int j = 1 ; j <= n ; j ++ ) { if ( i % j == 0 ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } if ( cnt == 8 ) list . add ( 1 ) ; } cnt = 0 ; } System . out . println ( list . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int d = sc.nextInt(); \n int max = Math.max(a, c); \n int min = Math.min(b, d); \n System.out.println(Math.max(0, min - max)); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int max = Math . max ( a , c ) ; int min = Math . min ( b , d ) ; System . out . println ( Math . max ( 0 , min - max ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int number = Integer . parseInt ( a + b ) ; for ( int i = 2 ; i * i <= number ; i ++ ) { if ( i * i == number ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextLong ( ) ; long k = scanner . nextLong ( ) ; int len = 0 ; if ( n == 0 ) { System . out . println ( 1 ) ; return ; } while ( n > 0 ) { System . out . println ( " [LOG] Block: ++len; \n n /= k; " ) ; ++ len ; n /= k ; } System . out . println ( len ) ; } } +import java . util . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; int sum = 0 ; for ( int i = 1 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: sum += i; " ) ; sum += i ; } for ( int i = 1 ; i < M ; i ++ ) { System . out . println ( " [LOG] Block: sum += i; " ) ; sum += i ; } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { final int A = 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 + A ; if ( kuchi >= B ) { System . out . println ( i ) ; System . exit ( 0 ) ; } } } finally { System . out . println ( " [LOG] Block: sc.close(); " ) ; sc . close ( ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int 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 ( x - count ) ) ) ) { System . out . println ( x - count ) ; break ; } if ( ! ( Arrays . asList ( nums ) . contains ( String . valueOf ( x + count ) ) ) ) { System . out . println ( " [LOG] Block: System.out.println(x + count); \n break; " ) ; System . out . println ( x + count ) ; break ; } } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); \n int d = in.nextInt(); \n int n = in.nextInt(); \n if (n == 100) \n n = 101; \n for (int i = 0; i < d; i++) n *= 100; \n System.out.println(n); \n in.close(); " ) ; Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int d = in . nextInt ( ) ; int n = in . nextInt ( ) ; if ( n == 100 ) n = 101 ; for ( int i = 0 ; i < d ; i ++ ) n *= 100 ; System . out . println ( n ) ; in . close ( ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long N = 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 ( N >= 1 ) { long a = N % 26 ; int b = ( int ) a ; if ( b != 0 ) { ans . add ( alpha [ b - 1 ] ) ; } else if ( b == 0 ) { ans . add ( alpha [ 25 ] ) ; } if ( N % 26 != 0 ) { N = N / 26 ; } else { N = N / 26 - 1 ; } } for ( int i = ans . size ( ) - 1 ; i >= 0 ; i -- ) { System . out . println ( " [LOG] Block: System.out.print(ans.get(i)); " ) ; System . out . print ( ans . get ( i ) ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; while ( true ) { C -= B ; if ( C <= 0 ) { System . out . println ( " Yes " ) ; break ; } A -= D ; if ( A <= 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n break; " ) ; System . out . println ( " No " ) ; break ; } } } } +import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { System . out . println ( " [LOG] Block: String s = in.next(); \n String t = in.next(); \n out.println(s.equals(t.substring(0, s.length())) ? \" Yes \" : \" No \" ); " ) ; String s = in . next ( ) ; String t = in . next ( ) ; out . println ( s . equals ( t . substring ( 0 , s . length ( ) ) ) ? " Yes " : " No " ) ; } } } +import java . util . * ; public class Main { final static int MOD = 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 { System . out . println ( " [LOG] Block: S.push(Integer.parseInt(s)); " ) ; S . push ( Integer . parseInt ( s ) ) ; } } sc . close ( ) ; System . out . println ( S . getFirst ( ) . intValue ( ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] Aandb = ( input . readLine ( ) ) . split ( " \\ s " ) ; int n = Integer . parseInt ( Aandb [ 0 ] ) ; int m = Integer . parseInt ( Aandb [ 1 ] ) ; int [ ] [ ] A = new int [ n ] [ m ] ; String [ ] z = null ; for ( int i = 0 ; i < n ; 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 < n ; l ++ ) { int C = 0 ; for ( int s = 0 ; s < m ; s ++ ) { System . out . println ( " [LOG] Block: C += (A[l][s] * b[s]); " ) ; C += ( A [ l ] [ s ] * b [ s ] ) ; } System . out . println ( C ) ; } } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { BufferedReader kb = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String [ ] str = kb . readLine ( ) . split ( " " ) ; int n = 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 < n ; 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 . out . println ( " [LOG] Block: System.err.println(e); " ) ; System . err . println ( e ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i <= A ; i ++ ) { for ( int j = 0 ; j <= B ; j ++ ) { int tmp = X - i * 500 - j * 100 ; if ( 0 <= tmp && tmp <= C * 50 ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , M = sc . nextInt ( ) ; int min = 0 , max = 100000 ; for ( int i = 0 ; i < M ; i ++ ) { System . out . println ( " [LOG] Block: int l = sc.nextInt(), r = sc.nextInt(); \n min = Math.max(min, l); \n max = Math.min(max, r); " ) ; 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 . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > used = new HashSet < String > ( ) ; String s = sc . next ( ) ; used . add ( s ) ; for ( int i = 1 ; i < N ; 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 == N - 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } s = t ; } } } +import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; if ( n == 0 ) { System . out . println ( x ) ; 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 = x ; while ( underPos == null ) { if ( p . contains ( startPos ) != true ) { underPos = startPos ; } startPos -- ; } startPos = x ; while ( upwardPos == null ) { if ( p . contains ( startPos ) != true ) { upwardPos = startPos ; } startPos ++ ; } int underDist = Math . abs ( x - underPos ) ; int upwardDist = Math . abs ( x - upwardPos ) ; if ( underDist == upwardDist ) { System . out . println ( underPos ) ; return ; } if ( underDist < upwardDist ) { System . out . println ( underPos ) ; } else { System . out . println ( " [LOG] Block: System.out.println(upwardPos); " ) ; System . out . println ( upwardPos ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] array = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { array [ i ] [ 1 ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int s = array [ i ] [ 0 ] - array [ i ] [ 1 ] ; if ( s > 0 ) { System . out . println ( " [LOG] Block: sum += s; " ) ; sum += s ; } } System . out . println ( sum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder answer = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int i = 1 ; if ( n >= 3 && n <= 10000 ) { while ( i <= n ) { if ( i % 3 == 0 ) { answer . append ( " " ) . append ( String . valueOf ( i ) ) ; } else { int x ; x = i ; while ( x != 0 ) { if ( x % 10 == 3 ) { System . out . println ( " [LOG] Block: answer.append( \" \" ).append(String.valueOf(i)); \n break; " ) ; answer . append ( " " ) . append ( String . valueOf ( i ) ) ; break ; } x = x / 10 ; } } i ++ ; } } System . out . println ( answer . toString ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] time = new int [ 5 ] , wait = new int [ 5 ] ; int total = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { time [ i ] = sc . nextInt ( ) ; wait [ i ] = ( 10 - time [ i ] % 10 ) % 10 ; total += time [ i ] + wait [ i ] ; } int idx = maxIdx ( wait ) ; total -= wait [ idx ] ; System . out . println ( total ) ; } public static int maxIdx ( int [ ] wait ) { int idx = 0 , data = wait [ 0 ] ; for ( int i = 1 ; i < 5 ; i ++ ) { if ( data < wait [ i ] ) { System . out . println ( " [LOG] Block: data = wait[i]; \n idx = i; " ) ; data = wait [ i ] ; idx = i ; } } return idx ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( N % 2 == 0 ) { int h = N / 2 - 1 ; String bs = S . substring ( 0 , h + 1 ) ; String as = S . substring ( h + 1 , N ) ; if ( as . equals ( bs ) ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String t = sc . next ( ) ; String S = s + s ; if ( S . contains ( t ) == true ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] d = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: d[i] = Integer.parseInt(sc.next()); " ) ; d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( d ) ; System . out . println ( d [ n / 2 ] - d [ n / 2 - 1 ] ) ; } } +import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String S = sc . next ( ) ; boolean f = true ; for ( int i = 0 ; i < S . length ( ) / 2 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) - i - 1 ) ) { System . out . println ( " [LOG] Block: f = false; \n break; " ) ; f = false ; break ; } } for ( int i = 0 ; i < S . length ( ) / 4 ; i ++ ) { if ( S . charAt ( i ) != S . charAt ( S . length ( ) / 2 - i - 1 ) ) { System . out . println ( " [LOG] Block: f = false; \n break; " ) ; f = false ; break ; } } System . out . println ( f ? " Yes " : " No " ) ; } } +import java . util . LinkedHashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] numbers = new int [ n ] ; for ( int i = 0 ; i < n ; 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] costs = new int [ N ] ; int [ ] cache = new int [ N ] ; for ( int i = 0 ; i < N ; 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 -- ) { System . out . println ( " [LOG] Block: cache[i] = Math.min(cache[i], cache[i - j] + (Math.abs(costs[i] - costs[i - 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 . Scanner ; public class Main { 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 m = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( " [LOG] Block: int subNum = sc.nextInt(); \n String tmpSub = alf.substring(0, subNum); \n String tmp = alf.substring(subNum); \n alf = tmp + tmpSub; " ) ; 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . start ( ) ; } private void start ( ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( a < b && b < c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +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 Main { static class FastReader { 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 i = 0 ; i < w . length ( ) ; i ++ ) { int k = w . charAt ( i ) - 'a' ; arr [ k ] = arr [ k ] + 1 ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] % 2 != 0 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); \n return; " ) ; System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n int p = scan.nextInt(); \n int q = scan.nextInt(); \n int r = scan.nextInt(); \n int[] a = { p, q, r } ; \n Arrays.sort(a); \n System.out.println(a[0] + a[1]); " ) ; Scanner scan = new Scanner ( System . in ) ; int p = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; int [ ] a = { p , q , r } ; Arrays . sort ( a ) ; System . out . println ( a [ 0 ] + a [ 1 ] ) ; } } +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 Main { public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; int z = in . nextInt ( ) ; int p = x ; System . out . println ( z + " " + x + " " + y ) ; } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) , d [ ] = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; ++ i ) d [ i ] = sc . nextInt ( ) ; sc . close ( ) ; d [ n ] = 1000 ; Arrays . sort ( d ) ; int ans = 0 ; for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( " [LOG] Block: if (d[i] != d[i + 1]) \n ++ans; " ) ; if ( d [ i ] != d [ i + 1 ] ) ++ ans ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; String S = " " ; if ( 2 * X <= Y && Y <= 4 * X && Y % 2 == 0 ) { S = " Yes " ; } else { System . out . println ( " [LOG] Block: S = \" No \" ; " ) ; S = " No " ; } System . out . println ( S ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int Y = scan . nextInt ( ) ; for ( int x = 0 ; x <= N ; x ++ ) { for ( int y = 0 ; y <= N - x ; y ++ ) { int total = x * 10000 + y * 5000 + 1000 * ( N - x - y ) ; if ( total == Y ) { System . out . println ( " [LOG] Block: System.out.println(x + \" \" + y + \" \" + (N - x - y)); \n return; " ) ; System . out . println ( x + " " + y + " " + ( N - x - y ) ) ; return ; } } } System . out . println ( " -1 -1 -1 " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int h ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: h = Integer.parseInt(sc.next()); \n if (h >= k) \n ans++; " ) ; h = Integer . parseInt ( sc . next ( ) ) ; if ( h >= k ) ans ++ ; } System . out . println ( ans ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { a . add ( sn . nextInt ( ) ) ; } Collections . sort ( a ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(a.get(a.size() - i - 1)); " ) ; System . out . println ( a . get ( a . size ( ) - i - 1 ) ) ; } } } +import java . util . HashMap ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int cityCnt = scanner . nextInt ( ) ; int routeCnt = scanner . nextInt ( ) ; Map < Integer , Integer > map = initMap ( cityCnt ) ; 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 cityCnt ) { Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i <= cityCnt ; i ++ ) { System . out . println ( " [LOG] Block: map.put(i, 0); " ) ; map . put ( i , 0 ) ; } return map ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Queue < String > name_queue = new ArrayDeque < > ( ) ; Queue < Integer > queue = new ArrayDeque < > ( ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; 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 { System . out . println ( " [LOG] Block: count_time += q; \n num -= q; \n queue.add(num); \n name_queue.add(name); " ) ; count_time += q ; num -= q ; queue . add ( num ) ; name_queue . add ( name ) ; } } } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); \n int n = in.nextInt(); \n int x = in.nextInt(); \n int t = in.nextInt(); \n int ans = n / x; \n if (n % x != 0) \n ans++; \n ans *= t; \n System.out.println(ans); " ) ; Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = in . nextInt ( ) ; int x = in . nextInt ( ) ; int t = in . nextInt ( ) ; int ans = n / x ; if ( n % x != 0 ) ans ++ ; ans *= t ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= n - 1 ; i ++ ) { System . out . println ( " [LOG] Block: count += i; " ) ; count += i ; } for ( int i = 1 ; i <= m - 1 ; i ++ ) { System . out . println ( " [LOG] Block: count += i; " ) ; count += i ; } System . out . println ( count ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ m ] ; boolean [ ] jdg = new boolean [ n + 1 ] ; long [ ] Dp = new long [ n + 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 <= n ; 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 ) { System . out . println ( " [LOG] Block: Dp[i] = 0; " ) ; Dp [ i ] = 0 ; } } System . out . println ( Dp [ n ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; int result = 0 ; for ( int i = 0 ; i < num ; 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 ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } } System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String M = sc . next ( ) ; if ( M . equals ( " AAA " ) ) { System . out . println ( " No " ) ; } else if ( M . equals ( " BBB " ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int a = sc . nextInt ( ) ; final int b = sc . nextInt ( ) ; final int c = sc . nextInt ( ) ; final int k = sc . nextInt ( ) ; sc . close ( ) ; int result = 0 ; if ( a >= k ) { result = k ; } else if ( b >= k - a ) { result = a ; } else if ( c >= k - b - a ) { System . out . println ( " [LOG] Block: result = 2 * a + b - k; " ) ; result = 2 * a + b - k ; } System . out . println ( result ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int N = sc.nextInt(); \n int K = sc.nextInt(); \n double log; \n log = Math.log10(N) / Math.log10(K); \n int ans = (int) Math.floor(log) + 1; \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; double log ; log = Math . log10 ( N ) / Math . log10 ( K ) ; int ans = ( int ) Math . floor ( log ) + 1 ; System . out . println ( ans ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { 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 p = Integer . parseInt ( st . nextToken ( ) ) + Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( ( int ) Math . log10 ( p ) + 1 ) ; s = br . readLine ( ) ; } } catch ( Exception ex ) { System . out . println ( " [LOG] Block: System.exit(0); " ) ; System . exit ( 0 ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] youso1 = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { youso1 [ i ] = sc . nextInt ( ) ; } int [ ] youso2 = youso1 . clone ( ) ; Arrays . sort ( youso2 ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( youso1 [ i ] < youso2 [ N - 1 ] ) { System . out . println ( youso2 [ N - 1 ] ) ; } else { System . out . println ( " [LOG] Block: System.out.println(youso2[N - 2]); " ) ; System . out . println ( youso2 [ N - 2 ] ) ; } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int tate = sc.nextInt(); \n int yoko = sc.nextInt(); \n int men; \n int syu; \n men = tate * yoko; \n syu = tate * 2 + yoko * 2; \n System.out.println(men + \" \" + syu); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; int tate = sc . nextInt ( ) ; int yoko = sc . nextInt ( ) ; int men ; int syu ; men = tate * yoko ; syu = tate * 2 + yoko * 2 ; System . out . println ( men + " " + syu ) ; sc . close ( ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int count = 0 ; int n ; while ( true ) { System . out . println ( " [LOG] Block: count++; \n n = Integer.parseInt(br.readLine()); \n if (n == 0) \n break; \n System.out.println( \" Case \" + count + \" : \" + n); " ) ; count ++ ; n = Integer . parseInt ( br . readLine ( ) ) ; if ( n == 0 ) break ; System . out . println ( " Case " + count + " : " + n ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numRow = sc . nextInt ( ) ; int numCol = sc . nextInt ( ) ; int [ ] [ ] mat = new int [ numRow ] [ numCol ] ; int [ ] vecIn = new int [ numCol ] ; int [ ] vecOut = new int [ numRow ] ; int i , j ; for ( i = 0 ; i < numRow ; 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 < numRow ; i ++ ) { for ( j = 0 ; j < numCol ; j ++ ) { System . out . println ( " [LOG] Block: vecOut[i] += mat[i][j] * vecIn[j]; " ) ; vecOut [ i ] += mat [ i ] [ j ] * vecIn [ j ] ; } System . out . println ( vecOut [ i ] ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int 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 { System . out . println ( " [LOG] Block: toN++; " ) ; toN ++ ; } } System . out . println ( Math . min ( toZero , toN ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 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 [ n ] ; int t = 0 ; for ( int i = 1 ; i < n ; ++ 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 ( " [LOG] Block: System.out.println(at[r[i] - 1] - at[l[i] - 1]); " ) ; System . out . println ( at [ r [ i ] - 1 ] - at [ l [ i ] - 1 ] ) ; } } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; int ans = 0 ; for ( int i = 0 ; i < K ; ++ i ) { System . out . println ( " [LOG] Block: ans += list.get(i); " ) ; ans += list . get ( i ) ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int k , a ; int [ ] [ ] food = new int [ n ] [ m + 1 ] ; for ( int i = 0 ; i < n ; ++ 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 < n ; ++ j ) { System . out . println ( " [LOG] Block: if (food[j][i] == 0) \n break; " ) ; if ( food [ j ] [ i ] == 0 ) break ; } if ( j == n ) ++ ans ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , D = sc . nextInt ( ) , c = 0 ; for ( int i = 0 ; i < N ; i ++ ) { long X = sc . nextInt ( ) , Y = sc . nextInt ( ) ; if ( Math . sqrt ( X * X + Y * Y ) <= D ) { System . out . println ( " [LOG] Block: c++; " ) ; c ++ ; } } System . out . println ( c ) ; } } +import java . util . Scanner ; import java . math . BigDecimal ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n double r = scan.nextDouble(); \n final double CIRCLERATE = 3.141592653589; \n double s = CIRCLERATE * r * r; \n double l = 2 * CIRCLERATE * r; \n BigDecimal x = new BigDecimal(s); \n x = x.setScale(5, BigDecimal.ROUND_HALF_UP); \n BigDecimal y = new BigDecimal(l); \n y = y.setScale(5, BigDecimal.ROUND_HALF_UP); \n System.out.printf( \" %.5f \" + \" \" + \" %.5f \" , x, y); " ) ; Scanner scan = new Scanner ( System . in ) ; double r = scan . nextDouble ( ) ; final double CIRCLERATE = 3.141592653589 ; double s = CIRCLERATE * r * r ; double l = 2 * CIRCLERATE * r ; 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 . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = Integer . parseInt ( stdIn . next ( ) ) ; String s = stdIn . next ( ) ; int count = 0 ; int i = 0 ; while ( i < n - 2 ) { if ( s . charAt ( i ) == 'A' ) { if ( s . charAt ( i + 1 ) == 'B' ) { if ( s . charAt ( i + 2 ) == 'C' ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } i ++ ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int n, m, ans; \n n = sc.nextInt(); \n m = sc.nextInt(); \n ans = ((n + m) * (n + m - 1)) / 2 - (n * m); \n System.out.println(ans); " ) ; Scanner sc = new Scanner ( System . in ) ; int n , m , ans ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; ans = ( ( n + m ) * ( n + m - 1 ) ) / 2 - ( n * m ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { int d , 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 ) { System . out . println ( " [LOG] Block: new Main().solve(); " ) ; new Main ( ) . solve ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { int i ; 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 { System . out . println ( " [LOG] Block: stack.addFirst(Integer.parseInt(temp)); " ) ; stack . addFirst ( Integer . parseInt ( temp ) ) ; } } System . out . println ( stack . removeFirst ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; arr [ 0 ] = - 1 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } String ans = " Yes " ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] <= arr [ i + 1 ] - 1 ) { arr [ i + 1 ] -- ; } else if ( arr [ i ] <= arr [ i + 1 ] ) { continue ; } else { System . out . println ( " [LOG] Block: ans = \" No \" ; \n break; " ) ; ans = " No " ; break ; } } System . out . println ( ans ) ; } } +import java . io . * ; import java . util . StringTokenizer ; class Main { 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 n = Integer . parseInt ( st . nextToken ( ) ) ; long m = Integer . parseInt ( st . nextToken ( ) ) ; long gcd ; long lcm = n * m ; while ( n % m != 0 ) { long t = m ; m = n % m ; n = t ; } gcd = m ; lcm = lcm / gcd ; System . out . println ( gcd + " " + lcm ) ; } } catch ( Exception e ) { System . out . println ( " [LOG] Block: System.out.println( \" Exception! \" ); " ) ; System . out . println ( " Exception! " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i <= A ; i ++ ) { for ( int j = 0 ; j <= B ; j ++ ) { int k = ( X - i * 500 - j * 100 ) / 50 ; if ( k >= 0 && k <= C ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } } System . out . println ( cnt ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; if ( S . contentEquals ( " ABC " ) ) { System . out . println ( " ARC " ) ; } if ( S . equals ( " ARC " ) ) { System . out . println ( " [LOG] Block: System.out.println( \" ABC \" ); " ) ; System . out . println ( " ABC " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = Integer . valueOf ( String . valueOf ( a ) + String . valueOf ( b ) ) ; if ( isPerfectSquare ( ( double ) c ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } static boolean isPerfectSquare ( double x ) { System . out . println ( " [LOG] Block: double sr = Math.sqrt(x); \n return ((sr - Math.floor(sr)) == 0); " ) ; double sr = Math . sqrt ( x ) ; return ( ( sr - Math . floor ( sr ) ) == 0 ) ; } } +import java . io . FileNotFoundException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; boolean flg = false ; for ( int i = 1 ; i < 1269 ; i ++ ) { if ( Math . floor ( i * 0.08 ) == A && Math . floor ( i * 0.10 ) == B ) { System . out . println ( i ) ; flg = true ; break ; } } if ( flg == false ) { System . out . println ( " [LOG] Block: System.out.println( \" -1 \" ); " ) ; System . out . println ( " -1 " ) ; } } } +import java . awt . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . util . List ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextInt ( ) ; long d = sc . nextInt ( ) ; long x = b - a + 1 - ( ( b / c ) - ( a / c ) + ( b / d ) - ( a / d ) - ( ( b / ( lcm ( c , d ) ) ) - ( a / ( lcm ( c , d ) ) ) ) ) ; if ( a % c == 0 ) x -- ; if ( a % d == 0 ) x -- ; if ( a % ( lcm ( c , d ) ) == 0 ) x ++ ; System . out . println ( x ) ; } static long gcd ( long a , long b ) { if ( a == 0 ) return b ; else return gcd ( b % a , a ) ; } static long lcm ( long a , long b ) { System . out . println ( " [LOG] Block: return (a * b) / gcd(a, b); " ) ; return ( a * b ) / gcd ( a , b ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( solve ( A , 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 ) { System . out . println ( " [LOG] Block: result = result * i; \n a = a / i; \n b = b / i; \n i = 1; " ) ; result = result * i ; a = a / i ; b = b / i ; i = 1 ; } } return result * ( long ) a * ( long ) b ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = 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 ; A -= D ; if ( A <= 0 ) break ; } if ( C <= 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] b = new int [ a ] ; 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 ++ ) { System . out . println ( " [LOG] Block: c = (double) (c + b[j]) / 2; " ) ; c = ( double ) ( c + b [ j ] ) / 2 ; } System . out . println ( c ) ; } } +import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = 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 <= N ; i ++ ) { if ( bloken . contains ( i ) ) { w . add ( 0 ) ; } else { System . out . println ( " [LOG] Block: w.add((w.get(i - 1) + w.get(i - 2)) % 1000000007); " ) ; w . add ( ( w . get ( i - 1 ) + w . get ( i - 2 ) ) % 1000000007 ) ; } } System . out . println ( w . get ( N ) % 1000000007 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n Double r = Double.parseDouble(sc.next()); \n double p = Math.PI; \n double s = r * r * p; \n double l = 2 * r * p; \n System.out.printf( \" %.6f \" , s); \n System.out.print( \" \" ); \n System.out.printf( \" %.6f \n \" , l); " ) ; Scanner sc = new Scanner ( System . in ) ; Double r = Double . parseDouble ( sc . next ( ) ) ; double p = Math . PI ; double s = r * r * p ; double l = 2 * r * p ; System . out . printf ( " %.6f " , s ) ; System . out . print ( " " ) ; System . out . printf ( " %.6f \n " , l ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int sortCount = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int flag = 0 ; int minj = i ; for ( int j = i ; j < N ; 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 . println ( " [LOG] Block: System.out.print(delimiter + a); \n delimiter = \" \" ; " ) ; System . out . print ( delimiter + a ) ; delimiter = " " ; } System . out . println ( ) ; System . out . println ( sortCount ) ; sc . close ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n String title = sc.next(); \n switch(title) { \n case \" ABC \" : \n System.out.println( \" ARC \" ); \n break; \n case \" ARC \" : \n System.out.println( \" ABC \" ); \n break; \n } \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; String title = sc . next ( ) ; switch ( title ) { case " ABC " : System . out . println ( " ARC " ) ; break ; case " ARC " : System . out . println ( " ABC " ) ; break ; } sc . close ( ) ; } } +import java . util . * ; class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { char c = scan . next ( ) . charAt ( 0 ) ; if ( c >= 'A' && c <= 'Z' ) { System . out . println ( " A " ) ; } else if ( c >= 'a' && c <= 'z' ) { System . out . println ( " [LOG] Block: System.out.println( \" a \" ); " ) ; System . out . println ( " a " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char [ ] s = in . next ( ) . toCharArray ( ) ; boolean A = false ; boolean B = false ; for ( int i = 0 ; i < s . length ; i ++ ) { System . out . println ( " [LOG] Block: if (s[i] == 'A') \n A = true; \n if (s[i] == 'B') \n B = true; " ) ; if ( s [ i ] == 'A' ) A = true ; if ( s [ i ] == 'B' ) B = true ; } if ( A && B ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int ans = 1 ; lavel : for ( int i = 2 ; i < X ; i ++ ) { for ( int j = 2 ; ; j ++ ) { if ( ( int ) Math . pow ( i , j ) > X ) { continue lavel ; } else if ( ans < ( int ) Math . pow ( i , j ) ) { System . out . println ( " [LOG] Block: ans = (int) Math.pow(i, j); " ) ; ans = ( int ) Math . pow ( i , j ) ; } } } System . out . println ( ans ) ; } } +import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; public class Main { 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 n = 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 ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } d = e ; } System . out . println ( cnt ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; if ( n < 10 ) { System . out . println ( n ) ; } else if ( n < 100 ) { System . out . println ( 9 ) ; } else if ( n < 1000 ) { System . out . println ( 9 + n - 99 ) ; } else if ( n < 10000 ) { System . out . println ( 909 ) ; } else if ( n < 100000 ) { System . out . println ( 909 + n - 9999 ) ; } else { System . out . println ( " [LOG] Block: System.out.println(90909); " ) ; System . out . println ( 90909 ) ; } sc . close ( ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String [ ] boxstr = new String [ line . length ( ) ] ; int [ ] box = new int [ line . length ( ) ] ; int answw = 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 ( answw % ans == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; class Main { int n ; 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 ) { n = sc . nextInt ( ) ; d = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } } void solve ( ) { boolean [ ] cnt = new boolean [ 100 ] ; for ( int i = 0 ; i < n ; i ++ ) { cnt [ d [ i ] - 1 ] = true ; } int dan = 0 ; for ( boolean f : cnt ) { System . out . println ( " [LOG] Block: if (f) \n dan++; " ) ; if ( f ) dan ++ ; } System . out . println ( dan ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String num = scan.nextLine(); \n scan.close(); \n switch(num.charAt(num.length() - 1)) { \n case '2': \n case '4': \n case '5': \n case '7': \n case '9': \n System.out.println( \" hon \" ); \n break; \n case '0': \n case '1': \n case '6': \n case '8': \n System.out.println( \" pon \" ); \n break; \n case '3': \n System.out.println( \" bon \" ); \n break; \n default: \n break; \n } " ) ; Scanner scan = new Scanner ( System . in ) ; String num = scan . nextLine ( ) ; scan . close ( ) ; switch ( num . charAt ( num . 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scanner = new Scanner(System.in); \n int amount = scanner.nextInt(); \n int result = amount + (int) Math.pow(amount, 2) + (int) Math.pow(amount, 3); \n System.out.println(result); " ) ; Scanner scanner = new Scanner ( System . in ) ; int amount = scanner . nextInt ( ) ; int result = amount + ( int ) Math . pow ( amount , 2 ) + ( int ) Math . pow ( amount , 3 ) ; System . out . println ( result ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; double ans = 0.0 ; for ( int i = 1 ; i <= N ; i ++ ) { double tmp = 1.0 / N ; int now = i ; while ( now < K ) { System . out . println ( " [LOG] Block: now *= 2; \n tmp /= 2; " ) ; now *= 2 ; tmp /= 2 ; } ans += tmp ; } System . out . println ( ans ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int count = scan . nextInt ( ) ; int strlenge = scan . nextInt ( ) ; String [ ] output = new String [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { output [ i ] = scan . next ( ) ; } Arrays . sort ( output ) ; for ( int i = 0 ; i < count ; i ++ ) { System . out . println ( " [LOG] Block: System.out.print(output[i]); " ) ; System . out . print ( output [ i ] ) ; } scan . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int A = sc.nextInt(); \n int B = sc.nextInt(); \n int T = sc.nextInt(); \n sc.close(); \n int a = T / A; \n System.out.println(a * B); " ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; sc . close ( ) ; int a = T / A ; System . out . println ( a * B ) ; } } +import java . util . * ; import java . util . Arrays ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int [ ] a = new int [ 10 ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int i = 9 ; i > 6 ; i -- ) { System . out . println ( " [LOG] Block: System.out.println(a[i]); " ) ; System . out . println ( a [ i ] ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] lines = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( lines [ 0 ] ) ; int m = Integer . parseInt ( lines [ 1 ] ) ; int [ ] rowSum = new int [ m ] ; for ( int i = 0 ; i < n ; 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 ++ ) { System . out . println ( " [LOG] Block: totalSum += rowSum[i]; \n System.out.print(rowSum[i] + \" \" ); " ) ; totalSum += rowSum [ i ] ; System . out . print ( rowSum [ i ] + " " ) ; } System . out . println ( totalSum ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = n ; int num = 0 ; while ( q > 0 ) { num += q % 10 ; q = q / 10 ; } if ( n % num == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = n * a ; if ( ans >= b ) { System . out . println ( " [LOG] Block: ans = b; " ) ; ans = b ; } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int all = 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 ++ ) { all = all + 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 ++ ) { System . out . println ( " [LOG] Block: all = all + c[CN.get(l) - 1]; " ) ; all = all + c [ CN . get ( l ) - 1 ] ; } System . out . println ( all ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n double r = Double.parseDouble(br.readLine()); \n System.out.printf( \" %.6f %.6f \" , r * r * Math.PI, 2 * r * Math.PI); " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double r = Double . parseDouble ( br . readLine ( ) ) ; System . out . printf ( " %.6f %.6f " , r * r * Math . PI , 2 * r * Math . PI ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long count = 0 ; long count1 = 0 ; int [ ] array = new int [ 3 ] ; Arrays . sort ( array ) ; if ( n <= 9 && m <= 9 ) { System . out . println ( n * m ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: int x = sc.nextInt(); \n total += x; \n max = Math.max(x, max); " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String buff = " " ; int m = 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 < m ; i ++ ) { array [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m - 1 ; i ++ ) { for ( int j = i + 1 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: count += array[i] * array[j]; " ) ; count += array [ i ] * array [ j ] ; } } System . out . println ( count ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; class Main { public static void main ( String [ ] args ) { int n = 0 ; int x = 0 ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; for ( int i = 1 ; i != n + 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 { System . out . println ( " [LOG] Block: x /= 10; " ) ; x /= 10 ; } } } } System . out . println ( " " ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { BufferedReader inMsg = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = " " ; try { while ( ( line = inMsg . readLine ( ) ) != null ) { String [ ] ab = line . 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n long a = sc.nextLong(); \n long b = sc.nextLong(); \n long div = n / (a + b); \n long rem = n % (a + b); \n long sum = div * a; \n sum += Math.min(rem, a); \n System.out.println(sum); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long div = n / ( a + b ) ; long rem = n % ( a + b ) ; long sum = div * a ; sum += Math . min ( rem , a ) ; System . out . println ( sum ) ; } } +import java . io . IOException ; import java . util . NoSuchElementException ; import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; int atA = 200001 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'A' ) { atA = i ; break ; } } int atZ = - 1 ; for ( int i = s . length ( ) - 1 ; 0 <= i ; i -- ) { if ( s . charAt ( i ) == 'Z' ) { System . out . println ( " [LOG] Block: atZ = i; \n break; " ) ; atZ = i ; break ; } } System . out . println ( atZ - atA + 1 ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( i != tmp ) { cnt ++ ; } } if ( cnt == 0 || cnt == 2 ) { System . out . print ( " YES " ) ; } else { System . out . println ( " [LOG] Block: System.out.print( \" NO \" ); " ) ; System . out . print ( " NO " ) ; } } } +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 Main { 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 A = 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 == A && d == B ) { System . out . println ( " [LOG] Block: ans = i; \n break; " ) ; ans = i ; break ; } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . math . BigInteger ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; long N = sc . nextLong ( ) ; BigInteger K = BigInteger . valueOf ( N ) ; 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 ( " [LOG] Block: System.out.println(c); \n return; " ) ; System . out . println ( c ) ; return ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] tmp = sc . nextLine ( ) . split ( " " ) ; int a = Integer . valueOf ( tmp [ 0 ] ) ; int b = Integer . valueOf ( tmp [ 1 ] ) ; int sum = judge ( a , b ) ; if ( a < b ) { b -- ; } else { a -- ; } sum += judge ( a , b ) ; System . out . println ( sum ) ; } public static int judge ( int a , int b ) { int res = 0 ; if ( a < b ) { res = b ; } else { System . out . println ( " [LOG] Block: res = a; " ) ; res = a ; } return res ; } } +import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; HashSet < Integer > sunuke = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; 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 ) ) { System . out . println ( " [LOG] Block: sunuke.remove(temp); " ) ; sunuke . remove ( temp ) ; } } } System . out . println ( sunuke . size ( ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int num = sc . nextInt ( ) ; int taro = 0 , hanako = 0 ; for ( int i = 0 ; i < num ; 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 { System . out . println ( " [LOG] Block: taro += 1; \n hanako += 1; " ) ; taro += 1 ; hanako += 1 ; } } System . out . println ( taro + " " + hanako ) ; } } } +import java . util . Scanner ; public class Main { 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 i = 0 ; i < 3 ; i ++ ) { if ( a [ i ] . equals ( " 1 " ) ) { a [ i ] = " 9 " ; } else if ( a [ i ] . equals ( " 9 " ) ) { System . out . println ( " [LOG] Block: a[i] = \" 1 \" ; " ) ; a [ i ] = " 1 " ; } } System . out . println ( a [ 0 ] + a [ 1 ] + a [ 2 ] ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = scan . nextInt ( ) ; } insertionSort ( A , N ) ; } public static void insertionSort ( int [ ] A , int N ) { String output = Arrays . toString ( A ) . replaceAll ( " , " , " " ) ; System . out . println ( output . substring ( 1 , output . length ( ) - 1 ) ) ; for ( int i = 1 ; i < N ; i ++ ) { int v = A [ i ] ; int j = i - 1 ; while ( j >= 0 && A [ j ] > v ) { System . out . println ( " [LOG] Block: A[j + 1] = A[j]; \n j--; \n A[j + 1] = 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 . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; out . println ( Math . max ( c - ( a - b ) , 0 ) ) ; out . flush ( ) ; } public static class FastScanner { 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; 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 ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } return str ; } } } +import java . math . BigInteger ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { int n , i , j , m , k , p , q , o , l , s , tt = 1 ; Double x , y , z ; int [ ] ar , br ; char ch ; BigInteger an , su , u , v ; String a , b = " " , c = " " , d ; Scanner sc = new Scanner ( System . in ) ; Scanner scc = new Scanner ( System . in ) ; ar = new int [ 200001 ] ; br = new int [ 200001 ] ; n = sc . nextInt ( ) ; k = 50000000 ; for ( i = 0 ; i < n ; i ++ ) { o = sc . nextInt ( ) ; if ( k > o ) { k = o ; } ar [ i ] = o ; br [ i ] = k ; } k = 0 ; for ( i = 1 ; i < n ; i ++ ) { if ( ar [ i ] <= br [ i ] ) { System . out . println ( " [LOG] Block: k++; " ) ; k ++ ; } } System . out . println ( k + 1 ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ sc . nextInt ( ) - 1 ] ++ ; b [ sc . nextInt ( ) - 1 ] ++ ; } sc . close ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(a[i] + b[i]); " ) ; System . out . println ( a [ i ] + b [ i ] ) ; } } } +import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int hp = 0 ; List < Integer > takoyaki = new ArrayList < Integer > ( ) ; takoyaki . add ( sc . nextInt ( ) ) ; for ( int i = 1 ; i < num ; i ++ ) { takoyaki . add ( sc . nextInt ( ) ) ; for ( int j = 0 ; j < i ; j ++ ) { System . out . println ( " [LOG] Block: hp = hp + takoyaki.get(i) * takoyaki.get(j); " ) ; hp = hp + takoyaki . get ( i ) * takoyaki . get ( j ) ; } } System . out . println ( hp ) ; } } +import java . util . Scanner ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; boolean flg = false ; for ( int i = 0 ; i < s . length ( ) ; i = i + 2 ) { if ( ! ( s . charAt ( i ) == 'R' || s . charAt ( i ) == 'U' || s . charAt ( i ) == 'D' ) ) { flg = 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' ) ) { flg = true ; break ; } } if ( flg ) { System . out . println ( " No " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); " ) ; System . out . println ( " Yes " ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] split = s . split ( " " ) ; int i ; int count = 0 , ans = 0 ; for ( i = 0 ; i < s . length ( ) ; i ++ ) { if ( split [ i ] . equals ( " A " ) || split [ i ] . equals ( " C " ) || split [ i ] . equals ( " G " ) || split [ i ] . equals ( " T " ) ) { count += 1 ; } else { if ( ans < count ) { System . out . println ( " [LOG] Block: ans = count; " ) ; ans = count ; } count = 0 ; } } if ( ans < count ) { System . out . println ( " [LOG] Block: ans = count; " ) ; ans = count ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; if ( s . charAt ( 0 ) != 'A' ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } int cCnt = 0 ; int cIndex = 0 ; for ( int i = 2 ; i < s . length ( ) - 1 ; i ++ ) { char c = s . charAt ( i ) ; if ( c == 'C' ) { cCnt ++ ; cIndex = i ; } } if ( cCnt != 1 ) { System . out . println ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; 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 ( " [LOG] Block: System.out.println( \" WA \" ); \n return; " ) ; System . out . println ( " WA " ) ; return ; } } } System . out . println ( " AC " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; while ( true ) { if ( ( A - 1 ) * count + 1 >= B ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } count += 1 ; } System . out . println ( count ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char st ; char [ ] ch = { 'A' , 'C' , 'G' , 'T' } ; int count = 0 ; int count_max = 0 ; boolean con ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { st = s . charAt ( i ) ; con = true ; count ++ ; for ( int j = 0 ; j < 4 && con ; j ++ ) { System . out . println ( " [LOG] Block: if (st == ch[j]) \n con = false; " ) ; if ( st == ch [ j ] ) con = false ; } if ( con ) count = 0 ; if ( count > count_max ) count_max = count ; } System . out . println ( count_max ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long [ ] A = new long [ ( int ) N ] ; int k = 1 ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] == k ) { k ++ ; } else { ans ++ ; } } if ( ans == N ) { System . out . println ( " [LOG] Block: ans = -1; " ) ; ans = - 1 ; } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = a ; i <= b ; i ++ ) { System . out . println ( " [LOG] Block: int num = i; \n int dig1 = num % 10; \n int dig2 = (num / 10) % 10; \n int dig4 = (num / 1000) % 10; \n int dig5 = num / 10000; \n if (dig1 == dig5 && dig2 == dig4) \n cnt++; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; if ( h == 0 && w == 0 ) break ; for ( int i = 0 ; i < h ; 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 . println ( " [LOG] Block: System.out.print( \" . \" ); " ) ; System . out . print ( " . " ) ; } } System . out . println ( " " ) ; } System . out . println ( " " ) ; } sc . close ( ) ; } } +import java . io . PrintStream ; import java . util . Scanner ; public class Main { 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 cnt = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( S . charAt ( i ) == T . charAt ( i ) ) { System . out . println ( " [LOG] Block: cnt++; " ) ; cnt ++ ; } } out . println ( cnt ) ; } } +import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { sB ( ) ; } void sB ( ) { int N = sc . nextInt ( ) ; int L ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: new Main().doIt(); " ) ; new Main ( ) . doIt ( ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner reader = new Scanner(System.in); \n double r = reader.nextDouble(); \n System.out.println(2 * r * 3.14159265); " ) ; Scanner reader = new Scanner ( System . in ) ; double r = reader . nextDouble ( ) ; System . out . println ( 2 * r * 3.14159265 ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] num = new int [ n ] ; 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 { System . out . println ( " [LOG] Block: left = mid + 1; " ) ; left = mid + 1 ; } } return false ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] L = new int [ N + 1 ] ; L [ 0 ] = 0 ; for ( int i = 1 ; i < N + 1 ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; System . out . println ( Bounding ( N + 1 , X , L , 0 , 0 ) ) ; } public static int Bounding ( int N , int X , int [ ] L , int index , int sum ) { if ( N <= index ) { return 0 ; } if ( sum + L [ index ] <= X ) { System . out . println ( " [LOG] Block: return 1 + Bounding(N, X, L, index + 1, sum + L[index]); " ) ; return 1 + Bounding ( N , X , L , index + 1 , sum + L [ index ] ) ; } return 0 ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a <= b ) { String stringA = String . valueOf ( a ) ; for ( int i = 1 ; i < b ; i ++ ) { stringA += a ; } System . out . println ( stringA ) ; } else { String stringB = String . valueOf ( b ) ; for ( int i = 1 ; i < a ; i ++ ) { System . out . println ( " [LOG] Block: stringB += b; " ) ; stringB += b ; } System . out . println ( stringB ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int result = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { while ( a [ i ] % 2 == 0 ) { System . out . println ( " [LOG] Block: a[i] /= 2; \n result++; " ) ; a [ i ] /= 2 ; result ++ ; } } System . out . println ( result ) ; sc . close ( ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; if ( H == 0 && W == 0 ) { break ; } for ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double [ ] v = new double [ N ] ; 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 ++ ) { System . out . println ( " [LOG] Block: res = (res + v[i]) / 2; " ) ; res = ( res + v [ i ] ) / 2 ; } System . out . println ( res ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { 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 n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } double minDiff = Math . abs ( a - temp ( t , h [ 0 ] ) ) ; int num = 0 ; for ( int i = 1 ; i < n ; i ++ ) { double hoge = Math . abs ( a - temp ( t , h [ i ] ) ) ; if ( minDiff > hoge ) { System . out . println ( " [LOG] Block: minDiff = hoge; \n num = i; " ) ; minDiff = hoge ; num = i ; } } System . out . println ( num + 1 ) ; } } +import java . util . * ; public class Main { public void main ( Scanner sc ) { int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int max = Math . max ( a1 , Math . max ( a2 , a3 ) ) ; int min = Math . min ( a1 , Math . min ( a2 , a3 ) ) ; System . out . println ( max - min ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n new Main().main(sc); \n sc.close(); " ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int t = sc.nextInt(); \n double v = t + 0.5; \n int p = 0; \n p = (int) v / a; \n int r = 0; \n r = (int) p * b; \n System.out.println(r); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; double v = t + 0.5 ; int p = 0 ; p = ( int ) v / a ; int r = 0 ; r = ( int ) p * b ; System . out . println ( r ) ; } } +import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { 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 ( ) ; System . out . println ( solve ( b , c , d ) - solve ( a - 1 , c , d ) ) ; } static long gcd ( long a , long b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } static long solve ( long b , long c , long d ) { System . out . println ( " [LOG] Block: long ret = b; \n long other = c * d / gcd(c, d); \n ret -= b / c; \n ret -= b / d; \n ret += b / other; \n return ret; " ) ; 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 Main { public static void main ( String [ ] args ) { int N ; try ( Scanner sc = new Scanner ( System . in ) ) { N = sc . nextInt ( ) ; } int maxKeta = ( int ) Math . floor ( Math . log10 ( ( double ) N ) + 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 ) { System . out . println ( " [LOG] Block: answer += N - (int) (Math.pow(10, maxKeta - 1)) + 1; " ) ; answer += N - ( int ) ( Math . pow ( 10 , maxKeta - 1 ) ) + 1 ; } System . out . println ( answer ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 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 ) { ans += i ; } } System . out . println ( ans ) ; } private static int sum ( int i ) { int sumDigits = 0 ; while ( i != 0 ) { System . out . println ( " [LOG] Block: sumDigits += i % 10; \n i /= 10; " ) ; sumDigits += i % 10 ; i /= 10 ; } return sumDigits ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = reader . readLine ( ) ; String [ ] b = a . split ( " " ) ; int c = Integer . parseInt ( b [ 0 ] ) ; int d = Integer . parseInt ( b [ 1 ] ) ; String [ ] e = new String [ d ] ; int [ ] [ ] f = new int [ c ] [ d ] ; for ( int g = 0 ; g < c ; 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 < c ; l ++ ) { for ( int m = 0 ; m < d ; m ++ ) { k += f [ l ] [ m ] * i [ m ] ; } System . out . println ( k ) ; k = 0 ; } } catch ( IOException e ) { System . out . println ( " [LOG] Block: e.printStackTrace(); " ) ; e . printStackTrace ( ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(System.in); \n String s = scan.next(); \n System.out.println(s.matches( \" [A][a-z][a-z]*[C][a-z]*[a-z] \" ) ? \" AC \" : \" WA \" ); " ) ; Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; System . out . println ( s . matches ( " [A][a-z][a-z]*[C][a-z]*[a-z] " ) ? " AC " : " WA " ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] T = new int [ N + 1 ] ; int [ ] X = new int [ N + 1 ] ; int [ ] Y = new int [ N + 1 ] ; T [ 0 ] = X [ 0 ] = Y [ 0 ] = 0 ; boolean yes = true ; for ( int i = 1 ; i <= N ; 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 ) { System . out . println ( " [LOG] Block: yes = false; \n break; " ) ; yes = false ; break ; } } System . out . println ( yes ? " Yes " : " No " ) ; } } +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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; int max = 0 ; for ( int i = 0 ; i < N ; 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 ( " [LOG] Block: System.out.println(S); " ) ; System . out . println ( S ) ; } } } +import java . io . * ; class Sta { int [ ] s ; int top ; Sta ( ) { s = new int [ 1000 ] ; top = 0 ; } void push ( int x ) { top ++ ; s [ top ] = x ; } int pop ( ) { top -- ; return s [ top + 1 ] ; } } public class Main { 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 { System . out . println ( " [LOG] Block: int t = Integer.parseInt(x); \n stack.push(t); " ) ; int t = Integer . parseInt ( x ) ; stack . push ( t ) ; } } System . out . println ( stack . pop ( ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] d = new int [ N ] ; long sum = 0 ; d [ 0 ] = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; 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 ) { System . out . println ( " [LOG] Block: if (m < n) \n return gcd(n, m); \n if (n == 0) \n return m; \n return gcd(n, m % n); " ) ; if ( m < n ) return gcd ( n , m ) ; if ( n == 0 ) return m ; return gcd ( n , m % n ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] color = new int [ 9 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; color [ Math . min ( a / 400 , 8 ) ] ++ ; } for ( int i = 0 ; i < 8 ; i ++ ) { System . out . println ( " [LOG] Block: if (color[i] > 0) \n ans++; " ) ; 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 Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; HashMap < Integer , Integer > a = new HashMap < Integer , Integer > ( ) ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int t = scan . nextInt ( ) ; a . put ( t , i + 1 ) ; b [ i ] = t ; } Arrays . sort ( b ) ; for ( int j = 0 ; j < n - 1 ; j ++ ) { System . out . println ( " [LOG] Block: System.out.print(a.get(b[j]) + \" \" ); " ) ; System . out . print ( a . get ( b [ j ] ) + " " ) ; } System . out . println ( a . get ( b [ n - 1 ] ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } int total = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i == 0 ) total += B [ i ] ; else if ( i == N - 1 ) total += B [ i - 1 ] ; else { System . out . println ( " [LOG] Block: if (B[i] > B[i - 1]) \n total += B[i - 1]; \n else \n total += B[i]; " ) ; if ( B [ i ] > B [ i - 1 ] ) total += B [ i - 1 ] ; else total += B [ i ] ; } } System . out . println ( total ) ; } } +import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int [ ] X = new int [ N ] ; int minSum = 2000000 ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { X [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( X ) ; for ( int i = X [ 0 ] ; i <= X [ N - 1 ] ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { sum += ( X [ j ] - i ) * ( X [ j ] - i ) ; } if ( sum < minSum ) { System . out . println ( " [LOG] Block: minSum = sum; " ) ; minSum = sum ; } sum = 0 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( minSum ) ; sc . close ( ) ; out . flush ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int L_MAX = 0 ; int R_MIN = N + 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 ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } } +import java . util . Scanner ; class Main { int x , y ; public void suzuki ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; while ( x != 0 || y != 0 ) { if ( x > y ) { System . out . println ( y + " " + x ) ; } else { System . out . println ( x + " " + y ) ; } x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().suzuki(); " ) ; new Main ( ) . suzuki ( ) ; } } +import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] Args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int ans = 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 ) { System . out . println ( " [LOG] Block: ans = 1; " ) ; ans = 1 ; } } if ( ans == 0 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { boolean first = 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 . println ( " [LOG] Block: System.out.print( \" # \" ); " ) ; System . out . print ( " # " ) ; } System . out . println ( ) ; } System . out . println ( ) ; } } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; boolean aa = false ; boolean bb = true ; for ( int i = 0 ; i < N ; i ++ ) { int a = Integer . parseInt ( sc . next ( ) ) ; if ( a % 2 == 0 ) { bb = false ; if ( a % 3 == 0 || a % 5 == 0 ) { aa = true ; } else { System . out . println ( " [LOG] Block: aa = false; \n break; " ) ; aa = false ; break ; } } } System . out . println ( aa || bb ? " APPROVED " : " DENIED " ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { map . put ( i , sc . nextInt ( ) ) ; } int cnt = 0 ; cnt += map . get ( 0 ) ; for ( int i = 1 ; i < N ; i ++ ) { if ( map . get ( i - 1 ) < map . get ( i ) ) { System . out . println ( " [LOG] Block: cnt += map.get(i) - map.get(i - 1); " ) ; cnt += map . get ( i ) - map . get ( i - 1 ) ; } } System . out . println ( cnt ) ; } } +import java . io . * ; public class Main { 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 h = Integer . parseInt ( arr [ 0 ] ) ; int w = Integer . parseInt ( arr [ 1 ] ) ; if ( h == 0 && w == 0 ) { break ; } for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( i == 0 || i == h - 1 || j == 0 || j == w - 1 ) { sb . append ( " # " ) ; } else { System . out . println ( " [LOG] Block: sb.append( \" . \" ); " ) ; sb . append ( " . " ) ; } } sb . append ( " \n " ) ; } sb . append ( " \n " ) ; } System . out . print ( sb ) ; } } +import java . util . Scanner ; public class Main { 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 a = 0 ; int b = 0 ; int c = 0 ; char currentChar = 'a' ; while ( true ) { if ( currentChar == 'a' ) { if ( a == s_a . length ( ) ) { System . out . println ( 'A' ) ; break ; } currentChar = s_a . charAt ( a ) ; a ++ ; } 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 ( " [LOG] Block: System.out.println('C'); \n break; " ) ; System . out . println ( 'C' ) ; break ; } currentChar = s_c . charAt ( c ) ; c ++ ; } } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( a ) ; int cost = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( i != 0 ) { System . out . println ( " [LOG] Block: cost += a[i] - a[i - 1]; " ) ; cost += a [ i ] - a [ i - 1 ] ; } } System . out . println ( cost ) ; } } +import java . util . Scanner ; import java . util . Stack ; class Main { public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } void compute ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] nanbon = new int [ N ] ; for ( int i = 0 ; i < M ; i ++ ) { nanbon [ sc . nextInt ( ) - 1 ] ++ ; nanbon [ sc . nextInt ( ) - 1 ] ++ ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(nanbon[i]); " ) ; System . out . println ( nanbon [ i ] ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( y % 2 == 1 ) { System . out . println ( " No " ) ; return ; } if ( y >= 2 * x && y <= 4 * x ) { System . out . println ( " [LOG] Block: System.out.println( \" Yes \" ); \n return; " ) ; System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { int a , b ; Scanner sc = new Scanner ( System . in ) ; do { a = sc . nextInt ( ) ; } while ( ! ( ( a >= 1 ) && ( a <= 20 ) ) ) ; do { b = sc . nextInt ( ) ; } while ( ! ( ( b >= 1 ) && ( b <= 20 ) ) ) ; if ( ( a >= 1 && a <= 9 ) && ( b >= 1 && b <= 9 ) ) { System . out . println ( a * b ) ; } else { System . out . println ( " [LOG] Block: System.out.println(-1); " ) ; System . out . println ( - 1 ) ; } } } +import java . math . BigInteger ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; BigInteger c = BigInteger . valueOf ( a ) . multiply ( BigInteger . valueOf ( b ) ) ; int d = a % b ; while ( d != 0 ) { System . out . println ( " [LOG] Block: a = b; \n b = d; \n d = a % b; " ) ; a = b ; b = d ; d = a % b ; } System . out . println ( c . divide ( BigInteger . valueOf ( b ) ) ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int a = sc . nextInt ( ) ; int ans = 0 ; ans = a + ( int ) Math . pow ( a , 2 ) + ( int ) Math . pow ( a , 3 ) ; System . out . println ( ans ) ; } private static class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { System . out . println ( " [LOG] Block: return Integer.parseInt(next()); " ) ; return Integer . parseInt ( next ( ) ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = scn . nextInt ( ) ; } Arrays . sort ( h ) ; long att = 0 ; for ( int i = 0 ; i < n - k ; i ++ ) { System . out . println ( " [LOG] Block: att = att + h[i]; " ) ; att = att + h [ i ] ; } System . out . println ( att ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x , t = 1 ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { System . out . println ( " [LOG] Block: x = sc.nextInt(); \n if (x == 0) \n break; \n System.out.println( \" Case \" + t++ + \" : \" + x); " ) ; x = sc . nextInt ( ) ; if ( x == 0 ) break ; System . out . println ( " Case " + t ++ + " : " + x ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a , b ; Scanner scanner = new Scanner ( System . in ) ; while ( scanner . hasNext ( ) ) { System . out . println ( " [LOG] Block: a = scanner.nextInt(); \n b = scanner.nextInt(); \n System.out.println((String.valueOf(a + b).length())); " ) ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; System . out . println ( ( String . valueOf ( a + b ) . length ( ) ) ) ; } scanner . close ( ) ; } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader 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 x = 0 ; x < arrayLength ; x ++ ) { for ( byte y = ( byte ) ( arrayLength - 1 ) ; y > x ; 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 . println ( " [LOG] Block: System.out.print(array[z] + \" \" ); " ) ; System . out . print ( array [ z ] + " " ) ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = 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 ++ ) { System . out . println ( " [LOG] Block: if (a[i] == '+') \n N = N + 1; \n else \n N = N - 1; " ) ; if ( a [ i ] == '+' ) N = N + 1 ; else N = N - 1 ; } System . out . print ( N ) ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int a = 0 ; int z = 0 ; while ( s . charAt ( a ) != 'A' ) { a ++ ; } for ( int i = a + 1 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == 'Z' ) { System . out . println ( " [LOG] Block: z = i; " ) ; z = i ; } } System . out . println ( z - a + 1 ) ; } } +import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { static int n = 0 ; public static void main ( String [ ] args ) { int anser = 100000000 ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; ArrayList < Integer > address = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { address . add ( scan . nextInt ( ) ) ; } Collections . sort ( address ) ; for ( int i = address . get ( 0 ) ; i <= address . get ( n - 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 < n ; i ++ ) { System . out . println ( " [LOG] Block: sum = sum + (j - array.get(i)) * (j - array.get(i)); " ) ; sum = sum + ( j - array . get ( i ) ) * ( j - array . get ( i ) ) ; } return sum ; } } +import java . util . * ; public class Main { 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 c = a + b ; long p = n / c ; long q = n % c ; if ( q > a ) { System . out . println ( " [LOG] Block: q = a; " ) ; q = a ; } long ans = a * p + q ; System . out . println ( ans ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] st = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: st[i] = sc.nextInt(); " ) ; st [ i ] = sc . nextInt ( ) ; } Arrays . sort ( st ) ; int a = st [ 0 ] ; int b = st [ n - 1 ] ; System . out . println ( Math . abs ( a - b ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s ; int m ; int i ; Deck d = new Deck ( ) ; while ( ! ( s = sc . next ( ) ) . equals ( " - " ) ) { d . setDeck ( s ) ; m = sc . nextInt ( ) ; for ( i = 0 ; i < m ; i ++ ) { d . shuffle ( sc . nextInt ( ) ) ; } d . printDeck ( ) ; } } } class Deck { 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 ( " [LOG] Block: System.out.println(this.str); " ) ; System . out . println ( this . str ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scan = new Scanner ( System . in ) ; int count = scan . nextInt ( ) ; double sum = 0 ; for ( int i = 0 ; i < count && scan . hasNextInt ( ) ; i ++ ) { System . out . println ( " [LOG] Block: sum += (1 / (double) scan.nextInt()); " ) ; sum += ( 1 / ( double ) scan . nextInt ( ) ) ; } System . out . println ( 1 / sum ) ; } } +import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] d = new Integer [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( d , Collections . reverseOrder ( ) ) ; int ans = 1 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( d [ i ] > d [ i + 1 ] ) { System . out . println ( " [LOG] Block: ans++; " ) ; ans ++ ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; public class Main { public static final String OK = " Yay! " ; public static final String NO = " :( " ; public static void main ( final String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = sc.nextInt(); \n int b = sc.nextInt(); \n int c = sc.nextInt(); \n int d = sc.nextInt(); \n int e = sc.nextInt(); \n int k = sc.nextInt(); \n sc.close(); \n if (e - a > k) \n System.out.println(NO); \n else \n System.out.println(OK); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a > k ) System . out . println ( NO ) ; else System . out . println ( OK ) ; } } +import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { 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 c : array ) { if ( map . containsKey ( c ) ) { System . out . println ( " [LOG] Block: map.put(c, map.get(c) + 1); " ) ; map . put ( c , map . get ( c ) + 1 ) ; } } System . out . println ( map . get ( '1' ) ) ; } } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s1 = sc . next ( ) ; int a = 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 <= a && a <= 20000 ) { if ( 0 <= b && b <= 20000 ) { if ( op == '+' ) { System . out . println ( a + b ) ; } else if ( op == '-' ) { System . out . println ( a - b ) ; } else if ( op == '*' ) { System . out . println ( a * b ) ; } else if ( op == '/' ) { System . out . println ( " [LOG] Block: System.out.println(a / b); " ) ; System . out . println ( a / b ) ; } } } } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { final String RESULT_YES = " Yes " ; final String RESULT_NO = " No " ; Scanner sc = new Scanner ( System . in ) ; int postOfficeCode = sc . nextInt ( ) ; int locationCode = sc . nextInt ( ) ; String val = sc . next ( ) ; boolean result = false ; if ( val . matches ( " [0-9] { " + postOfficeCode + " } -[0-9] { " + locationCode + " } " ) ) { result = true ; } if ( result ) { System . out . println ( RESULT_YES ) ; } else { System . out . println ( " [LOG] Block: System.out.println(RESULT_NO); " ) ; System . out . println ( RESULT_NO ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; scan . close ( ) ; long sum = 0 ; for ( int a = 1 ; a <= N ; a ++ ) { for ( int b = 1 ; b <= N ; b ++ ) { for ( int c = 1 ; c <= N ; 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 ) { System . out . println ( " [LOG] Block: a = b; \n b = r; \n r = a % b; " ) ; a = b ; b = r ; r = a % b ; } return b ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int hitPoint = 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 ( hitPoint <= damage ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int ans = 0 ; int b = 1 ; ArrayList < Integer > list = new ArrayList ( ) ; while ( n > 0 ) { list . add ( n % 10 ) ; n /= 10 ; } for ( int i = 0 ; i < 3 ; i ++ ) { if ( list . get ( i ) == 9 ) { ans += 1 * b ; } else if ( list . get ( i ) == 1 ) { System . out . println ( " [LOG] Block: ans += 9 * b; " ) ; ans += 9 * b ; } b *= 10 ; } System . out . println ( ans ) ; } } +import java . util . * ; public class Main { static final int MOD = 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 ) { System . out . println ( " [LOG] Block: result++; " ) ; result ++ ; } System . out . println ( ( w * h / 2.0 ) + " " + result ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int a = Integer.parseInt(sc.next()); \n int b = a + (a * a) + (a * a * a); \n System.out.println(b); " ) ; Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = a + ( a * a ) + ( a * a * a ) ; System . out . println ( b ) ; } } +import java . io . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; int W = in . nextInt ( ) ; int H = in . nextInt ( ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; int r = in . nextInt ( ) ; if ( 0 <= x - r && x + r <= W && 0 <= y - r && y + r <= H ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < p ; i ++ ) { System . out . println ( " [LOG] Block: double x1 = sc.nextDouble(); \n double x2 = sc.nextDouble(); \n double dis = Math.sqrt(Math.pow(x1, 2) + Math.pow(x2, 2)); \n if (dis <= q) \n result++; " ) ; 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 . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( n >= s . length ( ) ) { System . out . println ( s ) ; } else { System . out . println ( " [LOG] Block: System.out.println(s.substring(0, n) + \" ... \" ); " ) ; System . out . println ( s . substring ( 0 , n ) + " ... " ) ; } } catch ( Exception e ) { } finally { } } } +import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 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 ( x - Integer . parseInt ( numList . get ( i ) ) ) ; if ( abs < minAbs ) { System . out . println ( " [LOG] Block: minAbs = abs; \n ans = Integer.parseInt(numList.get(i)); " ) ; minAbs = abs ; ans = Integer . parseInt ( numList . get ( i ) ) ; } } System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( a <= b ) { if ( b <= c ) { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * c + a + b ) ) ; } else { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * b + a + c ) ) ; } } else { if ( a <= c ) { System . out . println ( ( int ) ( Math . pow ( 2 , k ) * c + a + b ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println((int) (Math.pow(2, k) * a + b + c)); " ) ; System . out . println ( ( int ) ( Math . pow ( 2 , k ) * a + b + c ) ) ; } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] d1 = new int [ n ] ; int [ ] d2 = new int [ n ] ; for ( int i = 0 ; i <= n - 1 ; i ++ ) { d1 [ i ] = sc . nextInt ( ) ; d2 [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i <= n - 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 == n - 3 ) { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } sc . close ( ) ; } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n long n = sc.nextLong(); \n double m = sc.nextLong(); \n long result = (long) Math.round(m * 100); \n result = result * n / 100; \n System.out.println(result); " ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; double m = sc . nextLong ( ) ; long result = ( long ) Math . round ( m * 100 ) ; result = result * n / 100 ; System . out . println ( result ) ; } } +import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int n = 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 < n ; 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 = n ; int mid ; while ( left < right ) { System . out . println ( " [LOG] Block: mid = (left + right) / 2; \n if (key == a[mid]) \n return true; \n if (key > a[mid]) \n left = mid + 1; \n else if (key < a[mid]) \n right = mid; " ) ; 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 . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { System . out . println ( " [LOG] Block: Scanner scan = new Scanner(is); \n int A = scan.nextInt(); \n int B = scan.nextInt(); \n os.println(A * B); " ) ; Scanner scan = new Scanner ( is ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; os . println ( A * B ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; if ( c - ( a - b ) >= 0 ) { System . out . println ( c - ( a - b ) ) ; } else { System . out . println ( " [LOG] Block: System.out.println(0); " ) ; System . out . println ( 0 ) ; } } } +import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: FastReader obj = new FastReader(); \n String str = obj.next(); \n System.out.println((str.compareTo( \" ABC \" ) == 0) ? \" ARC \" : \" ABC \" ); " ) ; FastReader obj = new FastReader ( ) ; String str = obj . next ( ) ; System . out . println ( ( str . compareTo ( " ABC " ) == 0 ) ? " ARC " : " ABC " ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] A = new int [ n ] [ m ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; 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 [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . println ( " [LOG] Block: c[i] += A[i][j] * b[j]; " ) ; c [ i ] += A [ i ] [ j ] * b [ j ] ; } } for ( int ans : c ) System . out . println ( ans ) ; sc . close ( ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: int length; \n Scanner sc = new Scanner(System.in); \n String num = sc.next(); \n num = num.replaceAll( \" 0 \" , \" \" ); \n length = num.length(); \n System.out.println(length); " ) ; int length ; Scanner sc = new Scanner ( System . in ) ; String num = sc . next ( ) ; num = num . replaceAll ( " 0 " , " " ) ; length = num . length ( ) ; System . out . println ( length ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int [ ] ans = new int [ num + 1 ] ; for ( int i = 1 ; i < num ; i ++ ) { int a = sc . nextInt ( ) ; ans [ a ] ++ ; } for ( int i = 1 ; i <= num ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(ans[i]); " ) ; System . out . println ( ans [ i ] ) ; } } } +import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long K = sc . nextLong ( ) ; long nA = Math . max ( 0 , A - K ) ; long nB = Math . max ( 0 , B - Math . max ( K - A , 0 ) ) ; System . out . println ( nA + " " + nB ) ; } void tr ( Object ... objects ) { System . out . println ( " [LOG] Block: System.out.println(Arrays.deepToString(objects)); " ) ; System . out . println ( Arrays . deepToString ( objects ) ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int count = 0 ; int now = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int n = Integer . parseInt ( S [ i ] ) ; if ( n > now ) { count += n - now ; now = n ; } else { System . out . println ( " [LOG] Block: now = n; " ) ; now = n ; } } System . out . println ( count ) ; } } +import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int n , t ; int [ ] data = new int [ 3 ] ; n = cin . nextInt ( ) ; while ( n -- > 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 ( " [LOG] Block: System.out.println( \" NO \" ); " ) ; System . out . println ( " NO " ) ; } } } } +import java . util . Scanner ; import java . util . Stack ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] A = scan . nextLine ( ) . split ( " " ) ; Stack < Integer > num = new Stack < Integer > ( ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < A . length ; i ++ ) { if ( A [ i ] . equals ( " + " ) ) { a = num . pop ( ) ; b = num . pop ( ) ; num . add ( b + a ) ; continue ; } if ( A [ i ] . equals ( " - " ) ) { a = num . pop ( ) ; b = num . pop ( ) ; num . add ( b - a ) ; continue ; } if ( A [ i ] . equals ( " * " ) ) { a = num . pop ( ) ; b = num . pop ( ) ; num . add ( b * a ) ; continue ; } if ( A [ i ] . equals ( " / " ) ) { System . out . println ( " [LOG] Block: a = num.pop(); \n b = num.pop(); \n num.add(b / a); \n continue; " ) ; a = num . pop ( ) ; b = num . pop ( ) ; num . add ( b / a ) ; continue ; } num . push ( Integer . parseInt ( A [ i ] ) ) ; } System . out . println ( num . pop ( ) ) ; } } +import java . util . * ; import javax . swing . text . AbstractDocument . BranchElement ; import com . sun . org . apache . xpath . internal . SourceTree ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Set < Integer > ans1 = new TreeSet < > ( ) ; for ( int i = 1 ; i <= a ; i ++ ) { if ( a % 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 ) { System . out . println ( " [LOG] Block: break; " ) ; break ; } } } System . out . println ( result . get ( result . size ( ) - k ) ) ; } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int maxPotision = 0 ; int maxValue = 0 ; int secondValue = 0 ; boolean maxDup = false ; for ( int i = 0 ; i < N ; 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 < N ; i ++ ) { System . out . println ( " [LOG] Block: System.out.println(maxValue); " ) ; System . out . println ( maxValue ) ; } } else { for ( int i = 0 ; i < N ; i ++ ) { if ( i == maxPotision ) { System . out . println ( secondValue ) ; } else { System . out . println ( " [LOG] Block: System.out.println(maxValue); " ) ; System . out . println ( maxValue ) ; } } } } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; System . out . println ( helper ( a , b ) ) ; sc . close ( ) ; } static long helper ( long a , long b ) { long v = a , u = b , y ; while ( b > 0 ) { System . out . println ( " [LOG] Block: y = a % b; \n a = b; \n b = y; " ) ; y = a % b ; a = b ; b = y ; } return v * u / a ; } } +import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { 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 ( " " ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { P [ i ] = Integer . parseInt ( Ws [ i ] ) ; } int ans = 0 ; int Pj = Integer . MAX_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { if ( P [ i ] <= Pj ) { System . out . println ( " [LOG] Block: ans++; \n Pj = P[i]; " ) ; ans ++ ; Pj = P [ i ] ; } } System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int taroPoint = 0 ; int hanakoPoint = 0 ; scanner . nextLine ( ) ; for ( int i = 1 ; i <= n ; 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 { System . out . println ( " [LOG] Block: hanakoPoint += 3; " ) ; hanakoPoint += 3 ; } } System . out . println ( Integer . toString ( taroPoint ) + " " + Integer . toString ( hanakoPoint ) ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] ary = sc . next ( ) . toCharArray ( ) ; int ans = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( ary [ i ] == '+' ) { ans ++ ; } else { System . out . println ( " [LOG] Block: ans--; " ) ; ans -- ; } } sc . close ( ) ; System . out . println ( ans ) ; } } +import java . util . Scanner ; class Main { public void cubic ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String out = " No " ; if ( a < b ) { if ( b < c ) { out = " Yes " ; } } System . out . println ( out ) ; } public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: new Main().cubic(); " ) ; new Main ( ) . cubic ( ) ; } } +import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { int w , 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 ) ) ; } w = 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 ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } else if ( 0 <= ( x + r ) && ( x + r ) <= w && 0 <= ( y + r ) && ( y + r ) <= h ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { System . out . println ( " [LOG] Block: Scanner in = new Scanner(System.in); \n String compet = in.nextLine(); \n if (compet.equals( \" ABC \" )) \n System.out.println( \" ARC \" ); \n else if (compet.equals( \" ARC \" )) \n System.out.println( \" ABC \" ); " ) ; Scanner in = new Scanner ( System . in ) ; String compet = in . nextLine ( ) ; if ( compet . equals ( " ABC " ) ) System . out . println ( " ARC " ) ; else if ( compet . equals ( " ARC " ) ) System . out . println ( " ABC " ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int 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 ] = ( ( K - A . get ( i + 1 ) ) + A . get ( 0 ) ) ; } right [ i ] = A . get ( i + 1 ) - A . get ( i ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { System . out . println ( " [LOG] Block: if (max < Math.max(right[i + 1], right[i])) \n max = Math.max(right[i + 1], right[i]); " ) ; if ( max < Math . max ( right [ i + 1 ] , right [ i ] ) ) max = Math . max ( right [ i + 1 ] , right [ i ] ) ; } System . out . println ( K - max ) ; } } +import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextLong ( ) ; long count = 0 ; while ( n > 1 ) { n = n / 2 ; count ++ ; } long answer = 0 ; for ( int i = 0 ; i <= count ; i ++ ) { System . out . println ( " [LOG] Block: answer += Math.pow(2, i); " ) ; answer += Math . pow ( 2 , i ) ; } System . out . println ( answer ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S1 = 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 ++ ) { S1 = 0 ; S2 = 0 ; S3 = 0 ; for ( int k = 0 ; k <= j ; k ++ ) { S1 = S1 + arys [ k ] ; } for ( int k = j + 1 ; k <= N - 1 ; k ++ ) { S2 = S2 + arys [ k ] ; } S3 = Math . abs ( S1 - S2 ) ; anss [ j ] = S3 ; } int ans = anss [ 0 ] ; for ( int i = 0 ; i <= N - 2 ; i ++ ) { System . out . println ( " [LOG] Block: ans = Math.min(ans, anss[i]); " ) ; ans = Math . min ( ans , anss [ i ] ) ; } System . out . println ( ans ) ; } } +import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int m = 0 , f = 0 , r = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String str = br . readLine ( ) ; String [ ] i = str . split ( " " ) ; m = Integer . parseInt ( i [ 0 ] ) ; f = Integer . parseInt ( i [ 1 ] ) ; r = Integer . parseInt ( i [ 2 ] ) ; if ( m == ( - 1 ) && f == ( - 1 ) && r == ( - 1 ) ) { break ; } if ( m == ( - 1 ) || f == ( - 1 ) ) { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } else if ( m + f >= 80 ) { System . out . println ( " A " ) ; } else if ( m + f >= 65 ) { System . out . println ( " B " ) ; } else if ( m + f >= 50 ) { System . out . println ( " C " ) ; } else if ( m + f >= 30 ) { if ( r >= 50 ) { System . out . println ( " C " ) ; } else { System . out . println ( " D " ) ; } } else { System . out . println ( " [LOG] Block: System.out.println( \" F \" ); " ) ; System . out . println ( " F " ) ; } } } } +import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = scan . nextInt ( ) ; } Arrays . parallelSort ( ar ) ; float ans = 0 ; float [ ] lol = new float [ n ] ; lol [ 0 ] = ar [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { System . out . println ( " [LOG] Block: lol[i] = (float) ((ar[i] + lol[i - 1]) / 2); " ) ; lol [ i ] = ( float ) ( ( ar [ i ] + lol [ i - 1 ] ) / 2 ) ; } System . out . printf ( " %.04f " , lol [ n - 1 ] ) ; } } +import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; long sum = 0 ; int l = s . length ( ) ; for ( int i = 0 ; i < l ; i ++ ) { int num = Character . getNumericValue ( s . charAt ( i ) ) ; sum += num ; } if ( sum % 9 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " [LOG] Block: System.out.println( \" No \" ); " ) ; System . out . println ( " No " ) ; } scan . close ( ) ; } } +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 Main { public static void main ( String [ ] args ) throws IOException { System . out . println ( " [LOG] Block: Scanner sc = new Scanner(System.in); \n int W = sc.nextInt(); \n int H = sc.nextInt(); \n int x = sc.nextInt(); \n int y = sc.nextInt(); \n int r = sc.nextInt(); \n System.out.println((x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) ? \" Yes \" : \" No \" ); " ) ; Scanner sc = new Scanner ( System . in ) ; int W = 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 <= W && y - r >= 0 && y + r <= H ) ? " Yes " : " No " ) ; } } +import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int b = 0 ; b < n ; ++ b ) { a [ b ] = sc . nextInt ( ) ; } for ( int b = n - 1 ; b >= 0 ; -- b ) { if ( b != 0 ) { System . out . print ( a [ b ] + " " ) ; } else { System . out . println ( " [LOG] Block: System.out.println(a[b]); " ) ; System . out . println ( a [ b ] ) ; } } } } +import java . io . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int count = 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 ) { System . out . println ( " [LOG] Block: count++; " ) ; count ++ ; } } } } System . out . println ( count ) ; } } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] alpha = new int [ n ] ; int i , j ; for ( i = 0 ; i < n ; 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 ++ ) { System . out . println ( " [LOG] Block: ans += alpha[j]; " ) ; ans += alpha [ j ] ; } System . out . println ( ans ) ; } } +import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > b ) { System . out . println ( 2 * a - 1 ) ; } else if ( a == b ) { System . out . println ( 2 * a ) ; } else { System . out . println ( " [LOG] Block: System.out.println(2 * b - 1); " ) ; System . out . println ( 2 * b - 1 ) ; } } } +import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( buf . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int num = 0 ; for ( int j = 3 ; j <= n ; j ++ ) { if ( j % 3 == 0 ) { sb . append ( " " + j ) ; } else { num = j ; while ( num != 0 ) { if ( num % 10 == 3 ) { sb . append ( " " + j ) ; break ; } else { System . out . println ( " [LOG] Block: num = num / 10; " ) ; num = num / 10 ; } } } } System . out . println ( sb ) ; } } +import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int [ ] arr = new int [ 1000000 ] ; arr [ 0 ] = s ; Set < Integer > set = new HashSet < > ( ) ; set . add ( s ) ; 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 { System . out . println ( " [LOG] Block: set.add(arr[i]); " ) ; set . add ( arr [ i ] ) ; } } } }