import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long x = in . nextLong ( ) , y = in . nextLong ( ) ; System . out . println ( Math . abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; } }

import java . io . IOException ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; long [ ] V = { sc . nextLong ( ) , sc . nextLong ( ) } ; Arrays . sort ( V ) ; if ( V [ 1 ] - V [ 0 ] > 1 ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Brown " ) ; } } int [ ] [ ] memo = new int [ 1000 ] [ 1000 ] ; boolean dfs ( int a , int b ) { if ( memo [ a ] [ b ] != 0 ) { return memo [ a ] [ b ] == 1 ; } boolean f = false ; for ( int i = 1 ; 2 * i <= a ; ++ i ) { f |= ! dfs ( a - i * 2 , b + i ) ; } for ( int i = 1 ; 2 * i <= b ; ++ i ) { f |= ! dfs ( a + i , b - 2 * i ) ; } if ( f ) { memo [ a ] [ b ] = 1 ; } else { memo [ a ] [ b ] = - 1 ; } return f ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; out . println ( Math . abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; out . close ( ) ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ; import java . io . * ; import static java . lang . Math . * ; import static java . util . Arrays . * ; import static java . util . Collections . * ; public class Main { static final long mod = 1000000007 ; public static void main ( String [ ] args ) throws Exception , IOException { Reader sc = new Reader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; out . println ( abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; out . flush ( ) ; } static void db ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } } class P implements Comparable < P > { int id , d ; P ( int id , int d ) { this . id = id ; this . d = d ; } public int compareTo ( P p ) { return d - p . d ; } } class Reader { private BufferedReader x ; private StringTokenizer st ; public Reader ( InputStream in ) { x = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; } public String nextString ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( x . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( nextString ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( nextString ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( nextString ( ) ) ; } }

import java . io . * ; import java . math . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _out = new PrintWriter ( System . out ) ; private static PrintWriter _err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { long X = sc . nextLong ( ) ; long Y = sc . nextLong ( ) ; if ( Math . abs ( X - Y ) <= 1 ) { _out . println ( " Brown " ) ; } else { _out . println ( " Alice " ) ; } } private static BigInteger C ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } for ( long i = r ; i > 1 ; -- i ) { res = res . divide ( BigInteger . valueOf ( i ) ) ; } return res ; } private static BigInteger P ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _err . println ( ( G - S ) + " ms " ) ; } _err . flush ( ) ; } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ' Alice ' if abs ( a - b ) > 1 else ' Brown ' ) NEW_LINE

X , Y = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE cache = { } NEW_LINE def calc ( X , Y ) : NEW_LINE INDENT if X < Y : NEW_LINE INDENT X , Y = Y , X NEW_LINE DEDENT def cal ( X , Y ) : NEW_LINE INDENT if X <= 1 : NEW_LINE INDENT return False NEW_LINE DEDENT for n in range ( 1 , X // 2 + 1 ) : NEW_LINE INDENT if calc ( X - n * 2 , Y + n ) == False : NEW_LINE INDENT return True NEW_LINE DEDENT DEDENT for n in range ( 1 , Y // 2 + 1 ) : NEW_LINE INDENT if calc ( X + n , Y - n * 2 ) == False : NEW_LINE INDENT return True NEW_LINE DEDENT DEDENT return False NEW_LINE DEDENT k = ( X , Y ) NEW_LINE if k in cache : NEW_LINE INDENT return cache [ k ] NEW_LINE DEDENT r = cal ( X , Y ) NEW_LINE cache [ k ] = r NEW_LINE return r NEW_LINE DEDENT def calc1 ( X , Y ) : NEW_LINE INDENT if abs ( X - Y ) < 2 : NEW_LINE INDENT return False NEW_LINE DEDENT return True NEW_LINE DEDENT if calc1 ( X , Y ) : NEW_LINE INDENT print ( " Alice " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Brown " ) NEW_LINE DEDENT

import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readline ( ) . split ( ) ) NEW_LINE def ls ( ) : return stdin . readline ( ) . split ( ) NEW_LINE def ns ( ) : return stdin . readline ( ) . rstrip ( ) NEW_LINE def lc ( ) : return list ( ns ( ) ) NEW_LINE def ni ( ) : return int ( stdin . readline ( ) ) NEW_LINE def nf ( ) : return float ( stdin . readline ( ) ) NEW_LINE x , y = li ( ) NEW_LINE print ( " Brown " ) if abs ( x - y ) <= 1 else print ( " Alice " ) NEW_LINE

print ( [ ' Alice ' , ' Brown ' ] [ abs ( eval ( input ( ) . replace ( ' ▁ ' , ' - ' ) ) ) < 2 ] ) NEW_LINE

x , y = map ( int , input ( ) . split ( ) ) NEW_LINE m = min ( x , y ) NEW_LINE x -= m NEW_LINE y -= m NEW_LINE if x == y : NEW_LINE INDENT print ( " Brown " ) NEW_LINE DEDENT else : NEW_LINE INDENT if max ( x , y ) == 1 : NEW_LINE INDENT print ( " Brown " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Alice " ) NEW_LINE DEDENT DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int total = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int count = 1 ; count += N - i ; total += count ; } System . out . println ( total ) ; } }

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 a = sc . nextInt ( ) ; pl ( a * ( a + 1 ) / 2 ) ; } 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 ) ; } }

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 ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { ans ++ ; } } out . println ( ans ) ; } }

import java . util . Scanner ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = s . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long ans = 0 ; for ( int i = n ; i >= 1 ; i -- ) { ans += i ; } System . out . println ( ans ) ; } }

n = int ( input ( ) ) ; print ( n * ( n + 1 ) // 2 ) NEW_LINE

N = int ( input ( ) ) NEW_LINE res = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i , N ) : NEW_LINE INDENT res += 1 NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE

def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE print ( n * ( n + 1 ) // 2 ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE def factorical ( n ) : NEW_LINE INDENT ret = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT ret += i NEW_LINE DEDENT return ret NEW_LINE DEDENT print ( factorical ( N ) ) NEW_LINE

n = int ( input ( ) ) ; print ( n * - ~ n // 2 ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int K = sc . nextInt ( ) ; System . out . println ( N % K == 0 ? 0 : 1 ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; numK = scanner . nextInt ( ) ; if ( numN % numK == 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( 1 ) ; } } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } }

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( n % k == 0 ) System . out . println ( 0 ) ; else System . out . println ( 1 ) ; } }

import java . io . BufferedWriter ; import java . io . IOException ; import java . io . OutputStreamWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; BufferedWriter bufferedWriter = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; int N = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; int res ; if ( N % K == 0 ) res = 0 ; else res = 1 ; bufferedWriter . write ( Integer . toString ( res ) ) ; bufferedWriter . close ( ) ; scanner . close ( ) ; } }

public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( scanner . nextInt ( ) % scanner . nextInt ( ) == 0 ? 0 : 1 ) ; } }

import numpy as np NEW_LINE class Calculator : NEW_LINE INDENT def __init__ ( self , N , K ) : NEW_LINE INDENT self . arr = np . array ( [ N , K ] ) NEW_LINE self . max_num = int ( ( self . arr [ 0 ] + self . arr [ 1 ] - 1 ) / self . arr [ 1 ] ) NEW_LINE self . min_num = int ( self . arr [ 0 ] / self . arr [ 1 ] ) NEW_LINE DEDENT def get_answer ( self ) : NEW_LINE INDENT return self . max_num - self . min_num NEW_LINE DEDENT DEDENT def main ( ) : NEW_LINE INDENT N , K , = map ( int , input ( ) . split ( ) ) NEW_LINE c = Calculator ( N , K ) NEW_LINE ans = c . get_answer ( ) NEW_LINE print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

n , k = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE print ( 0 if n % k == 0 else 1 ) NEW_LINE

def main ( ) : NEW_LINE INDENT N , K = map ( int , input ( ) . split ( ) ) NEW_LINE if N % K == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

N , K = map ( int , input ( ) . split ( ) ) NEW_LINE print ( [ 0 , 1 ] [ 0 < N % K ] ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { int value = input . nextInt ( ) ; if ( value == 5 ) a ++ ; else if ( value == 7 ) b ++ ; } if ( a == 2 && b == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; IrohaAndHaikuABCEdition solver = new IrohaAndHaikuABCEdition ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class IrohaAndHaikuABCEdition { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = { a , b , c } ; Arrays . sort ( array ) ; if ( array [ 0 ] == 5 && array [ 1 ] == 5 && array [ 2 ] == 7 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Map < Integer , Integer > seen = new HashMap < > ( ) ; for ( int ix = 0 ; ix < 3 ; ix ++ ) { int value = scanner . nextInt ( ) ; seen . put ( value , seen . getOrDefault ( value , 0 ) + 1 ) ; } boolean result = seen . containsKey ( 5 ) && seen . containsKey ( 7 ) && seen . get ( 5 ) == 2 && seen . get ( 7 ) == 1 ; System . out . println ( result ? " YES " : " NO " ) ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int SideA = keyboard . nextInt ( ) ; int SideB = keyboard . nextInt ( ) ; int SideC = keyboard . nextInt ( ) ; int [ ] arr = new int [ ] { SideA , SideB , SideC } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] == 5 && arr [ 1 ] == 5 && arr [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } keyboard . close ( ) ; } }

import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] input = new int [ 3 ] ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { input [ i ] = sc . nextInt ( ) ; if ( input [ i ] == 5 && fiveCount < 2 ) { fiveCount ++ ; } else if ( input [ i ] == 7 && sevenCount < 1 ) { sevenCount ++ ; } else { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } }

A = input ( ) . split ( ) NEW_LINE print ( " YES " if A . count ( "5" ) == 2 and A . count ( "7" ) == 1 else " NO " ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE arr = [ a , b , c ] NEW_LINE arr = sorted ( arr ) NEW_LINE if arr [ 0 ] == arr [ 1 ] == 5 and arr [ 2 ] == 7 : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT

print ( " YES " ) if input ( ) in ( "5 ▁ 7 ▁ 5" , "5 ▁ 5 ▁ 7" , "7 ▁ 5 ▁ 5" ) else print ( " NO " ) NEW_LINE

a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = 0 NEW_LINE c = 0 NEW_LINE for i in a : NEW_LINE INDENT if i == 7 : NEW_LINE INDENT b += 1 NEW_LINE DEDENT elif i == 5 : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT if b == 1 and c == 2 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT

from sys import stdin NEW_LINE a = stdin . readline ( ) . rstrip ( ) NEW_LINE a . count ( '5' ) NEW_LINE if a . count ( '5' ) == 2 : NEW_LINE INDENT print ( ' YES ' ) ; NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; String popo = sc . nextLine ( ) ; for ( int i = 0 ; i < popo . length ( ) ; i ++ ) { System . out . print ( po . substring ( i , i + 1 ) + popo . substring ( i , i + 1 ) ) ; } System . out . println ( ( po . length ( ) == popo . length ( ) ) ? " " : po . substring ( po . length ( ) - 1 , po . length ( ) ) ) ; } }

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 ) { String O = in . next ( ) ; String E = in . next ( ) ; for ( int i = 0 ; i < E . length ( ) ; i ++ ) { out . print ( " " + O . charAt ( i ) + E . charAt ( i ) ) ; } if ( O . length ( ) > E . length ( ) ) { out . println ( " " + O . charAt ( O . length ( ) - 1 ) ) ; } else { out . println ( ) ; } } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public 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 . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String o = input . readLine ( ) ; String e = input . readLine ( ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < Math . max ( o . length ( ) , e . length ( ) ) ; i ++ ) { if ( i < o . length ( ) ) out . append ( o . charAt ( i ) ) ; if ( i < e . length ( ) ) out . append ( e . charAt ( i ) ) ; } System . out . println ( out ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String O = sc . next ( ) ; String E = sc . next ( ) ; int Olen = O . length ( ) ; int Elen = E . length ( ) ; for ( int i = 0 ; i < Elen ; i ++ ) { System . out . print ( O . charAt ( i ) ) ; System . out . print ( E . charAt ( i ) ) ; } if ( Olen > Elen ) System . out . print ( O . charAt ( Olen - 1 ) ) ; } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String a = sc . next ( ) , b = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { sb . append ( a . charAt ( i ) ) ; if ( b . length ( ) > i ) { sb . append ( b . charAt ( i ) ) ; } } System . out . println ( sb ) ; } }

O = input ( ) NEW_LINE E = input ( ) NEW_LINE if len ( O ) == len ( E ) : NEW_LINE INDENT for i in range ( len ( O ) ) : NEW_LINE INDENT print ( O [ i ] + E [ i ] , end = ' ' ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT for i in range ( len ( E ) ) : NEW_LINE INDENT print ( O [ i ] + E [ i ] , end = ' ' ) NEW_LINE DEDENT print ( O [ - 1 : ] ) NEW_LINE DEDENT

j = ' ' . join ; print ( j ( map ( j , zip ( * open ( 0 ) ) ) ) ) NEW_LINE

import sys NEW_LINE ni = lambda : int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE o = list ( ns ( ) ) NEW_LINE e = list ( ns ( ) ) NEW_LINE ans = ' ' NEW_LINE for i in range ( len ( e ) ) : NEW_LINE INDENT ans += o [ i ] + e [ i ] NEW_LINE DEDENT if len ( o ) > len ( e ) : NEW_LINE INDENT ans += o [ - 1 ] NEW_LINE DEDENT print ( ans ) NEW_LINE

from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT O = list ( _ for _ in input ( ) ) NEW_LINE E = list ( _ for _ in input ( ) ) NEW_LINE ans = [ ] NEW_LINE for i in range ( len ( E ) ) : NEW_LINE INDENT ans . append ( O [ i ] ) NEW_LINE ans . append ( E [ i ] ) NEW_LINE DEDENT if ( len ( O ) > len ( E ) ) : NEW_LINE INDENT ans . append ( O [ - 1 ] ) NEW_LINE DEDENT print ( ' ' . join ( ans ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

O = input ( ) NEW_LINE E = input ( ) NEW_LINE res = " " NEW_LINE o_cnt = 0 NEW_LINE e_cnt = 0 NEW_LINE while True : NEW_LINE INDENT if o_cnt == len ( O ) and e_cnt == len ( E ) : NEW_LINE INDENT break NEW_LINE DEDENT if o_cnt < len ( O ) : NEW_LINE INDENT res += O [ o_cnt ] NEW_LINE o_cnt += 1 NEW_LINE DEDENT if e_cnt < len ( E ) : NEW_LINE INDENT res += E [ e_cnt ] NEW_LINE e_cnt += 1 NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( a + b > c + d ) { System . out . println ( " Left " ) ; } else if ( a + b < c + d ) { System . out . println ( " Right " ) ; } else { System . out . println ( " Balanced " ) ; } } }

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 l = in . nextInt ( ) + in . nextInt ( ) ; int r = in . nextInt ( ) + in . nextInt ( ) ; out . println ( l == r ? " Balanced " : l > r ? " Left " : " Right " ) ; } 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 . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d ; a = Integer . parseInt ( sc . next ( ) ) ; b = Integer . parseInt ( sc . next ( ) ) ; c = Integer . parseInt ( sc . next ( ) ) ; d = Integer . parseInt ( sc . next ( ) ) ; int left = a + b ; int right = c + d ; if ( left > right ) { System . out . println ( " Left " ) ; } else if ( left < right ) { System . out . println ( " Right " ) ; } else { System . out . println ( " Balanced " ) ; } sc . close ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int L = A + B ; int R = C + D ; if ( L > R ) { System . out . println ( " Left " ) ; } else if ( L == R ) { System . out . println ( " Balanced " ) ; } else { System . out . println ( " Right " ) ; } } }

import java . util . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; String ans = ( a + b > c + d ) ? " Left " : ( a + b == c + d ) ? " Balanced " : " Right " ; System . out . println ( ans ) ; } }

a , b , c , d = map ( int , input ( ) . split ( ) ) NEW_LINE l = a + b NEW_LINE r = c + d NEW_LINE if l > r : NEW_LINE INDENT print ( " Left " ) NEW_LINE DEDENT elif l == r : NEW_LINE INDENT print ( " Balanced " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Right " ) NEW_LINE DEDENT

A , B , C , D = map ( int , input ( ) . split ( ) ) NEW_LINE left = A + B NEW_LINE right = C + D NEW_LINE if left > right : NEW_LINE INDENT print ( " Left " ) NEW_LINE DEDENT elif left < right : NEW_LINE INDENT print ( " Right " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Balanced " ) NEW_LINE DEDENT

import sys NEW_LINE input = sys . stdin . readline NEW_LINE def io_generator ( ) : NEW_LINE INDENT return input ( ) NEW_LINE DEDENT def main ( io ) : NEW_LINE INDENT a , b , c , d = map ( int , io ( ) . split ( ) ) NEW_LINE rets = [ ' Left ' , ' Balanced ' , ' Right ' ] NEW_LINE if a + b > c + d : NEW_LINE INDENT return rets [ 0 ] NEW_LINE DEDENT elif a + b < c + d : NEW_LINE INDENT return rets [ 2 ] NEW_LINE DEDENT else : NEW_LINE INDENT return rets [ 1 ] NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT io = lambda : io_generator ( ) NEW_LINE print ( main ( io ) ) NEW_LINE DEDENT

A , B , C , D = map ( int , input ( ) . split ( ) ) NEW_LINE L , R = A + B , C + D NEW_LINE print ( [ " Balanced " , " Left " , " Right " ] [ ( R < L ) + - ( R > L ) ] ) NEW_LINE

W = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if ( sum ( W [ : 2 : ] ) > sum ( W [ 2 : : ] ) ) : NEW_LINE INDENT print ( ' Left ' ) NEW_LINE DEDENT elif ( sum ( W [ : 2 : ] ) < sum ( W [ 2 : : ] ) ) : NEW_LINE INDENT print ( ' Right ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Balanced ' ) NEW_LINE DEDENT


import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( br . readLine ( ) ) ; boolean [ ] rainTimes = new boolean [ 24 * 12 + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { String [ ] rainTime = br . readLine ( ) . split ( " - " ) ; int rainFrom = Integer . parseInt ( rainTime [ 0 ] ) ; int rainTo = Integer . parseInt ( rainTime [ 1 ] ) ; for ( int j = rainFrom / 100 * 12 + ( rainFrom % 100 ) / 5 ; j < rainTo / 100 * 12 + ( rainTo % 100 + 4 ) / 5 ; j ++ ) { rainTimes [ j ] = true ; } } for ( int i = 0 ; i < 24 * 12 ; i ++ ) { if ( ! rainTimes [ i ] ) continue ; System . out . print ( String . format ( " % 02d % 02d - " , i / 12 , i % 12 * 5 ) ) ; while ( i < 24 * 12 && rainTimes [ i ] && rainTimes [ i + 1 ] ) i ++ ; i ++ ; System . out . println ( String . format ( " % 02d % 02d " , i / 12 , i % 12 * 5 ) ) ; } } }

import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] range = new int [ ( 60 * 24 ) + 2 ] ; int m = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) { String [ ] sp = sc . next ( ) . split ( " - " ) ; int s = timeToIntB ( sp [ 0 ] ) , e = timeToIntA ( sp [ 1 ] ) ; range [ s ] += 1 ; range [ e + 1 ] -= 1 ; } for ( int i = 1 ; i <= ( 60 * 24 ) ; i ++ ) { range [ i ] += range [ i - 1 ] ; } for ( int i = 0 ; i <= ( 60 * 24 ) ; i ++ ) { if ( range [ i ] > 0 ) { int s = i ; int e = i ; for ( ; i <= 60 * 24 && range [ i ] > 0 ; i ++ ) { e = i ; } System . out . println ( intToTime ( s ) + " - " + intToTime ( e ) ) ; } } } int timeToIntB ( String time ) { int h = Integer . parseInt ( time . substring ( 0 , 2 ) ) ; int m = Integer . parseInt ( time . substring ( 2 ) ) ; m = ( m / 5 ) * 5 ; return ( h * 60 + m ) ; } int timeToIntA ( String time ) { int h = Integer . parseInt ( time . substring ( 0 , 2 ) ) ; int m = Integer . parseInt ( time . substring ( 2 ) ) ; m = ( m + 4 ) / 5 * 5 ; return ( h * 60 + m ) ; } String intToTime ( int time ) { int h = ( time ) / 60 ; int m = ( time ) % 60 ; return String . format ( " % 02d % 02d " , h , m ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { int timeData = 0 ; int [ ] [ ] times = new int [ 289 ] [ 2 ] ; for ( int i = 0 ; i < 289 ; i ++ ) { times [ i ] [ 0 ] = timeData ; timeData += 5 ; if ( i != 0 && ( times [ i ] [ 0 ] % 100 ) == 55 ) timeData = ( timeData / 100 + 1 ) * 100 ; } Scanner sc = new Scanner ( System . in ) ; int inputCount = sc . nextInt ( ) ; for ( int i = 0 ; i < inputCount ; i ++ ) { String [ ] lainTime = sc . next ( ) . split ( " - " ) ; int from = Integer . valueOf ( lainTime [ 0 ] ) ; int to = Integer . valueOf ( lainTime [ 1 ] ) ; from = from - from % 5 ; for ( int j = 0 ; j < 289 ; j ++ ) { if ( times [ j ] [ 0 ] >= from && times [ j ] [ 0 ] < to ) times [ j ] [ 1 ] = 1 ; } } ArrayList < String > resultList = new ArrayList < > ( ) ; String result = " " ; boolean isContinue = false ; for ( int i = 0 ; i < times . length ; i ++ ) { if ( isContinue ) { if ( times [ i ] [ 1 ] == 0 ) { isContinue = false ; String intResult = "0000" + times [ i ] [ 0 ] ; result += " - " + intResult . substring ( intResult . length ( ) - 4 ) ; resultList . add ( result ) ; result = " " ; } } else { if ( times [ i ] [ 1 ] == 1 ) { isContinue = true ; result = "0000" + ( times [ i ] [ 0 ] ) ; result = result . substring ( result . length ( ) - 4 ) ; } } if ( isContinue && i == 288 ) { result += " - 2400" ; resultList . add ( result ) ; } } for ( String output : resultList ) { System . out . println ( output ) ; } } }

import static java . util . Comparator . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { static public void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int size = scan . nextInt ( ) ; List < String > list = new ArrayList < > ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { list . add ( scan . next ( ) ) ; } list . sort ( naturalOrder ( ) ) ; int start = 9999 ; int end = - 1 ; for ( String data : list ) { String [ ] record = data . split ( " - " ) ; int rainStart = Integer . parseInt ( record [ 0 ] ) ; int rainEnd = Integer . parseInt ( record [ 1 ] ) ; rainStart -= rainStart % 5 ; if ( rainEnd % 5 > 0 ) { rainEnd += 5 - rainEnd % 5 ; } if ( rainEnd % 100 == 60 ) { rainEnd += 40 ; } if ( rainStart > end ) { if ( start != 9999 ) { System . out . println ( String . format ( " % 04d " , start ) + " - " + String . format ( " % 04d " , end ) ) ; } start = rainStart ; end = - 1 ; } if ( end < rainEnd ) { end = rainEnd ; } } System . out . println ( String . format ( " % 04d " , start ) + " - " + String . format ( " % 04d " , end ) ) ; scan . close ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int plot [ ] = new int [ 1000 ] ; for ( int i = 0 ; i < plot . length ; i ++ ) { plot [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { String baseTime = sc . next ( ) ; String times [ ] = baseTime . split ( " - " ) ; int startTime = Integer . parseInt ( times [ 0 ] ) ; int endTime = Integer . parseInt ( times [ 1 ] ) ; int start = startTime - ( startTime % 5 ) ; int end = endTime + ( 5 - ( endTime % 5 ) == 5 ? 0 : 5 - ( endTime % 5 ) ) ; if ( end % 100 > 59 ) { end += 100 - 60 + ( end % 100 - 60 ) ; } int startIndex = start / 5 ; int endIndex = end / 5 ; for ( int j = startIndex ; j < endIndex ; j ++ ) { plot [ j ] = 1 ; } } boolean startFlag = false ; for ( int i = 0 ; i < plot . length ; i ++ ) { if ( ! startFlag ) { if ( plot [ i ] == 1 ) { System . out . print ( String . format ( " % 04d " , ( i * 5 ) ) + " - " ) ; startFlag = true ; } } else { if ( plot [ i ] == 0 ) { System . out . println ( String . format ( " % 04d " , ( i * 5 ) ) ) ; startFlag = false ; } } } } }

import sys NEW_LINE input = sys . stdin . readline NEW_LINE n = int ( input ( ) ) NEW_LINE lis = [ list ( map ( int , input ( ) . rstrip ( ) . split ( ' - ' ) ) ) for _ in range ( n ) ] NEW_LINE lis . sort ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT lis [ i ] [ 0 ] = lis [ i ] [ 0 ] - lis [ i ] [ 0 ] % 5 NEW_LINE if ( lis [ i ] [ 1 ] % 5 != 0 ) : NEW_LINE INDENT lis [ i ] [ 1 ] = lis [ i ] [ 1 ] - lis [ i ] [ 1 ] % 5 + 5 NEW_LINE DEDENT tmp2 = lis [ i ] [ 1 ] / 100 NEW_LINE if ( tmp2 - int ( tmp2 ) > 0.59999 ) : NEW_LINE INDENT lis [ i ] [ 1 ] = ( int ( tmp2 ) + 1 ) * 100 NEW_LINE DEDENT if ( lis [ i ] [ 1 ] >= 2360 ) : NEW_LINE INDENT lis [ i ] [ 1 ] = 2400 NEW_LINE DEDENT DEDENT ans1 = [ lis [ 0 ] ] NEW_LINE aaaa = ans1 [ 0 ] NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT if ( aaaa [ 1 ] < lis [ i ] [ 0 ] ) : NEW_LINE INDENT ans1 . append ( lis [ i ] ) NEW_LINE aaaa = ans1 [ - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT if ( aaaa [ 1 ] < lis [ i ] [ 1 ] ) : NEW_LINE INDENT ans1 [ - 1 ] [ 1 ] = lis [ i ] [ 1 ] NEW_LINE DEDENT DEDENT DEDENT for i in range ( len ( ans1 ) ) : NEW_LINE INDENT start = str ( ans1 [ i ] [ 0 ] ) NEW_LINE end = str ( ans1 [ i ] [ 1 ] ) NEW_LINE print ( start . zfill ( 4 ) + ' - ' + end . zfill ( 4 ) ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE def r_forward ( string ) : NEW_LINE INDENT return str ( int ( string ) - int ( string ) % 5 ) . zfill ( 4 ) NEW_LINE DEDENT def r_backward ( string ) : NEW_LINE INDENT ret = str ( int ( string ) + 4 - ( int ( string ) - 1 ) % 5 ) . zfill ( 4 ) NEW_LINE if ret [ 2 ] == "6" : NEW_LINE INDENT ret = ( str ( int ( ret [ : 2 ] ) + 1 ) + "00" ) . zfill ( 4 ) NEW_LINE DEDENT return ret NEW_LINE DEDENT time_lst = [ ] NEW_LINE for i in range ( 24 ) : NEW_LINE INDENT for j in range ( 12 ) : NEW_LINE INDENT time_lst . append ( str ( i ) . zfill ( 2 ) + str ( j * 5 ) . zfill ( 2 ) ) NEW_LINE DEDENT DEDENT time_lst . append ( "2400" ) NEW_LINE rained = [ list ( [ time , 0 ] ) for time in time_lst ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT st_ , end_ = input ( ) . split ( " - " ) NEW_LINE for idx in range ( time_lst . index ( r_forward ( st_ ) ) , time_lst . index ( r_backward ( end_ ) ) ) : NEW_LINE INDENT rained [ idx ] [ 1 ] = 1 NEW_LINE DEDENT DEDENT prev = 0 NEW_LINE for i , j in rained : NEW_LINE INDENT if prev == 0 and j == 1 : NEW_LINE INDENT st = i NEW_LINE DEDENT if prev == 1 and ( j == 0 or i == "2400" ) : NEW_LINE INDENT print ( " { } - { } " . format ( st , i ) ) NEW_LINE DEDENT prev = j NEW_LINE DEDENT

from sys import stdin NEW_LINE def my_round ( val , digit = 0 ) : NEW_LINE INDENT p = 10 ** digit NEW_LINE return ( val * p * 2 + 1 ) // 2 / p NEW_LINE DEDENT def rounded_time_before ( time ) : NEW_LINE INDENT tmp = int ( 10 * my_round ( time * 0.1 , 0 ) ) NEW_LINE if time < float ( tmp ) : NEW_LINE INDENT tmp -= 5 NEW_LINE DEDENT return tmp NEW_LINE DEDENT def rounded_time_after ( time ) : NEW_LINE INDENT if str ( time ) [ - 1 ] == "5" : NEW_LINE INDENT time -= 1 NEW_LINE DEDENT tmp = int ( 10 * my_round ( time * 0.1 , 0 ) ) NEW_LINE if time > float ( tmp ) : NEW_LINE INDENT tmp += 5 NEW_LINE DEDENT if str ( tmp ) [ - 2 : ] == "60" : NEW_LINE INDENT tmp += 40 NEW_LINE DEDENT return tmp NEW_LINE DEDENT N = int ( stdin . readline ( ) . rstrip ( ) ) NEW_LINE SE = [ list ( map ( int , stdin . readline ( ) . rstrip ( ) . split ( " - " ) ) ) for _ in range ( N ) ] NEW_LINE start , end = None , None NEW_LINE for before , after in sorted ( SE ) : NEW_LINE INDENT bf = int ( rounded_time_before ( before ) ) NEW_LINE af = int ( rounded_time_after ( after ) ) NEW_LINE if not start and not end : NEW_LINE INDENT start , end = bf , af NEW_LINE DEDENT if bf > end : NEW_LINE INDENT print ( " { } - { } " . format ( str ( start ) . zfill ( 4 ) , str ( end ) . zfill ( 4 ) ) ) NEW_LINE start , end = bf , af NEW_LINE DEDENT else : NEW_LINE INDENT if af > end : NEW_LINE INDENT end = af NEW_LINE DEDENT DEDENT DEDENT print ( " { } - { } " . format ( str ( start ) . zfill ( 4 ) , str ( end ) . zfill ( 4 ) ) ) NEW_LINE

def convert ( m , e = False ) : NEW_LINE INDENT if m % 5 == 0 : return m NEW_LINE else : NEW_LINE INDENT if e : return m + ( 5 - m % 5 ) NEW_LINE else : return m - ( m % 5 ) NEW_LINE DEDENT DEDENT blocks = [ False ] * 12 * 24 NEW_LINE n = int ( input ( ) ) NEW_LINE for _ in range ( n ) : NEW_LINE INDENT s , e = map ( int , input ( ) . split ( ' - ' ) ) NEW_LINE sb = int ( s / 100 ) * 12 + int ( convert ( s % 100 ) / 5 ) NEW_LINE eb = int ( e / 100 ) * 12 + int ( convert ( e % 100 , True ) / 5 ) NEW_LINE for a in range ( sb , eb ) : NEW_LINE INDENT blocks [ a ] = True NEW_LINE DEDENT DEDENT pb = False NEW_LINE for i , e in enumerate ( blocks ) : NEW_LINE INDENT if pb == False and e == True : NEW_LINE INDENT print ( ' % 02d % 02d - ' % ( i / 12 , 5 * ( i % 12 ) ) , end = ' ' ) NEW_LINE DEDENT elif pb == True and e == False : NEW_LINE INDENT print ( ' % 02d % 02d ' % ( i / 12 , 5 * ( i % 12 ) ) ) NEW_LINE DEDENT elif e == True and i == len ( blocks ) - 1 : NEW_LINE INDENT print ( '2400' ) NEW_LINE DEDENT pb = e NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE imos = [ 0 for i in range ( 1443 ) ] NEW_LINE def mystart ( a_minute ) : NEW_LINE INDENT while ( 1 ) : NEW_LINE INDENT if a_minute % 5 == 0 : break NEW_LINE a_minute -= 1 NEW_LINE DEDENT return a_minute NEW_LINE DEDENT def myend ( a_minute ) : NEW_LINE INDENT while ( 1 ) : NEW_LINE INDENT if a_minute % 5 == 0 : break NEW_LINE a_minute += 1 NEW_LINE DEDENT return a_minute NEW_LINE DEDENT def output_time ( a_minute ) : NEW_LINE INDENT h = a_minute // 60 NEW_LINE h = ' % 02d ' % h NEW_LINE m = a_minute % 60 NEW_LINE m = ' % 02d ' % m NEW_LINE return h + m NEW_LINE DEDENT nums = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT time = [ t for t in input ( ) . split ( " - " ) ] NEW_LINE time = [ int ( t [ : 2 ] ) * 60 + int ( t [ 2 : ] ) for t in time ] NEW_LINE time = [ mystart ( time [ 0 ] ) , myend ( time [ 1 ] ) ] NEW_LINE nums . append ( time ) NEW_LINE DEDENT for n in nums : NEW_LINE INDENT imos [ n [ 0 ] ] += 1 NEW_LINE imos [ n [ 1 ] + 1 ] -= 1 NEW_LINE DEDENT ans = [ ] NEW_LINE j = 0 NEW_LINE for i in imos : NEW_LINE INDENT ans . append ( j + i ) NEW_LINE j += i NEW_LINE DEDENT start , end , flag = 0 , 0 , False NEW_LINE for i in range ( len ( ans ) ) : NEW_LINE INDENT if ans [ i ] == 0 and flag == False : continue NEW_LINE elif ans [ i ] == 0 and flag == True : NEW_LINE INDENT end = i NEW_LINE print ( output_time ( start ) + " - " + output_time ( end - 1 ) ) NEW_LINE start , end , flag = 0 , 0 , False NEW_LINE DEDENT elif ans [ i ] != 0 and flag == False : NEW_LINE INDENT start = i NEW_LINE flag = True NEW_LINE DEDENT else : NEW_LINE INDENT continue NEW_LINE DEDENT DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; System . out . println ( ( a + b == n ) ? ( a - b == n ) ? " ? " : " + " : ( a - b == n ) ? " - " : " ! " ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; if ( A + B == C && A - B == C ) { out . println ( " ? " ) ; } else if ( A + B == C ) { out . println ( " + " ) ; } else if ( A - B == C ) { out . println ( " - " ) ; } else { out . println ( " ! " ) ; } } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int state = 0 ; if ( n + m == l ) state += 1 ; if ( n - m == l ) state += 2 ; String ans = " ! " ; switch ( state ) { case 0 : break ; case 1 : ans = " + " ; break ; case 2 : ans = " - " ; break ; case 3 : ans = " ? " ; break ; } System . out . println ( ans ) ; } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " ▁ " , 3 ) ; int a = Integer . parseInt ( line [ 0 ] ) ; int b = Integer . parseInt ( line [ 1 ] ) ; int c = Integer . parseInt ( line [ 2 ] ) ; if ( a + b == c && a - b != c ) { System . out . println ( " + " ) ; } else if ( a + b != c && a - b == c ) { System . out . println ( " - " ) ; } else if ( a + b == c && a - b == c ) { System . out . println ( " ? " ) ; } else { System . out . println ( " ! " ) ; } } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } if ( a [ 0 ] + a [ 1 ] == a [ 2 ] && a [ 0 ] - a [ 1 ] == a [ 2 ] ) { System . out . println ( " ? " ) ; } else if ( a [ 0 ] + a [ 1 ] == a [ 2 ] ) { System . out . println ( " + " ) ; } else if ( a [ 0 ] - a [ 1 ] == a [ 2 ] ) { System . out . println ( " - " ) ; } else { System . out . println ( " ! " ) ; } } }

a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE if a - b == c : NEW_LINE INDENT if a + b == c : NEW_LINE INDENT print ( " ? " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " - " ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if a + b == c : NEW_LINE INDENT print ( " + " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " ! " ) NEW_LINE DEDENT DEDENT

x , y , c = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE judge = 0 NEW_LINE if x + y == c : NEW_LINE INDENT judge += 2 NEW_LINE DEDENT if x - y == c : NEW_LINE INDENT judge -= 1 NEW_LINE DEDENT if judge == 2 : NEW_LINE INDENT print ( " + " ) NEW_LINE DEDENT elif judge == - 1 : NEW_LINE INDENT print ( " - " ) NEW_LINE DEDENT elif judge == 1 : NEW_LINE INDENT print ( " ? " ) NEW_LINE DEDENT elif judge == 0 : NEW_LINE INDENT print ( " ! " ) NEW_LINE DEDENT

[ a , b , c ] = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE if a + b != c and a - b != c : NEW_LINE INDENT print ( " ! " ) NEW_LINE DEDENT elif a + b != c : NEW_LINE INDENT print ( " - " ) NEW_LINE DEDENT elif a - b != c : NEW_LINE INDENT print ( " + " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " ? " ) NEW_LINE DEDENT

x , y , z = map ( int , input ( ) . split ( ) ) NEW_LINE print ( " ? " if x - y == z and x + y == z else " + " if x + y == z else " - " if x - y == z else " ! " ) NEW_LINE

A , B , C = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE if A + B == C : NEW_LINE INDENT if A - B != C : NEW_LINE INDENT print ( ' + ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' ? ' ) NEW_LINE DEDENT DEDENT elif A + B != C : NEW_LINE INDENT if A - B == C : NEW_LINE INDENT print ( ' - ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' ! ' ) NEW_LINE DEDENT DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int tmp = ( B - 1 ) / A ; System . out . println ( tmp + 1 ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; out . println ( B % A == 0 ? B / A : B / A + 1 ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }

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

import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int ans = 0 ; if ( b % a == 0 ) { ans = b / a ; } else if ( a > b ) { ans = 1 ; } else { ans = b / a + 1 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( ans ) ; out . flush ( ) ; scan . close ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextInt ( ) ; double b = Integer . parseInt ( scan . next ( ) ) ; double box = b / a ; double calc = b % a ; int result = 0 ; if ( calc == 0 ) { result = ( int ) box ; System . out . println ( result ) ; } else { box = Math . ceil ( box ) ; result = ( int ) box ; System . out . println ( result ) ; } } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( - ( - b // a ) ) NEW_LINE

from math import ceil NEW_LINE def tea ( A : int , B : int ) -> int : NEW_LINE INDENT return ceil ( B / A ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT A , B = map ( int , input ( ) . split ( ) ) NEW_LINE ans = tea ( A , B ) NEW_LINE print ( ans ) NEW_LINE DEDENT

A , B = map ( int , input ( ) . split ( ) ) NEW_LINE tmp = A NEW_LINE ansFlg = True NEW_LINE ans = 1 NEW_LINE while ansFlg : NEW_LINE INDENT if A >= B : NEW_LINE INDENT print ( ans ) NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT A += tmp NEW_LINE ans += 1 NEW_LINE DEDENT DEDENT

A , B = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE if ( B % A == 0 ) : NEW_LINE INDENT print ( int ( B / A ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( int ( B / A ) + 1 ) NEW_LINE DEDENT

a , b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( b // a + ( b % a != 0 ) ) 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 ) ; final String S = sc . next ( ) ; sc . close ( ) ; int mNum = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == ' M ' ) mNum ++ ; } int [ ] m = new int [ mNum ] ; int at = S . length ( ) - 1 ; int current = 0 ; int mIndex = mNum - 1 ; while ( mIndex >= 0 ) { char c = S . charAt ( at ) ; if ( c == ' M ' ) { m [ mIndex ] = current ; mIndex -- ; } else if ( c == ' + ' ) { current ++ ; } else if ( c == ' - ' ) { current -- ; } at -- ; } Arrays . sort ( m ) ; int ans = 0 ; for ( int i = 0 ; i < mNum / 2 ; i ++ ) ans -= m [ i ] ; for ( int i = mNum / 2 ; i < mNum ; i ++ ) ans += m [ i ] ; System . out . println ( ans ) ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int m = 0 ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' M ' ) m ++ ; } int [ ] a = new int [ m ] ; int countp = 0 ; int countm = 0 ; int j = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == ' + ' ) countp ++ ; else if ( s . charAt ( i ) == ' - ' ) countm ++ ; else if ( s . charAt ( i ) == ' M ' ) { a [ j ++ ] = countp - countm ; } } Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { if ( i < m / 2 ) sum -= a [ i ] ; else sum += a [ i ] ; } System . out . println ( sum ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . StringTokenizer ; public class Main { char [ ] cs ; List < Integer > list ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; cs = sc . next ( ) . toCharArray ( ) ; solve ( ) ; } void solve ( ) { list = new ArrayList < > ( ) ; int plus = 0 ; int minus = 0 ; for ( int i = cs . length - 1 ; i >= 0 ; i -- ) { if ( cs [ i ] == ' + ' ) { plus ++ ; } else if ( cs [ i ] == ' - ' ) { minus ++ ; } else { list . add ( plus - minus ) ; } } Collections . sort ( list ) ; long ans = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( i * 2 < list . size ( ) ) { ans -= list . get ( i ) ; } else { ans += list . get ( i ) ; } } System . out . println ( ans ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

S = input ( ) NEW_LINE p = 0 NEW_LINE m = 0 NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if S [ i ] == ' + ' : NEW_LINE INDENT p += 1 NEW_LINE DEDENT elif S [ i ] == ' - ' : NEW_LINE INDENT m += 1 NEW_LINE DEDENT DEDENT l = [ ] NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if S [ i ] == ' + ' : NEW_LINE INDENT p -= 1 NEW_LINE DEDENT elif S [ i ] == ' - ' : NEW_LINE INDENT m -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT l . append ( p - m ) NEW_LINE DEDENT DEDENT l . sort ( ) NEW_LINE ans = 0 NEW_LINE for i in range ( len ( l ) ) : NEW_LINE INDENT if i <= len ( l ) / 2 - 1 : NEW_LINE INDENT ans -= l [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT ans += l [ i ] NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

S = input ( ) NEW_LINE plus , minus = S . count ( " + " ) , S . count ( " - " ) NEW_LINE ans = [ ] NEW_LINE append = ans . append NEW_LINE for c in S : NEW_LINE INDENT if c == " M " : NEW_LINE INDENT append ( plus - minus ) NEW_LINE DEDENT elif c == " + " : NEW_LINE INDENT plus -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT minus -= 1 NEW_LINE DEDENT DEDENT ans . sort ( ) NEW_LINE print ( - sum ( ans [ : len ( ans ) // 2 ] ) + sum ( ans [ len ( ans ) // 2 : ] ) ) NEW_LINE

def robot ( S : str ) -> int : NEW_LINE INDENT N = len ( S ) NEW_LINE Sp , Sm = [ 0 ] * ( N + 1 ) , [ 0 ] * ( N + 1 ) NEW_LINE A = [ float ( ' inf ' ) ] * ( N + 1 ) NEW_LINE S = reversed ( S ) NEW_LINE M = 0 NEW_LINE for i , c in enumerate ( S ) : NEW_LINE INDENT Sp [ i + 1 ] , Sm [ i + 1 ] = Sp [ i ] , Sm [ i ] NEW_LINE if c == ' M ' : NEW_LINE INDENT M += 1 NEW_LINE A [ i + 1 ] = Sp [ i ] - Sm [ i ] NEW_LINE DEDENT elif c == ' + ' : NEW_LINE INDENT Sp [ i + 1 ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT Sm [ i + 1 ] += 1 NEW_LINE DEDENT DEDENT A . sort ( ) NEW_LINE return sum ( A [ M // 2 : M ] ) - sum ( A [ : M // 2 ] ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT S = input ( ) NEW_LINE ans = robot ( S ) NEW_LINE print ( ans ) NEW_LINE DEDENT

from itertools import accumulate NEW_LINE S = input ( ) NEW_LINE N = len ( S ) NEW_LINE M_cnt = S . count ( ' M ' ) NEW_LINE cnt_plus = list ( accumulate ( [ ( 1 if s == ' + ' else 0 ) for s in S [ : : - 1 ] ] ) ) [ : : - 1 ] NEW_LINE cnt_minus = list ( accumulate ( [ ( 1 if s == ' - ' else 0 ) for s in S [ : : - 1 ] ] ) ) [ : : - 1 ] NEW_LINE p = [ ] NEW_LINE for i , s in enumerate ( S ) : NEW_LINE INDENT if s == ' M ' : NEW_LINE INDENT p . append ( cnt_plus [ i ] - cnt_minus [ i ] ) NEW_LINE DEDENT DEDENT p . sort ( ) NEW_LINE ans = sum ( p [ M_cnt // 2 : ] ) - sum ( p [ : M_cnt // 2 ] ) NEW_LINE print ( ans ) NEW_LINE

s = input ( ) NEW_LINE n = len ( s ) NEW_LINE a = [ [ 0 , 0 ] for i in range ( n ) ] NEW_LINE for i , j in enumerate ( s ) : NEW_LINE INDENT a [ i ] [ 0 ] += a [ i - 1 ] [ 0 ] NEW_LINE a [ i ] [ 1 ] += a [ i - 1 ] [ 1 ] NEW_LINE if j == " + " : NEW_LINE INDENT a [ i ] [ 0 ] += 1 NEW_LINE DEDENT if j == " - " : NEW_LINE INDENT a [ i ] [ 1 ] += 1 NEW_LINE DEDENT DEDENT b = [ 0 ] * n NEW_LINE for i in range ( n ) : NEW_LINE INDENT b [ i ] = ( a [ - 1 ] [ 0 ] - a [ i ] [ 0 ] ) - ( a [ - 1 ] [ 1 ] - a [ i ] [ 1 ] ) NEW_LINE DEDENT ans = [ ] NEW_LINE for i , j in enumerate ( s ) : NEW_LINE INDENT if j == " M " : NEW_LINE INDENT ans . append ( b [ i ] ) NEW_LINE DEDENT DEDENT ans . sort ( ) NEW_LINE ans1 = ans [ : len ( ans ) // 2 ] NEW_LINE ans2 = ans [ len ( ans ) // 2 : ] NEW_LINE print ( sum ( ans2 ) - sum ( ans1 ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String a = sc . next ( ) ; String b = sc . next ( ) ; char ach = a . charAt ( 0 ) ; char bch = b . charAt ( 0 ) ; if ( ach > bch ) { System . out . println ( " > " ) ; } else if ( ach < bch ) { System . out . println ( " < " ) ; } else { System . out . println ( " = " ) ; } } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { A ( ) ; } public static void A ( ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; if ( s1 . compareTo ( s2 ) < 0 ) System . out . println ( " < " ) ; else if ( s1 . compareTo ( s2 ) == 0 ) System . out . println ( " = " ) ; else System . out . println ( " > " ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String X = sc . next ( ) ; String Y = sc . next ( ) ; sc . close ( ) ; if ( X . equals ( Y ) ) { System . out . println ( " = " ) ; } else if ( X . compareTo ( Y ) < 0 ) { System . out . println ( " < " ) ; } else { System . out . println ( " > " ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; String y = sc . next ( ) ; byte [ ] x_byte = x . getBytes ( ) ; byte [ ] y_byte = y . getBytes ( ) ; if ( x_byte [ 0 ] > y_byte [ 0 ] ) { System . out . println ( " > " ) ; } else if ( x_byte [ 0 ] < y_byte [ 0 ] ) { System . out . println ( " < " ) ; } else { System . out . println ( " = " ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; char X = sc . next ( ) . charAt ( 0 ) ; char Y = sc . next ( ) . charAt ( 0 ) ; int num = X - Y ; System . out . println ( num < 0 ? " < " : ( num > 0 ) ? " > " : " = " ) ; } }

a , b = input ( ) . split ( ) NEW_LINE if a == b : NEW_LINE INDENT print ( " = " ) NEW_LINE DEDENT elif a < b : NEW_LINE INDENT print ( " < " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " > " ) NEW_LINE DEDENT

arr = { ' A ' : 0 , ' B ' : 1 , ' C ' : 2 , ' D ' : 3 , ' E ' : 4 , ' F ' : 5 } NEW_LINE x , y = map ( str , input ( ) . split ( ) ) NEW_LINE if arr [ x ] > arr [ y ] : NEW_LINE INDENT print ( ' > ' ) NEW_LINE DEDENT elif arr [ x ] < arr [ y ] : NEW_LINE INDENT print ( ' < ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' = ' ) NEW_LINE DEDENT

X , Y = input ( ) . split ( ) NEW_LINE print ( " = < > " [ ( X < Y ) + 2 * ( Y < X ) ] ) NEW_LINE

a , b = [ item for item in input ( ) . split ( ) ] NEW_LINE if a < b : NEW_LINE INDENT print ( " < " ) NEW_LINE DEDENT elif a > b : NEW_LINE INDENT print ( " > " ) NEW_LINE DEDENT elif a == b : NEW_LINE INDENT print ( " = " ) NEW_LINE DEDENT else : NEW_LINE INDENT pass NEW_LINE DEDENT

x , y = input ( ) . split ( ) ; print ( " = " if x == y else " < > " [ x > y : : 2 ] ) NEW_LINE


import java . util . Scanner ; public class Main { private static final long FIRST_SLICE_IS_BUN = 1 ; private static final long MIDDLE_PATTY = 1 ; public static long process ( TestCase testCase ) { final int N = testCase . N ; final long X = testCase . X ; return countNumPatty ( N , X ) ; } private static long countNumPatty ( int N , long X ) { if ( X == 0 ) { return 0L ; } final long burgerLength = burgerLength ( N ) ; boolean isWholeBurgerEaten = X >= burgerLength ; if ( isWholeBurgerEaten ) { return numPatty ( N ) ; } else { boolean isOnlyTopSliceRemaining = X == burgerLength - 1 ; final long oneSmallerLayerLength = burgerLength ( N - 1 ) ; final long oneSmallerLayerPatty = numPatty ( N - 1 ) ; if ( isOnlyTopSliceRemaining ) { return numPatty ( N ) ; } else { boolean canFinishHalfBurger = X >= ( burgerLength - FIRST_SLICE_IS_BUN - oneSmallerLayerLength ) ; if ( canFinishHalfBurger ) { return oneSmallerLayerPatty + MIDDLE_PATTY + countNumPatty ( N - 1 , X - FIRST_SLICE_IS_BUN - oneSmallerLayerLength - MIDDLE_PATTY ) ; } else { boolean canFinishOneSmallerLayer = ( X - FIRST_SLICE_IS_BUN ) >= ( FIRST_SLICE_IS_BUN + oneSmallerLayerLength ) ; if ( canFinishOneSmallerLayer ) { return oneSmallerLayerPatty ; } else { boolean canEatSomePatty = X > FIRST_SLICE_IS_BUN ; if ( canEatSomePatty ) { return countNumPatty ( N - 1 , X - FIRST_SLICE_IS_BUN ) ; } else { return 0L ; } } } } } } private static long burgerLength ( int layer ) { return ( long ) Math . pow ( 2 , layer + 2 ) - 3L ; } private static long numPatty ( int layer ) { return ( long ) Math . pow ( 2 , layer + 1 ) - 1L ; } public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final long result = process ( testCase ) ; output ( result ) ; } private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long X = sc . nextLong ( ) ; sc . close ( ) ; return new TestCase ( N , X ) ; } private static void output ( long result ) { System . out . println ( result ) ; } public static class TestCase { final int N ; final long X ; public TestCase ( int N , long X ) { this . N = N ; this . X = X ; } } }

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 ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ 51 ] ; a [ 0 ] = 1 ; long [ ] p = new long [ 51 ] ; p [ 0 ] = 1 ; for ( int i = 0 ; i < 50 ; i ++ ) { a [ i + 1 ] = 2 * a [ i ] + 3 ; p [ i + 1 ] = 2 * p [ i ] + 1 ; } out . println ( f ( a , p , n , x ) ) ; } static long f ( long [ ] a , long [ ] p , int n , long x ) { if ( x == 1 ) return n > 0 ? 0 : 1 ; if ( x == 3 + 2 * a [ n - 1 ] ) return p [ n - 1 ] * 2 + 1 ; if ( x == a [ n - 1 ] + 2 ) return p [ n - 1 ] + 1 ; if ( 1 < x && x <= a [ n - 1 ] + 1 ) return f ( a , p , n - 1 , x - 1 ) ; return p [ n - 1 ] + 1 + f ( a , p , n - 1 , x - a [ n - 1 ] - 2 ) ; } }

import java . util . * ; public class Main { static class Burger { public static long getNumPatties ( int level ) { return pow ( 2 , level + 1 ) - 1 ; } public static long getHeight ( int level ) { return pow ( 2 , level + 2 ) - 3 ; } static long pow ( int a , int b ) { long product = 1 ; while ( b > 0 ) { product *= a ; b -- ; } return product ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long X = sc . nextLong ( ) ; System . out . println ( countPatties ( N , X ) ) ; } public static long countPatties ( int level , long x ) { if ( x == 0 ) { return 0 ; } else if ( level == 0 ) { return 1 ; } else if ( x >= Burger . getHeight ( level ) - level ) { return Burger . getNumPatties ( level ) ; } if ( x < Burger . getHeight ( level - 1 ) + 2 ) { return countPatties ( level - 1 , x - 1 ) ; } else { return Burger . getNumPatties ( level - 1 ) + 1 + countPatties ( level - 1 , x - Burger . getHeight ( level - 1 ) - 2 ) ; } } }

import java . util . * ; import java . io . * ; public class Main { private static void solve ( ) { int n = nextInt ( ) ; long x = nextLong ( ) ; long [ ] l = new long [ n + 1 ] ; long [ ] p = new long [ n + 1 ] ; l [ 0 ] = 1 ; p [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { l [ i ] = 2 * l [ i - 1 ] + 3 ; p [ i ] = 2 * p [ i - 1 ] + 1 ; } System . out . println ( get ( n , x , l , p ) ) ; } private static long get ( int n , long x , long [ ] l , long [ ] p ) { if ( n == 0 ) { return 1 ; } if ( x == 1 ) { return 0 ; } x -- ; if ( x <= l [ n - 1 ] ) { return get ( n - 1 , x , l , p ) ; } x -= l [ n - 1 ] ; if ( x == 1 ) { return p [ n - 1 ] + 1 ; } x -- ; if ( x == l [ n - 1 ] + 1 ) { x -- ; } return p [ n - 1 ] + 1 + get ( n - 1 , x , l , p ) ; } private static void run ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } private static StringTokenizer st ; private static BufferedReader br ; private static PrintWriter out ; private static String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { String s ; try { s = br . readLine ( ) ; } catch ( IOException e ) { return null ; } st = new StringTokenizer ( s ) ; } return st . nextToken ( ) ; } private static int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } private static long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public static void main ( String [ ] args ) { run ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int N = scanner . nextInt ( ) ; long X = scanner . nextLong ( ) ; long [ ] as = new long [ N ] ; long [ ] ps = new long [ N ] ; as [ 0 ] = 1 ; ps [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { as [ i ] = as [ i - 1 ] * 2 + 3 ; ps [ i ] = ps [ i - 1 ] * 2 + 1 ; } System . out . println ( f ( N , X , as , ps ) ) ; } } static long f ( int n , long x , long [ ] a , long [ ] p ) { if ( n == 0 ) { return x > 0 ? 1 : 0 ; } long anp = a [ n - 1 ] ; long pnp = p [ n - 1 ] ; if ( x <= anp + 1 ) { return f ( n - 1 , x - 1 , a , p ) ; } if ( x == x + anp ) { return pnp ; } if ( x <= 2 * anp + 2 ) { return pnp + 1 + f ( n - 1 , x - anp - 2 , a , p ) ; } return 2 * pnp + 1 ; } static class Pair { final int kind ; final long point ; Pair ( int kind , long point ) { this . kind = kind ; this . point = point ; } } }

import sys NEW_LINE input = sys . stdin . readline NEW_LINE N , X = map ( int , input ( ) . split ( ) ) NEW_LINE b = [ 2 ** ( i + 2 ) - 3 for i in range ( N ) ] NEW_LINE p = [ 2 ** ( i + 1 ) - 1 for i in range ( N ) ] NEW_LINE def f ( N , X ) : NEW_LINE INDENT if N == 0 : NEW_LINE INDENT return 0 if X <= 0 else 1 NEW_LINE DEDENT elif X <= 1 + b [ N - 1 ] : NEW_LINE INDENT return f ( N - 1 , X - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT return p [ N - 1 ] + 1 + f ( N - 1 , X - 2 - b [ N - 1 ] ) NEW_LINE DEDENT DEDENT print ( f ( N , X ) ) NEW_LINE

ans = 0 NEW_LINE def count_ans ( level , index , len_dic , p_dic ) : NEW_LINE INDENT global ans NEW_LINE if level == 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT if index == 0 : NEW_LINE INDENT pass NEW_LINE DEDENT elif index == len_dic [ level ] // 2 : NEW_LINE INDENT ans += 1 NEW_LINE ans += p_dic [ level - 1 ] NEW_LINE DEDENT elif index == len_dic [ level ] - 1 : NEW_LINE INDENT ans += p_dic [ level ] NEW_LINE DEDENT elif index > len_dic [ level ] // 2 : NEW_LINE INDENT ans += p_dic [ level - 1 ] + 1 NEW_LINE index_next = index - len_dic [ level - 1 ] - 2 NEW_LINE count_ans ( level - 1 , index_next , len_dic , p_dic ) NEW_LINE DEDENT else : NEW_LINE INDENT index_next = index - 1 NEW_LINE count_ans ( level - 1 , index_next , len_dic , p_dic ) NEW_LINE DEDENT DEDENT DEDENT def get_len_dic ( level ) : NEW_LINE INDENT len_dic = [ 1 ] NEW_LINE for i in range ( level ) : NEW_LINE INDENT len_dic . append ( len_dic [ - 1 ] * 2 + 3 ) NEW_LINE DEDENT return len_dic NEW_LINE DEDENT def get_p_dic ( level ) : NEW_LINE INDENT p_dic = [ 1 ] NEW_LINE for i in range ( level ) : NEW_LINE INDENT p_dic . append ( p_dic [ - 1 ] * 2 + 1 ) NEW_LINE DEDENT return p_dic NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT global ans NEW_LINE level , eat_num = map ( int , input ( ) . split ( ) ) NEW_LINE len_dic = get_len_dic ( level ) NEW_LINE p_dic = get_p_dic ( level ) NEW_LINE count_ans ( level , eat_num - 1 , len_dic , p_dic ) NEW_LINE print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

nums = [ 0 ] * 51 NEW_LINE ps = [ 0 ] * 51 NEW_LINE def calc ( l , x ) : NEW_LINE INDENT global nums , ps NEW_LINE if l == 0 : NEW_LINE INDENT if x == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT else : NEW_LINE INDENT return 1 NEW_LINE DEDENT DEDENT if x == 1 : NEW_LINE INDENT return 0 NEW_LINE DEDENT elif x <= 1 + nums [ l - 1 ] : NEW_LINE INDENT return calc ( l - 1 , x - 1 ) NEW_LINE DEDENT elif x == 2 + nums [ l - 1 ] : NEW_LINE INDENT return ps [ l - 1 ] + 1 NEW_LINE DEDENT elif x <= 2 + 2 * nums [ l - 1 ] : NEW_LINE INDENT return ps [ l - 1 ] + 1 + calc ( l - 1 , x - 2 - nums [ l - 1 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT return ps [ l ] NEW_LINE DEDENT DEDENT def main ( ) : NEW_LINE INDENT global nums , ps NEW_LINE nums [ 0 ] = 1 NEW_LINE ps [ 0 ] = 1 NEW_LINE for i in range ( len ( nums ) ) : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT nums [ i ] = 2 * nums [ i - 1 ] + 3 NEW_LINE ps [ i ] = 2 * ps [ i - 1 ] + 1 NEW_LINE DEDENT n , x = map ( int , input ( ) . split ( ) ) NEW_LINE print ( calc ( n , x ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

burger = [ 1 for i in range ( 52 ) ] NEW_LINE for i in range ( 1 , 52 ) : NEW_LINE INDENT burger [ i ] = burger [ i - 1 ] * 2 + 3 NEW_LINE DEDENT patty = [ 1 for i in range ( 52 ) ] NEW_LINE for i in range ( 1 , 52 ) : NEW_LINE INDENT patty [ i ] = patty [ i - 1 ] * 2 + 1 NEW_LINE DEDENT def solve ( L , X ) : NEW_LINE INDENT if X == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT if burger [ L ] == X : NEW_LINE INDENT return patty [ L ] NEW_LINE DEDENT elif ( burger [ L ] - 1 ) // 2 + 1 == X : NEW_LINE INDENT return patty [ L - 1 ] + 1 NEW_LINE DEDENT elif ( burger [ L ] - 1 ) // 2 + 1 > X : NEW_LINE INDENT return solve ( L - 1 , X - 1 ) NEW_LINE DEDENT elif ( burger [ L ] - 1 ) // 2 + 1 < X : NEW_LINE INDENT return patty [ L - 1 ] + 1 + solve ( L - 1 , X - burger [ L - 1 ] - 2 ) NEW_LINE DEDENT DEDENT N , X = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( solve ( N , X ) ) NEW_LINE

N , X = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE layers = { 0 : 1 } NEW_LINE def layers_of_level ( n ) : NEW_LINE INDENT if n in layers : NEW_LINE INDENT return layers [ n ] NEW_LINE DEDENT layers [ n ] = 2 * layers_of_level ( n - 1 ) + 3 NEW_LINE return layers [ n ] NEW_LINE DEDENT def how_many_putty ( n , x ) : NEW_LINE INDENT if n == 0 and x == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT if n == layers_of_level ( n ) : NEW_LINE INDENT return 2 ** ( n + 1 ) - 1 NEW_LINE DEDENT total_layers = layers_of_level ( n ) NEW_LINE if x == 1 : NEW_LINE INDENT return 0 NEW_LINE DEDENT if x <= 1 + layers_of_level ( n - 1 ) : NEW_LINE INDENT return how_many_putty ( n - 1 , x - 1 ) NEW_LINE DEDENT if x == 1 + layers_of_level ( n - 1 ) + 1 : NEW_LINE INDENT return how_many_putty ( n - 1 , x - 2 ) + 1 NEW_LINE DEDENT if x <= 1 + 2 * layers_of_level ( n - 1 ) + 1 : NEW_LINE INDENT return how_many_putty ( n - 1 , layers_of_level ( n - 1 ) ) + 1 + how_many_putty ( n - 1 , x - layers_of_level ( n - 1 ) - 2 ) NEW_LINE DEDENT else : NEW_LINE INDENT return 2 * how_many_putty ( n - 1 , layers_of_level ( n - 1 ) ) + 1 NEW_LINE DEDENT DEDENT print ( how_many_putty ( N , X ) ) 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 M = sc . nextInt ( ) ; ArrayList < Integer > odd = new ArrayList < > ( ) ; ArrayList < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int A = sc . nextInt ( ) ; if ( A % 2 == 0 ) even . add ( A ) ; else odd . add ( A ) ; } if ( odd . size ( ) > 2 ) { System . out . println ( " Impossible " ) ; } else { ArrayList < Integer > list = new ArrayList < > ( ) ; if ( odd . size ( ) > 0 ) list . add ( odd . get ( 0 ) ) ; list . addAll ( even ) ; if ( odd . size ( ) > 1 ) list . add ( odd . get ( 1 ) ) ; printList ( list ) ; if ( list . size ( ) == 1 ) { if ( list . get ( 0 ) > 1 ) { list . set ( 0 , list . get ( 0 ) - 1 ) ; list . add ( 1 ) ; } } else { list . set ( 0 , list . get ( 0 ) - 1 ) ; list . set ( list . size ( ) - 1 , list . get ( list . size ( ) - 1 ) - 1 ) ; list . add ( 1 , 2 ) ; if ( list . get ( 0 ) == 0 ) list . remove ( 0 ) ; if ( list . get ( list . size ( ) - 1 ) == 0 ) list . remove ( list . size ( ) - 1 ) ; } System . out . println ( list . size ( ) ) ; printList ( list ) ; } sc . close ( ) ; } static void printList ( ArrayList < Integer > list ) { for ( int i = 0 ; i < list . size ( ) ; i ++ ) System . out . print ( list . get ( i ) + ( i == list . size ( ) - 1 ? " \n " : " ▁ " ) ) ; } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; List < Integer > odd = new ArrayList < > ( ) ; List < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; ++ i ) { int a = scan . nextInt ( ) ; if ( a % 2 == 0 ) even . add ( a ) ; else odd . add ( a ) ; } if ( odd . size ( ) > 2 ) { System . out . println ( " Impossible " ) ; return ; } List < Integer > ans = new ArrayList < > ( ) ; if ( odd . size ( ) >= 1 ) { int d = odd . remove ( 0 ) ; System . out . print ( d + " ▁ " ) ; while ( d > 1 ) { ans . add ( 2 ) ; d -= 2 ; } } else { int d = even . remove ( 0 ) ; System . out . print ( d + " ▁ " ) ; ans . add ( d - 1 ) ; } for ( int i = 0 ; i < even . size ( ) ; ++ i ) { ans . add ( even . get ( i ) ) ; System . out . print ( even . get ( i ) + " ▁ " ) ; } if ( odd . size ( ) >= 1 ) { int d = odd . remove ( 0 ) ; System . out . print ( d + " ▁ " ) ; while ( d > 0 ) { ans . add ( 2 ) ; d -= 2 ; } } else { ans . add ( 1 ) ; } System . out . println ( ) ; System . out . println ( ans . size ( ) ) ; for ( int i : ans ) System . out . print ( i + " ▁ " ) ; System . out . println ( ) ; } }

n , m = map ( int , input ( ) . split ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if m == 1 and ali [ 0 ] == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE print ( 1 ) NEW_LINE print ( 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT if m == 1 : NEW_LINE INDENT print ( ali [ 0 ] ) NEW_LINE print ( 2 ) NEW_LINE print ( ali [ 0 ] - 1 , 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT flag = 0 NEW_LINE c = [ ] NEW_LINE for a in ali : NEW_LINE INDENT if a % 2 == 1 : NEW_LINE INDENT if flag == 0 : NEW_LINE INDENT lm = a NEW_LINE flag += 1 NEW_LINE DEDENT elif flag == 1 : NEW_LINE INDENT rm = a NEW_LINE flag += 1 NEW_LINE DEDENT elif flag == 2 : NEW_LINE INDENT print ( ' Impossible ' ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT c . append ( a ) NEW_LINE DEDENT DEDENT if flag == 0 : NEW_LINE INDENT lm = c [ 0 ] NEW_LINE del c [ 0 ] NEW_LINE rm = c . pop ( ) NEW_LINE DEDENT if flag == 1 : NEW_LINE INDENT rm = c . pop ( ) NEW_LINE DEDENT b = [ lm + 1 ] + c NEW_LINE d = [ lm ] + c + [ rm ] NEW_LINE if rm > 1 : NEW_LINE INDENT b . append ( rm - 1 ) NEW_LINE DEDENT print ( " ▁ " . join ( map ( str , d ) ) ) NEW_LINE print ( len ( b ) ) NEW_LINE print ( " ▁ " . join ( map ( str , b ) ) ) NEW_LINE

S , N = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE O = [ a for a in A if a % 2 == 1 ] NEW_LINE E = [ a for a in A if a % 2 == 0 ] NEW_LINE if len ( O ) > 2 : NEW_LINE INDENT print ( " Impossible " ) NEW_LINE DEDENT else : NEW_LINE INDENT A = O [ : min ( len ( O ) , 1 ) ] + E + O [ 1 : ] NEW_LINE B = A [ : ] + ( [ 0 ] if N == 1 else [ ] ) NEW_LINE B [ 0 ] -= 1 NEW_LINE B [ - 1 ] += 1 NEW_LINE if B [ 0 ] == 0 : NEW_LINE INDENT B = B [ 1 : ] NEW_LINE DEDENT print ( * A , sep = " ▁ " ) NEW_LINE print ( len ( B ) ) NEW_LINE print ( * B , sep = " ▁ " ) NEW_LINE DEDENT

S , N = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE O = [ a for a in A if a % 2 == 1 ] NEW_LINE E = [ a for a in A if a % 2 == 0 ] NEW_LINE if len ( O ) > 2 : NEW_LINE INDENT print ( " Impossible " ) NEW_LINE DEDENT else : NEW_LINE INDENT A = O [ : min ( len ( O ) , 1 ) ] + E + O [ min ( 1 , len ( O ) ) : ] NEW_LINE B = A [ : ] + ( [ 0 ] if len ( A ) == 1 else [ ] ) NEW_LINE B [ 0 ] -= 1 NEW_LINE B [ - 1 ] += 1 NEW_LINE if B [ 0 ] == 0 : NEW_LINE INDENT B = B [ 1 : ] NEW_LINE DEDENT print ( " ▁ " . join ( str ( a ) for a in A ) ) NEW_LINE print ( len ( B ) ) NEW_LINE print ( " ▁ " . join ( str ( b ) for b in B ) ) NEW_LINE DEDENT

def solve ( n , m , a ) : NEW_LINE INDENT odd = [ ] NEW_LINE even = [ ] NEW_LINE for a_i in a : NEW_LINE INDENT if a_i % 2 == 0 : NEW_LINE INDENT even += [ a_i ] NEW_LINE DEDENT else : NEW_LINE INDENT odd += [ a_i ] NEW_LINE DEDENT DEDENT if len ( odd ) >= 3 : NEW_LINE INDENT return None NEW_LINE DEDENT a , b = [ ] , [ ] NEW_LINE if odd : NEW_LINE INDENT x = odd . pop ( ) NEW_LINE a += [ x ] NEW_LINE b += [ x - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT x = even . pop ( ) NEW_LINE a += [ x ] NEW_LINE b += [ x - 1 ] NEW_LINE DEDENT a += even NEW_LINE b += even NEW_LINE if odd : NEW_LINE INDENT x = odd . pop ( ) NEW_LINE a += [ x ] NEW_LINE b += [ x + 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT b += [ 1 ] NEW_LINE DEDENT return a , b NEW_LINE DEDENT n , m = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE it = solve ( n , m , a ) NEW_LINE if it is None : NEW_LINE INDENT print ( ' Impossible ' ) NEW_LINE DEDENT else : NEW_LINE INDENT a , b = it NEW_LINE b = list ( filter ( lambda b_i : b_i , b ) ) NEW_LINE print ( * a ) NEW_LINE print ( len ( b ) ) NEW_LINE print ( * b ) NEW_LINE DEDENT


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 ( ) ; int ans = Integer . MAX_VALUE ; int s1 = n / 6 , s2 = n / 9 ; int [ ] TS = new int [ n + 1 ] ; int [ ] TN = new int [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { int temp = i ; while ( temp / 6 > 0 ) { TS [ i ] += temp % 6 ; temp /= 6 ; } TS [ i ] += temp ; temp = i ; while ( temp / 9 > 0 ) { TN [ i ] += temp % 9 ; temp /= 9 ; } TN [ i ] += temp ; } for ( int i = 0 ; i <= s1 ; i ++ ) { int six = 6 * i ; int nine = ( n - six ) - ( n - six ) % 9 ; if ( six + nine <= n && six <= n && nine <= n ) ans = min ( ans , TS [ six ] + TN [ nine ] + ( n - six - nine ) ) ; } out . println ( ans ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = n ; for ( int i = 0 ; i <= n ; i ++ ) { int t = i ; int c = 0 ; while ( t > 0 ) { c += t % 6 ; t /= 6 ; } t = n - i ; while ( t > 0 ) { c += t % 9 ; t /= 9 ; } count = Math . min ( count , c ) ; } System . out . println ( count ) ; } }

import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < Integer > candidates = new TreeSet < > ( ) ; long tmp = 1 ; while ( tmp <= N ) { candidates . add ( ( int ) tmp ) ; tmp *= 6 ; } tmp = 1 ; while ( tmp <= N ) { candidates . add ( ( int ) tmp ) ; tmp *= 9 ; } int INF = 1_000_000 ; int dp [ ] = new int [ N + 1 ] ; Arrays . fill ( dp , INF ) ; dp [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int n : candidates ) { if ( i >= n ) { dp [ i ] = Math . min ( dp [ i ] , dp [ i - n ] + 1 ) ; } } } out . println ( dp [ N ] ) ; } }

import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int [ ] dp = new int [ 0 ] ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; dp = new int [ N + 1 ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; calc ( N ) ; System . out . println ( dp [ N ] ) ; } private static void calc ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int power = 1 ; int ans = Integer . MAX_VALUE ; while ( 0 <= i - power ) { ans = Math . min ( ans , 1 + dp [ i - power ] ) ; power *= 6 ; } power = 1 ; while ( 0 <= i - power ) { ans = Math . min ( ans , 1 + dp [ i - power ] ) ; power *= 9 ; } dp [ i ] = ans ; } } }

import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final int INF = Integer . MAX_VALUE ; Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; ArrayList < Integer > coins = new ArrayList < Integer > ( ) ; coins . add ( 1 ) ; for ( int i = 1 ; ; i ++ ) { int buf = ( int ) Math . pow ( 6 , i ) ; if ( buf > N ) break ; coins . add ( buf ) ; } for ( int i = 1 ; ; i ++ ) { int buf = ( int ) Math . pow ( 9 , i ) ; if ( buf > N ) break ; coins . add ( buf ) ; } int [ ] DP = new int [ N + 1 ] ; DP [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { DP [ i ] = INF ; } int length = coins . size ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 0 ; j < length ; j ++ ) { int coin = coins . get ( j ) ; if ( i >= coin ) { DP [ i ] = Math . min ( DP [ i ] , DP [ i - coin ] + 1 ) ; } } } System . out . println ( DP [ N ] ) ; } }

N = int ( input ( ) ) NEW_LINE dp = [ 0 for i in range ( N + 1 ) ] NEW_LINE dp [ 1 ] = 1 NEW_LINE kazu = [ 1 ] NEW_LINE i = 6 NEW_LINE while i <= N : NEW_LINE INDENT kazu . append ( i ) NEW_LINE i *= 6 NEW_LINE DEDENT i = 9 NEW_LINE while i <= N : NEW_LINE INDENT kazu . append ( i ) NEW_LINE i *= 9 NEW_LINE DEDENT kazu . sort ( ) NEW_LINE kazulazor = len ( kazu ) NEW_LINE temp = [ 1 ] NEW_LINE lentemp = 1 NEW_LINE index = 1 NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT kouho = [ ] NEW_LINE if index < kazulazor and i == kazu [ index ] : NEW_LINE INDENT temp . append ( i ) NEW_LINE index += 1 NEW_LINE lentemp += 1 NEW_LINE DEDENT for j in range ( lentemp ) : NEW_LINE INDENT kouho . append ( dp [ i - temp [ j ] ] + 1 ) NEW_LINE DEDENT dp [ i ] = min ( kouho ) NEW_LINE DEDENT print ( str ( dp [ N ] ) ) NEW_LINE

import bisect NEW_LINE six_list = [ 6 ** i for i in range ( 7 ) ] NEW_LINE nine_list = [ 9 ** i for i in range ( 6 ) ] NEW_LINE from functools import lru_cache NEW_LINE @ lru_cache ( maxsize = 1000 ) NEW_LINE def six_nine ( n ) : NEW_LINE INDENT if n < 6 : NEW_LINE INDENT return n NEW_LINE DEDENT else : NEW_LINE INDENT six = six_list [ bisect . bisect_right ( six_list , n ) - 1 ] NEW_LINE nine = nine_list [ bisect . bisect_right ( nine_list , n ) - 1 ] NEW_LINE return min ( n // six + six_nine ( n % six ) , 1 + six_nine ( n - nine ) ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT x = int ( input ( ) ) NEW_LINE print ( six_nine ( x ) ) NEW_LINE DEDENT

from collections import Counter NEW_LINE from functools import reduce NEW_LINE import fractions NEW_LINE import math NEW_LINE import statistics NEW_LINE import sys NEW_LINE import time NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LF ( ) : return [ float ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def MI ( ) : return map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE def II ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def IS ( ) : return input ( ) NEW_LINE def P ( x ) : return print ( x ) NEW_LINE def C ( x ) : return Counter ( x ) NEW_LINE def GCD_LIST ( numbers ) : NEW_LINE INDENT return reduce ( fractions . gcd , numbers ) NEW_LINE DEDENT def LCM_LIST ( numbers ) : NEW_LINE INDENT return reduce ( LCM , numbers ) NEW_LINE DEDENT def LCM ( m , n ) : NEW_LINE INDENT return ( m * n // fractions . gcd ( m , n ) ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE dp = [ INF ] * 100001 NEW_LINE dp [ 0 ] , dp [ 1 ] = 0 , 1 NEW_LINE L = [ 1 , 6 , 36 , 216 , 1296 , 7776 , 46656 , 9 , 81 , 729 , 6561 , 59049 ] NEW_LINE for i in range ( 2 , 100001 ) : NEW_LINE INDENT for j in range ( len ( L ) ) : NEW_LINE INDENT if i - L [ j ] >= 0 : NEW_LINE INDENT dp [ i ] = min ( dp [ i - L [ j ] ] + 1 , dp [ i ] ) NEW_LINE DEDENT DEDENT DEDENT print ( dp [ N ] ) NEW_LINE

import sys NEW_LINE sys . setrecursionlimit ( 1000000 ) NEW_LINE N = int ( input ( ) ) NEW_LINE dp = [ 0 ] * ( N + 1 ) NEW_LINE def fun ( n ) : NEW_LINE INDENT if n == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT elif dp [ n ] != 0 : NEW_LINE INDENT return dp [ n ] NEW_LINE DEDENT ans = N NEW_LINE for i in [ 6 ** k for k in range ( 7 ) ] : NEW_LINE INDENT if i <= n : NEW_LINE INDENT ans = min ( ans , fun ( n - i ) + 1 ) NEW_LINE DEDENT DEDENT for j in [ 9 ** l for l in range ( 6 ) ] : NEW_LINE INDENT if j <= n : NEW_LINE INDENT ans = min ( ans , fun ( n - j ) + 1 ) NEW_LINE DEDENT DEDENT dp [ n ] = ans NEW_LINE return dp [ n ] NEW_LINE DEDENT fun ( N ) NEW_LINE print ( dp [ - 1 ] ) NEW_LINE

import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE N = int ( stdin . readline ( ) ) NEW_LINE large = float ( ' inf ' ) NEW_LINE memo = { } NEW_LINE def cal_count ( total ) : NEW_LINE INDENT global memo NEW_LINE if total in memo : return memo [ total ] NEW_LINE if total < 0 : return large NEW_LINE if total == 0 : return 0 NEW_LINE cans = [ ] NEW_LINE for i in range ( 1 , 8 ) : NEW_LINE INDENT if 6 ** i > total : break NEW_LINE cans . append ( cal_count ( total - 9 ** i ) ) NEW_LINE cans . append ( cal_count ( total - 6 ** i ) ) NEW_LINE DEDENT cans . append ( cal_count ( total - 1 ) ) NEW_LINE res = min ( cans ) + 1 NEW_LINE memo [ total ] = res NEW_LINE return res NEW_LINE DEDENT cnt = cal_count ( N ) NEW_LINE print ( cnt ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ; class Problem { private int N ; Problem ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; } void solve ( ) { int n = N % 2 == 1 ? N : N + 1 ; int M = N % 2 == 1 ? ( N - 1 ) / 2 : N / 2 ; ArrayList < String > edges = new ArrayList < > ( ) ; for ( int i = 1 ; i < M ; i ++ ) { edges . add ( i + " ▁ " + ( i + 1 ) ) ; edges . add ( i + " ▁ " + ( n - ( i + 1 ) ) ) ; edges . add ( ( i + 1 ) + " ▁ " + ( n - i ) ) ; edges . add ( ( n - ( i + 1 ) ) + " ▁ " + ( n - i ) ) ; } if ( N % 2 == 0 && M > 2 ) { edges . add ( 1 + " ▁ " + M ) ; edges . add ( 1 + " ▁ " + ( M + 1 ) ) ; edges . add ( M + " ▁ " + ( n - 1 ) ) ; edges . add ( ( M + 1 ) + " ▁ " + ( n - 1 ) ) ; } else if ( N % 2 == 1 ) { edges . add ( 1 + " ▁ " + N ) ; edges . add ( ( n - 1 ) + " ▁ " + N ) ; if ( M > 1 ) { edges . add ( M + " ▁ " + N ) ; edges . add ( ( M + 1 ) + " ▁ " + N ) ; } } System . out . println ( edges . size ( ) ) ; for ( String e : edges ) { System . out . println ( e ) ; } } } public class Main { public static void main ( String [ ] args ) { new Problem ( ) . solve ( ) ; } }

import java . util . * ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 4 ) { System . out . println ( 4 ) ; System . out . println ( 1 + " ▁ " + 2 ) ; System . out . println ( 1 + " ▁ " + 3 ) ; System . out . println ( 4 + " ▁ " + 2 ) ; System . out . println ( 4 + " ▁ " + 3 ) ; return ; } else if ( n == 3 ) { System . out . println ( 2 ) ; System . out . println ( 3 + " ▁ " + 1 ) ; System . out . println ( 3 + " ▁ " + 2 ) ; return ; } ArrayList < ArrayList < Integer > > ans = new ArrayList < > ( ) ; if ( n % 2 == 1 ) { ArrayList < Integer > a = new ArrayList < > ( ) ; a . add ( n ) ; ans . add ( a ) ; n -- ; } for ( int i = 1 ; i <= n / 2 ; i ++ ) { ArrayList < Integer > a = new ArrayList < > ( ) ; a . add ( i ) ; a . add ( n - i + 1 ) ; ans . add ( a ) ; } int len = ans . size ( ) ; int m = 0 ; for ( int i = 0 ; i < len ; i ++ ) { m += ans . get ( i ) . size ( ) * ans . get ( ( i + 1 ) % len ) . size ( ) ; } System . out . println ( m ) ; for ( int i = 0 ; i < len ; i ++ ) { for ( int j : ans . get ( i ) ) for ( int k : ans . get ( ( i + 1 ) % len ) ) { System . out . println ( j + " ▁ " + k ) ; } } } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 ; int [ ] [ ] ans ; if ( n % 2 == 0 ) { m = ( n - 2 ) * n / 2 ; ans = new int [ m ] [ 2 ] ; int c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( i + j == n + 1 ) continue ; ans [ c ] [ 0 ] = i ; ans [ c ] [ 1 ] = j ; c ++ ; } } } else { int n2 = n - 1 ; m = ( n2 - 2 ) * n2 / 2 + n2 ; ans = new int [ m ] [ 2 ] ; int c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( i + j == n ) continue ; ans [ c ] [ 0 ] = i ; ans [ c ] [ 1 ] = j ; c ++ ; } } } System . out . println ( m ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( ans [ i ] [ 0 ] + " ▁ " + ans [ i ] [ 1 ] ) ; } sc . close ( ) ; } }

import java . util . * ; public class Main { int N ; List < Set < Integer > > groups = new ArrayList < > ( ) ; Main ( ) { Scanner in = new Scanner ( System . in ) ; N = in . nextInt ( ) ; in . close ( ) ; } void makeGroups ( ) { if ( N % 2 == 0 ) { for ( int i = 0 ; i < N / 2 ; ++ i ) { Set < Integer > set = new HashSet < > ( ) ; set . add ( i + 1 ) ; set . add ( N - i ) ; this . groups . add ( set ) ; } } else { for ( int i = 0 ; i < N / 2 ; ++ i ) { Set < Integer > set = new HashSet < > ( ) ; set . add ( i + 1 ) ; set . add ( N - i - 1 ) ; this . groups . add ( set ) ; } Set < Integer > s = new HashSet < > ( ) ; s . add ( N ) ; this . groups . add ( s ) ; } } void show ( ) { List < String > results = new ArrayList < > ( ) ; for ( int i = 0 ; i < this . groups . size ( ) ; ++ i ) { Set < Integer > grA = this . groups . get ( i ) ; for ( int j = i + 1 ; j < this . groups . size ( ) ; ++ j ) { Set < Integer > grB = this . groups . get ( j ) ; for ( Integer a : grA ) { for ( Integer b : grB ) { results . add ( a + " ▁ " + b ) ; } } } } System . out . println ( results . size ( ) ) ; for ( String line : results ) { System . out . println ( line ) ; } } public static void main ( String [ ] args ) { Main ins = new Main ( ) ; ins . makeGroups ( ) ; ins . show ( ) ; } }

import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * ( num - 1 ) / 2 - num / 2 ) ; for ( int i = 1 ; i <= num ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { if ( i + j == num / 2 * 2 + 1 ) { continue ; } System . out . println ( i + " ▁ " + j ) ; } } } }

n = int ( input ( ) ) ; print ( * [ ( n - 1 ) ** 2 // 2 ] + [ ' % d ▁ % d ' % ( i , j ) * ( j > i != n - j + 1 - n % 2 ) for i in range ( 1 , n ) for j in range ( n + 1 ) ] ) NEW_LINE

import sys NEW_LINE def input ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE def list2d ( a , b , c ) : return [ [ c ] * b for i in range ( a ) ] NEW_LINE def list3d ( a , b , c , d ) : return [ [ [ d ] * c for j in range ( b ) ] for i in range ( a ) ] NEW_LINE def ceil ( x , y = 1 ) : return int ( - ( - x // y ) ) NEW_LINE def INT ( ) : return int ( input ( ) ) NEW_LINE def MAP ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE def Yes ( ) : print ( ' Yes ' ) NEW_LINE def No ( ) : print ( ' No ' ) NEW_LINE def YES ( ) : print ( ' YES ' ) NEW_LINE def NO ( ) : print ( ' NO ' ) NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE N = INT ( ) NEW_LINE ans = [ ] NEW_LINE if N % 2 == 0 : NEW_LINE INDENT for i in range ( 1 , N + 1 ) : NEW_LINE INDENT for j in range ( i + 1 , N + 1 ) : NEW_LINE INDENT if i + j != N + 1 : NEW_LINE INDENT ans . append ( ( i , j ) ) NEW_LINE DEDENT DEDENT DEDENT DEDENT else : NEW_LINE INDENT for i in range ( 1 , N ) : NEW_LINE INDENT ans . append ( ( i , N ) ) NEW_LINE DEDENT for i in range ( 1 , N ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT if i + j != N : NEW_LINE INDENT ans . append ( ( i , j ) ) NEW_LINE DEDENT DEDENT DEDENT DEDENT print ( len ( ans ) ) NEW_LINE for edge in ans : NEW_LINE INDENT print ( * edge ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE ls = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE import itertools NEW_LINE plist = list ( itertools . combinations ( ls , 2 ) ) NEW_LINE ls = [ ] NEW_LINE cnt = 0 NEW_LINE all_pattern = len ( plist ) NEW_LINE if N % 2 == 0 : NEW_LINE INDENT print ( all_pattern - ( N // 2 ) ) NEW_LINE idx_x = N NEW_LINE DEDENT else : NEW_LINE INDENT print ( all_pattern - ( N - 1 ) // 2 ) NEW_LINE idx_x = N - 1 NEW_LINE DEDENT idx_y = 1 NEW_LINE for p in plist : NEW_LINE INDENT if p [ 0 ] == idx_y and p [ 1 ] == idx_x : NEW_LINE INDENT idx_x = idx_x - 1 NEW_LINE idx_y = idx_y + 1 NEW_LINE DEDENT else : NEW_LINE INDENT print ( p [ 0 ] , p [ 1 ] ) NEW_LINE DEDENT DEDENT

N = int ( input ( ) ) NEW_LINE matrix = [ [ 1 for i in range ( N ) ] for i in range ( N ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT matrix [ i ] [ i ] = 0 NEW_LINE DEDENT if N % 2 == 0 : NEW_LINE INDENT for i in range ( N ) : NEW_LINE INDENT matrix [ i ] [ N - i - 1 ] = 0 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT for i in range ( N - 1 ) : NEW_LINE INDENT matrix [ i ] [ N - i - 2 ] = 0 NEW_LINE DEDENT DEDENT print ( int ( ( N * ( N - 1 ) / 2 ) - int ( N / 2 ) ) ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT if matrix [ i ] [ j ] == 1 : NEW_LINE INDENT print ( i + 1 , j + 1 ) NEW_LINE DEDENT DEDENT DEDENT

n = int ( input ( ) ) NEW_LINE ans = [ ] NEW_LINE if n % 2 == 0 : NEW_LINE INDENT p = [ [ i , n + 1 - i ] for i in range ( 1 , n // 2 + 1 ) ] NEW_LINE for i in range ( len ( p ) ) : NEW_LINE INDENT for x in p [ i ] : NEW_LINE INDENT for j in range ( i + 1 , len ( p ) ) : NEW_LINE INDENT for y in p [ j ] : NEW_LINE INDENT ans . append ( [ x , y ] ) NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT else : NEW_LINE INDENT p = [ [ i , n - i ] for i in range ( 1 , ( n - 1 ) // 2 + 1 ) ] NEW_LINE p . append ( [ n ] ) NEW_LINE for i in range ( len ( p ) ) : NEW_LINE INDENT for x in p [ i ] : NEW_LINE INDENT for j in range ( i + 1 , len ( p ) ) : NEW_LINE INDENT for y in p [ j ] : NEW_LINE INDENT ans . append ( [ x , y ] ) NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT print ( len ( ans ) ) NEW_LINE for edge in ans : NEW_LINE INDENT print ( edge [ 0 ] , edge [ 1 ] ) NEW_LINE DEDENT