import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int W = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans ; if ( a < b ) { ans = b - a - W ; } else { ans = a - b - W ; } System . out . println ( ans > 0 ? ans : 0 ) ; } }

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 W = in . nextInt ( ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; if ( a <= b && b <= a + W || a <= b + W && b + W <= a ) { out . println ( 0 ) ; } else { out . println ( a < b ? b - ( a + W ) : a - ( b + W ) ) ; } } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }

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

import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int mod = 1000000007 ; public static void main ( String [ ] args ) { int w = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Line line1 = new Line ( a , a + w ) ; Line line2 = new Line ( b , b + w ) ; System . out . println ( Math . abs ( line1 . getL ( ) - line2 . getL ( ) ) <= w ? 0 : Math . abs ( line2 . getL ( ) - line1 . getL ( ) ) - w ) ; } } class Line { private int L ; private int R ; Line ( int a , int b ) { L = a ; R = b ; } int getL ( ) { return L ; } int getR ( ) { return R ; } int getLength ( ) { return R - L ; } void setL ( int n ) { L = n ; } void setR ( int n ) { R = n ; } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int w = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( b - ( a + w ) , a - ( b + w ) ) , 0 ) ) ; } }

W , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE if a + W < b : NEW_LINE INDENT ans = b - a - W NEW_LINE DEDENT elif b + W < a : NEW_LINE INDENT ans = a - b - W NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE W , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE a , b = min ( a , b ) , max ( a , b ) NEW_LINE return max ( 0 , b - ( a + W ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT print ( main ( ) ) NEW_LINE DEDENT

def narrow_rectangles_easy ( W : int , a : int , b : int ) -> int : NEW_LINE INDENT if a + W < b : NEW_LINE INDENT return b - ( a + W ) NEW_LINE DEDENT if b + W < a : NEW_LINE INDENT return a - ( b + W ) NEW_LINE DEDENT return 0 NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT W , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE ans = narrow_rectangles_easy ( W , a , b ) NEW_LINE print ( ans ) NEW_LINE DEDENT

from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT W , a , b = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE if ( a > b ) : NEW_LINE INDENT tmp = a NEW_LINE a = b NEW_LINE b = tmp NEW_LINE DEDENT if b - ( a + W ) <= 0 : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT else : NEW_LINE INDENT ans = b - ( a + W ) NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

W , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( 0 , A - B - W , B - A - W ) ) NEW_LINE


import java . util . * ; public class Main { int [ ] numbers = new int [ 10 ] ; int [ ] invers = new int [ 10 ] ; Scanner sc ; void run ( ) { this . initialize ( ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > convertedNum = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { convertedNum . add ( this . convert ( sc . nextInt ( ) ) ) ; } Collections . sort ( convertedNum ) ; for ( int num : convertedNum ) { System . out . println ( this . deconvert ( num ) ) ; } } void initialize ( ) { sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < numbers . length ; i ++ ) { numbers [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < numbers . length ; i ++ ) { invers [ numbers [ i ] ] = i ; } } int convert ( int num ) { int m = num ; int p = num ; int ret = 0 ; for ( int i = 0 ; m > 0 ; i ++ ) { p = m % 10 ; m /= 10 ; ret += invers [ p ] * Math . pow ( 10 , i ) ; } return ret ; } int deconvert ( int num ) { int m = num ; int p = num ; int ret = 0 ; for ( int i = 0 ; m > 0 ; i ++ ) { p = m % 10 ; m /= 10 ; ret += numbers [ p ] * Math . pow ( 10 , i ) ; } return ret ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } }

import java . util . ArrayList ; import java . util . Comparator ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static IntStream REPS ( int v ) { return IntStream . range ( 0 , v ) ; } static IntStream REPS ( int l , int r ) { return IntStream . rangeClosed ( l , r ) ; } static IntStream INS ( int n ) { return REPS ( n ) . map ( i -> getInt ( ) ) ; } static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static class E { String t ; int i ; public E ( String t , int i ) { this . t = t ; this . i = i ; } public int getI ( ) { return this . i ; } public int getL ( ) { return this . t . length ( ) ; } public String getT ( ) { return this . t ; } } public static void main ( String [ ] $ ) { int [ ] order = new int [ 10 ] ; REPS ( 10 ) . forEach ( i -> order [ getInt ( ) ] = i ) ; ArrayList < E > m = new ArrayList < > ( ) ; for ( int i = getInt ( ) ; i > 0 ; -- i ) { String in = s . next ( ) ; char [ ] c = in . toCharArray ( ) ; for ( int j = 0 ; j < c . length ; ++ j ) { c [ j ] = ( char ) ( order [ c [ j ] - '0' ] + '0' ) ; } m . add ( new E ( in , Integer . parseInt ( String . valueOf ( c ) ) ) ) ; } m . stream ( ) . sorted ( Comparator . comparingInt ( E :: getL ) . thenComparingInt ( E :: getI ) ) . map ( E :: getT ) . forEach ( System . out :: println ) ; } }

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 [ ] b = Arrays . asList ( br . readLine ( ) . split ( " ▁ " ) ) . stream ( ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int [ ] x = new int [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) x [ b [ i ] ] = i ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = br . readLine ( ) ; a [ i ] = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { a [ i ] *= 10 ; a [ i ] += x [ s . charAt ( j ) - '0' ] ; } } Arrays . sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) { StringBuilder sb = new StringBuilder ( ) ; int t = a [ i ] ; if ( t == 0 ) { System . out . println ( 0 ) ; continue ; } while ( t > 0 ) { sb . append ( b [ t % 10 ] ) ; t /= 10 ; } sb . reverse ( ) ; System . out . println ( sb . toString ( ) ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] change = new String [ 10 ] ; String [ ] dec = new String [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { int b = sc . nextInt ( ) ; change [ b ] = String . valueOf ( i ) ; dec [ i ] = String . valueOf ( b ) ; } int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { String d = String . valueOf ( sc . nextInt ( ) ) ; String num = " " ; for ( int j = 0 ; j < d . length ( ) ; j ++ ) { num += change [ Integer . parseInt ( String . valueOf ( d . charAt ( j ) ) ) ] ; } a [ i ] = Integer . parseInt ( num ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < N ; i ++ ) { String d = String . valueOf ( a [ i ] ) ; String num = " " ; for ( int j = 0 ; j < d . length ( ) ; j ++ ) { num += dec [ Integer . parseInt ( String . valueOf ( d . charAt ( j ) ) ) ] ; } System . out . println ( num ) ; } } }

import java . io . * ; import java . math . * ; import java . text . * ; import java . util . * ; import java . util . regex . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] digit = new int [ 10 ] ; Map < Integer , Integer > map = new HashMap < > ( ) ; Map < Integer , Integer > reverseMap = new HashMap < > ( ) ; for ( int i = 0 ; i < digit . length ; i ++ ) { digit [ i ] = scan . nextInt ( ) ; map . put ( i , digit [ i ] ) ; reverseMap . put ( digit [ i ] , i ) ; } int n = scan . nextInt ( ) ; List < Integer > valueString = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String next = scan . next ( ) ; String res = " " ; for ( int j = 0 ; j < next . length ( ) ; j ++ ) { res += Character . toString ( ( char ) ( reverseMap . get ( next . charAt ( j ) - '0' ) + '0' ) ) ; } valueString . add ( Integer . parseInt ( res ) ) ; } valueString . sort ( Comparator . comparingInt ( o -> o ) ) ; for ( int i = 0 ; i < n ; i ++ ) { String next = " " + valueString . get ( i ) ; String res = " " ; for ( int j = 0 ; j < next . length ( ) ; j ++ ) { res += Character . toString ( ( char ) ( map . get ( next . charAt ( j ) - '0' ) + '0' ) ) ; } System . out . println ( res ) ; } } }

d = { } NEW_LINE B = input ( ) . split ( ) NEW_LINE for i in range ( 10 ) : NEW_LINE INDENT d [ B [ i ] ] = str ( i ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT t = input ( ) NEW_LINE u = ' ' NEW_LINE for i in t : NEW_LINE INDENT u += d [ i ] NEW_LINE DEDENT a . append ( [ int ( u ) , t ] ) NEW_LINE DEDENT a . sort ( key = lambda x : x [ 0 ] ) NEW_LINE for v in a : NEW_LINE INDENT print ( v [ 1 ] ) NEW_LINE DEDENT

d = { str ( j ) : str ( i ) for i , j in enumerate ( map ( int , input ( ) . split ( ) ) ) } NEW_LINE e = { j : i for i , j in d . items ( ) } NEW_LINE n = int ( input ( ) ) NEW_LINE a = [ input ( ) for _ in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT a [ i ] = int ( a [ i ] . translate ( str . maketrans ( d ) ) ) NEW_LINE DEDENT a . sort ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT print ( str ( a [ i ] ) . translate ( str . maketrans ( e ) ) ) NEW_LINE DEDENT

rule = input ( ) . split ( ) NEW_LINE N = int ( input ( ) ) NEW_LINE inputs = [ str ( input ( ) ) for _ in range ( N ) ] NEW_LINE ans = [ ] NEW_LINE for item in inputs : NEW_LINE INDENT ans . append ( ( item , int ( ' ' . join ( str ( rule . index ( key ) ) for key in item ) ) ) ) NEW_LINE DEDENT for item in sorted ( ans , key = lambda x : x [ 1 ] ) : NEW_LINE INDENT print ( item [ 0 ] ) NEW_LINE DEDENT

sbef = list ( "0123456789" ) NEW_LINE d = str . maketrans ( input ( ) . replace ( " ▁ " , " " ) , "0123456789" ) NEW_LINE def tr ( n ) : NEW_LINE INDENT global d NEW_LINE return ( int ( n . translate ( d ) ) ) NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE a = [ input ( ) for _ in range ( n ) ] NEW_LINE a . sort ( key = tr ) NEW_LINE for i in a : NEW_LINE INDENT print ( i ) NEW_LINE DEDENT

z , n , a , b = input ( ) . split ( ) , int ( input ( ) ) , [ ] , [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT m = input ( ) NEW_LINE x = 0 NEW_LINE for j in range ( len ( m ) ) : x += ( z . index ( m [ len ( m ) - j - 1 ] ) ) * ( 10 ** j ) NEW_LINE a . append ( x ) NEW_LINE b . append ( m ) NEW_LINE DEDENT def swap ( ab , ba , X ) : NEW_LINE INDENT abc = X [ ab ] NEW_LINE X [ ab ] = X [ ba ] NEW_LINE X [ ba ] = abc NEW_LINE DEDENT h = n NEW_LINE while 1 : NEW_LINE INDENT hh = a [ : ] NEW_LINE if h > 1 : h = round ( h // 1.3 ) NEW_LINE for i in range ( n - h ) : NEW_LINE INDENT if a [ i ] > a [ i + h ] : NEW_LINE INDENT swap ( i , i + h , a ) NEW_LINE swap ( i , i + h , b ) NEW_LINE DEDENT DEDENT if hh == a and h == 1 : break NEW_LINE DEDENT for i in b : print ( i ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int [ ] c = new int [ M + 1 ] ; for ( int i = 1 ; i <= M ; i ++ ) { c [ i ] = scanner . nextInt ( ) ; } int cards = N ; int index = - 1 ; boolean flag = true ; for ( int i = 1 ; i <= M ; i ++ ) { if ( cards <= A ) { cards += B ; } if ( cards < c [ i ] ) { index = i ; flag = false ; break ; } cards -= c [ i ] ; } if ( flag ) { System . out . println ( " complete " ) ; } else { System . out . println ( index ) ; } } }

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

import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] param = br . readLine ( ) . split ( " ▁ " ) ; Integer defo = Integer . valueOf ( param [ 0 ] ) ; Integer nissu = Integer . valueOf ( param [ 1 ] ) ; Integer limit = Integer . valueOf ( param [ 2 ] ) ; Integer hojuu = Integer . valueOf ( param [ 3 ] ) ; Integer tmpMaisu = defo ; if ( tmpMaisu <= limit ) { tmpMaisu += hojuu ; } for ( int i = 0 ; i < nissu ; i ++ ) { tmpMaisu -= Integer . valueOf ( br . readLine ( ) ) ; if ( tmpMaisu < 0 ) { System . out . println ( i + 1 ) ; return ; } if ( tmpMaisu <= limit ) { tmpMaisu += hojuu ; } } System . out . println ( " complete " ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader bfr = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = " " ; str = bfr . readLine ( ) ; StringTokenizer stk = new StringTokenizer ( str , " ▁ " ) ; int meisi = Integer . parseInt ( stk . nextToken ( ) ) ; int nisuu = Integer . parseInt ( stk . nextToken ( ) ) ; int hoju_min = Integer . parseInt ( stk . nextToken ( ) ) ; int hmi = Integer . parseInt ( stk . nextToken ( ) ) ; int heru = 0 ; boolean kubari = true ; for ( int i = 0 ; i < nisuu ; i ++ ) { str = bfr . readLine ( ) ; if ( meisi <= hoju_min ) { meisi += hmi ; } heru = Integer . parseInt ( str ) ; meisi -= heru ; if ( meisi < 0 ) { System . out . println ( i + 1 ) ; kubari = false ; System . exit ( 0 ) ; } } if ( kubari == true ) { System . out . println ( " complete " ) ; } } }

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 ( ) , m = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; int [ ] c = new int [ m + 1 ] ; for ( int i = 1 ; i <= m ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= m ; i ++ ) { if ( n <= a ) n += b ; n -= c [ i ] ; if ( n < 0 ) { out . println ( i ) ; exit ( 0 ) ; } } out . println ( " complete " ) ; } }

n , m , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE cnt = 0 NEW_LINE for i in range ( m ) : NEW_LINE INDENT if n <= a : NEW_LINE INDENT n += b NEW_LINE DEDENT cnt += 1 NEW_LINE c = int ( input ( ) ) NEW_LINE n -= c NEW_LINE if n < 0 : NEW_LINE INDENT print ( cnt ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT print ( " complete " ) NEW_LINE

N , M , A , B = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE c = [ int ( input ( ) ) for i in range ( M ) ] NEW_LINE result = " complete " NEW_LINE x = N NEW_LINE for i in range ( M ) : NEW_LINE INDENT if x <= A : NEW_LINE INDENT x += B NEW_LINE DEDENT x -= c [ i ] NEW_LINE if x < 0 : NEW_LINE INDENT result = i + 1 NEW_LINE break NEW_LINE DEDENT DEDENT print ( result ) NEW_LINE

def main ( ) : NEW_LINE INDENT n , m , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE cc = [ int ( input ( ) ) for _ in range ( m ) ] NEW_LINE for i , c in enumerate ( cc ) : NEW_LINE INDENT if n <= a : NEW_LINE INDENT n += b NEW_LINE DEDENT if n < c : NEW_LINE INDENT print ( i + 1 ) NEW_LINE return NEW_LINE DEDENT n -= c NEW_LINE DEDENT print ( " complete " ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

from sys import stdin NEW_LINE input = stdin . readline NEW_LINE n , m , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( 1 , m + 1 ) : NEW_LINE INDENT c = int ( input ( ) ) NEW_LINE if n <= a : NEW_LINE INDENT n += b NEW_LINE DEDENT n -= c NEW_LINE if n < 0 : NEW_LINE INDENT print ( i ) NEW_LINE break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( " complete " ) NEW_LINE DEDENT

N , M , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE res = N NEW_LINE c = [ ] NEW_LINE for _ in range ( M ) : NEW_LINE INDENT c . append ( int ( input ( ) ) ) NEW_LINE DEDENT for i in range ( M ) : NEW_LINE INDENT if res <= A : res += B NEW_LINE if res < c [ i ] : NEW_LINE INDENT print ( i + 1 ) NEW_LINE break NEW_LINE DEDENT else : res -= c [ i ] NEW_LINE DEDENT else : print ( ' complete ' ) NEW_LINE


import java . util . * ; class Main { static final double E = 1.0e-9 ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double ax = scan . nextDouble ( ) ; double ay = scan . nextDouble ( ) ; double dx = scan . nextDouble ( ) - ax ; double dy = scan . nextDouble ( ) - ay ; int n = scan . nextInt ( ) ; double [ ] x = new double [ n ] , y = new double [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { double u = scan . nextDouble ( ) - ax ; double v = scan . nextDouble ( ) - ay ; x [ i ] = ( dx * u + dy * v ) / ( dx * dx + dy * dy ) ; y [ i ] = ( - dy * u + dx * v ) / ( dx * dx + dy * dy ) ; } int k = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( y [ i ] * y [ ( i + 1 ) % n ] >= 0 ) continue ; double z = x [ i ] * y [ ( i + 1 ) % n ] - x [ ( i + 1 ) % n ] * y [ i ] ; z /= - y [ i ] + y [ ( i + 1 ) % n ] ; if ( z > E && z < 1 - E ) k ++ ; } System . out . println ( k / 2 + 1 ) ; } }

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 ax = in . nextInt ( ) , ay = in . nextInt ( ) , bx = in . nextInt ( ) , by = in . nextInt ( ) ; int n = in . nextInt ( ) ; int ans = 0 ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = in . nextInt ( ) ; y [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { long cx = x [ i ] , cy = y [ i ] , dx = x [ ( i + 1 ) % n ] , dy = y [ ( i + 1 ) % n ] ; long ta = ( cx - dx ) * ( ay - cy ) + ( cy - dy ) * ( cx - ax ) ; long tb = ( cx - dx ) * ( by - cy ) + ( cy - dy ) * ( cx - bx ) ; long tc = ( ax - bx ) * ( cy - ay ) + ( ay - by ) * ( ax - cx ) ; long td = ( ax - bx ) * ( dy - ay ) + ( ay - by ) * ( ax - dx ) ; if ( tc * td < 0 && ta * tb < 0 ) { ans ++ ; } } if ( ans % 2 == 1 ) { System . exit ( 1 ) ; } out . println ( ans / 2 + 1 ) ; } } }

import java . awt . geom . Line2D ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } void compute ( ) { Scanner sc = new Scanner ( System . in ) ; int Ax = sc . nextInt ( ) ; int Ay = sc . nextInt ( ) ; int Bx = sc . nextInt ( ) ; int By = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] X = new int [ N ] ; int [ ] Y = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { X [ i ] = sc . nextInt ( ) ; Y [ i ] = sc . nextInt ( ) ; } int intersects = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( Line2D . linesIntersect ( Ax , Ay , Bx , By , X [ i ] , Y [ i ] , X [ i + 1 ] , Y [ i + 1 ] ) ) { intersects ++ ; } } if ( Line2D . linesIntersect ( Ax , Ay , Bx , By , X [ 0 ] , Y [ 0 ] , X [ N - 1 ] , Y [ N - 1 ] ) ) { intersects ++ ; } System . out . println ( intersects / 2 + 1 ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final Coord A = new Coord ( sc . nextInt ( ) , sc . nextInt ( ) ) ; final Coord B = new Coord ( sc . nextInt ( ) , sc . nextInt ( ) ) ; final int N = sc . nextInt ( ) ; Coord [ ] c = new Coord [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { c [ i ] = new Coord ( sc . nextInt ( ) , sc . nextInt ( ) ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( isIntersect ( A . x , A . y , B . x , B . y , c [ i ] . x , c [ i ] . y , c [ ( i + 1 ) % N ] . x , c [ ( i + 1 ) % N ] . y ) ) { count ++ ; } } System . out . println ( count / 2 + 1 ) ; } static boolean isIntersect ( double ax , double ay , double bx , double by , double cx , double cy , double dx , double dy ) { double ta = ( cx - dx ) * ( ay - cy ) + ( cy - dy ) * ( cx - ax ) ; double tb = ( cx - dx ) * ( by - cy ) + ( cy - dy ) * ( cx - bx ) ; double tc = ( ax - bx ) * ( cy - ay ) + ( ay - by ) * ( ax - cx ) ; double td = ( ax - bx ) * ( dy - ay ) + ( ay - by ) * ( ax - dx ) ; return tc * td < 0 && ta * tb < 0 ; } ; static class Coord { int x ; int y ; Coord ( final int x , final int y ) { this . x = x ; this . y = y ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long ax = sc . nextLong ( ) ; long ay = sc . nextLong ( ) ; long bx = sc . nextLong ( ) ; long by = sc . nextLong ( ) ; int N = sc . nextInt ( ) ; long [ ] x = new long [ N ] ; long [ ] y = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { x [ i ] = sc . nextLong ( ) ; y [ i ] = sc . nextLong ( ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { long abx = bx - ax ; long aby = by - ay ; long px = x [ i ] - ax ; long py = y [ i ] - ay ; long qx = x [ 0 ] - ax ; long qy = y [ 0 ] - ay ; if ( i < N - 1 ) { qx = x [ i + 1 ] - ax ; qy = y [ i + 1 ] - ay ; } long ex = x [ 0 ] - x [ N - 1 ] ; long ey = y [ 0 ] - y [ N - 1 ] ; if ( i < N - 1 ) { ex = x [ i + 1 ] - x [ i ] ; ey = y [ i + 1 ] - y [ i ] ; } long rx = ax - x [ i ] ; long ry = ay - y [ i ] ; long sx = bx - x [ i ] ; long sy = by - y [ i ] ; if ( ( ( abx * py - aby * px ) * ( abx * qy - aby * qx ) <= 0 ) && ( ( ex * ry - ey * rx ) * ( ex * sy - ey * sx ) <= 0 ) ) count ++ ; } System . out . println ( count / 2 + 1 ) ; } }

Ax , Ay , Bx , By = map ( int , input ( ) . split ( ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE num = 0 NEW_LINE def calc ( x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 ) : NEW_LINE INDENT P0 = ( x0 - x1 ) * ( y2 - y0 ) + ( y0 - y1 ) * ( x0 - x2 ) NEW_LINE Q0 = ( x0 - x1 ) * ( y3 - y0 ) + ( y0 - y1 ) * ( x0 - x3 ) NEW_LINE P1 = ( x2 - x3 ) * ( y0 - y2 ) + ( y2 - y3 ) * ( x2 - x0 ) NEW_LINE Q1 = ( x2 - x3 ) * ( y1 - y2 ) + ( y2 - y3 ) * ( x2 - x1 ) NEW_LINE return P0 * Q0 < 0 and P1 * Q1 < 0 NEW_LINE DEDENT num = 0 NEW_LINE preX0 , preY0 = map ( int , input ( ) . split ( ) ) NEW_LINE preX , preY = preX0 , preY0 NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT x , y = map ( int , input ( ) . split ( ) ) NEW_LINE if calc ( Ax , Ay , Bx , By , preX , preY , x , y ) : NEW_LINE INDENT num += 1 NEW_LINE DEDENT preX , preY = x , y NEW_LINE DEDENT if calc ( Ax , Ay , Bx , By , preX , preY , preX0 , preY0 ) : NEW_LINE INDENT num += 1 NEW_LINE DEDENT print ( num // 2 + 1 ) NEW_LINE

import math NEW_LINE def input_parse ( ) : NEW_LINE INDENT return tuple ( int ( c ) for c in input ( ) . split ( ) ) NEW_LINE DEDENT def sort_linePoint ( Ax , Ay , Bx , By ) : NEW_LINE INDENT if Ax > Bx or ( Ax == By and Ay > By ) : NEW_LINE INDENT tmpx = Ax NEW_LINE tmpy = Ay NEW_LINE Ax = Bx NEW_LINE Ay = By NEW_LINE Bx = tmpx NEW_LINE By = tmpy NEW_LINE DEDENT return Ax , Ay , Bx , By NEW_LINE DEDENT Ax , Ay , Bx , By = input_parse ( ) NEW_LINE Ax , Ay , Bx , By = sort_linePoint ( Ax , Ay , Bx , By ) NEW_LINE Bx_dash = Bx - Ax NEW_LINE By_dash = By - Ay NEW_LINE if By_dash == 0 : NEW_LINE INDENT sin_theta = 0 NEW_LINE cos_theta = 1 NEW_LINE Bx_dash_rot = Bx_dash NEW_LINE By_dash_rot = 0 NEW_LINE DEDENT elif Bx_dash == 0 : NEW_LINE INDENT sin_theta = - 1 NEW_LINE cos_theta = 0 NEW_LINE Bx_dash_rot = By_dash NEW_LINE By_dash_rot = 0 NEW_LINE DEDENT else : NEW_LINE INDENT theta = math . atan2 ( By_dash , Bx_dash ) NEW_LINE sin_theta = math . sin ( - theta ) NEW_LINE cos_theta = math . cos ( - theta ) NEW_LINE Bx_dash_rot = Bx_dash * cos_theta - By_dash * sin_theta NEW_LINE By_dash_rot = 0 NEW_LINE DEDENT def transCoordinate ( x , y ) : NEW_LINE INDENT x = x - Ax NEW_LINE y = y - Ay NEW_LINE x_rot = x * cos_theta - y * sin_theta NEW_LINE y_rot = x * sin_theta + y * cos_theta NEW_LINE return x_rot , y_rot NEW_LINE DEDENT N , = input_parse ( ) NEW_LINE vertices = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT x , y = input_parse ( ) NEW_LINE vertices . append ( transCoordinate ( x , y ) ) NEW_LINE DEDENT pre_x , pre_y = vertices [ - 1 ] NEW_LINE inter_count = 0 NEW_LINE for ( x , y ) in vertices : NEW_LINE INDENT if pre_y * y >= 0 : NEW_LINE INDENT pre_x , pre_y = x , y NEW_LINE continue NEW_LINE DEDENT if pre_x == x : NEW_LINE INDENT intersection_x = x NEW_LINE DEDENT else : NEW_LINE INDENT intersection_x = ( pre_y * x - y * pre_x ) / ( pre_y - y ) NEW_LINE DEDENT if 0 <= intersection_x and intersection_x <= Bx_dash_rot : NEW_LINE INDENT inter_count += 1 NEW_LINE DEDENT pre_x , pre_y = x , y NEW_LINE DEDENT print ( int ( inter_count / 2 + 1 ) ) NEW_LINE

import sys NEW_LINE input = sys . stdin . readline NEW_LINE Ax , Ay , Bx , By = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE N = int ( input ( ) ) NEW_LINE aXY = [ [ int ( _ ) for _ in sLine . split ( ) ] for sLine in sys . stdin . readlines ( ) ] NEW_LINE def   ? ? ? ? ( x1 : int , y1 : int , x2 : int , y2 : int , x3 : int , y3 : int , x4 : int , y4 : int ) -> bool : NEW_LINE INDENT tc = ( x1 - x2 ) * ( y3 - y1 ) + ( y1 - y2 ) * ( x1 - x3 ) NEW_LINE td = ( x1 - x2 ) * ( y4 - y1 ) + ( y1 - y2 ) * ( x1 - x4 ) NEW_LINE ta = ( x3 - x4 ) * ( y1 - y3 ) + ( y3 - y4 ) * ( x3 - x1 ) NEW_LINE tb = ( x3 - x4 ) * ( y2 - y3 ) + ( y3 - y4 ) * ( x3 - x2 ) NEW_LINE if tc * td < 0 and ta * tb < 0 : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT iC = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT x0 , y0 = aXY [ i - 1 ] NEW_LINE x1 , y1 = aXY [ i ] NEW_LINE if   ? ? ? ? ( Ax , Ay , Bx , By , x0 , y0 , x1 , y1 ) : NEW_LINE INDENT iC += 1 NEW_LINE DEDENT DEDENT print ( iC // 2 + 1 ) NEW_LINE

class Vector ( object ) : NEW_LINE INDENT def __init__ ( self , pos1 , pos2 ) : NEW_LINE INDENT self . point1 = pos1 NEW_LINE self . point2 = pos2 NEW_LINE self . size_x = pos2 [ 0 ] - pos1 [ 0 ] NEW_LINE self . size_y = pos2 [ 1 ] - pos1 [ 1 ] NEW_LINE DEDENT def get_cross ( self , other : " Vector " ) : NEW_LINE INDENT return self . size_x * other . size_y - self . size_y * other . size_x NEW_LINE DEDENT def check_crossing ( self , other : " Vector " ) : NEW_LINE INDENT vec1 , vec2 = Vector ( self . point1 , other . point1 ) , Vector ( self . point1 , other . point2 ) NEW_LINE vec3 , vec4 = Vector ( other . point1 , self . point1 ) , Vector ( other . point1 , self . point2 ) NEW_LINE return self . get_cross ( vec1 ) * self . get_cross ( vec2 ) < 0 and other . get_cross ( vec3 ) * other . get_cross ( vec4 ) < 0 NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT pos = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE line = Vector ( pos [ 0 : 2 ] , pos [ 2 : ] ) NEW_LINE N = int ( input ( ) ) NEW_LINE a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in [ 0 ] * N ] NEW_LINE a += [ a [ 0 ] ] NEW_LINE count = 0 NEW_LINE for p1 , p2 in zip ( a , a [ 1 : ] ) : NEW_LINE INDENT if Vector ( p1 , p2 ) . check_crossing ( line ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT print ( count // 2 + 1 ) NEW_LINE DEDENT

def intersect ( p1 , p2 , p3 , p4 ) : NEW_LINE INDENT t1 = ( p1 [ 0 ] - p2 [ 0 ] ) * ( p3 [ 1 ] - p1 [ 1 ] ) + ( p1 [ 1 ] - p2 [ 1 ] ) * ( p1 [ 0 ] - p3 [ 0 ] ) NEW_LINE t2 = ( p1 [ 0 ] - p2 [ 0 ] ) * ( p4 [ 1 ] - p1 [ 1 ] ) + ( p1 [ 1 ] - p2 [ 1 ] ) * ( p1 [ 0 ] - p4 [ 0 ] ) NEW_LINE t3 = ( p3 [ 0 ] - p4 [ 0 ] ) * ( p1 [ 1 ] - p3 [ 1 ] ) + ( p3 [ 1 ] - p4 [ 1 ] ) * ( p3 [ 0 ] - p1 [ 0 ] ) NEW_LINE t4 = ( p3 [ 0 ] - p4 [ 0 ] ) * ( p2 [ 1 ] - p3 [ 1 ] ) + ( p3 [ 1 ] - p4 [ 1 ] ) * ( p3 [ 0 ] - p2 [ 0 ] ) NEW_LINE return t1 * t2 < 0 and t3 * t4 < 0 NEW_LINE DEDENT ax , ay , bx , by = map ( int , input ( ) . split ( ) ) NEW_LINE point1 = [ ax , ay ] NEW_LINE point2 = [ bx , by ] NEW_LINE n = int ( input ( ) ) NEW_LINE info = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] NEW_LINE info . append ( info [ 0 ] ) NEW_LINE count = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if intersect ( point1 , point2 , info [ i ] , info [ i + 1 ] ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT print ( count // 2 + 1 ) NEW_LINE


import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; ArrayDeque < Integer > rq = new ArrayDeque < Integer > ( ) ; ArrayDeque < Integer > lq = new ArrayDeque < Integer > ( ) ; long ans = 0 ; long sumi_cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; char direction = sc . next ( ) . charAt ( 0 ) ; if ( direction == ' L ' ) { if ( rq . isEmpty ( ) ) { long cnt = x - 1 - sumi_cnt ; ans += cnt ; sumi_cnt ++ ; } else { lq . addLast ( x ) ; } } else { if ( lq . isEmpty ( ) ) { rq . addLast ( x ) ; } else { long cnt = calc ( rq , lq ) ; ans += cnt ; rq . push ( x ) ; } } } if ( lq . isEmpty ( ) ) { sumi_cnt = 0 ; while ( rq . size ( ) > 0 ) { int x = rq . pollLast ( ) ; long cnt = l - x - sumi_cnt ; ans += cnt ; sumi_cnt ++ ; } } else { ans += calc ( rq , lq ) ; } System . out . println ( ans ) ; } static long calc ( ArrayDeque < Integer > rq , ArrayDeque < Integer > lq ) { int rx = rq . pollLast ( ) ; int rcount = 1 ; long ans = 0 ; while ( rq . size ( ) > 0 ) { int x = rq . pollLast ( ) ; long cnt = rx - x - rcount ; ans += cnt ; rcount ++ ; } int lx = lq . pollFirst ( ) ; int lcount = 1 ; while ( lq . size ( ) > 0 ) { int x = lq . pollFirst ( ) ; long cnt = x - lx - lcount ; ans += cnt ; lcount ++ ; } long max_cnt = Math . max ( rcount , lcount ) ; long cnt = max_cnt * ( lx - rx - 1 ) ; ans += cnt ; return ans ; } }

def solve ( n , l , lst ) : NEW_LINE INDENT ans = 0 NEW_LINE np = 1 NEW_LINE while len ( lst ) : NEW_LINE INDENT x , d = lst [ 0 ] NEW_LINE if d == 0 : NEW_LINE INDENT ans += x - np NEW_LINE np += 1 NEW_LINE lst . pop ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT np = l NEW_LINE while len ( lst ) : NEW_LINE INDENT x , d = lst [ - 1 ] NEW_LINE if d == 1 : NEW_LINE INDENT ans += np - x NEW_LINE np -= 1 NEW_LINE lst . pop ( ) NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT while len ( lst ) : NEW_LINE INDENT rlist = [ ] NEW_LINE llist = [ ] NEW_LINE while len ( lst ) : NEW_LINE INDENT x , d = lst [ 0 ] NEW_LINE if d == 1 : NEW_LINE INDENT rlist . append ( x ) NEW_LINE lst . pop ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT while len ( lst ) : NEW_LINE INDENT x , d = lst [ 0 ] NEW_LINE if d == 0 : NEW_LINE INDENT llist . append ( x ) NEW_LINE lst . pop ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT rc = len ( rlist ) NEW_LINE rx = rlist [ - 1 ] NEW_LINE lc = len ( llist ) NEW_LINE lx = llist [ 0 ] NEW_LINE for i , x in enumerate ( rlist ) : NEW_LINE INDENT ans += rx - x - i NEW_LINE DEDENT for i , x in enumerate ( llist ) : NEW_LINE INDENT ans += x - lx - i NEW_LINE DEDENT ans += ( lx - rx - 1 ) * max ( rc , lc ) NEW_LINE DEDENT return ans NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT n , l = input ( ) . split ( ) NEW_LINE n = int ( n ) NEW_LINE l = int ( l ) NEW_LINE lst = [ ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT x , d = input ( ) . split ( ) NEW_LINE x = int ( x ) NEW_LINE lst . append ( ( x , 0 if d == ' L ' else 1 ) ) NEW_LINE DEDENT print ( solve ( n , l , lst ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

def count_jump ( right_list , left_list , L ) : NEW_LINE INDENT jump_count = 0 NEW_LINE if len ( right_list ) == 0 : NEW_LINE INDENT for i , p in enumerate ( left_list ) : NEW_LINE INDENT jump_count += p - i - 1 NEW_LINE DEDENT DEDENT elif len ( left_list ) == 0 : NEW_LINE INDENT for i , p in enumerate ( right_list ) : NEW_LINE INDENT jump_count += L - p - i NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT for i , p in enumerate ( right_list ) : NEW_LINE INDENT jump_count += right_list [ - 1 ] - p - i NEW_LINE DEDENT for i , p in enumerate ( left_list ) : NEW_LINE INDENT jump_count += p - left_list [ 0 ] - i NEW_LINE DEDENT head_diff = left_list [ 0 ] - right_list [ - 1 ] - 1 NEW_LINE max_cnt = max ( len ( right_list ) , len ( left_list ) ) NEW_LINE jump_count += head_diff * max_cnt NEW_LINE DEDENT return jump_count NEW_LINE DEDENT def solve ( rabbits , L ) : NEW_LINE INDENT jump_count = 0 NEW_LINE bef_d = ' R ' NEW_LINE right_list = [ ] NEW_LINE left_list = [ ] NEW_LINE for n_pos , n_d in rabbits : NEW_LINE INDENT if bef_d == ' L ' and n_d == ' R ' : NEW_LINE INDENT jump_count += count_jump ( right_list , left_list , L ) NEW_LINE right_list = [ ] NEW_LINE left_list = [ ] NEW_LINE DEDENT if n_d == ' R ' : NEW_LINE INDENT right_list . append ( n_pos ) NEW_LINE DEDENT else : NEW_LINE INDENT left_list . append ( n_pos ) NEW_LINE DEDENT bef_d = n_d NEW_LINE DEDENT jump_count += count_jump ( right_list , left_list , L ) NEW_LINE return jump_count NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N , L = map ( int , input ( ) . split ( ) ) NEW_LINE rabbits = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT pos , direction = input ( ) . split ( ) NEW_LINE rabbits . append ( ( int ( pos ) , direction ) ) NEW_LINE DEDENT result = solve ( rabbits , L ) NEW_LINE print ( result ) NEW_LINE DEDENT

n , k = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE p , ln , rn , l , r , ans = [ ] , 0 , 0 , 0 , 0 , 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT x , d = ( i for i in input ( ) . split ( ) ) NEW_LINE p . append ( ( int ( x ) , d == " L " ) ) NEW_LINE DEDENT if p [ 0 ] [ 1 ] : l = p [ 0 ] [ 0 ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT if p [ i ] [ 1 ] and p [ i + 1 ] [ 1 ] : NEW_LINE INDENT ln += 1 NEW_LINE ans += p [ i + 1 ] [ 0 ] - l - ln NEW_LINE DEDENT elif p [ i ] [ 1 ] : NEW_LINE INDENT ans += ( l - r - 1 ) * max ( ln + 1 , rn ) NEW_LINE ln , rn = 0 , 0 NEW_LINE DEDENT elif p [ i + 1 ] [ 1 ] : NEW_LINE INDENT l , r = p [ i + 1 ] [ 0 ] , p [ i ] [ 0 ] NEW_LINE rn += 1 NEW_LINE DEDENT else : NEW_LINE INDENT rn += 1 NEW_LINE ans += ( p [ i + 1 ] [ 0 ] - p [ i ] [ 0 ] - 1 ) * rn NEW_LINE DEDENT DEDENT if n - 1 : NEW_LINE INDENT if p [ - 1 ] [ 1 ] and p [ - 2 ] [ 1 ] : ans += ( l - r - 1 ) * max ( ln + 1 , rn ) NEW_LINE elif p [ - 1 ] [ 1 ] : ans += ( p [ - 1 ] [ 0 ] - r - 1 ) * max ( rn , 1 ) NEW_LINE else : ans += ( k - p [ - 1 ] [ 0 ] ) * ( rn + 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT if p [ 0 ] [ 1 ] : ans = p [ 0 ] [ 0 ] - 1 NEW_LINE else : ans = k - p [ 0 ] [ 0 ] NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE N , L = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ ( - 1 , 0 ) , ( 0 , 1 ) ] + [ ( int ( x ) , 0 if d == " R " else 1 ) for x , d in ( l . split ( ) for l in sys . stdin ) ] + [ ( L + 1 , 0 ) , ( L + 2 , 1 ) ] NEW_LINE jumps = 0 NEW_LINE l_rabbit , r_rabbit , l_mid , r_mid = 0 , 0 , 0 , 0 NEW_LINE for ( current_pos , current_dir ) , ( next_pos , next_dir ) in zip ( a , a [ 1 : ] ) : NEW_LINE INDENT if current_dir == 0 : NEW_LINE INDENT l_rabbit += 1 NEW_LINE if current_dir == next_dir : NEW_LINE INDENT jumps += ( next_pos - current_pos - 1 ) * l_rabbit NEW_LINE DEDENT else : NEW_LINE INDENT l_mid , r_mid = current_pos , next_pos NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT jumps += current_pos - r_mid - r_rabbit NEW_LINE r_rabbit += 1 NEW_LINE if current_dir != next_dir : NEW_LINE INDENT jumps += max ( l_rabbit , r_rabbit ) * ( r_mid - l_mid - 1 ) NEW_LINE l_rabbit , r_rabbit = 0 , 0 NEW_LINE DEDENT DEDENT DEDENT print ( jumps ) NEW_LINE

import sys NEW_LINE def bunny ( L , R ) : NEW_LINE INDENT L = L [ : : - 1 ] NEW_LINE gap = l - L [ 0 ] if not R else R [ 0 ] - 1 if not L else R [ 0 ] - L [ 0 ] - 1 NEW_LINE len_L , len_R = len ( L ) , len ( R ) NEW_LINE gap_L = sum ( L [ 0 ] - L [ i ] - i for i in range ( 1 , len_L ) ) NEW_LINE gap_R = sum ( R [ i ] - R [ 0 ] - i for i in range ( 1 , len_R ) ) NEW_LINE return gap_L + gap * max ( len_L , len_R ) + gap_R NEW_LINE DEDENT N , l = map ( int , input ( ) . split ( ) ) NEW_LINE rabbit , b2b = [ [ ] , [ ] ] , 0 NEW_LINE ans = 0 NEW_LINE for e in sys . stdin : NEW_LINE INDENT x , d = int ( e [ : - 3 ] ) , e [ - 2 ] NEW_LINE if b2b == 0 or d == ' L ' : NEW_LINE INDENT rabbit [ d == ' L ' ] += [ x ] NEW_LINE b2b = d == ' L ' NEW_LINE DEDENT else : NEW_LINE INDENT ans += bunny ( * rabbit ) NEW_LINE rabbit , b2b = [ [ x ] , [ ] ] , 0 NEW_LINE DEDENT DEDENT ans += bunny ( * rabbit ) NEW_LINE print ( ans ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , l = sc . nextInt ( ) , t = sc . nextInt ( ) ; int temp , cnt = 0 , d ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; d = sc . nextInt ( ) ; if ( d == 1 ) { temp = a [ i ] + t ; a [ i ] = temp % l ; cnt += temp / l ; } else { temp = a [ i ] - t ; a [ i ] = temp % l ; cnt += temp / l ; if ( a [ i ] < 0 ) { a [ i ] += l ; cnt -- ; } } } Arrays . sort ( a ) ; cnt %= n ; if ( cnt < 0 ) cnt += n ; cnt %= n ; for ( int i = cnt ; i < cnt + n ; i ++ ) { int j = i % n ; System . out . println ( a [ j ] ) ; } sc . close ( ) ; } }

import java . io . * ; import java . util . * ; class MyInputStream extends InputStream { public BufferedInputStream bis = new BufferedInputStream ( System . in ) ; public int read ( ) throws IOException { int i ; while ( ( i = bis . read ( ) ) < 48 ) if ( i == - 1 ) return - 1 ; int temp = 0 ; while ( i > 47 ) { temp = temp * 10 + i - 48 ; i = bis . read ( ) ; } return temp ; } } public class Main { static final int N = 100005 ; static final int inf = 0x3f3f3f3f ; static final double eps = 1e-6 ; static int a [ ] = new int [ N ] ; public static void main ( String [ ] args ) throws IOException { MyInputStream cin = new MyInputStream ( ) ; int n = cin . read ( ) , l = cin . read ( ) , t = cin . read ( ) ; int tmp , cnt = 0 , d ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = cin . read ( ) ; d = cin . read ( ) ; if ( d == 1 ) { tmp = a [ i ] + t ; a [ i ] = tmp % l ; cnt += tmp / l ; } else { tmp = a [ i ] - t ; a [ i ] = tmp % l ; cnt += tmp / l ; if ( a [ i ] < 0 ) { a [ i ] += l ; cnt -- ; } } } Arrays . sort ( a , 0 , n ) ; cnt %= n ; if ( cnt < 0 ) cnt += n ; cnt %= n ; StringBuilder ans = new StringBuilder ( " " ) ; for ( int i = cnt ; i < cnt + n ; i ++ ) { int j = i % n ; System . out . println ( a [ j ] ) ; } } }

import java . io . IOException ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long l = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; long [ ] x = new long [ n ] ; long [ ] w = new long [ n ] ; long [ ] v = new long [ n ] ; long [ ] p = new long [ n ] ; int shift = 0 ; for ( int i = 0 ; i < n ; ++ i ) { x [ i ] = sc . nextLong ( ) ; w [ i ] = sc . nextLong ( ) ; v [ i ] = w [ i ] == 1 ? 1 : - 1 ; p [ i ] = ( x [ i ] + v [ i ] * t % l + l ) % l ; if ( v [ i ] < 0 ) { shift += ( l - x [ i ] + ( - v [ i ] ) * t - 1 ) / l % n ; } else { shift -= ( x [ i ] + v [ i ] * t ) / l % n ; } shift %= n ; } while ( shift < 0 ) shift += n ; Arrays . sort ( p ) ; long [ ] ans = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { ans [ i ] = p [ ( i - shift + n ) % n ] ; } for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( ans [ i ] ) ; } } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

N , L , T = map ( int , input ( ) . split ( ) ) NEW_LINE ants = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT x , w = map ( int , input ( ) . split ( ) ) NEW_LINE ants . append ( ( x , w ) ) NEW_LINE DEDENT ants2 = [ ] NEW_LINE for ant in ants : NEW_LINE INDENT ants2 . append ( ( ant [ 0 ] + T * ( 3 - 2 * ant [ 1 ] ) ) % L ) NEW_LINE DEDENT st = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if ants2 . count ( ants2 [ i ] ) == 1 : NEW_LINE INDENT st = i NEW_LINE break NEW_LINE DEDENT DEDENT cl = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if ants [ i ] [ 1 ] == ants [ st ] [ 1 ] : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT if ants [ st ] [ 1 ] == 1 : NEW_LINE INDENT if ants [ i ] [ 0 ] > ants [ st ] [ 0 ] : NEW_LINE INDENT fc = ( ants [ i ] [ 0 ] - ants [ st ] [ 0 ] ) / 2 NEW_LINE DEDENT else : NEW_LINE INDENT fc = ( ( L - ants [ st ] [ 0 ] ) + ants [ i ] [ 0 ] ) / 2 NEW_LINE DEDENT cl += ( 2 * ( T - fc ) ) // L + 1 NEW_LINE DEDENT else : NEW_LINE INDENT if ants [ i ] [ 0 ] > ants [ st ] [ 0 ] : NEW_LINE INDENT fc = ( ( L - ants [ i ] [ 0 ] ) + ants [ st ] [ 0 ] ) / 2 NEW_LINE DEDENT else : NEW_LINE INDENT fc = ( ants [ st ] [ 0 ] - ants [ i ] [ 0 ] ) / 2 NEW_LINE DEDENT cl -= ( 2 * ( T - fc ) ) // L + 1 NEW_LINE DEDENT DEDENT DEDENT stant = ants2 [ st ] NEW_LINE ants2 . sort ( ) NEW_LINE idx = ants2 . index ( stant ) - int ( cl ) - st NEW_LINE for i in range ( N ) : NEW_LINE INDENT print ( ants2 [ ( i + idx ) % N ] ) NEW_LINE DEDENT

( lambda N , L , T : ( lambda a , m : ( lambda X , W : ( lambda n : ( lambda b : ( lambda c : any ( map ( print , b [ c : ] + b [ : c ] ) ) ) ( b . index ( ( X + [ - T , T ] [ W < 2 ] ) % L ) - [ N - n , n ] [ W < 2 ] ) ) ( sorted ( ( x + [ - T , T ] [ w < 2 ] ) % L for x , w in a ) ) ) ( sum ( T // L * 2 + sum ( [ X - x + L + i <= m , x - X + i < m ] [ W < 2 ] for i in [ 0 , L ] ) for x , w in a if w != W ) % N ) ) ( * a [ 0 ] ) ) ( [ list ( map ( int , input ( ) . split ( ) ) ) for _ in [ 0 ] * N ] , T % L * 2 ) ) ( * map ( int , input ( ) . split ( ) ) ) NEW_LINE

from bisect import bisect_left , bisect NEW_LINE n , l , t = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE x , y , c = [ [ int ( i ) for i in input ( ) . split ( ) ] ] , [ 0 ] , 0 NEW_LINE ans = [ ( x [ 0 ] [ 0 ] - t ) % l if x [ 0 ] [ 1 ] - 1 else ( x [ 0 ] [ 0 ] + t ) % l ] NEW_LINE ans2 = ans [ 0 ] NEW_LINE for _ in range ( n - 1 ) : NEW_LINE INDENT a , b = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE x . append ( [ a , b ] ) NEW_LINE if b != x [ 0 ] [ 1 ] : c += 1 NEW_LINE y . append ( c ) NEW_LINE if b - 1 : ans . append ( ( a - t ) % l ) NEW_LINE else : ans . append ( ( a + t ) % l ) NEW_LINE DEDENT ans . sort ( ) NEW_LINE if x [ 0 ] [ 1 ] - 1 : ans3 = bisect_left ( ans , ans2 ) NEW_LINE else : ans3 = bisect ( ans , ans2 ) - 1 NEW_LINE num = int ( t / ( l / 2 ) ) NEW_LINE if x [ 0 ] [ 1 ] - 1 : NEW_LINE INDENT p = ( - ( t - num * ( l / 2 ) ) * 2 + x [ 0 ] [ 0 ] ) % l NEW_LINE d = ( y [ - 1 ] * num + y [ - 1 ] - y [ bisect_left ( x , [ p , 0 ] ) - 1 ] ) % n NEW_LINE DEDENT else : NEW_LINE INDENT p = ( ( t - num * ( l / 2 ) ) * 2 + x [ 0 ] [ 0 ] ) NEW_LINE d = ( y [ - 1 ] * num + y [ bisect_left ( x , [ p , 3 ] ) - 1 ] ) % n NEW_LINE DEDENT if x [ 0 ] [ 1 ] - 1 : d = - d NEW_LINE for i in range ( n ) : print ( ans [ ( ans3 - d + i ) % n ] ) NEW_LINE

from bisect import bisect , bisect_left NEW_LINE def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE N , L , T = inpl ( ) NEW_LINE Fants = [ ] NEW_LINE Bants = [ ] NEW_LINE A = [ [ 0 , 0 ] for _ in range ( N ) ] NEW_LINE P = [ - 1 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT x , w = inpl ( ) NEW_LINE A [ i ] = ( x , w ) NEW_LINE if w == 1 : NEW_LINE INDENT Fants . append ( x ) NEW_LINE P [ i ] = ( x + T ) % L NEW_LINE DEDENT else : NEW_LINE INDENT Bants . append ( x ) NEW_LINE P [ i ] = ( x - T ) % L NEW_LINE DEDENT DEDENT B = Bants + [ b + L for b in Bants ] + [ b + 2 * L for b in Bants ] NEW_LINE F = [ f - 2 * L for f in Fants ] + [ f - L for f in Fants ] + Fants NEW_LINE d , m = divmod ( T , L ) NEW_LINE ans = [ - 1 ] * N NEW_LINE for i , ( x , w ) in enumerate ( A ) : NEW_LINE INDENT if w == 1 : NEW_LINE INDENT j = i + 2 * d * len ( Bants ) + ( bisect ( B , x + 2 * m ) - bisect ( B , x ) ) NEW_LINE ans [ j % N ] = P [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT j = i - 2 * d * len ( Fants ) - ( bisect_left ( F , x ) - bisect_left ( F , x - 2 * m ) ) NEW_LINE ans [ j % N ] = P [ i ] NEW_LINE DEDENT DEDENT print ( * ans , sep = " \n " ) NEW_LINE

N , L , T = map ( int , input ( ) . split ( ) ) NEW_LINE src = [ tuple ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE xs = [ ] NEW_LINE for x , w in src : NEW_LINE INDENT dx = T if w == 1 else - T NEW_LINE xs . append ( ( x + dx ) % L ) NEW_LINE DEDENT xs . sort ( ) NEW_LINE if N == 1 : NEW_LINE INDENT print ( xs [ 0 ] ) NEW_LINE exit ( ) NEW_LINE DEDENT x0 , w0 = src [ 0 ] NEW_LINE k0 = 0 NEW_LINE for x , w in src : NEW_LINE INDENT if x == x0 : continue NEW_LINE if w == w0 : continue NEW_LINE if w0 == 1 : NEW_LINE INDENT dist = ( x - x0 ) % L NEW_LINE DEDENT else : NEW_LINE INDENT dist = ( x0 - x ) % L NEW_LINE DEDENT if 2 * T >= dist : NEW_LINE INDENT k0 += 1 + ( 2 * T - dist ) // L NEW_LINE DEDENT DEDENT newx0 = ( x0 + T ) % L if w0 == 1 else ( x0 - T ) % L NEW_LINE i0 = xs . index ( newx0 ) NEW_LINE if w0 == 1 and i0 + 1 < N and xs [ i0 ] == xs [ i0 + 1 ] : NEW_LINE INDENT i0 += 1 NEW_LINE DEDENT i0 += ( k0 if w0 == 2 else - k0 ) NEW_LINE i0 %= N NEW_LINE for i in range ( i0 , i0 + N ) : NEW_LINE INDENT print ( xs [ i % N ] ) NEW_LINE DEDENT


import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) , m = sc . nextInt ( ) , x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int max = x , min = y ; for ( int i = 0 ; i < n ; i ++ ) { max = Math . max ( max , sc . nextInt ( ) ) ; } for ( int i = 0 ; i < m ; i ++ ) { min = Math . min ( min , sc . nextInt ( ) ) ; } System . out . println ( max >= min ? " War " : " No ▁ War " ) ; } }

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 x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int xa [ ] = new int [ n ] ; int ya [ ] = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { xa [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { ya [ i ] = sc . nextInt ( ) ; } boolean ans = false ; for ( int i = x + 1 ; i <= y ; i ++ ) { boolean flag = false ; for ( int j = 0 ; j < n ; j ++ ) { if ( xa [ j ] >= i ) { flag = true ; } } for ( int j = 0 ; j < m ; j ++ ) { if ( ya [ j ] < i ) flag = true ; } if ( flag == false ) { ans = true ; break ; } } if ( ans ) { System . out . print ( " No ▁ War " ) ; } else { System . out . print ( " War " ) ; } } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int n , m , X , Y ; n = Integer . parseInt ( sc . next ( ) ) ; m = Integer . parseInt ( sc . next ( ) ) ; X = Integer . parseInt ( sc . next ( ) ) ; Y = Integer . parseInt ( sc . next ( ) ) ; int [ ] x = new int [ n ] , y = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < m ; i ++ ) { y [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Arrays . sort ( x ) ; Arrays . sort ( y ) ; if ( Math . max ( X , x [ n - 1 ] ) < Math . min ( Y , y [ 0 ] ) ) { System . out . println ( " No ▁ War " ) ; } else { System . out . println ( " War " ) ; } } catch ( Exception e ) { System . out . println ( " out " ) ; } } }

import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; List < Integer > xList = new ArrayList < > ( ) ; List < Integer > yList = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { xList . add ( sc . nextInt ( ) ) ; } for ( int i = 0 ; i < m ; i ++ ) { yList . add ( sc . nextInt ( ) ) ; } Collections . sort ( xList ) ; Collections . sort ( yList ) ; for ( int i = xList . get ( n - 1 ) + 1 ; i <= yList . get ( 0 ) ; i ++ ) { if ( i > x && i <= y ) { System . out . println ( " No ▁ War " ) ; return ; } } System . out . println ( " War " ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int M = reader . nextInt ( ) ; int X = reader . nextInt ( ) ; int Y = reader . nextInt ( ) ; int [ ] xn = new int [ N ] ; int [ ] ym = new int [ M ] ; for ( int i = 0 ; i < N ; i ++ ) { xn [ i ] = reader . nextInt ( ) ; } for ( int i = 0 ; i < M ; i ++ ) { ym [ i ] = reader . nextInt ( ) ; } int Z = X + 1 ; while ( Z < Y ) { boolean isWar = false ; for ( int i = 0 ; i < N ; i ++ ) { if ( xn [ i ] >= Z ) { isWar = true ; } } for ( int i = 0 ; i < M ; i ++ ) { if ( ym [ i ] < Z ) { isWar = true ; } } if ( ! isWar ) { System . out . print ( " No ▁ War " ) ; return ; } Z ++ ; } System . out . print ( " War " ) ; } }

n , m , X , Y = map ( int , input ( ) . split ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x . append ( X ) NEW_LINE y . append ( Y ) NEW_LINE if max ( x ) < min ( y ) : NEW_LINE INDENT print ( ' No ▁ War ' ) NEW_LINE DEDENT else : print ( ' War ' ) NEW_LINE

import sys NEW_LINE n , m , x , y = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE xl = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE yl = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( x + 1 , y + 1 ) : NEW_LINE INDENT if ( max ( xl ) < i and min ( yl ) >= i ) : NEW_LINE INDENT print ( " No ▁ War " ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT print ( " War " ) NEW_LINE

import sys NEW_LINE n , m , X , Y = map ( int , input ( ) . split ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for z in range ( 101 ) : NEW_LINE INDENT if X < z <= Y and all ( x [ i ] < z for i in range ( n ) ) and all ( y [ j ] >= z for j in range ( m ) ) : NEW_LINE INDENT print ( ' No ▁ War ' ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT for z in range ( 1 , 101 ) : NEW_LINE INDENT if X < z * ( - 1 ) <= Y and all ( x [ i ] < z * ( - 1 ) for i in range ( n ) ) and all ( y [ j ] >= z * ( - 1 ) for j in range ( m ) ) : NEW_LINE INDENT print ( ' No ▁ War ' ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT print ( ' War ' ) NEW_LINE

n , m , x , y = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x_li = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y_li = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans_f = 0 NEW_LINE for z in range ( x + 1 , y + 1 ) : NEW_LINE INDENT x_not_f = 0 NEW_LINE y_not_f = 0 NEW_LINE for i in x_li : NEW_LINE INDENT if z <= i : NEW_LINE INDENT x_not_f = 1 NEW_LINE DEDENT DEDENT for i in y_li : NEW_LINE INDENT if z > i : NEW_LINE INDENT y_not_f = 1 NEW_LINE DEDENT DEDENT if x_not_f == 0 and y_not_f == 0 : NEW_LINE INDENT ans_f = 1 NEW_LINE break NEW_LINE DEDENT DEDENT if ans_f == 1 : NEW_LINE INDENT print ( " No ▁ War " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " War " ) NEW_LINE DEDENT

N , M , X , Y = map ( int , input ( ) . split ( ) ) NEW_LINE x = input ( ) . split ( ) NEW_LINE xls = [ ] NEW_LINE for n in range ( 0 , N ) : NEW_LINE INDENT xls . append ( int ( x [ n ] ) ) NEW_LINE DEDENT y = input ( ) . split ( ) NEW_LINE yls = [ ] NEW_LINE for n in range ( 0 , M ) : NEW_LINE INDENT yls . append ( int ( y [ n ] ) ) NEW_LINE DEDENT xls . sort ( ) NEW_LINE yls . sort ( ) NEW_LINE if xls [ len ( xls ) - 1 ] >= yls [ 0 ] : NEW_LINE INDENT print ( " War " ) NEW_LINE DEDENT elif yls [ 0 ] <= X : NEW_LINE INDENT print ( " War " ) NEW_LINE DEDENT elif xls [ len ( xls ) - 1 ] >= Y : NEW_LINE INDENT print ( " War " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No ▁ War " ) NEW_LINE DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N % 111 == 0 ) { System . out . println ( N ) ; } else { int a = N / 111 + 1 ; System . out . println ( a * 100 + a * 10 + a ) ; } } }

import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; InputStreamScanner in = new InputStreamScanner ( System . in ) ; new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } private void solve ( InputStreamScanner in , PrintWriter out ) { int n = in . nextInt ( ) ; for ( int i = 1 ; i < 10 ; i ++ ) { if ( i * 111 >= n ) { out . println ( i * 111 ) ; break ; } } } static class InputStreamScanner { private InputStream in ; private byte [ ] buf = new byte [ 1024 ] ; private int len = 0 ; private int off = 0 ; InputStreamScanner ( InputStream in ) { this . in = in ; } String next ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( int b = skip ( ) ; ! isSpace ( b ) ; ) { sb . appendCodePoint ( b ) ; b = read ( ) ; } return sb . toString ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } char nextChar ( ) { return ( char ) skip ( ) ; } int skip ( ) { for ( int b ; ( b = read ( ) ) != - 1 ; ) { if ( ! isSpace ( b ) ) { return b ; } } return - 1 ; } private boolean isSpace ( int c ) { return c < 33 || c > 126 ; } private int read ( ) { if ( len == - 1 ) { throw new InputMismatchException ( " End ▁ of ▁ Input " ) ; } if ( off >= len ) { off = 0 ; try { len = in . read ( buf ) ; } catch ( IOException e ) { throw new InputMismatchException ( e . getMessage ( ) ) ; } if ( len <= 0 ) { return - 1 ; } } return buf [ off ++ ] ; } } }

import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int ALL_DIGITS_SAME = 111 ; public static String process ( TestCase testCase ) { final int N = testCase . N ; return String . valueOf ( IntStream . range ( 1 , 10 ) . map ( i -> i * ALL_DIGITS_SAME ) . filter ( contestNum -> contestNum >= N ) . findFirst ( ) . orElseThrow ( ( ) -> new IllegalArgumentException ( " N ▁ is ▁ too ▁ large : ▁ " + N ) ) ) ; } public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final String result = process ( testCase ) ; output ( result ) ; } private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; return new TestCase ( N ) ; } private static void output ( String result ) { System . out . println ( result ) ; } public static class TestCase { final int N ; public TestCase ( int N ) { this . N = N ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( 100 <= N && N <= 111 ) { System . out . println ( 111 ) ; } else if ( 112 <= N && N <= 222 ) { System . out . println ( 222 ) ; } else if ( 223 <= N && N <= 333 ) { System . out . println ( 333 ) ; } else if ( 334 <= N && N <= 444 ) { System . out . println ( 444 ) ; } else if ( 445 <= N && N <= 555 ) { System . out . println ( 555 ) ; } else if ( 556 <= N && N <= 666 ) { System . out . println ( 666 ) ; } else if ( 667 <= N && N <= 777 ) { System . out . println ( 777 ) ; } else if ( 778 <= N && N <= 888 ) { System . out . println ( 888 ) ; } else if ( 889 <= N && N <= 999 ) { System . out . println ( 999 ) ; } } }

import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; while ( ! isAllSame ( N ) ) { N ++ ; } System . out . println ( N ) ; } private static boolean isAllSame ( int N ) { String str = String . valueOf ( N ) ; char [ ] chars = str . toCharArray ( ) ; char c = chars [ 0 ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { if ( chars [ i ] != c ) return false ; } return true ; } }

n = int ( input ( ) ) NEW_LINE num = [ 111 , 222 , 333 , 444 , 555 , 666 , 777 , 888 , 999 ] NEW_LINE min_ = 111 NEW_LINE ans = 0 NEW_LINE for i in num : NEW_LINE INDENT if i - n < 0 : NEW_LINE INDENT None NEW_LINE DEDENT else : NEW_LINE INDENT if min_ > i - n : NEW_LINE INDENT ans = i NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE

from math import ceil NEW_LINE print ( 111 * ceil ( int ( input ( ) ) / 111 ) ) NEW_LINE

import sys NEW_LINE import copy NEW_LINE from bisect import bisect_left NEW_LINE def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE for i in range ( N , 1000 ) : NEW_LINE INDENT tmp = i % 10 NEW_LINE ans = " " NEW_LINE tugi = 0 NEW_LINE isOK = True NEW_LINE for j in range ( len ( str ( i ) ) ) : NEW_LINE INDENT if j == 0 : NEW_LINE INDENT tugi = i NEW_LINE DEDENT tmp2 = tugi % 10 NEW_LINE tugi = tugi // 10 NEW_LINE ans += str ( tmp ) NEW_LINE if tmp != tmp2 : NEW_LINE INDENT isOK = False NEW_LINE break NEW_LINE DEDENT DEDENT if isOK == True : NEW_LINE INDENT print ( ans ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

n = input ( ) NEW_LINE m = n [ 0 ] NEW_LINE for i in range ( len ( n ) - 1 ) : NEW_LINE INDENT m += n [ 0 ] NEW_LINE DEDENT if int ( n ) > int ( m ) : NEW_LINE INDENT if n [ 0 ] != str ( 9 ) : NEW_LINE INDENT a = str ( int ( n [ 0 ] ) + 1 ) NEW_LINE for j in range ( len ( n ) - 1 ) : NEW_LINE INDENT a += str ( int ( n [ 0 ] ) + 1 ) NEW_LINE DEDENT print ( a ) NEW_LINE DEDENT else : NEW_LINE INDENT b = str ( 1 ) NEW_LINE for k in range ( len ( n ) ) : NEW_LINE INDENT b += str ( 1 ) NEW_LINE DEDENT print ( b ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( m ) NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE x = n NEW_LINE while True : NEW_LINE INDENT flag = False NEW_LINE first_s = str ( x ) [ 0 ] NEW_LINE if all ( s == first_s for s in str ( x ) ) : NEW_LINE INDENT print ( x ) NEW_LINE exit ( ) NEW_LINE DEDENT x += 1 NEW_LINE DEDENT


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; int x3 = sc . nextInt ( ) ; int y3 = sc . nextInt ( ) ; double w1 = Math . pow ( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) , 0.5 ) ; double w2 = Math . pow ( ( x1 - x3 ) * ( x1 - x3 ) + ( y1 - y2 ) * ( y1 - y2 ) , 0.5 ) ; double w3 = Math . pow ( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y3 ) * ( y1 - y3 ) , 0.5 ) ; double w4 = Math . pow ( ( x1 - x3 ) * ( x1 - x3 ) + ( y1 - y3 ) * ( y1 - y3 ) , 0.5 ) ; if ( w1 <= r && w2 <= r && w3 <= r && w4 <= r ) { System . out . println ( " YES " ) ; System . out . println ( " NO " ) ; } else if ( x2 <= x1 - r && x1 + r <= x3 && y2 <= y1 - r && y1 + r <= y3 ) { System . out . println ( " NO " ) ; System . out . println ( " YES " ) ; } else { System . out . println ( " YES " ) ; System . out . println ( " YES " ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String red = " YES " ; String blue = " YES " ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int x1_left = x1 - r ; int x1_right = x1 + r ; int y1_up = y1 + r ; int y1_down = y1 - r ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; int x3 = sc . nextInt ( ) ; int y3 = sc . nextInt ( ) ; if ( x2 <= x1_left && x1_right <= x3 && y2 <= y1_down && y1_up <= y3 ) { red = " NO " ; } if ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) <= r * r && ( x3 - x1 ) * ( x3 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) <= r * r && ( x3 - x1 ) * ( x3 - x1 ) + ( y3 - y1 ) * ( y3 - y1 ) <= r * r && ( x2 - x1 ) * ( x2 - x1 ) + ( y3 - y1 ) * ( y3 - y1 ) <= r * r ) { blue = " NO " ; } System . out . println ( red ) ; System . out . println ( blue ) ; } }

import java . awt . geom . Ellipse2D ; import java . awt . geom . Rectangle2D ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] __ ) { int x = getInt ( ) , y = getInt ( ) , r = getInt ( ) ; Ellipse2D . Double red = new Ellipse2D . Double ( x - r , y - r , r * 2 , r * 2 ) ; x = getInt ( ) ; y = getInt ( ) ; int xx = getInt ( ) , yy = getInt ( ) ; Rectangle2D . Double blue = new Rectangle2D . Double ( x , y , xx - x , yy - y ) ; System . out . println ( blue . contains ( red . getBounds2D ( ) ) ? " NO " : " YES " ) ; System . out . println ( red . contains ( blue ) ? " NO " : " YES " ) ; } }

import java . util . * ; import java . math . * ; public class Main { private static boolean blueVisible ( double x , double y , double x1 , double y1 , double r ) { double dx = x - x1 ; double dy = y - y1 ; return dx * dx + dy * dy > r * r ; } public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; double x1 = s . nextDouble ( ) ; double y1 = s . nextDouble ( ) ; double r = s . nextDouble ( ) ; double x2 = s . nextDouble ( ) ; double y2 = s . nextDouble ( ) ; double x3 = s . nextDouble ( ) ; double y3 = s . nextDouble ( ) ; System . out . println ( ( x1 + r > x3 || x1 - r < x2 || y1 + r > y3 || y1 - r < y2 ) ? " YES " : " NO " ) ; System . out . println ( ( blueVisible ( x2 , y2 , x1 , y1 , r ) || blueVisible ( x2 , y3 , x1 , y1 , r ) || blueVisible ( x3 , y3 , x1 , y1 , r ) || blueVisible ( x3 , y2 , x1 , y1 , r ) ) ? " YES " : " NO " ) ; } }

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 ) ; Point [ ] p = new Point [ 3 ] ; p [ 0 ] = new Point ( sc . nextInt ( ) , sc . nextInt ( ) ) ; int r = sc . nextInt ( ) ; for ( int i = 1 ; i < 3 ; i ++ ) p [ i ] = new Point ( sc . nextInt ( ) , sc . nextInt ( ) ) ; if ( c ( p , r ) ) { out . println ( " YES " ) ; out . println ( " NO " ) ; } else if ( d ( p , r ) ) { out . println ( " NO " ) ; out . println ( " YES " ) ; } else { out . println ( " YES " ) ; out . println ( " YES " ) ; } } static boolean c ( Point [ ] p , int r ) { r *= r ; int d1 = g ( p [ 0 ] , p [ 1 ] ) ; int d2 = g ( p [ 0 ] , p [ 2 ] ) ; int d3 = g ( p [ 0 ] , new Point ( p [ 1 ] . x , p [ 2 ] . y ) ) ; int d4 = g ( p [ 0 ] , new Point ( p [ 2 ] . x , p [ 1 ] . y ) ) ; return d1 <= r && d2 <= r && d3 <= r && d4 <= r ; } static boolean d ( Point [ ] p , int r ) { return p [ 1 ] . y <= p [ 0 ] . y - r && p [ 0 ] . y + r <= p [ 2 ] . y && p [ 1 ] . x <= p [ 0 ] . x - r && p [ 1 ] . x + r <= p [ 2 ] . x ; } static int g ( Point p1 , Point p2 ) { return ( p1 . x - p2 . x ) * ( p1 . x - p2 . x ) + ( p1 . y - p2 . y ) * ( p1 . y - p2 . y ) ; } }

import math NEW_LINE def caldistance ( x , y , s , t ) : NEW_LINE INDENT return math . sqrt ( ( x - s ) ** 2 + ( y - t ) ** 2 ) NEW_LINE DEDENT x1 , y1 , r = map ( int , input ( ) . split ( ) ) NEW_LINE x2 , y2 , x3 , y3 = map ( int , input ( ) . split ( ) ) NEW_LINE if x2 <= x1 - r and x3 >= x1 + r and y2 <= y1 - r and y3 >= y1 + r : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT if caldistance ( x2 , y2 , x1 , y1 ) <= r and caldistance ( x2 , y3 , x1 , y1 ) <= r and caldistance ( x3 , y2 , x1 , y1 ) <= r and caldistance ( x3 , y3 , x1 , y1 ) <= r : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT

def a_paint ( X1 , Y1 , R , X2 , Y2 , X3 , Y3 ) : NEW_LINE INDENT is_rectangle_include_circle = all ( [ X2 <= X1 - R , X1 + R <= X3 , Y2 <= Y1 - R , Y1 + R <= Y3 ] ) NEW_LINE is_circle_include_rectangle = all ( [ ( X1 - X2 ) ** 2 + ( Y1 - Y2 ) ** 2 <= R ** 2 , ( X1 - X3 ) ** 2 + ( Y1 - Y3 ) ** 2 <= R ** 2 , ( X1 - X2 ) ** 2 + ( Y1 - Y3 ) ** 2 <= R ** 2 , ( X1 - X3 ) ** 2 + ( Y1 - Y2 ) ** 2 <= R ** 2 ] ) NEW_LINE if is_rectangle_include_circle : NEW_LINE INDENT ans = ' NO ▁ YES ' NEW_LINE DEDENT elif is_circle_include_rectangle : NEW_LINE INDENT ans = ' YES ▁ NO ' NEW_LINE DEDENT else : NEW_LINE INDENT ans = ' YES ▁ YES ' NEW_LINE DEDENT return ans NEW_LINE DEDENT X1 , Y1 , R = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE X2 , Y2 , X3 , Y3 = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( a_paint ( X1 , Y1 , R , X2 , Y2 , X3 , Y3 ) ) NEW_LINE

X1 , Y1 , R = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE X2 , Y2 , X3 , Y3 = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE min_x , max_x = sorted ( [ X2 , X3 ] ) NEW_LINE min_y , max_y = sorted ( [ Y2 , Y3 ] ) NEW_LINE is_red = False NEW_LINE for x , y in [ ( X1 + R , Y1 ) , ( X1 - R , Y1 ) , ( X1 , Y1 + R ) , ( X1 , Y1 - R ) ] : NEW_LINE INDENT if min_x <= x <= max_x and min_y <= y <= max_y : NEW_LINE INDENT continue NEW_LINE DEDENT is_red = True NEW_LINE break NEW_LINE DEDENT is_blue = False NEW_LINE for x , y in [ ( X2 , Y2 ) , ( X2 , Y3 ) , ( X3 , Y2 ) , ( X3 , Y3 ) ] : NEW_LINE INDENT if ( abs ( X1 - x ) ** 2 + abs ( Y1 - y ) ** 2 ) ** ( 1 / 2 ) <= R : NEW_LINE INDENT continue NEW_LINE DEDENT is_blue = True NEW_LINE break NEW_LINE DEDENT print ( [ " NO " , " YES " ] [ is_red ] ) NEW_LINE print ( [ " NO " , " YES " ] [ is_blue ] ) NEW_LINE

x , y , r = map ( int , input ( ) . split ( ) ) NEW_LINE x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) NEW_LINE def f ( i ) : NEW_LINE INDENT p , q , n , m = i NEW_LINE return ( ( p - n ) ** 2 + ( q - m ) ** 2 ) ** 0.5 < r NEW_LINE DEDENT e = [ f ( [ x , y ] + i ) for i in [ [ x1 , y1 ] , [ x1 , y2 ] , [ x2 , y1 ] , [ x2 , y2 ] ] ] NEW_LINE f = [ x1 <= s <= x2 and y1 <= t <= y2 for ( s , t ) in [ [ x + r , y + r ] , [ x - r , y + r ] , [ x + r , y - r ] , [ x - r , y - r ] ] ] NEW_LINE if any ( e ) == 0 and any ( f ) == 0 : NEW_LINE INDENT print ( " YES " ) NEW_LINE print ( " YES " ) NEW_LINE DEDENT elif all ( e ) and any ( f ) == 0 : NEW_LINE INDENT print ( " YES " ) NEW_LINE print ( " NO " ) NEW_LINE DEDENT elif any ( e ) == 0 and all ( f ) : NEW_LINE INDENT print ( " NO " ) NEW_LINE print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " YES " ) NEW_LINE print ( " YES " ) NEW_LINE DEDENT

x1 , y1 , r = map ( int , input ( ) . split ( ) ) NEW_LINE x2 , y2 , x3 , y3 = map ( int , input ( ) . split ( ) ) NEW_LINE if ( x2 <= ( x1 - r ) and x3 >= ( x1 + r ) and y2 <= ( y1 - r ) and y3 >= ( y1 + r ) ) : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT r1 = ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) NEW_LINE r2 = ( ( x1 - x3 ) ** 2 + ( y1 - y3 ) ** 2 ) NEW_LINE r3 = ( ( x1 - x2 ) ** 2 + ( y1 - y3 ) ** 2 ) NEW_LINE r4 = ( ( x1 - x3 ) ** 2 + ( y1 - y2 ) ** 2 ) NEW_LINE if ( r1 > r ** 2 or r2 > r ** 2 or r3 > r ** 2 or r4 > r ** 2 ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; if ( a % 2 == 0 || b % 2 == 0 || c % 2 == 0 ) { System . out . println ( 0 ) ; return ; } long ans = Math . min ( a * b , Math . min ( b * c , c * a ) ) ; 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 ) ; ADivideACuboid solver = new ADivideACuboid ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ADivideACuboid { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) ; out . println ( a * b * c % 2 == 0 ? 0 : Math . min ( a * b , Math . min ( b * c , c * a ) ) ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] arr = new long [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] % 2 == 0 ) { System . out . println ( 0 ) ; return ; } } Arrays . sort ( arr ) ; System . out . println ( arr [ 0 ] * arr [ 1 ] ) ; } }

import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; if ( a % 2 * b % 2 * c % 2 == 0 ) { out . println ( 0 ) ; } else { long x = a * b ; long y = c * b ; long z = a * c ; out . println ( min ( x , min ( y , z ) ) ) ; } } }

import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] hen = new long [ 3 ] ; long wa = 1 ; for ( int i = 0 ; i < 3 ; i ++ ) { hen [ i ] = sc . nextLong ( ) ; wa *= hen [ i ] % 2 ; } if ( wa == 0 ) { System . out . println ( 0 ) ; } else { Arrays . sort ( hen ) ; System . out . println ( hen [ 0 ] * hen [ 1 ] ) ; } } }

l = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( l [ 0 ] * l [ 1 ] * ( l [ 2 ] % 2 ) ) NEW_LINE

a , b , c = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE one = abs ( ( a // 2 ) * b * c - ( a - a // 2 ) * b * c ) NEW_LINE two = abs ( a * ( b // 2 ) * c - a * ( b - b // 2 ) * c ) NEW_LINE thr = abs ( a * b * ( c // 2 ) - a * b * ( c - c // 2 ) ) NEW_LINE print ( min ( one , two , thr ) ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE d = sorted ( [ a , b , c ] ) NEW_LINE if ( a % 2 + b % 2 + c % 2 ) == 3 : NEW_LINE INDENT print ( d [ 0 ] * d [ 1 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT

A , B , C = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE c1 = 0 if C % 2 == 0 else A * B NEW_LINE c2 = 0 if B % 2 == 0 else A * C NEW_LINE c3 = 0 if A % 2 == 0 else B * C NEW_LINE ans = min ( c1 , c2 , c3 ) NEW_LINE print ( ans ) NEW_LINE

a = list ( map ( int , input ( ) . split ( ) ) ) ; a . sort ( ) ; s = a [ 0 ] * a [ 1 ] NEW_LINE if ( a [ 2 ] * s ) % 2 == 0 : print ( 0 ) NEW_LINE else : print ( s ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) a [ i ] = sc . nextInt ( ) ; if ( firstWin ( N , a ) ) System . out . println ( " First " ) ; else System . out . println ( " Second " ) ; sc . close ( ) ; } static boolean firstWin ( int N , int [ ] a ) { Arrays . sort ( a ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( N - i <= a [ i ] ) { boolean win = ( a [ i ] - ( N - i ) ) % 2 == 1 ; int sameSize = 0 ; for ( int j = i - 1 ; j >= 0 && a [ j ] == N - i ; j -- ) sameSize ++ ; win |= sameSize % 2 == 1 ; return win ; } } return false ; } }

import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE inf = 10 ** 10 NEW_LINE mod = 10 ** 9 + 7 NEW_LINE def f ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . sort ( ) NEW_LINE a . reverse ( ) NEW_LINE i = j = 0 NEW_LINE while i + 1 < n and a [ i + 1 ] > j + 1 : NEW_LINE INDENT i += 1 NEW_LINE j += 1 NEW_LINE DEDENT if ( a [ i ] - j - 1 ) % 2 == 1 : NEW_LINE INDENT return ' First ' NEW_LINE DEDENT k = 0 NEW_LINE while i + 1 < n and a [ i + 1 ] > j : NEW_LINE INDENT i += 1 NEW_LINE k += 1 NEW_LINE DEDENT if k % 2 == 1 : NEW_LINE INDENT return ' First ' NEW_LINE DEDENT return ' Second ' NEW_LINE DEDENT print ( f ( ) ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] num = new int [ n + 1 ] ; long ans = 0 ; long [ ] [ ] [ ] dp = new long [ n + 1 ] [ n + 1 ] [ n * a + 1 ] ; num [ 0 ] = 1000000007 ; for ( int i = 1 ; i <= n ; i ++ ) { num [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { for ( int k = 0 ; k <= n * a ; k ++ ) { if ( i == 0 && j == 0 && k == 0 ) { dp [ i ] [ j ] [ k ] = 1 ; } else if ( i >= 1 && k < num [ i ] ) { dp [ i ] [ j ] [ k ] = dp [ i - 1 ] [ j ] [ k ] ; } else if ( i >= 1 && j >= 1 && k >= num [ i ] ) { dp [ i ] [ j ] [ k ] = dp [ i - 1 ] [ j ] [ k ] + dp [ i - 1 ] [ j - 1 ] [ k - num [ i ] ] ; } else { dp [ i ] [ j ] [ k ] = 0 ; } } } } for ( int i = 1 ; i <= n ; i ++ ) { ans += dp [ n ] [ i ] [ i * a ] ; } System . out . println ( ans ) ; sc . close ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader rd = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String str = rd . readLine ( ) ; String [ ] sl = str . split ( " ▁ " ) ; int n = Integer . parseInt ( sl [ 0 ] ) ; int a = Integer . parseInt ( sl [ 1 ] ) ; str = rd . readLine ( ) ; sl = str . split ( " ▁ " ) ; int x [ ] = new int [ 51 ] ; long v [ ] [ ] [ ] = new long [ 51 ] [ 51 ] [ 2501 ] ; for ( int i = 1 ; i <= n ; i ++ ) { x [ i ] = Integer . parseInt ( sl [ i - 1 ] ) ; } v [ 1 ] [ 1 ] [ x [ 1 ] ] = 1 ; v [ 1 ] [ 0 ] [ 0 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { for ( int k = 0 ; k <= 50 * i ; k ++ ) { v [ i ] [ j ] [ k ] += v [ i - 1 ] [ j ] [ k ] ; } } for ( int j = 1 ; j <= i ; j ++ ) { for ( int k = x [ i ] ; k <= 50 * i ; k ++ ) { v [ i ] [ j ] [ k ] += v [ i - 1 ] [ j - 1 ] [ k - x [ i ] ] ; } } } long ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { ans += v [ i ] [ j ] [ a * j ] - v [ i - 1 ] [ j ] [ a * j ] ; } } System . out . println ( ans ) ; } }

import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static int n = gInt ( ) , a = gInt ( ) , v [ ] = IntStream . range ( 0 , n ) . map ( i -> gInt ( ) - a ) . sorted ( ) . toArray ( ) ; static long [ ] [ ] memo = new long [ n ] [ 2501 ] ; static { for ( int i = 0 ; i < n ; ++ i ) Arrays . fill ( memo [ i ] , - 1 ) ; } static long solve ( int i , int j ) { if ( j > 0 ) return 0 ; if ( i == n ) { return j == 0 ? 1 : 0 ; } if ( memo [ i ] [ - j ] != - 1 ) { return memo [ i ] [ - j ] ; } memo [ i ] [ - j ] = 0 ; memo [ i ] [ - j ] += solve ( i + 1 , j + v [ i ] ) ; memo [ i ] [ - j ] += solve ( i + 1 , j ) ; return memo [ i ] [ - j ] ; } public static void main ( String [ ] $ ) { solve ( 0 , 0 ) ; System . out . println ( memo [ 0 ] [ 0 ] - 1 ) ; } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] d = new int [ 51 ] ; for ( int i = 0 ; i < n ; i ++ ) d [ i ] = sc . nextInt ( ) ; long [ ] [ ] [ ] dp = new long [ 60 ] [ 60 ] [ 2510 ] ; dp [ 0 ] [ 0 ] [ 0 ] = 1 ; for ( int i = 0 ; i < n ; i ++ ) { int x = d [ i ] ; for ( int j = 0 ; j < n ; j ++ ) { for ( int k = 0 ; k < 2500 ; k ++ ) { if ( dp [ i ] [ j ] [ k ] > 0 ) { dp [ i + 1 ] [ j ] [ k ] += dp [ i ] [ j ] [ k ] ; dp [ i + 1 ] [ j + 1 ] [ k + x ] += dp [ i ] [ j ] [ k ] ; } } } } long ret = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= 2500 ; j ++ ) { if ( i * a == j && dp [ n ] [ i ] [ j ] > 0 ) { ret += dp [ n ] [ i ] [ j ] ; } } } System . out . println ( ret ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String text [ ] = line . split ( " ▁ " ) ; int N , A ; N = Integer . parseInt ( text [ 0 ] ) ; A = Integer . parseInt ( text [ 1 ] ) ; line = br . readLine ( ) ; text = line . split ( " ▁ " ) ; int [ ] x = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { x [ i ] = Integer . parseInt ( text [ i ] ) - A ; } long dp [ ] [ ] = new long [ N ] [ N * 50 * 2 + 1 ] ; int dpl = 50 * N ; dp [ 0 ] [ x [ 0 ] + dpl ] = 1 ; for ( int j = 1 ; j < N ; j ++ ) { for ( int k = - 1 * N * 50 ; k < N * 50 + 1 ; k ++ ) { if ( k + dpl - x [ j ] >= 0 && k + dpl - x [ j ] <= 50 * N * 2 ) { dp [ j ] [ k + dpl ] = dp [ j - 1 ] [ k + dpl ] + dp [ j - 1 ] [ k + dpl - x [ j ] ] ; } else { dp [ j ] [ k + dpl ] = dp [ j - 1 ] [ k + dpl ] ; } if ( x [ j ] == k ) dp [ j ] [ k + dpl ] ++ ; } } System . out . println ( dp [ N - 1 ] [ dpl ] ) ; } }

import array NEW_LINE from bisect import * NEW_LINE from collections import * NEW_LINE import fractions NEW_LINE import heapq NEW_LINE from itertools import * NEW_LINE import math NEW_LINE import random NEW_LINE import re NEW_LINE import string NEW_LINE import sys NEW_LINE N , A = map ( int , input ( ) . split ( ) ) NEW_LINE Xs = list ( sorted ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE lower = [ ] NEW_LINE same = 0 NEW_LINE upper = [ ] NEW_LINE for x in Xs : NEW_LINE INDENT if x < A : NEW_LINE INDENT lower . append ( A - x ) NEW_LINE DEDENT elif x == A : NEW_LINE INDENT same += 1 NEW_LINE DEDENT else : NEW_LINE INDENT upper . append ( x - A ) NEW_LINE DEDENT DEDENT def make_counter ( nums ) : NEW_LINE INDENT counter = Counter ( { 0 : 1 } ) NEW_LINE for n in nums : NEW_LINE INDENT new_counter = Counter ( ) NEW_LINE for k , v in counter . items ( ) : NEW_LINE INDENT new_counter [ k ] += v NEW_LINE new_counter [ k + n ] += v NEW_LINE DEDENT counter = new_counter NEW_LINE DEDENT return counter NEW_LINE DEDENT lower_counter = make_counter ( lower ) NEW_LINE upper_counter = make_counter ( upper ) NEW_LINE ans = 0 NEW_LINE for lk , lv in lower_counter . items ( ) : NEW_LINE INDENT if lk == 0 : NEW_LINE INDENT ans += 2 ** same - 1 NEW_LINE DEDENT else : NEW_LINE INDENT if lk in upper_counter : NEW_LINE INDENT ans += ( 2 ** same ) * lv * upper_counter [ lk ] NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE

def makelist2 ( n , m ) : NEW_LINE INDENT return [ [ 0 for k in range ( m ) ] for i in range ( n ) ] NEW_LINE DEDENT n , a = map ( int , input ( ) . split ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE X = max ( x ) NEW_LINE X = max ( X , a ) NEW_LINE b = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT b . append ( x [ i ] - a ) NEW_LINE DEDENT dp = makelist2 ( n + 1 , 2 * n * X + 1 ) NEW_LINE dp [ 0 ] [ n * X ] = 1 NEW_LINE for j in range ( n + 1 ) : NEW_LINE INDENT for t in range ( 2 * n * X + 1 ) : NEW_LINE INDENT if j >= 1 and ( t - b [ j - 1 ] < 0 or t - b [ j - 1 ] > 2 * n * X ) : NEW_LINE INDENT dp [ j ] [ t ] = dp [ j - 1 ] [ t ] NEW_LINE DEDENT elif j >= 1 : NEW_LINE INDENT dp [ j ] [ t ] = dp [ j - 1 ] [ t ] + dp [ j - 1 ] [ t - b [ j - 1 ] ] NEW_LINE DEDENT DEDENT DEDENT print ( dp [ n ] [ n * X ] - 1 ) NEW_LINE

import bisect NEW_LINE from collections import Counter , deque NEW_LINE from itertools import combinations , accumulate NEW_LINE from math import factorial NEW_LINE from operator import neg NEW_LINE n , a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE xs = list ( map ( lambda x : int ( x ) - a , input ( ) . split ( ) ) ) NEW_LINE xs . sort ( ) NEW_LINE l , r = bisect . bisect_left ( xs , 0 ) , bisect . bisect_right ( xs , 0 ) NEW_LINE low , n0 , high = list ( map ( neg , xs [ : l ] [ : : - 1 ] ) ) , r - l , xs [ r : ] NEW_LINE def sums ( arr ) : NEW_LINE INDENT cntr = Counter ( [ 0 ] ) NEW_LINE for v in arr : NEW_LINE INDENT tmps = tuple ( cntr . items ( ) ) NEW_LINE for u , cnt in tmps : NEW_LINE INDENT cntr [ u + v ] += cnt NEW_LINE DEDENT DEDENT del cntr [ 0 ] NEW_LINE return cntr NEW_LINE DEDENT lsums = sums ( low ) NEW_LINE hsums = sums ( high ) NEW_LINE ans = sum ( hsums [ a ] * b for a , b in lsums . items ( ) ) NEW_LINE ans *= 2 ** n0 NEW_LINE ans += 2 ** n0 - 1 NEW_LINE print ( ans ) NEW_LINE

II = lambda : int ( input ( ) ) NEW_LINE MI = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE def sumcnt ( values ) : NEW_LINE INDENT sc = [ 0 ] * ( 50 * 50 + 1 ) NEW_LINE sc [ 0 ] = 1 NEW_LINE max_sc = 0 NEW_LINE for v in values : NEW_LINE INDENT for i in range ( max_sc , - 1 , - 1 ) : NEW_LINE INDENT sc [ i + v ] += sc [ i ] NEW_LINE DEDENT max_sc += v NEW_LINE DEDENT return sc , max_sc NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT N , A = MI ( ) NEW_LINE ds = [ x - A for x in MI ( ) ] NEW_LINE count0 = 0 NEW_LINE dp , dm = [ ] , [ ] NEW_LINE for d in ds : NEW_LINE INDENT if d == 0 : count0 += 1 NEW_LINE elif d > 0 : dp . append ( d ) NEW_LINE else : dm . append ( - d ) NEW_LINE DEDENT dp . sort ( ) NEW_LINE dm . sort ( ) NEW_LINE scp , scpmax = sumcnt ( dp ) NEW_LINE scm , scmmax = sumcnt ( dm ) NEW_LINE ans = 0 NEW_LINE for i in range ( 1 , min ( scpmax , scmmax ) + 1 ) : NEW_LINE INDENT ans += scp [ i ] * scm [ i ] NEW_LINE DEDENT ans = ans * ( 2 ** count0 ) + 2 ** count0 - 1 NEW_LINE return ans NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT print ( main ( ) ) NEW_LINE DEDENT

N , A = map ( int , input ( ) . split ( ) ) NEW_LINE X = [ int ( x ) - A for x in input ( ) . split ( ) ] NEW_LINE d = { 0 : 1 } NEW_LINE for x in X : NEW_LINE INDENT d_tmp = d . copy ( ) NEW_LINE for k in d_tmp : NEW_LINE INDENT d [ k + x ] = d . get ( k + x , 0 ) + d_tmp [ k ] NEW_LINE DEDENT DEDENT print ( d [ 0 ] - 1 ) NEW_LINE


import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; String S = reader . next ( ) ; int [ ] X = new int [ 10 ] ; for ( int k = 0 ; k < S . length ( ) ; k ++ ) { X [ k ] = Integer . parseInt ( Character . toString ( S . charAt ( k ) ) ) ; } int [ ] nearSevenDG = new int [ 10 ] ; int minGap = 1000 ; for ( int i = 0 ; i < S . length ( ) - 2 ; i ++ ) { int gap = Math . abs ( ( X [ i ] * 100 + X [ i + 1 ] * 10 + X [ i + 2 ] ) - 753 ) ; if ( gap < minGap ) { minGap = gap ; } } System . out . print ( minGap ) ; } }

import java . util . Scanner ; public class Main { private static final int FAVOURITE_NUMBER = 753 ; public static int process ( TestCase testCase ) { String S = testCase . S ; int min = Integer . MAX_VALUE ; for ( int i = 2 , length = S . length ( ) ; i < length ; ++ i ) { final int num = Integer . valueOf ( S . substring ( i - 2 , i + 1 ) ) ; min = Math . min ( min , diff ( num ) ) ; } return min ; } private static int diff ( int num ) { return Math . abs ( FAVOURITE_NUMBER - num ) ; } public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final int result = process ( testCase ) ; output ( result ) ; } private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; sc . close ( ) ; return new TestCase ( S ) ; } private static void output ( int result ) { System . out . println ( result ) ; } public static class TestCase { final String S ; public TestCase ( String S ) { this . S = S ; } } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String s ; s = sc . next ( ) ; int ans = 1000 ; for ( int i = 2 ; i < s . length ( ) ; i ++ ) { if ( Math . abs ( Integer . parseInt ( s . substring ( i - 2 , i + 1 ) ) - 753 ) < ans ) { ans = Math . abs ( Integer . parseInt ( s . substring ( i - 2 , i + 1 ) ) - 753 ) ; } } System . out . println ( ans ) ; } catch ( Exception e ) { System . out . println ( " out " ) ; } } }

import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int min = 753 ; for ( int i = 0 ; i < s . length ( ) - 2 ; i ++ ) { String num = s . substring ( i , i + 3 ) ; int n = Integer . parseInt ( num ) ; min = Math . min ( min , Math . abs ( 753 - n ) ) ; } System . out . println ( min ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int length = str . length ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < length - 2 ; i ++ ) { int tmp = Integer . parseInt ( str . substring ( i , i + 3 ) ) ; min = Math . min ( min , Math . abs ( 753 - tmp ) ) ; } System . out . println ( min ) ; } }

n = input ( ) NEW_LINE a = [ ] NEW_LINE for i in range ( len ( n ) - 2 ) : NEW_LINE INDENT a . append ( abs ( int ( n [ i : i + 3 ] ) - 753 ) ) NEW_LINE DEDENT print ( min ( a ) ) NEW_LINE

import sys NEW_LINE INF = float ( " inf " ) NEW_LINE def solve ( S : int ) : NEW_LINE INDENT S = str ( S ) NEW_LINE print ( min ( [ abs ( int ( S [ i : i + 3 ] ) - 753 ) for i in range ( len ( S ) - 2 ) ] ) ) 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 S = int ( next ( tokens ) ) NEW_LINE solve ( S ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

S = [ int ( i ) for i in input ( ) ] NEW_LINE ans = 0 NEW_LINE for i in range ( len ( S ) - 2 ) : NEW_LINE INDENT dog_cup = 100 * S [ i ] + 10 * S [ i + 1 ] + S [ i + 2 ] NEW_LINE if abs ( 753 - ans ) > abs ( 753 - dog_cup ) : NEW_LINE INDENT ans = dog_cup NEW_LINE DEDENT DEDENT print ( abs ( 753 - ans ) ) NEW_LINE

S = str ( input ( ) ) NEW_LINE M = 753 NEW_LINE min = 10000 NEW_LINE for i in range ( len ( S ) - 2 ) : NEW_LINE INDENT a = 100 * int ( S [ i ] ) + 10 * int ( S [ i + 1 ] ) + int ( S [ i + 2 ] ) NEW_LINE b = abs ( a - M ) NEW_LINE if b < min : NEW_LINE INDENT min = b NEW_LINE DEDENT DEDENT print ( min ) NEW_LINE

S = input ( ) NEW_LINE print ( min ( abs ( int ( S [ i : i + 3 ] ) - 753 ) for i in range ( len ( S ) - 2 ) ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int number = Integer . parseInt ( br . readLine ( ) ) ; int sum = 0 ; for ( int i = 0 ; i < number ; i ++ ) { String [ ] setting = br . readLine ( ) . split ( " ▁ " ) ; int num = Integer . parseInt ( setting [ 0 ] ) ; int price = Integer . parseInt ( setting [ 1 ] ) ; sum = sum + num * price ; } System . out . println ( ( int ) ( sum * 1.05 ) ) ; } }

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 = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += in . nextInt ( ) * in . nextInt ( ) ; out . println ( sum * 105 / 100 ) ; } } 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 isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public int nextInt ( ) { int 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 ; } } }

import java . util . * ; 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 ( ) ; double [ ] a = new double [ n ] ; double [ ] b = new double [ n ] ; double ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextDouble ( ) ; b [ i ] = sc . nextDouble ( ) ; ans += a [ i ] * b [ i ] ; } out . println ( ( int ) ( floor ( ans * 1.05 ) ) ) ; } }

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int N = sc . nextInt ( ) ; long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += sc . nextLong ( ) * sc . nextLong ( ) ; } pl ( ( sum * 21 / 20 ) ) ; } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } public static boolean isPrime ( int a ) { if ( a < 4 ) { if ( a == 2 || a == 3 ) { return true ; } else { return false ; } } else { for ( int j = 2 ; j * j <= a ; j ++ ) { if ( a % j == 0 ) { return false ; } if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) { return true ; } } return true ; } } }

print ( eval ( " + eval ( input ( ) . replace ( ' ▁ ' , ' * ' ) ) " * int ( input ( ) ) ) * 105 // 100 ) NEW_LINE

import sys NEW_LINE import copy NEW_LINE sys . setrecursionlimit ( 1000000 ) NEW_LINE N = int ( input ( ) ) NEW_LINE a = [ 0 ] * N NEW_LINE b = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT a [ i ] , b [ i ] = map ( int , input ( ) . split ( ) ) NEW_LINE DEDENT sum = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT sum += a [ i ] * b [ i ] NEW_LINE DEDENT print ( int ( sum * 1.05 ) ) NEW_LINE

N = int ( input ( ) ) NEW_LINE ab = [ [ int ( _ ) for _ in input ( ) . split ( ) ] for i in range ( N ) ] NEW_LINE import math NEW_LINE result = math . floor ( sum ( a * b for a , b in ab ) * 1.05 ) NEW_LINE print ( result ) NEW_LINE

def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE res = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE res += a * b NEW_LINE DEDENT print ( int ( res * 1.05 ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE src = [ tuple ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE ans = 0 NEW_LINE for a , b in src : NEW_LINE INDENT ans += a * b NEW_LINE DEDENT ans *= 1.05 NEW_LINE print ( int ( ans ) ) NEW_LINE