import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; String str2 = sc . nextLine ( ) ; int size = str . length ( ) ; int size2 = str2 . length ( ) ; int flag = 1 ; while ( true ) { if ( str . equals ( str2 ) ) { break ; } else { size2 = size2 - 1 ; String str3 = str . substring ( 0 , 1 ) ; str = str . substring ( 1 , size ) ; str = str . concat ( str3 ) ; if ( size2 == 0 ) { flag = 0 ; break ; } } } if ( flag == 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 ) { new Main ( ) . solveB ( ) ; } private void solveA ( ) { Scanner scanner = null ; try { scanner = new Scanner ( System . in ) ; int [ ] wk = new int [ 3 ] ; for ( int i = 0 ; i < wk . length ; i ++ ) { wk [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( wk ) ; int res = Math . abs ( wk [ 0 ] - wk [ 1 ] ) + Math . abs ( wk [ 1 ] - wk [ 2 ] ) ; System . out . println ( res ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; String s ; String t ; try { scanner = new Scanner ( System . in ) ; s = scanner . next ( ) ; t = scanner . next ( ) ; s = s + s ; System . out . println ( s . contains ( t ) ? " Yes " : " No " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String A = br . readLine ( ) ; String B = br . readLine ( ) ; int lengths = A . length ( ) ; boolean Bb [ ] = new boolean [ lengths ] ; for ( int i = 0 ; i < lengths ; i ++ ) { Bb [ i ] = false ; } int k = 0 ; for ( int i = 0 ; i < lengths ; i ++ ) { if ( i == 0 ) { for ( int j = 0 ; ; j ++ ) { if ( j == lengths ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } if ( ! Bb [ j ] && A . substring ( i , i + 1 ) . equals ( B . substring ( j , j + 1 ) ) ) { Bb [ j ] = true ; k = j ; break ; } } } else { int l = k + i >= lengths ? k + i - lengths : k + i ; if ( ! A . substring ( i , i + 1 ) . equals ( B . substring ( l , l + 1 ) ) ) { i = - 1 ; } } } System . out . println ( " Yes " ) ; } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { ArrayList < String > list = new ArrayList < > ( ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String T = sc . nextLine ( ) ; String tmp ; int L = S . length ( ) ; boolean check = true ; for ( int i = 0 ; i < L ; i ++ ) { list . add ( String . valueOf ( S . charAt ( i ) ) ) ; } for ( int i = 0 ; i < L ; i ++ ) { tmp = list . get ( L - 1 ) ; list . add ( 0 , tmp ) ; list . remove ( list . size ( ) - 1 ) ; int cnt = 0 ; for ( int j = 0 ; j < L ; j ++ ) { if ( list . get ( j ) . equals ( String . valueOf ( T . charAt ( j ) ) ) ) { cnt ++ ; } } if ( cnt == L ) { System . out . println ( " Yes " ) ; check = false ; break ; } } if ( check ) { System . out . println ( " No " ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder s , t ; s = new StringBuilder ( sc . next ( ) ) ; t = new StringBuilder ( sc . next ( ) ) ; boolean flag = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { s = new StringBuilder ( Rotate ( s ) ) ; if ( t . toString ( ) . equals ( s . toString ( ) ) ) { flag = true ; break ; } } if ( flag == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static StringBuilder Rotate ( StringBuilder str ) { int len = str . length ( ) ; char t = str . charAt ( 0 ) ; for ( int i = 0 ; i < len - 1 ; i ++ ) { str . setCharAt ( i , str . charAt ( i + 1 ) ) ; } str . setCharAt ( len - 1 , t ) ; return str ; } }

S = input ( ) NEW_LINE T = input ( ) NEW_LINE s = len ( S ) NEW_LINE if S == T : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE exit ( ) NEW_LINE DEDENT for i in range ( s + 1 ) : NEW_LINE INDENT S = S [ - 1 ] + S [ 0 : s - 1 ] NEW_LINE if S == T : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT print ( ' No ' ) NEW_LINE

s = input ( ) NEW_LINE t = input ( ) NEW_LINE i = 0 NEW_LINE count = 0 NEW_LINE while i < len ( s ) : NEW_LINE INDENT s = list ( s ) NEW_LINE a = s . pop ( 0 ) NEW_LINE s . append ( a ) NEW_LINE s = ' ' . join ( s ) NEW_LINE if s == t : NEW_LINE INDENT count += 1 NEW_LINE DEDENT i += 1 NEW_LINE DEDENT if count >= 1 : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT

def rot ( s ) : NEW_LINE INDENT ret = s [ - 1 ] + s [ : - 1 ] NEW_LINE return ret NEW_LINE DEDENT s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE tmp = s1 NEW_LINE flag = False NEW_LINE for i in range ( len ( s1 ) ) : NEW_LINE INDENT tmp = rot ( tmp ) NEW_LINE if tmp == s2 : NEW_LINE INDENT flag = True NEW_LINE DEDENT DEDENT if flag : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT

S = list ( input ( ) ) NEW_LINE T = list ( input ( ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT S . insert ( 0 , S [ - 1 ] ) NEW_LINE del S [ - 1 ] NEW_LINE if S == T : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT print ( " Yes " if ans != 0 else " No " ) NEW_LINE

s = input ( ) NEW_LINE t = input ( ) NEW_LINE count = 0 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if s != t : NEW_LINE INDENT count += 1 NEW_LINE s = s [ - 1 ] + s [ : - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( " No " if count == len ( s ) else " Yes " ) NEW_LINE


import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int sum = 0 ; int s = sc . nextInt ( ) ; int g = s + T ; for ( int i = 1 ; i < N ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tmp > g ) { sum += g - s ; s = tmp ; g = tmp + T ; } else if ( tmp <= g ) { g = tmp + T ; } } sum += g - s ; System . out . println ( sum ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . io . UncheckedIOException ; import java . util . stream . LongStream ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , LightScanner in , PrintWriter out ) { int n = in . ints ( ) , t = in . ints ( ) ; long [ ] a = in . longs ( n ) ; long ans = 0 ; long last = - 10000000 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < last + t ) { ans += a [ i ] - last ; } else { ans += t ; } last = a [ i ] ; } out . println ( ans ) ; } } static class LightScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public LightScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String string ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int ints ( ) { return Integer . parseInt ( string ( ) ) ; } public long longs ( ) { return Long . parseLong ( string ( ) ) ; } public long [ ] longs ( int length ) { return IntStream . range ( 0 , length ) . mapToLong ( x -> longs ( ) ) . toArray ( ) ; } } }

import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; long n = stdIn . nextLong ( ) , t = stdIn . nextLong ( ) , tmp = stdIn . nextLong ( ) , a , i , s = 0 ; for ( i = 1 ; i < n ; i ++ ) { a = stdIn . nextLong ( ) ; if ( t > a - tmp ) s += a - tmp ; else s += t ; tmp = a ; } s += t ; 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 T = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; ++ i ) A [ i ] = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; int currentTime = A [ 0 ] ; for ( int i = 1 ; i < N ; ++ i ) { if ( currentTime + T < A [ i ] ) { ans += T ; } else { ans += A [ i ] - A [ i - 1 ] ; } currentTime = A [ i ] ; } ans += T ; System . out . println ( ans ) ; } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " ▁ " , 2 ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int t = Integer . parseInt ( line [ 1 ] ) ; int total = 0 ; int lastOpen = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = Integer . parseInt ( scanner . nextLine ( ) ) ; total += Math . max ( ( a + t ) - Math . max ( lastOpen , a ) , 0 ) ; lastOpen = Math . max ( a + t , lastOpen ) ; } System . out . println ( total ) ; } }

n , t = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE a = [ ] NEW_LINE x = 0 NEW_LINE y = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT a . append ( int ( input ( ) ) ) NEW_LINE DEDENT for i in range ( 1 , n ) : NEW_LINE INDENT if abs ( a [ i ] - a [ i - 1 ] ) > t : NEW_LINE INDENT x += t NEW_LINE DEDENT elif abs ( a [ i ] - a [ i - 1 ] ) - y <= t : NEW_LINE INDENT x += abs ( a [ i ] - a [ i - 1 ] ) NEW_LINE y = t NEW_LINE DEDENT DEDENT print ( x + t ) NEW_LINE

def autodoor ( N : int , T : int , A : list ) -> int : NEW_LINE INDENT open_time , close_time = 0 , 0 NEW_LINE total_opening_time = 0 NEW_LINE for a in A : NEW_LINE INDENT if a > close_time : NEW_LINE INDENT total_opening_time += close_time - open_time NEW_LINE open_time = a NEW_LINE DEDENT close_time = a + T NEW_LINE DEDENT else : NEW_LINE INDENT total_opening_time += close_time - open_time NEW_LINE DEDENT return total_opening_time NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 0 NEW_LINE N , T = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE ans = autodoor ( N , T , A ) NEW_LINE print ( ans ) NEW_LINE DEDENT

N , T = list ( map ( int , input ( ) . rstrip ( ) . split ( ) ) ) NEW_LINE time = int ( input ( ) . rstrip ( ) ) NEW_LINE total = 0 NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT nexttime = int ( input ( ) . rstrip ( ) ) NEW_LINE dif = nexttime - time NEW_LINE total += dif NEW_LINE if dif - T > 0 : NEW_LINE INDENT total -= dif - T NEW_LINE DEDENT time = nexttime NEW_LINE DEDENT print ( total + T ) NEW_LINE

n , t = map ( int , input ( ) . split ( ) ) NEW_LINE door = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE total = 0 NEW_LINE for i , v in enumerate ( door ) : NEW_LINE INDENT total += t NEW_LINE if i != 0 and door [ i - 1 ] + t >= v : NEW_LINE INDENT total -= ( t + door [ i - 1 ] - v ) NEW_LINE DEDENT DEDENT print ( total ) NEW_LINE

N , T = map ( int , input ( ) . split ( ) ) NEW_LINE amount = 0 NEW_LINE pre = int ( input ( ) ) NEW_LINE for _ in range ( N - 1 ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE if ( a - pre ) < T : NEW_LINE INDENT amount += ( a - pre ) NEW_LINE DEDENT else : NEW_LINE INDENT amount += T NEW_LINE DEDENT pre = a NEW_LINE DEDENT amount += T NEW_LINE print ( amount ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; long array [ ] = new long [ num + 5 ] ; for ( int i = 1 ; i <= num ; i ++ ) { array [ i ] = i == 1 || i == 2 ? 0 : i == 3 ? 1 : array [ i - 1 ] + array [ i - 2 ] + array [ i - 3 ] ; array [ i ] = mod ( array [ i ] ) ; } System . out . println ( array [ num ] ) ; } static long divisor = 10007 ; public static long mod ( long i ) { return i % divisor + ( ( i % divisor ) < 0 ? divisor : 0 ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] map = new long [ 1_000_000 ] ; map [ 0 ] = 0 ; map [ 1 ] = 0 ; map [ 2 ] = 1 ; for ( int i = 3 ; i < map . length ; i ++ ) { long num = map [ i - 3 ] + map [ i - 2 ] + map [ i - 1 ] ; map [ i ] = num % 10_007 ; } System . out . println ( map [ N - 1 ] ) ; } }

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 ( ) ; scanner . close ( ) ; ArrayList < Integer > tribonach = new ArrayList < Integer > ( ) ; tribonach . add ( 0 ) ; tribonach . add ( 0 ) ; tribonach . add ( 1 ) ; for ( int i = 3 ; i < n ; i ++ ) { int a = ( tribonach . get ( i - 1 ) + tribonach . get ( i - 2 ) + tribonach . get ( i - 3 ) ) % 10007 ; tribonach . add ( a ) ; } int an = tribonach . get ( n - 1 ) ; System . out . println ( an ) ; } }

import java . util . * ; public class Main { static final int MOD = 10007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 1 || n == 2 ) { System . out . println ( 0 ) ; return ; } else if ( n == 3 ) { System . out . println ( 1 ) ; return ; } int a1 = 0 ; int a2 = 0 ; int a3 = 1 ; for ( int i = 4 ; i <= n ; i ++ ) { int x = a1 + a2 + a3 ; x %= MOD ; a1 = a2 ; a2 = a3 ; a3 = x ; } System . out . println ( a3 ) ; } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int n ; n = Integer . parseInt ( sc . next ( ) ) ; int [ ] t = new int [ n + 1 ] ; t [ 0 ] = 0 ; t [ 1 ] = 0 ; if ( n >= 2 ) { t [ 2 ] = 0 ; if ( n >= 3 ) { t [ 3 ] = 1 ; if ( n >= 4 ) { for ( int i = 4 ; i <= n ; i ++ ) { t [ i ] = t [ i - 1 ] + t [ i - 2 ] + t [ i - 3 ] ; if ( t [ i ] > 10007 ) { t [ i ] = t [ i ] % 10007 ; } } } } } System . out . println ( t [ n ] ) ; } catch ( Exception e ) { System . out . println ( " out " ) ; } } }

n = int ( input ( ) ) NEW_LINE a = [ 0 ] * n NEW_LINE if n >= 3 : NEW_LINE INDENT a [ 2 ] = 1 NEW_LINE DEDENT for i in range ( 3 , n ) : NEW_LINE INDENT a [ i ] = ( a [ i - 1 ] + a [ i - 2 ] + a [ i - 3 ] ) % 10007 NEW_LINE DEDENT print ( a [ - 1 ] ) NEW_LINE

from sys import stdin NEW_LINE n = int ( stdin . readline ( ) . rstrip ( ) ) NEW_LINE def tribonacci ( n ) : NEW_LINE INDENT if n == 1 : NEW_LINE INDENT return 0 NEW_LINE DEDENT elif n == 2 : NEW_LINE INDENT return 0 NEW_LINE DEDENT elif n == 3 : NEW_LINE INDENT return 1 NEW_LINE DEDENT else : NEW_LINE INDENT newN = n - 3 NEW_LINE num1 , num2 , num3 = 0 , 0 , 1 NEW_LINE for i in range ( newN ) : NEW_LINE INDENT num1 , num2 , num3 = num2 % 10007 , num3 % 10007 , ( num1 + num2 + num3 ) % 10007 NEW_LINE DEDENT return num3 NEW_LINE DEDENT DEDENT print ( tribonacci ( n ) ) NEW_LINE

a , b , c = 0 , 0 , 1 NEW_LINE for i in range ( int ( input ( ) ) - 1 ) : NEW_LINE INDENT a , b , c = b , c , ( a + b + c ) % 10007 NEW_LINE DEDENT print ( a ) NEW_LINE

n = int ( input ( ) ) NEW_LINE w = 10007 NEW_LINE a = [ 0 ] * n NEW_LINE for i in range ( n ) : NEW_LINE INDENT if i == 2 : NEW_LINE INDENT a [ i ] = 1 NEW_LINE DEDENT elif i > 2 : NEW_LINE INDENT a [ i ] = a [ i - 1 ] + a [ i - 2 ] + a [ i - 3 ] NEW_LINE a [ i ] %= w NEW_LINE DEDENT DEDENT print ( a [ n - 1 ] ) NEW_LINE


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 ( ) ; int [ ] [ ] stu = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < stu . length ; i ++ ) { stu [ i ] [ 0 ] = sc . nextInt ( ) ; stu [ i ] [ 1 ] = sc . nextInt ( ) ; } int [ ] [ ] cp = new int [ m ] [ 2 ] ; for ( int i = 0 ; i < cp . length ; i ++ ) { cp [ i ] [ 0 ] = sc . nextInt ( ) ; cp [ i ] [ 1 ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < stu . length ; i ++ ) { int min = - 1 ; int d = 1000000000 ; for ( int j = 0 ; j < cp . length ; j ++ ) { int temp = Math . abs ( stu [ i ] [ 0 ] - cp [ j ] [ 0 ] ) + Math . abs ( stu [ i ] [ 1 ] - cp [ j ] [ 1 ] ) ; if ( d > temp ) { min = j ; d = temp ; } } System . out . println ( min + 1 ) ; } } }

import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int mod = 1000000007 ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Point [ ] student = new Point [ n ] ; Point [ ] checkPoint = new Point [ m ] ; for ( int i = 0 ; i < n ; i ++ ) student [ i ] = new Point ( sc . nextInt ( ) , sc . nextInt ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) checkPoint [ i ] = new Point ( sc . nextInt ( ) , sc . nextInt ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { int minNum = - 1 ; int minValue = Integer . MAX_VALUE ; for ( int j = 0 ; j < m ; j ++ ) { int d = calcManhatDistance ( student [ i ] . getX ( ) , student [ i ] . getY ( ) , checkPoint [ j ] . getX ( ) , checkPoint [ j ] . getY ( ) ) ; if ( d < minValue ) { minValue = d ; minNum = j ; } } System . out . println ( minNum + 1 ) ; } } static int calcManhatDistance ( int x1 , int y1 , int x2 , int y2 ) { int d = Math . abs ( x1 - x2 ) + Math . abs ( y1 - y2 ) ; return d ; } static double calcEuclidDistance ( double x1 , double y1 , double x2 , double y2 ) { double d = Math . sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) ; return d ; } } class Point { private int x ; private int y ; Point ( int a , int b ) { x = a ; y = b ; } int getX ( ) { return x ; } int getY ( ) { return y ; } void setX ( int n ) { x = n ; } void setY ( int n ) { y = n ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) , M = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ N ] , b = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; b [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int [ ] c = new int [ M ] , d = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { c [ i ] = Integer . parseInt ( sc . next ( ) ) ; d [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < N ; i ++ ) { int checkPoint = 0 ; for ( int j = 0 ; j < M ; j ++ ) { if ( Math . abs ( a [ i ] - c [ j ] ) + Math . abs ( b [ i ] - d [ j ] ) < Math . abs ( a [ i ] - c [ checkPoint ] ) + Math . abs ( b [ i ] - d [ checkPoint ] ) ) { checkPoint = j ; } } System . out . println ( checkPoint + 1 ) ; } } }

import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; public class Main { public static int abs ( int x ) { return ( x > 0 ) ? x : - x ; } public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; List < Integer > list_a = new ArrayList < Integer > ( ) ; List < Integer > list_b = new ArrayList < Integer > ( ) ; List < Integer > list_c = new ArrayList < Integer > ( ) ; List < Integer > list_d = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int p = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; list_a . add ( p ) ; list_b . add ( q ) ; } for ( int i = 0 ; i < m ; i ++ ) { int p = scan . nextInt ( ) ; int q = scan . nextInt ( ) ; list_c . add ( p ) ; list_d . add ( q ) ; } for ( int i = 0 ; i < n ; i ++ ) { int minIndex = 0 , minDiff = 1234567890 ; for ( int j = 0 ; j < m ; j ++ ) { int diff = abs ( list_a . get ( i ) - list_c . get ( j ) ) + abs ( list_b . get ( i ) - list_d . get ( j ) ) ; if ( diff < minDiff ) { minIndex = j + 1 ; minDiff = diff ; } } System . out . println ( minIndex ) ; } } }

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 [ ] [ ] map = new long [ N ] [ 2 ] ; for ( int i = 0 ; i < N ; i ++ ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; map [ i ] [ 0 ] = a ; map [ i ] [ 1 ] = b ; } long [ ] [ ] points = new long [ M ] [ 2 ] ; for ( int i = 0 ; i < M ; i ++ ) { long c = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; points [ i ] [ 0 ] = c ; points [ i ] [ 1 ] = d ; } for ( int i = 0 ; i < N ; i ++ ) { long a = map [ i ] [ 0 ] ; long b = map [ i ] [ 1 ] ; int point = - 1 ; long min = Long . MAX_VALUE ; for ( int j = 0 ; j < M ; j ++ ) { long c = points [ j ] [ 0 ] ; long d = points [ j ] [ 1 ] ; long km = Math . abs ( a - c ) + Math . abs ( b - d ) ; if ( min > km ) { point = j + 1 ; min = km ; } } System . out . println ( point ) ; } } }

N , M = map ( int , input ( ) . split ( ) ) NEW_LINE STUDENTS = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( N ) ] NEW_LINE CHECKPOINTS = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( M ) ] NEW_LINE for student in STUDENTS : NEW_LINE INDENT L = 10 ** 10 NEW_LINE for i , checkpoint in enumerate ( CHECKPOINTS ) : NEW_LINE INDENT l = abs ( checkpoint [ 0 ] - student [ 0 ] ) + abs ( checkpoint [ 1 ] - student [ 1 ] ) NEW_LINE if l < L : NEW_LINE INDENT nc = i + 1 NEW_LINE L = l NEW_LINE DEDENT DEDENT print ( nc ) NEW_LINE DEDENT

( n , m ) , * a = [ list ( map ( int , s . split ( ) ) ) for s in open ( 0 ) ] NEW_LINE for i , j in a [ : n ] : l = [ abs ( x - i ) + abs ( y - j ) for x , y in a [ n : ] ] ; print ( 1 + l . index ( min ( l ) ) ) NEW_LINE

from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT N , M = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE a = [ ] NEW_LINE b = [ ] NEW_LINE c = [ ] NEW_LINE d = [ ] NEW_LINE ans = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT t1 , t2 = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE a . append ( t1 ) NEW_LINE b . append ( t2 ) NEW_LINE DEDENT for i in range ( M ) : NEW_LINE INDENT t1 , t2 = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE c . append ( t1 ) NEW_LINE d . append ( t2 ) NEW_LINE DEDENT for i in range ( N ) : NEW_LINE INDENT min_dist = 1e10 NEW_LINE ans . append ( 0 ) NEW_LINE for j in range ( M ) : NEW_LINE INDENT dist = abs ( a [ i ] - c [ j ] ) + abs ( b [ i ] - d [ j ] ) NEW_LINE if min_dist > dist : NEW_LINE INDENT ans [ i ] = str ( j + 1 ) NEW_LINE min_dist = dist NEW_LINE DEDENT DEDENT DEDENT print ( ' \n ' . join ( ans ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

import sys NEW_LINE ni = lambda : int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE INF = 10 ** 9 NEW_LINE n , m = nm ( ) NEW_LINE ab = [ nl ( ) for i in range ( n ) ] NEW_LINE cd = [ nl ( ) for i in range ( m ) ] NEW_LINE ans = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT temp = INF NEW_LINE a = ab [ i ] [ 0 ] NEW_LINE b = ab [ i ] [ 1 ] NEW_LINE for j in range ( m - 1 , - 1 , - 1 ) : NEW_LINE INDENT c = cd [ j ] [ 0 ] NEW_LINE d = cd [ j ] [ 1 ] NEW_LINE if abs ( a - c ) + abs ( b - d ) <= temp : NEW_LINE INDENT temp = abs ( a - c ) + abs ( b - d ) NEW_LINE idx = j + 1 NEW_LINE DEDENT DEDENT ans . append ( str ( idx ) ) NEW_LINE DEDENT print ( ' \n ' . join ( ans ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) NEW_LINE hoge_x = [ ] NEW_LINE hoge_y = [ ] NEW_LINE huga_x = [ ] NEW_LINE huga_y = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE hoge_x . append ( a ) NEW_LINE hoge_y . append ( b ) NEW_LINE DEDENT for j in range ( m ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE huga_x . append ( a ) NEW_LINE huga_y . append ( b ) NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT ans_kyori = - 1 NEW_LINE ans_index = - 1 NEW_LINE for j in range ( m ) : NEW_LINE INDENT kyori = abs ( hoge_x [ i ] - huga_x [ j ] ) + abs ( hoge_y [ i ] - huga_y [ j ] ) NEW_LINE if ( kyori < ans_kyori or ans_kyori == - 1 ) : NEW_LINE INDENT ans_kyori = kyori NEW_LINE ans_index = j + 1 NEW_LINE DEDENT DEDENT print ( ans_index ) NEW_LINE DEDENT


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] yo = Arrays . asList ( br . readLine ( ) . split ( " ▁ " ) ) . stream ( ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int r = yo [ 0 ] ; int g = yo [ 1 ] ; int b = yo [ 2 ] ; long ans = 1252521830252521L ; final int OH = 1500 ; int [ ] arr = new int [ OH ] ; for ( int gl = - 1000 ; gl <= 700 ; gl ++ ) { long cnt = 0 ; for ( int i = 0 ; i < g ; i ++ ) { cnt += Math . abs ( gl + i ) ; } { for ( int i = 0 ; i < OH ; i ++ ) { int p = gl - 1 - i ; arr [ i ] = Math . abs ( p - ( - 100 ) ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < r ; i ++ ) { cnt += arr [ i ] ; } } { for ( int i = 0 ; i < OH ; i ++ ) { int p = gl + g + i ; arr [ i ] = Math . abs ( p - ( 100 ) ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < b ; i ++ ) { cnt += arr [ i ] ; } } ans = Math . min ( ans , cnt ) ; } 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 ) ; D solver = new D ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class D { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int r = in . nextInt ( ) , g = in . nextInt ( ) , b = in . nextInt ( ) ; int minAns = Integer . MAX_VALUE ; for ( int gr = - 1000 ; gr < 1000 ; gr ++ ) { int gl = 1 + gr - g ; int ans = calc ( 0 , gl , gr ) ; int rl = - r / 2 - 100 , rr = ( r - 1 ) / 2 - 100 ; int bl = - b / 2 + 100 , br = ( b - 1 ) / 2 + 100 ; if ( rr >= gl ) { int d = rr - gl + 1 ; rl -= d ; rr -= d ; } if ( gr >= bl ) { int d = gr - bl + 1 ; bl += d ; br += d ; } ans += calc ( - 100 , rl , rr ) ; ans += calc ( 100 , bl , br ) ; minAns = Math . min ( minAns , ans ) ; } out . println ( minAns ) ; } private static int calc ( int orig , int left , int right ) { int l = left - orig ; int r = right - orig ; if ( l <= 0 && 0 <= r ) { return ( l * ( l - 1 ) + r * ( r + 1 ) ) / 2 ; } else if ( r < 0 ) { return ( l * ( l - 1 ) - r * ( r + 1 ) ) / 2 ; } else { return ( r * ( r + 1 ) - l * ( l - 1 ) ) / 2 ; } } } }

import java . util . Scanner ; public class Main { private static int dp [ ] [ ] ; private static final int SIZE = 2000 ; private static int R ; private static int G ; private static int B ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; R = sc . nextInt ( ) ; G = sc . nextInt ( ) ; B = sc . nextInt ( ) ; sc . close ( ) ; dp = new int [ SIZE ] [ R + G + B + 1 ] ; for ( int i = 0 ; i < SIZE ; i ++ ) { for ( int j = 0 ; j < R + G + B + 1 ; j ++ ) { dp [ i ] [ j ] = - 1 ; } } System . out . println ( dfs ( 0 , R + G + B ) ) ; } private static int dfs ( int pos , int num ) { if ( num == 0 ) { return 0 ; } if ( dp [ pos ] [ num ] >= 0 ) { return dp [ pos ] [ num ] ; } int move = 0 ; if ( num > G + B ) { move = Math . abs ( SIZE / 2 - 100 - pos ) ; } else if ( num > B ) { move = Math . abs ( SIZE / 2 - pos ) ; } else if ( num > 0 ) { move = Math . abs ( SIZE / 2 + 100 - pos ) ; } if ( pos >= SIZE - num ) { dp [ pos ] [ num ] = dfs ( pos + 1 , num - 1 ) + move ; } else { dp [ pos ] [ num ] = Math . min ( dfs ( pos + 1 , num ) , dfs ( pos + 1 , num - 1 ) + move ) ; } return dp [ pos ] [ num ] ; } }

import java . util . * ; public class Main { public static int r , g , b , total ; public static int ENOUGH_BIG = ( int ) Math . pow ( 10 , 9 ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; r = sc . nextInt ( ) ; g = sc . nextInt ( ) ; b = sc . nextInt ( ) ; total = r + g + b ; int table [ ] [ ] = new int [ 1000 ] [ 1000 ] ; for ( int i = 0 ; i < 1000 ; ++ i ) { for ( int j = 0 ; j < 1000 ; ++ j ) { if ( j == total ) { table [ i ] [ j ] = 0 ; } else { table [ i ] [ j ] = ENOUGH_BIG ; } } } for ( int i = 1 ; i < 999 ; ++ i ) { for ( int j = 0 ; j < total ; ++ j ) { table [ i ] [ j ] = Math . min ( table [ i - 1 ] [ j ] , table [ i - 1 ] [ j + 1 ] + cost ( i , j + 1 ) ) ; } } int minScore = ENOUGH_BIG ; for ( int i = 0 ; i < 1000 ; ++ i ) { minScore = Math . min ( minScore , table [ i ] [ 0 ] ) ; } System . out . println ( minScore ) ; } public static int cost ( int i , int j ) { int result ; if ( j > g + b ) { result = Math . abs ( i - 400 ) ; } else if ( j > b ) { result = Math . abs ( i - 500 ) ; } else { result = Math . abs ( i - 600 ) ; } return 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 r , g , b ; r = sc . nextInt ( ) ; g = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int [ ] f = new int [ r + g + b + 1 ] ; Arrays . fill ( f , Integer . MAX_VALUE / 3 ) ; f [ r + g + b ] = 0 ; for ( int i = - 1000 ; i <= 1000 ; ++ i ) { for ( int res = 1 ; res <= r + g + b ; ++ res ) { if ( res > g + b ) { f [ res - 1 ] = Math . min ( f [ res - 1 ] , f [ res ] + Math . abs ( - 100 - i ) ) ; } else if ( res > b && g + b >= res ) { f [ res - 1 ] = Math . min ( f [ res - 1 ] , f [ res ] + Math . abs ( i ) ) ; } else { f [ res - 1 ] = Math . min ( f [ res - 1 ] , f [ res ] + Math . abs ( 100 - i ) ) ; } } } System . out . println ( f [ 0 ] ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

r , g , b = map ( int , input ( ) . split ( ) ) NEW_LINE def count ( remaining , place ) : NEW_LINE INDENT if remaining == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT elif 0 < remaining <= b : NEW_LINE INDENT return abs ( place - 600 ) NEW_LINE DEDENT elif b < remaining <= b + g : NEW_LINE INDENT return abs ( place - 500 ) NEW_LINE DEDENT elif b + g < remaining <= b + g + r : NEW_LINE INDENT return abs ( place - 400 ) NEW_LINE DEDENT DEDENT dp = [ [ 10 ** 8 for i in range ( r + g + b + 1 ) ] for j in range ( 1000 ) ] NEW_LINE dp [ 0 ] [ r + g + b ] = 0 NEW_LINE dp [ 0 ] [ r + g + b - 1 ] = count ( r + g + b , 0 ) NEW_LINE for i in range ( 1 , 1000 ) : NEW_LINE INDENT if dp [ i - 1 ] [ 0 ] != 10 ** 8 : NEW_LINE INDENT dp [ i ] [ 0 ] = dp [ i - 1 ] [ 0 ] NEW_LINE DEDENT for j in range ( 1 , r + g + b + 1 ) : NEW_LINE INDENT if dp [ i - 1 ] [ j ] != 10 ** 8 : NEW_LINE INDENT dp [ i ] [ j ] = min ( dp [ i - 1 ] [ j ] , dp [ i ] [ j ] ) NEW_LINE dp [ i ] [ j - 1 ] = min ( dp [ i - 1 ] [ j ] + count ( j , i ) , dp [ i ] [ j - 1 ] ) NEW_LINE DEDENT DEDENT DEDENT print ( dp [ 999 ] [ 0 ] ) NEW_LINE

R , G , B = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 10 ** 10 NEW_LINE def prog ( n ) : NEW_LINE INDENT return n * ( n + 1 ) // 2 NEW_LINE DEDENT for g_left in range ( - 49 - G , 51 ) : NEW_LINE INDENT g_right = g_left + G - 1 NEW_LINE if - 100 + ( R - 1 ) // 2 < g_left : NEW_LINE INDENT r_left = - 100 - R // 2 NEW_LINE r_right = r_left + R - 1 NEW_LINE DEDENT else : NEW_LINE INDENT r_right = g_left - 1 NEW_LINE r_left = r_right - R + 1 NEW_LINE DEDENT if g_right < 100 - ( B - 1 ) // 2 : NEW_LINE INDENT b_right = 100 + B // 2 NEW_LINE b_left = b_right - B + 1 NEW_LINE DEDENT else : NEW_LINE INDENT b_left = g_right + 1 NEW_LINE b_right = b_left + B - 1 NEW_LINE DEDENT res = 0 NEW_LINE if r_left <= - 100 <= r_right : NEW_LINE INDENT res += prog ( - 100 - r_left ) NEW_LINE res += prog ( r_right - ( - 100 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT res += prog ( R ) NEW_LINE res += R * ( - 100 - r_right - 1 ) NEW_LINE DEDENT if b_left <= 100 <= b_right : NEW_LINE INDENT res += prog ( 100 - b_left ) NEW_LINE res += prog ( b_right - 100 ) NEW_LINE DEDENT else : NEW_LINE INDENT res += prog ( B ) NEW_LINE res += B * ( b_left - 100 - 1 ) NEW_LINE DEDENT if g_left <= 0 <= g_right : NEW_LINE INDENT res += prog ( - g_left ) NEW_LINE res += prog ( g_right ) NEW_LINE DEDENT elif g_right < 0 : NEW_LINE INDENT res += prog ( G ) NEW_LINE res += G * ( - g_right - 1 ) NEW_LINE DEDENT elif 0 < g_left : NEW_LINE INDENT res += prog ( G ) NEW_LINE res += G * ( g_left - 1 ) NEW_LINE DEDENT ans = min ( ans , res ) NEW_LINE DEDENT print ( ans ) NEW_LINE

from functools import lru_cache NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( 10000 ) NEW_LINE sb = [ - 100 , 0 , 100 ] NEW_LINE @ lru_cache ( maxsize = None ) NEW_LINE def ops ( l , m ) : NEW_LINE INDENT global marble NEW_LINE r = l + marble [ m ] - 1 NEW_LINE if l < sb [ m ] < r : NEW_LINE INDENT ln = abs ( l - sb [ m ] ) NEW_LINE rn = marble [ m ] - ln - 1 NEW_LINE op = ( ln * ( ln + 1 ) + rn * ( rn + 1 ) ) // 2 NEW_LINE DEDENT else : NEW_LINE INDENT ofs = abs ( r - sb [ m ] ) if r <= sb [ m ] else abs ( l - sb [ m ] ) NEW_LINE n = marble [ m ] - 1 NEW_LINE op = ( n * ( n + 1 ) ) // 2 + ofs * marble [ m ] NEW_LINE DEDENT return ( op ) NEW_LINE DEDENT @ lru_cache ( maxsize = None ) NEW_LINE def plcMbl ( b , m ) : NEW_LINE INDENT if b + sum ( marble [ m : ] ) > 500 : NEW_LINE INDENT return ( float ( ' inf ' ) ) NEW_LINE DEDENT if m == 3 : NEW_LINE INDENT return ( 0 ) NEW_LINE DEDENT op = ops ( b , m ) NEW_LINE opl = [ plcMbl ( b + 1 , m ) , op + plcMbl ( b + marble [ m ] , m + 1 ) ] NEW_LINE return ( min ( opl ) ) NEW_LINE DEDENT marble = list ( map ( int , input ( ) . rstrip ( ) . split ( ) ) ) NEW_LINE print ( plcMbl ( - 500 , 0 ) ) NEW_LINE

from math import * NEW_LINE R , G , B = [ int ( x ) for x in input ( ) . strip ( ) . split ( ) ] NEW_LINE pr = - 100 NEW_LINE pg = 0 NEW_LINE pb = 100 NEW_LINE R0min = min ( floor ( - ( R - 1 ) / 2 ) + pr , floor ( - ( B - 1 ) / 2 ) - G - R ) NEW_LINE R0max = ceil ( - ( R - 1 ) / 2 ) + pr NEW_LINE B0min = floor ( - ( B - 1 ) / 2 ) + pb NEW_LINE B0max = max ( ceil ( - ( B - 1 ) / 2 ) + pb , ceil ( ( R - 1 ) / 2 ) + G ) NEW_LINE def sumn ( n ) : NEW_LINE INDENT return int ( n * ( n + 1 ) / 2 ) NEW_LINE DEDENT def calc_count ( n , p0 , p1 , c ) : NEW_LINE INDENT if p0 <= c and p1 >= c : NEW_LINE INDENT return sumn ( abs ( p0 - c ) ) + sumn ( abs ( p1 - c ) ) NEW_LINE DEDENT elif p0 > c : NEW_LINE INDENT return ( p0 - c ) * n + sumn ( n - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT return ( c - p1 ) * n + sumn ( n - 1 ) NEW_LINE DEDENT DEDENT minmove = 2 ** 31 NEW_LINE for r0 in range ( R0min , R0max + 1 ) : NEW_LINE INDENT for b0 in range ( B0min , B0max + 1 ) : NEW_LINE INDENT r1 = r0 + R - 1 NEW_LINE b1 = b0 + B - 1 NEW_LINE if G >= b0 - r1 : NEW_LINE INDENT continue NEW_LINE DEDENT if - ( r1 + 1 ) <= b0 - 1 : NEW_LINE INDENT g0 = max ( floor ( - ( G - 1 ) / 2 ) , r1 + 1 ) NEW_LINE g1 = g0 + G - 1 NEW_LINE DEDENT else : NEW_LINE INDENT g1 = min ( ceil ( ( G - 1 ) / 2 ) , b0 - 1 ) NEW_LINE g0 = g1 - G + 1 NEW_LINE DEDENT count = 0 NEW_LINE count += calc_count ( R , r0 , r1 , pr ) NEW_LINE count += calc_count ( G , g0 , g1 , pg ) NEW_LINE count += calc_count ( B , b0 , b1 , pb ) NEW_LINE if count <= minmove : NEW_LINE INDENT minmove = count NEW_LINE DEDENT DEDENT DEDENT print ( minmove ) NEW_LINE

iR , iG , iB = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE if iR < iB : NEW_LINE INDENT iR , iB = iB , iR NEW_LINE DEDENT def calcMoveEach ( n ) : NEW_LINE INDENT return n * ( n + 1 ) // 2 NEW_LINE DEDENT def calcMove ( a , l ) : NEW_LINE INDENT if l < a : NEW_LINE INDENT return calcMoveEach ( l ) + calcMoveEach ( a - l - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT return calcMoveEach ( l ) - calcMoveEach ( l - a ) NEW_LINE DEDENT DEDENT def diffmod2 ( t ) : NEW_LINE INDENT return 1 if t % 2 == 0 else 0 NEW_LINE DEDENT if iR < 100 and iG < 100 and iB < 100 : NEW_LINE INDENT print ( calcMove ( iR , iR // 2 ) + calcMove ( iG , iG // 2 ) + calcMove ( iB , iB // 2 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT iDiff = max ( iG , iR , iB ) NEW_LINE iAns = calcMove ( iDiff , 900 ) NEW_LINE for iED in range ( - iDiff , iDiff ) : NEW_LINE INDENT lG = iG + iED NEW_LINE lR = max ( 100 + iR // 2 , iR + lG ) NEW_LINE rB = max ( 100 + iB // 2 , iB + ( iG - lG - 1 ) ) NEW_LINE iLLL = calcMove ( iR , lR - 100 ) + calcMove ( iG , max ( lG , iG - lG - 1 ) ) + calcMove ( iB , rB - 100 ) NEW_LINE iAns = min ( iAns , iLLL ) NEW_LINE DEDENT print ( iAns ) NEW_LINE NEW_LINE DEDENT


import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; List < Long > a = new ArrayList < > ( ) ; IntStream . range ( 0 , n ) . forEach ( i -> a . add ( sc . nextLong ( ) ) ) ; Collections . sort ( a ) ; int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( x < a . get ( i ) ) { break ; } x -= a . get ( i ) ; count ++ ; } if ( x == a . get ( n - 1 ) ) { count ++ ; } System . out . println ( count ) ; } }

import java . util . * ; import static java . lang . System . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = ni ( ) ; int x = ni ( ) ; int [ ] a = niarr ( N ) ; Arrays . sort ( a ) ; int num = 0 ; int i = 0 ; while ( i < N && x >= a [ i ] ) { x -= a [ i ] ; i ++ ; num ++ ; } if ( x > 0 && num > 0 && i == N ) { num -- ; } out . println ( num ) ; } static int ni ( ) { return sc . nextInt ( ) ; } static long nl ( ) { return sc . nextLong ( ) ; } static String ns ( ) { return sc . next ( ) ; } static int [ ] niarr ( int N ) { int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } return a ; } static long [ ] nlarr ( int N ) { long [ ] a = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } return a ; } }

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 x = scan . nextInt ( ) ; int [ ] a_ = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a_ [ i ] = scan . nextInt ( ) ; } Arrays . sort ( a_ ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { x -= a_ [ i ] ; if ( x < 0 ) { break ; } else { ans ++ ; } } if ( x > 0 ) { ans -- ; } System . out . println ( ans ) ; } }

import java . util . stream . IntStream ; public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) , x = scanner . nextInt ( ) , ans = 0 ; int [ ] a = IntStream . range ( 0 , n ) . map ( i -> scanner . nextInt ( ) ) . sorted ( ) . toArray ( ) ; for ( int i = 0 ; i < n ; i ++ , ans ++ ) { if ( x >= a [ i ] ) { x -= a [ i ] ; } else { break ; } } if ( ans == n && x != 0 ) { ans -- ; } System . out . println ( ans ) ; } }

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 ( ) ; int x = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; sc . nextLine ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list , Comparator . naturalOrder ( ) ) ; int index = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( x < list . get ( i ) ) { break ; } if ( i == list . size ( ) - 1 && x > list . get ( i ) ) { break ; } index ++ ; x -= list . get ( i ) ; } System . out . println ( index ) ; } }

n , x = map ( int , input ( ) . split ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; a . sort ( ) ; ans = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if a [ i ] > x : break NEW_LINE else : NEW_LINE INDENT ans += 1 NEW_LINE x -= a [ i ] NEW_LINE if i == n - 1 and x != 0 : ans -= 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

n , x = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) NEW_LINE if sum ( a ) == x : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT elif sum ( a ) < x : NEW_LINE INDENT print ( n - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE for i in a : NEW_LINE INDENT x -= i NEW_LINE if x >= 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT

import numpy as np NEW_LINE N , x = map ( int , input ( ) . split ( ) ) NEW_LINE a = np . array ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE a . sort ( ) NEW_LINE s = np . cumsum ( a ) NEW_LINE b = ( s <= x ) NEW_LINE if b . all ( ) : NEW_LINE INDENT if s [ - 1 ] == x : NEW_LINE INDENT c = b . sum ( ) NEW_LINE DEDENT else : NEW_LINE INDENT c = b . sum ( ) - 1 NEW_LINE DEDENT DEDENT elif b . any ( ) : NEW_LINE INDENT c = b . sum ( ) NEW_LINE r = x - s [ c - 1 ] NEW_LINE if ( r == a [ c : ] ) . any ( ) : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT c = 0 NEW_LINE DEDENT print ( c ) NEW_LINE

N , x = map ( int , input ( ) . split ( ) ) NEW_LINE a = sorted ( int ( x ) for x in input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE for ai in a : NEW_LINE INDENT x -= ai NEW_LINE if x < 0 : NEW_LINE INDENT break NEW_LINE DEDENT ans += 1 NEW_LINE DEDENT if 0 < x : NEW_LINE INDENT ans -= 1 NEW_LINE DEDENT print ( ans ) NEW_LINE

def main ( ) : NEW_LINE INDENT N , x = map ( int , input ( ) . split ( ) ) NEW_LINE num = x NEW_LINE a_s = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a_s . sort ( ) NEW_LINE cnt = 0 NEW_LINE for i , a in enumerate ( a_s ) : NEW_LINE INDENT if num >= a : NEW_LINE INDENT num -= a NEW_LINE cnt += 1 NEW_LINE DEDENT DEDENT if cnt == N and num > 0 : NEW_LINE INDENT cnt -= 1 NEW_LINE DEDENT print ( cnt ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int [ ] t = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { t [ i ] = scanner . nextInt ( ) ; } int time = 0 ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < ( 1 << N ) ; i ++ ) { int timeA = 0 ; int timeB = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( ( i >> j & 1 ) == 1 ) { timeA += t [ j ] ; } else { timeB += t [ j ] ; } } time = Math . max ( timeA , timeB ) ; ans = Math . min ( time , ans ) ; } System . out . println ( ans ) ; } }

import java . util . * ; public class Main { public static int N ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; String t = " " ; for ( int i = 0 ; i < N ; i ++ ) { int tmp = sc . nextInt ( ) ; t += Integer . toString ( tmp ) ; if ( i != N - 1 ) { t += " : " ; } } String p1 = "0" ; String p2 = "0" ; System . out . println ( dfs ( 0 , t , p1 , p2 ) ) ; } public static int dfs ( int depth , String t , String p1 , String p2 ) { if ( depth == N ) { int sum1 = 0 ; int sum2 = 0 ; String [ ] p1_ary = p1 . split ( " : " ) ; String [ ] p2_ary = p2 . split ( " : " ) ; for ( int i = 0 ; i < p1_ary . length ; i ++ ) { sum1 += Integer . parseInt ( p1_ary [ i ] ) ; } for ( int i = 0 ; i < p2_ary . length ; i ++ ) { sum2 += Integer . parseInt ( p2_ary [ i ] ) ; } return Math . max ( sum1 , sum2 ) ; } String [ ] t_ary = t . split ( " : " ) ; String add = t_ary [ 0 ] ; String t_new = " " ; for ( int i = 1 ; i < t_ary . length ; i ++ ) { t_new += t_ary [ i ] ; if ( i != t_ary . length - 1 ) { t_new += " : " ; } } return Math . min ( dfs ( depth + 1 , t_new , p1 + " : " + add , p2 ) , dfs ( depth + 1 , t_new , p1 , p2 + " : " + add ) ) ; } }

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 [ ] t = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { t [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; if ( N == 1 ) { System . out . println ( t [ 0 ] ) ; } else if ( N == 2 ) { System . out . println ( Math . max ( t [ 0 ] , t [ 1 ] ) ) ; } else if ( N == 3 ) { Arrays . sort ( t ) ; System . out . println ( Math . max ( t [ 0 ] + t [ 1 ] , t [ 2 ] ) ) ; } else { Arrays . sort ( t ) ; if ( t [ 3 ] >= t [ 0 ] + t [ 1 ] + t [ 2 ] ) { System . out . println ( t [ 3 ] ) ; return ; } if ( t [ 0 ] + t [ 3 ] > t [ 0 ] + t [ 1 ] + t [ 2 ] ) { System . out . println ( t [ 0 ] + t [ 1 ] + t [ 2 ] ) ; return ; } System . out . println ( Math . max ( t [ 0 ] + t [ 3 ] , t [ 1 ] + t [ 2 ] ) ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } public void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int T [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { T [ i ] = sc . nextInt ( ) ; } int minTime = Integer . MAX_VALUE ; for ( int ptn = 0 , bound = 1 << N ; ptn < bound ; ptn ++ ) { boolean [ ] pattern = getPatten ( N , ptn ) ; int nikuTimeA = 0 ; int nikuTimeB = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( pattern [ i ] ) { nikuTimeA += T [ i ] ; } else { nikuTimeB += T [ i ] ; } } int nikuTime = Math . max ( nikuTimeA , nikuTimeB ) ; minTime = Math . min ( minTime , nikuTime ) ; } System . out . println ( minTime ) ; sc . close ( ) ; } private boolean [ ] getPatten ( int n , int ptn ) { boolean [ ] pattern = new boolean [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int mask = 1 << i ; if ( ( ptn & mask ) > 0 ) { pattern [ i ] = true ; } } return pattern ; } }

import java . util . Scanner ; public class Main { private static int loast ( int [ ] t , int n , int i , int a , int b ) { if ( i == n ) return Math . max ( a , b ) ; return Math . min ( loast ( t , n , i + 1 , a + t [ i ] , b ) , loast ( t , n , i + 1 , a , b + t [ i ] ) ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { t [ i ] = sc . nextInt ( ) ; } System . out . println ( loast ( t , n , 0 , 0 , 0 ) ) ; sc . close ( ) ; } }

n = int ( input ( ) ) NEW_LINE t = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE t . sort ( reverse = True ) NEW_LINE yaki1 = 0 NEW_LINE yaki2 = 0 NEW_LINE for i in t : NEW_LINE INDENT if yaki1 <= yaki2 : NEW_LINE INDENT yaki1 += i NEW_LINE DEDENT else : NEW_LINE INDENT yaki2 += i NEW_LINE DEDENT DEDENT print ( max ( yaki1 , yaki2 ) ) NEW_LINE

from itertools import permutations NEW_LINE def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ts = [ int ( input ( ) ) for _ in range ( n ) ] NEW_LINE res = 1 << 30 NEW_LINE for us in permutations ( ts ) : NEW_LINE INDENT for i in range ( n ) : NEW_LINE INDENT res = min ( res , max ( sum ( us [ : i ] ) , sum ( us [ i : ] ) ) ) NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) NEW_LINE print ( min ( max ( sum ( a [ s ] * ( t >> s & 1 ) for s in range ( n ) ) , sum ( a [ s ] * ( not t >> s & 1 ) for s in range ( n ) ) ) for t in range ( 2 ** n ) ) ) NEW_LINE

print ( ( lambda N : ( lambda T , d : min ( d . update ( a = [ [ T [ - 1 ] ] , [ ] ] ) or any ( d [ ' a ' ] [ i >> j & 1 ] . append ( T [ j ] ) for j in range ( N - 1 ) ) or max ( map ( sum , d [ ' a ' ] ) ) for i in range ( 1 << N - 1 ) ) ) ( [ int ( input ( ) ) for _ in [ 0 ] * N ] , { } ) ) ( int ( input ( ) ) ) ) NEW_LINE

from itertools import product NEW_LINE ans = 10 ** 9 NEW_LINE N = int ( input ( ) ) NEW_LINE m = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE for i in range ( 1 << N ) : NEW_LINE INDENT a , b = 0 , 0 NEW_LINE for j in range ( N ) : NEW_LINE INDENT if ( ( i >> j ) & 1 ) == 0 : NEW_LINE INDENT a += m [ j ] NEW_LINE DEDENT else : NEW_LINE INDENT b += m [ j ] NEW_LINE DEDENT DEDENT ans = min ( ans , max ( a , b ) ) NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String X = sc . next ( ) ; int sum = 0 ; sum += X . charAt ( 0 ) - '0' ; sum += X . charAt ( 1 ) - '0' ; System . out . println ( sum ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int n = 0 ; for ( char cc : in . next ( ) . toCharArray ( ) ) n += cc - '0' ; out . println ( n ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; this . bufPointer = 0 ; this . bufLength = 0 ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; } public String next ( ) { StringBuilder sb = new StringBuilder ( ) ; int b = readByte ( ) ; while ( ! isPrintableChar ( b ) ) b = readByte ( ) ; while ( isPrintableChar ( b ) ) { sb . appendCodePoint ( b ) ; b = readByte ( ) ; } return sb . toString ( ) ; } } }

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

import java . 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 . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String X = in . next ( ) ; int ans = Character . getNumericValue ( X . charAt ( 1 ) ) + Character . getNumericValue ( X . charAt ( 0 ) ) ; out . println ( ans ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { String s = sc . next ( ) ; out . println ( ( s . charAt ( 0 ) - '0' ) + ( s . charAt ( 1 ) - '0' ) ) ; } }

X = input ( ) NEW_LINE print ( sum ( map ( int , X ) ) ) NEW_LINE

x = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE while x > 0 : NEW_LINE INDENT ans += x % 10 NEW_LINE x //= 10 NEW_LINE DEDENT print ( ans ) NEW_LINE

def plus_king ( X : int ) -> int : NEW_LINE INDENT return X // 10 + X % 10 NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT X = int ( input ( ) ) NEW_LINE ans = plus_king ( X ) NEW_LINE print ( ans ) NEW_LINE DEDENT

print ( sum ( [ int ( i ) for i in input ( ) ] ) ) NEW_LINE

def digit ( i , lst = [ ] ) : NEW_LINE INDENT if i > 0 : NEW_LINE INDENT lst . append ( i % 10 ) NEW_LINE return digit ( i // 10 , lst ) NEW_LINE DEDENT else : NEW_LINE INDENT lst . reverse ( ) NEW_LINE return lst NEW_LINE DEDENT DEDENT print ( sum ( digit ( int ( input ( ) ) ) ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { Scanner scanner = null ; String [ ] stringS = new String [ 4 ] ; try { scanner = new Scanner ( System . in ) ; stringS = scanner . next ( ) . split ( " " ) ; int res = 0 ; for ( int i = 0 ; i < stringS . length ; i ++ ) { if ( stringS [ i ] . equals ( " + " ) ) { res ++ ; } else if ( stringS [ i ] . equals ( " - " ) ) { res -- ; } } System . out . println ( res ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } }

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; br . close ( ) ; int p = s . length ( ) - s . replaceAll ( " \\ + " , " " ) . length ( ) ; int m = s . length ( ) - p ; System . out . println ( p - m ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( S . charAt ( i ) == ' + ' ) count ++ ; if ( S . charAt ( i ) == ' - ' ) 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 ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int sum = 0 ; for ( char x : str . toCharArray ( ) ) { if ( x == ' + ' ) sum ++ ; else if ( x == ' - ' ) sum -- ; } System . out . println ( sum ) ; } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s = sc . next ( ) ; int ans = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' + ' ) { ans ++ ; } else { ans -- ; } } System . out . println ( ans ) ; } }

s = input ( ) NEW_LINE s_list = list ( s ) NEW_LINE count = 0 NEW_LINE for i in range ( len ( s_list ) ) : NEW_LINE INDENT if s_list [ i ] == ' + ' : NEW_LINE INDENT count += 1 NEW_LINE DEDENT elif s_list [ i ] == ' - ' : NEW_LINE INDENT count -= 1 NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE

import collections NEW_LINE S = input ( ) NEW_LINE c = collections . Counter ( S ) NEW_LINE print ( c . get ( ' + ' , 0 ) - c . get ( ' - ' , 0 ) ) NEW_LINE

def main ( ) : NEW_LINE INDENT chars = list ( input ( ) ) NEW_LINE n = 0 NEW_LINE for c in chars : NEW_LINE INDENT n = n + 1 if c == ' + ' else n - 1 NEW_LINE DEDENT print ( n ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

s = input ( ) NEW_LINE print ( s . count ( ' + ' ) * 2 - 4 ) NEW_LINE

S = input ( ) NEW_LINE ans = 0 NEW_LINE for s in S : NEW_LINE INDENT if s == ' + ' : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans -= 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import java . io . * ; import java . time . ZonedDateTime ; import java . time . format . DateTimeFormatter ; import java . util . * ; import java . math . * ; public class Main { static boolean debug = false ; static boolean debug2 = false ; public static void main ( String [ ] args ) throws java . io . IOException { debug = 1 == args . length ; debug2 = 2 == args . length ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ZonedDateTime date = ZonedDateTime . parse ( in . readLine ( ) . replaceAll ( " / " , " - " ) + " T00:00:00Z " ) ; while ( true ) { if ( date . getYear ( ) % date . getMonthValue ( ) == 0 && date . getYear ( ) / date . getMonthValue ( ) % date . getDayOfMonth ( ) == 0 ) { System . out . println ( date . format ( DateTimeFormatter . ISO_LOCAL_DATE ) . replaceAll ( " - " , " / " ) ) ; break ; } date = date . plusDays ( 1 ) ; } } }

import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Calendar ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String YMD = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; SimpleDateFormat sdf2 = new SimpleDateFormat ( " yyyyMMdd " ) ; Date date = new Date ( ) ; Date d1 = new Date ( ) ; String Day1 = " " ; String Day2 = " " ; try { date = sdf . parse ( YMD ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; Day1 = sdf2 . format ( date ) ; if ( Double . valueOf ( Day1 . substring ( 0 , 4 ) ) / Double . valueOf ( Day1 . substring ( 4 , 6 ) ) % Integer . valueOf ( Day1 . substring ( 6 , 8 ) ) == 0 ) { System . out . println ( sdf . format ( date ) ) ; } else { while ( 1 == 1 ) { calendar . add ( Calendar . DATE , 1 ) ; d1 = calendar . getTime ( ) ; Day1 = sdf2 . format ( d1 ) ; if ( Double . valueOf ( Day1 . substring ( 0 , 4 ) ) / Double . valueOf ( Day1 . substring ( 4 , 6 ) ) % Integer . valueOf ( Day1 . substring ( 6 , 8 ) ) == 0 ) { System . out . println ( sdf . format ( d1 ) ) ; break ; } } } } }

import java . io . * ; import java . util . * ; public class Main { public static boolean find_date ( Calendar cal ) { int year = cal . get ( Calendar . YEAR ) ; int month = cal . get ( Calendar . MONTH ) + 1 ; int day = cal . get ( Calendar . DATE ) ; if ( year % month == 0 && year / month % day == 0 ) return true ; else return false ; } public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String date [ ] = scan . next ( ) . split ( " / " , 0 ) ; int year = Integer . parseInt ( date [ 0 ] ) ; int month = Integer . parseInt ( date [ 1 ] ) ; int day = Integer . parseInt ( date [ 2 ] ) ; Calendar cal = Calendar . getInstance ( ) ; cal . set ( year , month - 1 , day ) ; while ( ! ( find_date ( cal ) ) ) cal . add ( Calendar . DAY_OF_MONTH , 1 ) ; year = cal . get ( Calendar . YEAR ) ; month = cal . get ( Calendar . MONTH ) + 1 ; day = cal . get ( Calendar . DATE ) ; System . out . printf ( " % 4d / %02d / %02d \n " , year , month , day ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int md [ ] = new int [ ] { - 1 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; String S = sc . next ( ) ; String sp [ ] = S . split ( " / " ) ; int Y = Integer . parseInt ( sp [ 0 ] ) ; int M = Integer . parseInt ( sp [ 1 ] ) ; int D = Integer . parseInt ( sp [ 2 ] ) ; int ansy = 0 ; int ansm = 0 ; int ansd = 0 ; int y = Y ; int m = M ; while ( ansy == 0 ) { int day = md [ m ] ; if ( m == 2 ) { boolean flag = false ; if ( y % 4 == 0 ) { flag = true ; } if ( y % 100 == 0 ) { flag = false ; } if ( y % 400 == 0 ) { flag = true ; } if ( flag ) { day ++ ; } } for ( int d = D ; d <= day ; d ++ ) { if ( y % m == 0 ) { int y1 = y / m ; if ( y1 % d == 0 ) { ansy = y ; ansm = m ; ansd = d ; break ; } } } D = 1 ; m ++ ; if ( m == 13 ) { m = 1 ; } if ( m == 1 ) y ++ ; } String sy = String . valueOf ( ansy ) ; String sm = String . valueOf ( ansm ) ; String sd = String . valueOf ( ansd ) ; if ( ansm < 10 ) { sm = "0" + sm ; } if ( ansd < 10 ) { sd = "0" + sd ; } System . out . println ( sy + " / " + sm + " / " + sd ) ; } }

import java . util . * ; public class Main { private static int y ; private static int m ; private static int d ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; String [ ] date = str . split ( " / " , 0 ) ; y = Integer . parseInt ( date [ 0 ] ) ; m = Integer . parseInt ( date [ 1 ] ) ; d = Integer . parseInt ( date [ 2 ] ) ; } public static void main ( String args [ ] ) { input ( ) ; Calendar calendar = Calendar . getInstance ( ) ; calendar . set ( y , ( m - 1 ) , d ) ; String answer = " " ; while ( true ) { int year = calendar . get ( Calendar . YEAR ) ; int month = calendar . get ( Calendar . MONTH ) + 1 ; int day = calendar . get ( Calendar . DATE ) ; if ( ( year % ( month * day ) ) == 0 ) { answer = year + " / " + ( ( month >= 10 ) ? month : "0" + month ) + " / " + ( ( day >= 10 ) ? day : "0" + day ) ; break ; } calendar . add ( Calendar . DAY_OF_MONTH , 1 ) ; } System . out . println ( answer ) ; } }

def main ( ) : NEW_LINE INDENT from datetime import datetime NEW_LINE from datetime import timedelta NEW_LINE ymd = input ( ) NEW_LINE fmt = ' % Y / % m / % d ' NEW_LINE current_date = datetime . strptime ( ymd , fmt ) NEW_LINE while True : NEW_LINE INDENT year = current_date . year NEW_LINE month = current_date . month NEW_LINE day = current_date . day NEW_LINE candidate = datetime . strftime ( current_date , fmt ) NEW_LINE if year % ( month * day ) == 0 and candidate >= ymd : NEW_LINE INDENT print ( candidate ) NEW_LINE exit ( ) NEW_LINE DEDENT current_date += timedelta ( days = 1 ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

n = input ( ) NEW_LINE y , m , d = int ( n [ 0 ] + n [ 1 ] + n [ 2 ] + n [ 3 ] ) , int ( n [ 5 ] + n [ 6 ] ) , int ( n [ 8 ] + n [ 9 ] ) NEW_LINE D = [ 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] NEW_LINE def uruu ( ) : NEW_LINE INDENT global y , m NEW_LINE if m == 2 : NEW_LINE INDENT if y % 400 == 0 : return 1 NEW_LINE elif y % 100 == 0 : return 0 NEW_LINE elif y % 4 == 0 : return 1 NEW_LINE else : return 0 NEW_LINE DEDENT return 0 NEW_LINE DEDENT while 1 : NEW_LINE INDENT if y / ( m * d ) % 1 == 0 : break NEW_LINE d += 1 NEW_LINE if d > D [ m - 1 ] + uruu ( ) : NEW_LINE INDENT d = 1 NEW_LINE m += 1 NEW_LINE if m == 13 : NEW_LINE INDENT m = 1 NEW_LINE y += 1 NEW_LINE DEDENT DEDENT DEDENT if m > 9 and d > 9 : print ( str ( y ) + " / " + str ( m ) + " / " + str ( d ) ) NEW_LINE elif m > 9 : print ( str ( y ) + " / " + str ( m ) + " / 0" + str ( d ) ) NEW_LINE elif d > 9 : print ( str ( y ) + " / 0" + str ( m ) + " / " + str ( d ) ) NEW_LINE else : print ( str ( y ) + " / 0" + str ( m ) + " / 0" + str ( d ) ) NEW_LINE

y , m , d = map ( int , input ( ) . split ( ' / ' ) ) NEW_LINE def leap_year ( y ) : NEW_LINE INDENT if y % 400 == 0 : NEW_LINE INDENT return True NEW_LINE DEDENT if y % 100 == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT if y % 4 == 0 : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT lims = { 1 : 31 , 2 : 28 , 3 : 31 , 4 : 30 , 5 : 31 , 6 : 30 , 7 : 31 , 8 : 31 , 9 : 30 , 10 : 31 , 11 : 30 , 12 : 31 } NEW_LINE while m <= 12 : NEW_LINE INDENT lim = lims [ m ] NEW_LINE if leap_year ( y ) and m == 2 : NEW_LINE INDENT lim += 1 NEW_LINE DEDENT while d <= lim : NEW_LINE INDENT if y % ( m * d ) == 0 : NEW_LINE INDENT print ( " { year : 02d } / { month : 02d } / { date : 02d } " . format ( year = y , month = m , date = d ) ) NEW_LINE exit ( ) NEW_LINE DEDENT d += 1 NEW_LINE DEDENT d = 1 NEW_LINE m += 1 NEW_LINE DEDENT print ( " { year : 02d } / { month : 02d } / { date : 02d } " . format ( year = y + 1 , month = 1 , date = 1 ) ) NEW_LINE

def is_leap ( year ) : NEW_LINE INDENT if year % 400 == 0 : NEW_LINE INDENT return True NEW_LINE DEDENT elif year % 100 == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT elif year % 4 == 0 : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT def main ( ) : NEW_LINE INDENT from datetime import datetime NEW_LINE ymd = input ( ) NEW_LINE ymd_mod = list ( map ( int , ymd . split ( ' / ' ) ) ) NEW_LINE days = [ 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] NEW_LINE for year in range ( ymd_mod [ 0 ] , 3000 ) : NEW_LINE INDENT for month , day in enumerate ( days , 1 ) : NEW_LINE INDENT for d in range ( 1 , day + 1 ) : NEW_LINE INDENT if is_leap ( year ) and month == 2 and d == 29 : NEW_LINE INDENT candidate = datetime ( year , month , d ) . strftime ( ' % Y / % m / % d ' ) NEW_LINE if year % ( month * d ) == 0 and candidate >= ymd : NEW_LINE INDENT print ( candidate ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT elif not is_leap ( year ) and month == 2 and d == 29 : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT candidate = datetime ( year , month , d ) . strftime ( ' % Y / % m / % d ' ) NEW_LINE if year % ( month * d ) == 0 and candidate >= ymd : NEW_LINE INDENT print ( candidate ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT print ( '3000/01/01' ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

month = [ 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] NEW_LINE S = list ( map ( int , input ( ) . split ( " / " ) ) ) NEW_LINE while S [ 0 ] / S [ 1 ] / S [ 2 ] != S [ 0 ] // S [ 1 ] // S [ 2 ] : NEW_LINE INDENT Y = S [ 0 ] NEW_LINE flag = False NEW_LINE if Y % 400 == 0 : NEW_LINE INDENT flag = True NEW_LINE DEDENT elif Y % 100 == 0 : NEW_LINE INDENT flag = False NEW_LINE DEDENT elif Y % 4 == 0 : NEW_LINE INDENT flag = True NEW_LINE DEDENT m = 0 NEW_LINE if S [ 1 ] == 2 and flag : NEW_LINE INDENT m = 1 NEW_LINE DEDENT S [ 2 ] += 1 NEW_LINE if month [ S [ 1 ] - 1 ] + m < S [ 2 ] : NEW_LINE INDENT S [ 2 ] = 1 NEW_LINE S [ 1 ] += 1 NEW_LINE if S [ 1 ] == 13 : NEW_LINE INDENT S [ 1 ] = 1 NEW_LINE S [ 0 ] += 1 NEW_LINE DEDENT DEDENT DEDENT T = [ str ( S [ 0 ] ) ] NEW_LINE if S [ 1 ] // 10 == 0 : NEW_LINE INDENT T . append ( "0" + str ( S [ 1 ] ) ) NEW_LINE DEDENT else : NEW_LINE INDENT T . append ( str ( S [ 1 ] ) ) NEW_LINE DEDENT if S [ 2 ] // 10 == 0 : NEW_LINE INDENT T . append ( "0" + str ( S [ 2 ] ) ) NEW_LINE DEDENT else : NEW_LINE INDENT T . append ( str ( S [ 2 ] ) ) NEW_LINE DEDENT print ( " / " . join ( T ) ) NEW_LINE


import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int N = 0 , W = 0 , E = 0 , S = 0 ; String s = sc . next ( ) ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { switch ( s . charAt ( i ) ) { case ' N ' : ++ N ; break ; case ' W ' : ++ W ; break ; case ' S ' : ++ S ; break ; case ' E ' : ++ E ; break ; default : break ; } } String ans = " Yes " ; if ( ( N == 0 || S == 0 ) && ( N + S > 0 ) ) ans = " No " ; else if ( ( W == 0 || E == 0 ) && ( W + E > 0 ) ) ans = " No " ; out . println ( ans ) ; } }

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 ( ) ; Boolean a = true ; if ( S . contains ( " N " ) ) { if ( S . contains ( " S " ) ) { } else { a = false ; } } if ( S . contains ( " W " ) ) { if ( S . contains ( " E " ) ) { } else { a = false ; } } if ( S . contains ( " S " ) ) { if ( S . contains ( " N " ) ) { } else { a = false ; } } if ( S . contains ( " E " ) ) { if ( S . contains ( " W " ) ) { } else { a = false ; } } if ( a ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AWannaGoBackHome solver = new AWannaGoBackHome ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AWannaGoBackHome { private static final String YES = " Yes " ; private static final String NO = " No " ; public void solve ( int testNumber , LightScanner in , PrintWriter out ) { String s = in . string ( ) ; int mask = 0 ; for ( char c : s . toCharArray ( ) ) { switch ( c ) { case ' N ' : mask |= 0b0001 ; break ; case ' S ' : mask |= 0b0010 ; break ; case ' E ' : mask |= 0b0100 ; break ; case ' W ' : mask |= 0b1000 ; break ; } } if ( mask == 3 || mask == 12 || mask == 15 ) { out . println ( YES ) ; } else { out . println ( NO ) ; } } } static class LightScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public LightScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String string ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } } }

import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] , ns = 0 , we = 0 ; String s = new String ( ) ; s = sc . next ( ) ; sc . close ( ) ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) { if ( s . charAt ( i ) == ' N ' ) ++ a [ 0 ] ; else if ( s . charAt ( i ) == ' W ' ) ++ a [ 1 ] ; else if ( s . charAt ( i ) == ' S ' ) ++ a [ 2 ] ; else ++ a [ 3 ] ; } for ( int i = 0 ; i < 4 ; i += 2 ) if ( a [ i ] > 0 ) ++ ns ; for ( int i = 1 ; i < 4 ; i += 2 ) if ( a [ i ] > 0 ) ++ we ; System . out . print ( ns % 2 > 0 || we % 2 > 0 ? " No " : " Yes " ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] srgs ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; boolean fig1 = false ; boolean fig2 = false ; boolean fig3 = false ; boolean fig4 = false ; for ( int i = 0 ; i != a . length ( ) ; i ++ ) { char ch = a . charAt ( i ) ; switch ( ch ) { case ' S ' : fig1 = true ; break ; case ' E ' : fig2 = true ; break ; case ' N ' : fig3 = true ; break ; case ' W ' : fig4 = true ; break ; } } boolean ans = false ; if ( fig3 && fig1 && fig2 == false && fig4 == false ) { ans = true ; } if ( fig3 == false && fig1 == false && fig2 && fig4 ) { ans = true ; } if ( fig1 && fig2 && fig3 && fig4 ) { ans = true ; } System . out . println ( ans ? " Yes " : " No " ) ; scan . close ( ) ; } }

S = input ( ) NEW_LINE s = set ( S [ : ] ) NEW_LINE ans = s == set ( [ " N " , " W " , " S " , " E " ] ) or s == set ( [ " N " , " S " ] ) or s == set ( [ " W " , " E " ] ) NEW_LINE print ( " Yes " if ans else " No " ) NEW_LINE

print ( ' NYoe ▁ s ' [ set ( input ( ) ) in map ( set , [ ' ' , ' NS ' , ' EW ' , ' NSEW ' ] ) : : 2 ] ) NEW_LINE

S = input ( ) NEW_LINE N = len ( S ) NEW_LINE d = [ 0 , 0 , 0 , 0 ] NEW_LINE s = [ ' N ' , ' W ' , ' S ' , ' E ' ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( 4 ) : NEW_LINE INDENT if S [ i ] == s [ j ] : NEW_LINE INDENT d [ j ] += 1 NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT flag = True NEW_LINE if ( d [ 0 ] == 0 and d [ 2 ] == 0 ) or ( d [ 0 ] != 0 and d [ 2 ] != 0 ) : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT flag = False NEW_LINE DEDENT if ( d [ 1 ] == 0 and d [ 3 ] == 0 ) or ( d [ 1 ] != 0 and d [ 3 ] != 0 ) : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT flag = False NEW_LINE DEDENT if flag : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT

s = set ( list ( input ( ) ) ) NEW_LINE if " S " in s : NEW_LINE INDENT if not " N " in s : NEW_LINE INDENT print ( " No " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT if " N " in s : NEW_LINE INDENT if not " S " in s : NEW_LINE INDENT print ( " No " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT if " E " in s : NEW_LINE INDENT if not " W " in s : NEW_LINE INDENT print ( " No " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT if " W " in s : NEW_LINE INDENT if not " E " in s : NEW_LINE INDENT print ( " No " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT print ( " Yes " ) NEW_LINE

S = input ( ) NEW_LINE flag = 1 NEW_LINE if S . count ( " W " ) == 0 and S . count ( " E " ) == 0 : NEW_LINE INDENT if S . count ( " N " ) == 0 or S . count ( " S " ) == 0 : NEW_LINE INDENT flag = 0 NEW_LINE DEDENT else : NEW_LINE INDENT flag = 1 NEW_LINE DEDENT DEDENT elif S . count ( " W " ) == 0 or S . count ( " E " ) == 0 : NEW_LINE INDENT flag = 0 NEW_LINE DEDENT elif S . count ( " N " ) == 0 and S . count ( " S " ) == 0 : NEW_LINE INDENT flag = 1 NEW_LINE DEDENT elif S . count ( " N " ) == 0 or S . count ( " S " ) == 0 : NEW_LINE INDENT flag = 0 NEW_LINE DEDENT else : NEW_LINE INDENT flag = 1 NEW_LINE DEDENT if flag == 1 : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT


import java . util . * ; import static java . lang . System . * ; 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 ; boolean watered = false ; int [ ] h = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { h [ i ] = sc . nextInt ( ) ; if ( h [ i ] == 0 ) { count ++ ; } } while ( count < h . length ) { for ( int i = 0 ; i < N ; i ++ ) { if ( h [ i ] > 0 ) { h [ i ] -- ; if ( h [ i ] == 0 ) { count ++ ; } watered = true ; continue ; } if ( watered ) { ans ++ ; watered = false ; } } if ( watered ) { ans ++ ; watered = false ; } } out . println ( ans ) ; } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( bf . readLine ( ) ) ; String [ ] str = bf . readLine ( ) . split ( " ▁ " ) ; List < Integer > h = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { h . add ( Integer . parseInt ( str [ i ] ) ) ; } System . out . println ( count ( h ) ) ; } public static Integer min ( List < Integer > data ) { Integer min = data . get ( 0 ) ; for ( int i = 1 ; i < data . size ( ) ; i ++ ) { Integer value = data . get ( i ) ; if ( value < min ) { min = value ; } } return min ; } public static int count ( List < Integer > data ) { int min = min ( data ) ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { Integer value = data . get ( i ) ; data . set ( i , value - min ) ; } boolean zero = true ; List < List > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { int value = data . get ( i ) ; if ( zero && value > 0 ) { a . add ( new ArrayList < Integer > ( ) ) ; a . get ( a . size ( ) - 1 ) . add ( value ) ; zero = false ; } else if ( ! zero ) { if ( value > 0 ) { a . get ( a . size ( ) - 1 ) . add ( value ) ; } else { zero = true ; } } } int answer = min ; for ( int i = 0 ; i < a . size ( ) ; i ++ ) { answer += count ( a . get ( i ) ) ; } return answer ; } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .

import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; int next ( int [ ] h , int idx ) { for ( int i = idx ; i < h . length ; i ++ ) { if ( h [ i ] != 0 ) { return i ; } } return - 1 ; } public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int idx = 0 ; while ( true ) { idx = next ( h , idx ) ; if ( idx == - 1 ) { break ; } while ( h [ idx ] > 0 ) { ans ++ ; for ( int i = idx ; i < n && h [ i ] > 0 ; i ++ ) { h [ i ] -- ; } } } out . println ( ans ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } }

import java . util . Scanner ; public class Main { static int N ; static int [ ] flowers ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; flowers = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { flowers [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 0 ; int cur = 0 ; for ( int k = 0 ; k < N ; k ++ ) { if ( flowers [ k ] > cur ) { ans += flowers [ k ] - cur ; } cur = flowers [ k ] ; } System . out . println ( ans ) ; } }

public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) , last = 0 , ans = 0 ; for ( int i = 0 , j ; i < n ; i ++ , last = j ) if ( last >= ( j = scanner . nextInt ( ) ) ) ans += last - j ; System . out . println ( last + ans ) ; } }

N = int ( input ( ) ) NEW_LINE H = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE S = sum ( H ) NEW_LINE ans = 0 NEW_LINE while S > 0 : NEW_LINE INDENT for i in range ( N ) : NEW_LINE INDENT if H [ i ] > 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT for j in range ( i , N ) : NEW_LINE INDENT if H [ j ] == 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if j == N - 1 and H [ j ] > 0 : NEW_LINE INDENT j += 1 NEW_LINE DEDENT for k in range ( i , j ) : NEW_LINE INDENT H [ k ] -= 1 NEW_LINE DEDENT ans += 1 NEW_LINE S -= j - i NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE def solve ( N : int , h : " List [ int ] " ) : NEW_LINE INDENT cost = 0 NEW_LINE CUR = [ 0 for i in range ( len ( h ) ) ] NEW_LINE for i in range ( len ( CUR ) ) : NEW_LINE INDENT while CUR [ i ] != h [ i ] : NEW_LINE INDENT l = i NEW_LINE r = i NEW_LINE for j in range ( i , len ( CUR ) ) : NEW_LINE INDENT if CUR [ i ] >= h [ j ] : NEW_LINE INDENT break NEW_LINE DEDENT r += 1 NEW_LINE DEDENT grow = 10 ** 16 NEW_LINE for j in range ( l , r ) : NEW_LINE INDENT grow = min ( grow , h [ j ] - CUR [ j ] ) NEW_LINE DEDENT for j in range ( l , r ) : NEW_LINE INDENT CUR [ j ] += grow NEW_LINE DEDENT cost += grow NEW_LINE DEDENT DEDENT print ( cost ) NEW_LINE return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT def iterate_tokens ( ) : NEW_LINE INDENT for line in sys . stdin : NEW_LINE INDENT for word in line . split ( ) : NEW_LINE INDENT yield word NEW_LINE DEDENT DEDENT DEDENT tokens = iterate_tokens ( ) NEW_LINE N = int ( next ( tokens ) ) NEW_LINE h = [ int ( next ( tokens ) ) for _ in range ( N ) ] NEW_LINE solve ( N , h ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

import sys NEW_LINE def ii2ss ( n ) : NEW_LINE INDENT return [ sys . stdin . readline ( ) for _ in range ( n ) ] NEW_LINE DEDENT def sp2nn ( sp , sep = ' ▁ ' ) : NEW_LINE INDENT return [ int ( s ) for s in sp . split ( sep ) ] NEW_LINE DEDENT def ss2nn ( ss ) : NEW_LINE INDENT return [ int ( s ) for s in list ( ss ) ] NEW_LINE DEDENT def count ( hh , n ) : NEW_LINE INDENT c = 0 NEW_LINE b = False NEW_LINE for h in hh : NEW_LINE INDENT if h >= n : NEW_LINE INDENT if b == False : NEW_LINE INDENT b = True NEW_LINE c += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if b == True : NEW_LINE INDENT b = False NEW_LINE DEDENT DEDENT DEDENT return c NEW_LINE DEDENT def main ( ss ) : NEW_LINE INDENT hh = sp2nn ( ss [ 1 ] ) NEW_LINE total = 0 NEW_LINE n = 1 NEW_LINE while True : NEW_LINE INDENT c = count ( hh , n ) NEW_LINE if c == 0 : NEW_LINE INDENT break NEW_LINE DEDENT total += c NEW_LINE n += 1 NEW_LINE DEDENT print ( total ) NEW_LINE DEDENT main ( ii2ss ( 2 ) ) NEW_LINE

import sys NEW_LINE def f ( k ) : NEW_LINE INDENT global N , h , update NEW_LINE if k == N : NEW_LINE INDENT return - 1 NEW_LINE DEDENT if h [ k ] == 0 : NEW_LINE INDENT return k NEW_LINE DEDENT else : NEW_LINE INDENT h [ k ] -= 1 NEW_LINE update = True NEW_LINE f ( k + 1 ) NEW_LINE DEDENT DEDENT update = False NEW_LINE N = int ( input ( ) ) NEW_LINE h = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) NEW_LINE r = 0 NEW_LINE s = 0 NEW_LINE try : NEW_LINE INDENT while True : NEW_LINE INDENT if h [ s ] != 0 : NEW_LINE INDENT break NEW_LINE DEDENT s += 1 NEW_LINE DEDENT DEDENT except Exception : NEW_LINE INDENT print ( 0 ) NEW_LINE sys . exit ( 0 ) NEW_LINE DEDENT while True : NEW_LINE INDENT f ( s ) NEW_LINE if update : NEW_LINE INDENT r += 1 NEW_LINE while s != N - 1 and h [ s ] == 0 : NEW_LINE INDENT s += 1 NEW_LINE DEDENT update = False NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( r ) NEW_LINE

def gcd_core ( a , b ) : NEW_LINE INDENT if b == 0 : NEW_LINE INDENT return a NEW_LINE DEDENT else : NEW_LINE INDENT return gcd_core ( b , a % b ) NEW_LINE DEDENT DEDENT def gcd ( arr ) : NEW_LINE INDENT g = gcd_core ( arr [ 0 ] , arr [ 1 ] ) NEW_LINE for i in range ( 2 , len ( arr ) ) : NEW_LINE INDENT g = gcd_core ( g , arr [ i ] ) NEW_LINE DEDENT return g NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE bef = arr [ 0 ] NEW_LINE cst = arr [ 0 ] NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT if bef < arr [ i ] : NEW_LINE INDENT cst += arr [ i ] - bef NEW_LINE DEDENT bef = arr [ i ] NEW_LINE DEDENT print ( cst ) NEW_LINE


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 ans ; if ( B >= A * C ) { ans = C ; } else { ans = ( int ) B / A ; } System . out . println ( ans ) ; } }

import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; if ( b / a > c ) { count = c ; } else { count = b / a ; } System . out . println ( count ) ; System . out . flush ( ) ; sc . close ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { try ( final Scanner sc = new Scanner ( System . in ) ) { final int A = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int C = sc . nextInt ( ) ; System . out . println ( Math . min ( B / A , C ) ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A , B , C ; A = s . nextInt ( ) ; B = s . nextInt ( ) ; C = s . nextInt ( ) ; System . out . println ( Math . min ( B / A , C ) ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * c <= b ) { System . out . println ( c ) ; } else { int count = 0 ; for ( int i = 1 ; i <= c ; i ++ ) { if ( i * a <= b ) { count ++ ; } else { break ; } } System . out . println ( count ) ; } sc . close ( ) ; } }

A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE print ( min ( B // A , C ) ) NEW_LINE

import math NEW_LINE i = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = i [ 0 ] NEW_LINE B = i [ 1 ] NEW_LINE C = i [ 2 ] NEW_LINE if ( A * C <= B ) : NEW_LINE INDENT print ( C ) NEW_LINE DEDENT if ( A * C > B ) : NEW_LINE INDENT if ( B >= A ) : NEW_LINE INDENT print ( math . floor ( B / A ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT DEDENT

a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE res = 0 NEW_LINE if a > b : NEW_LINE INDENT res = 0 NEW_LINE DEDENT else : NEW_LINE INDENT res = b // a NEW_LINE DEDENT if res <= c : NEW_LINE INDENT print ( res ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( c ) NEW_LINE DEDENT

m = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = m [ 0 ] NEW_LINE b = m [ 1 ] NEW_LINE c = m [ 2 ] NEW_LINE if ( b >= a * c ) : NEW_LINE INDENT print ( c ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( b // a ) NEW_LINE DEDENT

A , B , C = [ int ( v ) for v in input ( ) . split ( ) ] NEW_LINE print ( min ( B // A , C ) ) NEW_LINE


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

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

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

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = ( a + b ) % 24 ; System . out . print ( ans ) ; } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( ( sc . nextInt ( ) + sc . nextInt ( ) ) % 24 ) ; } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ( a + b ) % 24 ) NEW_LINE

print ( eval ( ' ( ' + input ( ) . replace ( ' ▁ ' , ' + ' ) + ' ) %24' ) ) NEW_LINE

import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE A , B = map ( int , input ( ) . split ( ) ) NEW_LINE return ( A + B ) % 24 NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT print ( main ( ) ) NEW_LINE DEDENT

from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT a , b = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE print ( ( a + b ) % 24 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE c = a + b NEW_LINE if c <= 23 : NEW_LINE INDENT print ( c ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( c - 24 ) NEW_LINE DEDENT


public class Main { public static void main ( String [ ] $ ) { int n = 2025 - new java . util . Scanner ( System . in ) . nextInt ( ) ; java . util . stream . IntStream . range ( 1 , 10 ) . filter ( i -> n % i == 0 && n / i <= 9 ) . forEach ( i -> System . out . println ( i + " ▁ x ▁ " + n / i ) ) ; } }

import java . util . * ; public class Main { static final int SUM = 2025 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = SUM - n ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) { for ( int j = 1 ; j <= 9 ; j ++ ) { if ( i * j == ans ) { sb . append ( i ) . append ( " ▁ x ▁ " ) . append ( j ) . append ( " \n " ) ; } } } System . out . print ( sb ) ; } }

import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; @ SuppressWarnings ( " unchecked " ) public class Main { public static void main ( String [ ] args ) throws IOException { final String s ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { s = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; int N = Integer . parseInt ( s ) ; int [ ] [ ] tbl = new int [ 9 ] [ 9 ] ; int sum = 0 ; for ( int i = 0 ; i < tbl . length ; i ++ ) { for ( int j = 0 ; j < tbl [ i ] . length ; j ++ ) { tbl [ i ] [ j ] = ( i + 1 ) * ( j + 1 ) ; sum += tbl [ i ] [ j ] ; } } int x = sum - N ; for ( int i = 0 ; i < tbl . length ; i ++ ) for ( int j = 0 ; j < tbl [ i ] . length ; j ++ ) if ( tbl [ i ] [ j ] == x ) out . println ( ( i + 1 ) + " ▁ x ▁ " + ( j + 1 ) ) ; out . flush ( ) ; } }

import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; n = 2025 - n ; for ( int i = 1 ; i < 10 ; i ++ ) { for ( int j = 1 ; j < 10 ; j ++ ) { if ( i * j == n ) out . println ( i + " ▁ x ▁ " + j ) ; } } } }

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 N = 2025 - n ; List < String > list = new ArrayList < > ( ) ; for ( int i = 1 ; i <= 9 ; i ++ ) { for ( int j = i ; j <= 9 ; j ++ ) { if ( i * j == N && i == j ) { list . add ( new String ( i + " ▁ x ▁ " + j ) ) ; } else if ( i * j == N ) { list . add ( new String ( i + " ▁ x ▁ " + j ) ) ; list . add ( new String ( j + " ▁ x ▁ " + i ) ) ; } } } Collections . sort ( list ) ; for ( String s : list ) { System . out . println ( s ) ; } } }

n = int ( input ( ) ) NEW_LINE for i in range ( 1 , 10 ) : NEW_LINE INDENT for j in range ( 1 , 10 ) : NEW_LINE INDENT if i * j + n == 2025 : NEW_LINE INDENT print ( ' { } ▁ x ▁ { } ' . format ( i , j ) ) NEW_LINE DEDENT DEDENT DEDENT

max = 2025 NEW_LINE kuku = int ( input ( ) ) NEW_LINE diff = max - kuku NEW_LINE for i in range ( 1 , 10 ) : NEW_LINE INDENT if i * 9 < diff or diff < i : NEW_LINE INDENT continue NEW_LINE DEDENT for j in range ( 1 , 10 ) : NEW_LINE INDENT if i * j == diff : NEW_LINE INDENT print ( " { } ▁ x ▁ { } " . format ( i , j ) ) NEW_LINE DEDENT DEDENT DEDENT

n = int ( input ( ) ) NEW_LINE a = 2025 - n NEW_LINE divs = [ ] NEW_LINE for i in range ( 1 , int ( a ** 0.5 ) + 1 ) : NEW_LINE INDENT if a % i == 0 : NEW_LINE INDENT divs . append ( i ) NEW_LINE if i != a // i : NEW_LINE INDENT divs . append ( a // i ) NEW_LINE DEDENT DEDENT DEDENT divs . sort ( ) NEW_LINE for x in divs : NEW_LINE INDENT y = int ( a / x ) NEW_LINE if x < 10 and y < 10 : NEW_LINE INDENT print ( str ( x ) + ' ▁ x ▁ ' + str ( y ) ) NEW_LINE DEDENT DEDENT

N = int ( input ( ) ) NEW_LINE ans = [ ] NEW_LINE for i in range ( 1 , 2026 - N ) : NEW_LINE INDENT if i >= 10 : NEW_LINE INDENT break NEW_LINE DEDENT if ( 2025 - N ) % i == 0 and ( 2025 - N ) // i < 10 : NEW_LINE INDENT ans . append ( str ( i ) + ' ▁ x ▁ ' + str ( ( 2025 - N ) // i ) ) NEW_LINE DEDENT DEDENT print ( * ans , sep = ' \n ' ) NEW_LINE

n = int ( input ( ) ) NEW_LINE dic = { } NEW_LINE for i in range ( 1 , 10 ) : NEW_LINE INDENT for j in range ( 1 , 10 ) : NEW_LINE INDENT if i * j in dic . keys ( ) : NEW_LINE INDENT dic [ i * j ] . append ( str ( i ) + " ▁ x ▁ " + str ( j ) ) NEW_LINE DEDENT else : NEW_LINE INDENT dic [ i * j ] = [ str ( i ) + " ▁ x ▁ " + str ( j ) ] NEW_LINE DEDENT DEDENT DEDENT ls = sorted ( dic [ 2025 - n ] ) NEW_LINE for i in ls : NEW_LINE INDENT print ( i ) NEW_LINE DEDENT