import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; char [ ] s = scanner . next ( ) . toCharArray ( ) ; int n = s . length ; long dp [ ] [ ] = new long [ n + 1 ] [ 4 ] ; for ( int i = 0 ; i <= 3 ; i ++ ) { dp [ n ] [ i ] = i == 3 ? 1 : 0 ; } for ( int i = n - 1 ; i >= 0 ; i -- ) { for ( int j = 3 ; j >= 0 ; j -- ) { dp [ i ] [ j ] = dp [ i + 1 ] [ j ] * ( s [ i ] == ' ? ' ? 3L : 1L ) ; if ( j < 3 && ( s [ i ] == ' ? ' || s [ i ] == " ABC " . toCharArray ( ) [ j ] ) ) { dp [ i ] [ j ] += dp [ i + 1 ] [ j + 1 ] ; } dp [ i ] [ j ] %= 1_000_000_007L ; } } System . out . println ( dp [ 0 ] [ 0 ] ) ; } }

import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long [ ] [ ] dp = new long [ S . length ( ) + 1 ] [ 4 ] ; long prime = 1000000007 ; dp [ 0 ] [ 0 ] = 1 ; for ( int i = 1 ; i <= S . length ( ) ; i ++ ) { for ( int j = 0 ; j < 4 ; j ++ ) { dp [ i ] [ j ] = dp [ i - 1 ] [ j ] ; dp [ i ] [ j ] %= prime ; } if ( S . charAt ( i - 1 ) == ' A ' ) { dp [ i ] [ 1 ] += dp [ i - 1 ] [ 0 ] ; dp [ i ] [ 1 ] %= prime ; } else if ( S . charAt ( i - 1 ) == ' B ' ) { dp [ i ] [ 2 ] += dp [ i - 1 ] [ 1 ] ; dp [ i ] [ 2 ] %= prime ; } else if ( S . charAt ( i - 1 ) == ' C ' ) { dp [ i ] [ 3 ] += dp [ i - 1 ] [ 2 ] ; dp [ i ] [ 3 ] %= prime ; } else { for ( int j = 0 ; j < 4 ; j ++ ) { dp [ i ] [ j ] += 2 * dp [ i - 1 ] [ j ] ; dp [ i ] [ j ] %= prime ; } dp [ i ] [ 1 ] += dp [ i - 1 ] [ 0 ] ; dp [ i ] [ 2 ] += dp [ i - 1 ] [ 1 ] ; dp [ i ] [ 3 ] += dp [ i - 1 ] [ 2 ] ; dp [ i ] [ 1 ] %= prime ; dp [ i ] [ 2 ] %= prime ; dp [ i ] [ 3 ] %= prime ; } } out . println ( dp [ S . length ( ) ] [ 3 ] ) ; } }

import java . util . * ; public class Main { private static final char ABC [ ] = " ABC " . toCharArray ( ) ; private static final long MOD = 1_000_000_007L ; public void main ( Scanner sc ) throws Exception { char s [ ] = sc . next ( ) . toCharArray ( ) ; sc . close ( ) ; int len = s . length ; long data [ ] [ ] = new long [ len + 1 ] [ 4 ] ; data [ len ] [ 3 ] = 1 ; for ( int i = len - 1 ; i >= 0 ; i -- ) { data [ i ] [ 3 ] = ( s [ i ] == ' ? ' ? 3 : 1 ) * data [ i + 1 ] [ 3 ] ; data [ i ] [ 3 ] %= MOD ; } for ( int i = len - 1 ; i >= 0 ; i -- ) { for ( int j = 2 ; j >= 0 ; j -- ) { data [ i ] [ j ] = ( s [ i ] == ' ? ' ? 3 : 1 ) * data [ i + 1 ] [ j ] + ( s [ i ] == ABC [ j ] || s [ i ] == ' ? ' ? 1 : 0 ) * data [ i + 1 ] [ j + 1 ] ; data [ i ] [ j ] %= MOD ; } } System . out . println ( data [ 0 ] [ 0 ] % MOD ) ; } public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; } }

import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; StringBuffer sb = new StringBuffer ( S ) ; S = sb . reverse ( ) . toString ( ) ; String [ ] T = S . split ( " " ) ; long C = 0 ; long BC = 0 ; long ABC = 0 ; long AB = 1 ; long X = 1 ; for ( String i : T ) { if ( " ? " . equals ( i ) ) { ABC = ( ABC * 3 + BC ) % 1000000007 ; BC = ( BC * 3 + C ) % 1000000007 ; C = ( C * 3 + X ) % 1000000007 ; X = ( X * 3 ) % 1000000007 ; } else if ( " C " . equals ( i ) ) { AB = 0 ; C += X ; } else if ( " B " . equals ( i ) ) { BC += C ; } else if ( " A " . equals ( i ) ) { ABC += BC ; } } System . out . println ( ABC % 1000000007 ) ; } }

import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; long mod = 1000000007L ; String ABC = " ABC " ; long [ ] [ ] dp = new long [ S . length ( ) ] [ 4 ] ; if ( S . charAt ( 0 ) == ' ? ' ) { dp [ 0 ] [ 0 ] = 3 ; } else { dp [ 0 ] [ 0 ] = 1 ; } if ( S . charAt ( 0 ) == ' A ' || S . charAt ( 0 ) == ' ? ' ) { dp [ 0 ] [ 1 ] = 1 ; } for ( int i = 1 ; i < S . length ( ) ; i ++ ) { for ( int j = 0 ; j < 4 ; j ++ ) { if ( j == 0 ) { if ( S . charAt ( i ) == ' A ' || S . charAt ( i ) == ' B ' || S . charAt ( i ) == ' C ' ) { dp [ i ] [ 0 ] = dp [ i - 1 ] [ 0 ] ; } else { dp [ i ] [ 0 ] = dp [ i - 1 ] [ 0 ] * 3L ; } dp [ i ] [ j ] %= mod ; } else { long x = ( S . charAt ( i ) == ' ? ' ? 3L : 1L ) ; long y = ( ( S . charAt ( i ) == ABC . charAt ( j - 1 ) || S . charAt ( i ) == ' ? ' ) ? 1L : 0L ) ; dp [ i ] [ j ] = ( dp [ i - 1 ] [ j ] * x ) + ( dp [ i - 1 ] [ j - 1 ] * y ) ; dp [ i ] [ j ] %= mod ; } } } System . out . println ( dp [ S . length ( ) - 1 ] [ 3 ] ) ; } }

s = input ( ) NEW_LINE dp = [ [ 0 ] * ( len ( s ) + 1 ) for _ in range ( 4 ) ] NEW_LINE dp [ 0 ] [ 0 ] = 1 NEW_LINE for i , c in enumerate ( s ) : NEW_LINE INDENT if c == " A " or c == " ? " : NEW_LINE INDENT dp [ 1 ] [ i + 1 ] = dp [ 0 ] [ i ] NEW_LINE DEDENT if c == " B " or c == " ? " : NEW_LINE INDENT dp [ 2 ] [ i + 1 ] = dp [ 1 ] [ i ] NEW_LINE DEDENT if c == " C " or c == " ? " : NEW_LINE INDENT dp [ 3 ] [ i + 1 ] = dp [ 2 ] [ i ] NEW_LINE DEDENT for j in range ( 4 ) : NEW_LINE INDENT if c == " ? " : NEW_LINE INDENT dp [ j ] [ i + 1 ] += dp [ j ] [ i ] * 3 NEW_LINE DEDENT else : NEW_LINE INDENT dp [ j ] [ i + 1 ] += dp [ j ] [ i ] NEW_LINE DEDENT dp [ j ] [ i + 1 ] %= 10 ** 9 + 7 NEW_LINE DEDENT DEDENT print ( dp [ - 1 ] [ - 1 ] ) NEW_LINE

import sys NEW_LINE sys . setrecursionlimit ( 1000000 ) NEW_LINE test_data1 = ''' \ STRNEWLINE A ? ? C STRNEWLINE ''' NEW_LINE test_data2 = ''' \ STRNEWLINE ACACAC STRNEWLINE ''' NEW_LINE test_data3 = ''' \ STRNEWLINE ? ? ? ? C ? ? ? ? ? B ? ? ? ? ? ? A ? ? ? ? ? ? ? STRNEWLINE ''' NEW_LINE test_data4 = ''' \ STRNEWLINE ? AC ? AC STRNEWLINE ''' NEW_LINE td_num = 3 NEW_LINE def GetTestData ( index ) : NEW_LINE INDENT if index == 1 : NEW_LINE INDENT return test_data1 NEW_LINE DEDENT if index == 2 : NEW_LINE INDENT return test_data2 NEW_LINE DEDENT if index == 3 : NEW_LINE INDENT return test_data3 NEW_LINE DEDENT if index == 4 : NEW_LINE INDENT return test_data4 NEW_LINE DEDENT DEDENT if False : NEW_LINE INDENT with open ( " . . / test . txt " , mode = ' w ' ) as f : NEW_LINE INDENT f . write ( GetTestData ( td_num ) ) NEW_LINE DEDENT with open ( " . . / test . txt " ) as f : NEW_LINE INDENT s = f . readline ( ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT s = input ( ) NEW_LINE DEDENT n = len ( s ) NEW_LINE dc = dict ( ) NEW_LINE dc [ ' A ' ] = 0 NEW_LINE dc [ ' B ' ] = 1 NEW_LINE dc [ ' C ' ] = 2 NEW_LINE dc [ ' ? ' ] = 3 NEW_LINE dp = [ [ 0 for i in range ( 4 ) ] for j in range ( n + 1 ) ] NEW_LINE dp [ 0 ] [ 0 ] = 1 NEW_LINE mo = 10 ** 9 + 7 NEW_LINE for i in range ( n ) : NEW_LINE INDENT for t in range ( 4 ) : NEW_LINE INDENT ch = s [ i ] NEW_LINE if dc [ ch ] == t - 1 or dc [ ch ] == 3 : NEW_LINE INDENT m = 1 NEW_LINE DEDENT else : NEW_LINE INDENT m = 0 NEW_LINE DEDENT if t != 0 : NEW_LINE INDENT dp [ i + 1 ] [ t ] += ( dp [ i ] [ t - 1 ] * m ) % mo NEW_LINE DEDENT dp [ i + 1 ] [ t ] += ( dp [ i ] [ t ] * max ( int ( dc [ ch ] / 3 ) * 3 , 1 ) ) % mo NEW_LINE DEDENT DEDENT ans = dp [ n ] [ 3 ] NEW_LINE print ( ans % mo ) NEW_LINE NEW_LINE

import sys NEW_LINE import itertools NEW_LINE import collections NEW_LINE import functools NEW_LINE import math NEW_LINE from queue import Queue NEW_LINE INF = float ( " inf " ) NEW_LINE MOD = 1000000007 NEW_LINE d = { } NEW_LINE def thpow ( q ) : NEW_LINE INDENT if q < 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT if q == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT if q in d : NEW_LINE INDENT return d [ q ] NEW_LINE DEDENT else : NEW_LINE INDENT d [ q ] = ( 3 * thpow ( q - 1 ) ) % MOD NEW_LINE return d [ q ] NEW_LINE DEDENT DEDENT def solve ( S : str ) : NEW_LINE INDENT dp = [ 0 , 0 , 0 ] NEW_LINE q = 0 NEW_LINE for ch in S : NEW_LINE INDENT a , b , c = dp NEW_LINE if ch == " A " : NEW_LINE INDENT dp = [ ( a + thpow ( q ) ) % MOD , b , c ] NEW_LINE DEDENT elif ch == " B " : NEW_LINE INDENT dp = [ a , ( b + a ) % MOD , c ] NEW_LINE DEDENT elif ch == " C " : NEW_LINE INDENT dp = [ a , b , ( c + b ) % MOD ] NEW_LINE DEDENT elif ch == " ? " : NEW_LINE INDENT dp = [ ( ( a * 3 % MOD ) + thpow ( q ) ) % MOD , ( ( b * 3 ) % MOD + a ) % MOD , ( ( c * 3 ) + b ) % MOD ] NEW_LINE q += 1 NEW_LINE DEDENT DEDENT print ( dp [ 2 ] ) NEW_LINE return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT def iterate_tokens ( ) : NEW_LINE INDENT for line in sys . stdin : NEW_LINE INDENT for word in line . split ( ) : NEW_LINE INDENT yield word NEW_LINE DEDENT DEDENT DEDENT tokens = iterate_tokens ( ) NEW_LINE S = next ( tokens ) NEW_LINE solve ( S ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

X = list ( input ( ) ) NEW_LINE q_num = X . count ( " ? " ) NEW_LINE a_num = 0 NEW_LINE c_num = X . count ( " C " ) NEW_LINE left_q_num = 0 NEW_LINE right_q_num = q_num NEW_LINE ans = 0 NEW_LINE len_x = len ( X ) NEW_LINE q_dict = [ ] NEW_LINE b_ans = 0 NEW_LINE q_ans = 0 NEW_LINE q_dict = { } NEW_LINE q_dict [ q_num - 1 ] = ( 3 ** ( q_num - 1 ) ) % ( 10 ** 9 + 7 ) NEW_LINE q_dict [ q_num - 2 ] = ( 3 ** ( q_num - 2 ) ) % ( 10 ** 9 + 7 ) NEW_LINE q_dict [ q_num - 3 ] = ( 3 ** ( q_num - 3 ) ) % ( 10 ** 9 + 7 ) NEW_LINE q_dict [ q_num ] = ( 3 ** ( q_num ) ) % ( 10 ** 9 + 7 ) NEW_LINE if X [ 0 ] == " ? " : NEW_LINE INDENT right_q_num -= 1 NEW_LINE DEDENT elif X [ 0 ] == " C " : NEW_LINE INDENT c_num -= 1 NEW_LINE DEDENT for i , x in enumerate ( X ) : NEW_LINE INDENT if x == " B " or x == " ? " : NEW_LINE INDENT ans += ( a_num * c_num ) * ( q_dict [ ( left_q_num + right_q_num ) ] ) NEW_LINE if left_q_num + right_q_num >= 2 : NEW_LINE INDENT ans += ( right_q_num * left_q_num + 3 * ( left_q_num * c_num ) + 3 * ( right_q_num * a_num ) ) * ( q_dict [ ( left_q_num + right_q_num - 2 ) ] ) NEW_LINE DEDENT elif left_q_num + right_q_num == 1 : NEW_LINE INDENT ans += ( ( left_q_num * c_num ) + ( right_q_num * a_num ) ) * ( q_dict [ ( left_q_num + right_q_num - 1 ) ] ) NEW_LINE DEDENT ans = ans % ( 10 ** 9 + 7 ) NEW_LINE DEDENT if i == len_x - 1 : NEW_LINE INDENT break NEW_LINE DEDENT if x == " A " : NEW_LINE INDENT a_num += 1 NEW_LINE DEDENT elif x == " ? " : NEW_LINE INDENT left_q_num += 1 NEW_LINE DEDENT if X [ i + 1 ] == " C " : NEW_LINE INDENT c_num -= 1 NEW_LINE DEDENT elif X [ i + 1 ] == " ? " : NEW_LINE INDENT right_q_num -= 1 NEW_LINE DEDENT DEDENT print ( ans % ( 10 ** 9 + 7 ) ) NEW_LINE

a = [ 1 ] + [ 0 ] * 4 NEW_LINE m = 10 ** 9 + 7 NEW_LINE for s in input ( ) : NEW_LINE INDENT i = ord ( s ) - 64 NEW_LINE if i > 0 : a [ i ] += a [ i - 1 ] NEW_LINE else : a = [ a [ i ] * 3 % m + a [ i - 1 ] for i in range ( 4 ) ] + [ 0 ] NEW_LINE DEDENT print ( a [ 3 ] % m ) NEW_LINE


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

import java . util . ArrayList ; import java . util . Scanner ; import static java . lang . System . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static ArrayList < Integer > train = new ArrayList ( ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int count = 0 ; String answer = null ; for ( int i = a ; i > 0 ; i -- ) { count += ( i * 10000 ) ; } count = count / a ; answer = String . valueOf ( count ) ; out . println ( answer ) ; out . flush ( ) ; } static ArrayList < Integer > gcd ( int a , int b ) { for ( int i = 101 ; i > 0 ; i -- ) { if ( a % i == 0 ) { if ( b % i == 0 ) { train . add ( i ) ; } } } return train ; } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .

import java . util . * ; import java . util . List ; import java . util . ArrayList ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int sum = N * ( N + 1 ) / 2 ; System . out . println ( 10000 * sum / N ) ; } }

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

import java . util . Arrays ; import java . util . Collection ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { sum += i ; } System . out . println ( ( sum * 10000 ) / N ) ; } static String adjustValue ( int value ) { if ( 10 > value ) { return "0" + value ; } else { return value + " " ; } } }

n = int ( input ( ) ) NEW_LINE print ( int ( sum ( [ i + 1 for i in range ( n ) ] ) / n * 10000 ) ) NEW_LINE

def calc ( n ) : NEW_LINE INDENT sum = ( n * ( n + 1 ) / 2 ) * 10000 NEW_LINE return ( int ) ( sum / n ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n , = map ( int , input ( ) . split ( ) ) NEW_LINE print ( calc ( n ) ) NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE i = 0 NEW_LINE k = 10000 NEW_LINE sum = 0 NEW_LINE while i < n : NEW_LINE INDENT sum += k / n NEW_LINE k += 10000 NEW_LINE i += 1 NEW_LINE DEDENT print ( int ( sum ) ) NEW_LINE

print ( ( int ( input ( ) ) + 1 ) * 5000 ) NEW_LINE

N = float ( input ( ) ) NEW_LINE if N % 2 == 0 : NEW_LINE INDENT print ( int ( ( N / 2 + 0.5 ) * 10000 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( int ( ( N + 1 ) / 2 * 10000 ) ) NEW_LINE DEDENT


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; long a = in . nextLong ( ) , b = in . nextLong ( ) ; long [ ] x = in . nextLongArray ( n ) ; long sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += Math . min ( a * ( x [ i + 1 ] - x [ i ] ) , b ) ; } out . println ( sum ) ; } } static class InputReader { BufferedReader in ; StringTokenizer tok ; public String nextString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) , " ▁ " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return tok . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( nextString ( ) ) ; } public long [ ] nextLongArray ( int n ) { long [ ] res = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { res [ i ] = nextLong ( ) ; } return res ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } }

import java . util . Scanner ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . ArrayList ; import java . util . Set ; import java . util . Queue ; import java . text . DecimalFormat ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long a = input . nextLong ( ) ; long b = input . nextLong ( ) ; long fatiga = 0 ; input . nextLine ( ) ; long pueblos [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { pueblos [ i ] = input . nextLong ( ) ; } input . nextLine ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ( pueblos [ i + 1 ] - pueblos [ i ] ) * a < b ) fatiga += ( pueblos [ i + 1 ] - pueblos [ i ] ) * a ; else fatiga += b ; } System . out . println ( fatiga ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int n , a , b ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; long ans = 0 ; int prevX = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( ( long ) a * ( x - prevX ) < b ) { ans += ( long ) a * ( x - prevX ) ; } else { ans += b ; } prevX = x ; } 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 ; } } }

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 ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int pre = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int c = sc . nextInt ( ) ; ans += min ( b , ( long ) a * ( c - pre ) ) ; pre = c ; } out . println ( ans ) ; 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 . util . * ; import java . io . * ; import static java . lang . System . in ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long [ ] x = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) x [ i ] = sc . nextLong ( ) ; long ans = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { ans += Math . min ( A * ( x [ i + 1 ] - x [ i ] ) , B ) ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( ans ) ; out . flush ( ) ; } }

n , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ret = 0 NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT ret += min ( a * ( x [ i + 1 ] - x [ i ] ) , b ) NEW_LINE DEDENT print ( ret ) NEW_LINE

import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE from functools import partial , reduce NEW_LINE from operator import mul NEW_LINE prod = partial ( reduce , mul ) NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LI_ ( ) : return [ int ( x ) - 1 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 II ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def SI ( ) : return input ( ) NEW_LINE def main ( ) : NEW_LINE INDENT N , A , B = LI ( ) NEW_LINE X = LI ( ) NEW_LINE ans = 0 NEW_LINE for x , y in zip ( X , X [ 1 : ] ) : NEW_LINE INDENT if ( y - x ) * A < B : NEW_LINE INDENT ans += ( y - x ) * A NEW_LINE DEDENT else : NEW_LINE INDENT ans += B NEW_LINE DEDENT DEDENT return ans NEW_LINE DEDENT print ( main ( ) ) NEW_LINE

( N , A , B ) = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE X = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE hirou = 0 NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT length = X [ i + 1 ] - X [ i ] NEW_LINE if length * A <= B : NEW_LINE INDENT hirou += length * A NEW_LINE DEDENT else : NEW_LINE INDENT hirou += B NEW_LINE DEDENT DEDENT print ( hirou ) NEW_LINE

N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE X = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE X . insert ( 0 , 0 ) NEW_LINE ans = 0 NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT ans += min ( A * ( X [ i ] - X [ i - 1 ] ) , B ) NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE L = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE diff = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT diff [ i ] = L [ i ] - L [ i - 1 ] NEW_LINE DEDENT for i in range ( 1 , N ) : NEW_LINE INDENT if diff [ i ] * A >= B : NEW_LINE INDENT ans += B NEW_LINE DEDENT else : NEW_LINE INDENT ans += diff [ i ] * A NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


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

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

import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { BigDecimal number1 = new BigDecimal ( scanner . next ( ) ) ; BigDecimal number2 = new BigDecimal ( scanner . next ( ) ) ; System . out . println ( number1 . divide ( number2 , 10 , RoundingMode . HALF_UP ) ) ; } } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " ▁ " ) ; double ans = Double . parseDouble ( s [ 0 ] ) / Double . parseDouble ( s [ 1 ] ) ; System . out . println ( ans ) ; } }

import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double t = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; System . out . println ( t / x ) ; sc . close ( ) ; } }

t , x = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ' { :4f } ' . format ( t / x ) ) NEW_LINE

a , b = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( a / b ) NEW_LINE

T , X = map ( int , input ( ) . split ( ) ) NEW_LINE output = T / X NEW_LINE print ( output ) NEW_LINE

A = list ( map ( float , input ( ) . split ( ) ) ) NEW_LINE print ( A [ 0 ] / A [ 1 ] ) NEW_LINE

T , X = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE print ( float ( T ) / float ( X ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; if ( a == 3 || a == 5 || a == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } }

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 a = in . nextInt ( ) ; List < Integer > c = Arrays . asList ( 3 , 5 , 7 ) ; out . println ( c . contains ( a ) ? " YES " : " NO " ) ; } static class InputStreamScanner { private InputStream in ; private byte [ ] buf = new byte [ 1024 ] ; private int len = 0 ; private int off = 0 ; InputStreamScanner ( InputStream in ) { this . in = in ; } String next ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( int b = skip ( ) ; ! isSpace ( b ) ; ) { sb . appendCodePoint ( b ) ; b = read ( ) ; } return sb . toString ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } char nextChar ( ) { return ( char ) skip ( ) ; } int skip ( ) { for ( int b ; ( b = read ( ) ) != - 1 ; ) { if ( ! isSpace ( b ) ) { return b ; } } return - 1 ; } private boolean isSpace ( int c ) { return c < 33 || c > 126 ; } private int read ( ) { if ( len == - 1 ) { throw new InputMismatchException ( " End ▁ of ▁ Input " ) ; } if ( off >= len ) { off = 0 ; try { len = in . read ( buf ) ; } catch ( IOException e ) { throw new InputMismatchException ( e . getMessage ( ) ) ; } if ( len <= 0 ) { return - 1 ; } } return buf [ off ++ ] ; } } }

import java . util . Scanner ; public class Main { static int N ; static String ans = " NO " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; if ( N == 7 || N == 5 || N == 3 ) ans = " YES " ; System . out . println ( ans ) ; } }

import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; switch ( a ) { case 7 : case 5 : case 3 : System . out . println ( " YES " ) ; break ; default : System . out . println ( " NO " ) ; break ; } } }

import java . util . * ; import java . util . List ; import java . util . ArrayList ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int X = scanner . nextInt ( ) ; if ( X == 3 || X == 5 || X == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

List = [ 7 , 5 , 3 ] NEW_LINE X = int ( input ( ) ) NEW_LINE if X in List : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT

age = int ( input ( ) ) NEW_LINE ans = ' YES ' if age == 7 or age == 5 or age == 3 else ' NO ' NEW_LINE print ( ans ) NEW_LINE

a = [ "7" , "5" , "3" ] NEW_LINE old = input ( ) NEW_LINE res = " NO " NEW_LINE if old in a : NEW_LINE INDENT res = " YES " NEW_LINE DEDENT print ( res ) NEW_LINE

if int ( input ( ) ) in ( 7 , 5 , 3 ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT

X = input ( ) NEW_LINE if X in [ '3' , '5' , '7' ] : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


import java . util . Scanner ; import java . util . StringJoiner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; String [ ] [ ] a = new String [ h ] [ w ] ; boolean [ ] row = new boolean [ h ] ; boolean [ ] column = new boolean [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { a [ i ] = sc . next ( ) . split ( " " ) ; row [ i ] = false ; } for ( int i = 0 ; i < w ; i ++ ) { column [ i ] = false ; } for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( " # " . equals ( a [ i ] [ j ] ) ) { row [ i ] = true ; column [ j ] = true ; } } } for ( int i = 0 ; i < h ; i ++ ) { if ( ! row [ i ] ) { continue ; } StringJoiner sj = new StringJoiner ( " " ) ; for ( int j = 0 ; j < w ; j ++ ) { if ( ! column [ j ] ) { continue ; } sj . add ( a [ i ] [ j ] ) ; } System . out . println ( sj . toString ( ) ) ; } } }

import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import static java . util . stream . Collectors . joining ; public class Main { private static final String WHITE = " . " ; private static final String BLACK = " # " ; public static List < String > process ( int H , int W , List < String > a ) { final List < String > removedBlankRows = a . stream ( ) . filter ( Main :: keepRowWithAnyBlack ) . collect ( Collectors . toList ( ) ) ; final List < String > transposed = transpose ( removedBlankRows ) ; final List < String > compressedTranspose = transposed . stream ( ) . filter ( Main :: keepRowWithAnyBlack ) . collect ( Collectors . toList ( ) ) ; return transpose ( compressedTranspose ) ; } private static boolean keepRowWithAnyBlack ( String row ) { return row . chars ( ) . anyMatch ( Main :: isBlack ) ; } private static boolean isBlack ( int c ) { return c == BLACK . codePointAt ( 0 ) ; } private static List < String > transpose ( List < String > grid ) { if ( grid . isEmpty ( ) ) { return new ArrayList < > ( ) ; } else { final int W = grid . get ( 0 ) . length ( ) ; return IntStream . range ( 0 , W ) . boxed ( ) . map ( i -> grid . stream ( ) . map ( row -> row . substring ( i , i + 1 ) ) . collect ( joining ( ) ) ) . collect ( Collectors . toList ( ) ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; final List < String > a = IntStream . range ( 0 , H ) . mapToObj ( i -> sc . next ( ) ) . collect ( Collectors . toList ( ) ) ; final List < String > result = process ( H , W , a ) ; result . forEach ( System . out :: println ) ; } }

import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; char [ ] [ ] map = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) map [ i ] = sc . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < h ; i ++ ) { boolean F = true ; for ( int j = 0 ; j < w ; j ++ ) { if ( map [ i ] [ j ] == ' # ' ) { F = false ; break ; } } if ( F == true ) { for ( int j = 0 ; j < w ; j ++ ) { map [ i ] [ j ] = ' x ' ; } } } for ( int i = 0 ; i < w ; i ++ ) { boolean F = true ; for ( int j = 0 ; j < h ; j ++ ) { if ( map [ j ] [ i ] == ' # ' ) { F = false ; break ; } } if ( F == true ) { for ( int j = 0 ; j < h ; j ++ ) { map [ j ] [ i ] = ' x ' ; } } } for ( int i = 0 ; i < h ; i ++ ) { StringBuilder sb = new StringBuilder ( " " ) ; boolean F = true ; for ( int j = 0 ; j < w ; j ++ ) { if ( map [ i ] [ j ] != ' x ' ) sb . append ( map [ i ] [ j ] ) ; } if ( ! sb . toString ( ) . equals ( " " ) ) System . out . println ( sb ) ; } } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int H = input . nextInt ( ) ; int W = input . nextInt ( ) ; String [ ] HS = new String [ H ] ; boolean [ ] rows = new boolean [ H ] ; boolean [ ] cols = new boolean [ W ] ; Arrays . fill ( rows , false ) ; Arrays . fill ( cols , false ) ; for ( int i = 0 ; i < H ; i ++ ) { HS [ i ] = input . next ( ) ; } for ( int j = 0 ; j < H ; j ++ ) { if ( HS [ j ] . indexOf ( " # " ) != - 1 ) { rows [ j ] = true ; } for ( int i = 0 ; i < W ; i ++ ) { if ( HS [ j ] . charAt ( i ) == ' # ' ) { cols [ i ] = true ; } } } for ( int i = 0 ; i < H ; i ++ ) { if ( rows [ i ] ) { for ( int j = 0 ; j < W ; j ++ ) { if ( cols [ j ] ) { System . out . print ( HS [ i ] . charAt ( j ) ) ; } } System . out . println ( ) ; } } } }

import java . util . List ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . Stream ; public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int h = scanner . nextInt ( ) ; int w = scanner . nextInt ( ) ; String [ ] a = Stream . generate ( ( ) -> null ) . limit ( h ) . map ( b -> scanner . next ( ) ) . filter ( b -> b . contains ( " # " ) ) . toArray ( String [ ] :: new ) ; List < Integer > i = IntStream . range ( 0 , w ) . boxed ( ) . collect ( Collectors . toList ( ) ) ; for ( String s : a ) i . removeIf ( i2 -> s . charAt ( i2 ) == ' # ' ) ; for ( String s : a ) { char [ ] c = s . toCharArray ( ) ; for ( int j = 0 ; j < c . length ; j ++ ) if ( ! i . contains ( j ) ) System . out . print ( c [ j ] ) ; System . out . println ( ) ; } } }

H , W = map ( int , input ( ) . split ( ) ) NEW_LINE bd = [ ] NEW_LINE for i in range ( H ) : NEW_LINE INDENT bd . append ( input ( ) ) NEW_LINE DEDENT x = set ( ) NEW_LINE y = set ( ) NEW_LINE for i in range ( H ) : NEW_LINE INDENT for j in range ( W ) : NEW_LINE INDENT if bd [ i ] [ j ] == " # " : NEW_LINE INDENT x . add ( j ) NEW_LINE y . add ( i ) NEW_LINE DEDENT DEDENT DEDENT for i in y : NEW_LINE INDENT for j in x : NEW_LINE INDENT print ( bd [ i ] [ j ] , end = " " ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT

f = lambda s : zip ( * [ t for t in s if ' # ' in t ] ) ; print ( * map ( ' ' . join , f ( f ( open ( 0 ) ) ) ) ) NEW_LINE

H , W = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ [ 0 ] * W for _ in range ( H ) ] NEW_LINE for h in range ( H ) : NEW_LINE INDENT a [ h ] = [ inp for inp in input ( ) ] NEW_LINE DEDENT check = [ [ 0 ] * W for _ in range ( H ) ] NEW_LINE for h in range ( H ) : NEW_LINE INDENT for w in range ( W ) : NEW_LINE INDENT if a [ h ] [ w ] == ' # ' : NEW_LINE INDENT check [ h ] [ w ] = 1 NEW_LINE DEDENT DEDENT DEDENT final_w = [ 0 ] * W NEW_LINE for h in range ( H ) : NEW_LINE INDENT final_w = [ final_w [ w ] + check [ h ] [ w ] for w in range ( W ) ] NEW_LINE DEDENT final_h = [ 0 ] * H NEW_LINE for w in range ( W ) : NEW_LINE INDENT final_h = [ final_h [ h ] + check [ h ] [ w ] for h in range ( H ) ] NEW_LINE DEDENT for h in range ( H ) : NEW_LINE INDENT res = ' ' NEW_LINE for w in range ( W ) : NEW_LINE INDENT if final_w [ w ] >= 1 and final_h [ h ] >= 1 : NEW_LINE INDENT res += a [ h ] [ w ] NEW_LINE DEDENT DEDENT print ( res + ' \n ' ) NEW_LINE DEDENT

H , W = map ( int , input ( ) . split ( ) ) NEW_LINE box = [ ] NEW_LINE for i in range ( H ) : NEW_LINE INDENT a = [ j for j in input ( ) ] NEW_LINE if all ( j == ' . ' for j in a ) : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT box . append ( a ) NEW_LINE DEDENT DEDENT idx = [ ] NEW_LINE for i in range ( len ( box [ 0 ] ) ) : NEW_LINE INDENT ct = 0 NEW_LINE for j in box : NEW_LINE INDENT if j [ i ] == ' . ' : NEW_LINE INDENT ct += 1 NEW_LINE DEDENT DEDENT if ct == len ( box ) : NEW_LINE INDENT idx . append ( i ) NEW_LINE DEDENT DEDENT for i in box : NEW_LINE INDENT for j in range ( len ( i ) ) : NEW_LINE INDENT if j < len ( i ) - 1 : NEW_LINE INDENT if j in idx : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT print ( i [ j ] , end = ' ' ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if j in idx : NEW_LINE INDENT print ( ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( i [ j ] ) NEW_LINE DEDENT DEDENT DEDENT DEDENT

def main ( ) : NEW_LINE INDENT H , W = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ [ " . " for _ in range ( W ) ] for _ in range ( H ) ] NEW_LINE ans = [ ] NEW_LINE is_column_white = [ True ] * H NEW_LINE is_row_white = [ True ] * W NEW_LINE for i in range ( H ) : NEW_LINE INDENT row = input ( ) NEW_LINE for j in range ( W ) : NEW_LINE INDENT a [ i ] [ j ] = row [ j ] NEW_LINE if row [ j ] == " # " : NEW_LINE INDENT is_column_white [ i ] = False NEW_LINE is_row_white [ j ] = False NEW_LINE DEDENT DEDENT DEDENT for i in range ( H ) : NEW_LINE INDENT if is_column_white [ i ] : NEW_LINE INDENT continue NEW_LINE DEDENT ans_row = " " NEW_LINE for j in range ( W ) : NEW_LINE INDENT if is_row_white [ j ] : NEW_LINE INDENT continue NEW_LINE DEDENT ans_row += a [ i ] [ j ] NEW_LINE DEDENT print ( ans_row ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; String name = sc . next ( ) ; String kit = sc . next ( ) ; char n [ ] = new char [ 26 ] ; char m [ ] = new char [ 26 ] ; for ( int i = 0 ; i < N ; i ++ ) { char nc = name . charAt ( i ) ; n [ nc - ' A ' ] ++ ; } for ( int i = 0 ; i < M ; i ++ ) { char nk = kit . charAt ( i ) ; m [ nk - ' A ' ] ++ ; } int an = Integer . MIN_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { char target = name . charAt ( i ) ; int count = 0 ; if ( m [ target - ' A ' ] == 0 ) { System . out . println ( - 1 ) ; return ; } if ( n [ target - ' A ' ] % m [ target - ' A ' ] == 0 ) { count = n [ target - ' A ' ] / m [ target - ' A ' ] ; } else { count = n [ target - ' A ' ] / m [ target - ' A ' ] + 1 ; } an = Math . max ( an , count ) ; } System . out . println ( an ) ; } }

import java . io . * ; import java . util . * ; import java . math . * ; public class Main { static boolean debug = false ; static boolean debug2 = false ; public static void main ( String [ ] args ) throws java . io . IOException { debug = 1 <= args . length ; debug2 = 2 <= args . length ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; in . readLine ( ) ; final String name = in . readLine ( ) ; final String kit = in . readLine ( ) ; int [ ] name_count = new int [ ' Z ' - ' A ' + 1 ] ; int [ ] kit_count = new int [ name_count . length ] ; for ( int i = 0 ; i < name . length ( ) ; ++ i ) { ++ name_count [ name . charAt ( i ) - ' A ' ] ; } for ( int i = 0 ; i < kit . length ( ) ; ++ i ) { ++ kit_count [ kit . charAt ( i ) - ' A ' ] ; } int ans = 0 ; for ( int i = 0 ; i < kit_count . length ; ++ i ) { if ( kit_count [ i ] == 0 ) { if ( 0 < name_count [ i ] ) { ans = - 1 ; break ; } } else { ans = Math . max ( ans , name_count [ i ] / kit_count [ i ] + ( 0 < name_count [ i ] % kit_count [ i ] ? 1 : 0 ) ) ; } } System . out . println ( ans ) ; } }

import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static IntStream REPS ( int v ) { return IntStream . range ( 0 , v ) ; } static IntStream REPS ( int l , int r ) { return IntStream . rangeClosed ( l , r ) ; } static IntStream INS ( int n ) { return REPS ( n ) . map ( i -> getInt ( ) ) ; } static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int [ ] name = new int [ 26 ] , kit = new int [ 26 ] ; s . next ( ) ; s . next ( ) ; s . next ( ) . chars ( ) . forEach ( i -> ++ name [ i - ' A ' ] ) ; s . next ( ) . chars ( ) . forEach ( i -> ++ kit [ i - ' A ' ] ) ; if ( REPS ( 26 ) . anyMatch ( i -> name [ i ] > 0 && kit [ i ] == 0 ) ) { System . out . println ( - 1 ) ; return ; } System . out . println ( REPS ( 26 ) . map ( i -> name [ i ] == 0 ? 0 : ( name [ i ] + kit [ i ] - 1 ) / kit [ i ] ) . max ( ) . getAsInt ( ) ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] setting = br . readLine ( ) . split ( " ▁ " ) ; int nameNum = Integer . parseInt ( setting [ 0 ] ) ; int kitLetterNum = Integer . parseInt ( setting [ 1 ] ) ; String [ ] nameArray = br . readLine ( ) . split ( " " ) ; String [ ] kitArray = br . readLine ( ) . split ( " " ) ; int count = 1 ; int nullNum = 0 ; while ( true ) { for ( int i = 0 ; i < kitLetterNum ; i ++ ) { for ( int j = 0 ; j < nameNum ; j ++ ) { if ( nameArray [ j ] == null ) { } else if ( nameArray [ j ] . equals ( kitArray [ i ] ) ) { nameArray [ j ] = null ; nullNum ++ ; break ; } } } if ( nullNum == nameNum ) { break ; } else if ( count == 50000 ) { count = - 1 ; break ; } else { count ++ ; } } System . out . println ( count ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; String name = sc . next ( ) ; String kit = sc . next ( ) ; HashMap < String , Integer > namemap = new HashMap < String , Integer > ( ) ; HashMap < String , Integer > kitmap = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { String s = String . valueOf ( name . charAt ( i ) ) ; if ( namemap . containsKey ( s ) ) { namemap . put ( s , namemap . get ( s ) + 1 ) ; } else { namemap . put ( s , 1 ) ; } } for ( int i = 0 ; i < M ; i ++ ) { String s = String . valueOf ( kit . charAt ( i ) ) ; if ( kitmap . containsKey ( s ) ) { kitmap . put ( s , kitmap . get ( s ) + 1 ) ; } else { kitmap . put ( s , 1 ) ; } } int ans = 0 ; for ( String s : namemap . keySet ( ) ) { int num1 = namemap . get ( s ) ; int num2 = 0 ; if ( kitmap . containsKey ( s ) ) num2 = kitmap . get ( s ) ; if ( num2 == 0 ) { ans = - 1 ; break ; } else { ans = Math . max ( ans , ( num1 + num2 - 1 ) / num2 ) ; } } System . out . println ( ans ) ; } }

n , m = map ( int , input ( ) . split ( ) ) NEW_LINE N = list ( input ( ) ) NEW_LINE K = list ( input ( ) ) NEW_LINE dic_N = { } NEW_LINE for i in N : NEW_LINE INDENT if i not in dic_N : NEW_LINE INDENT dic_N [ i ] = 1 NEW_LINE DEDENT else : NEW_LINE INDENT dic_N [ i ] += 1 NEW_LINE DEDENT DEDENT dic_K = { } NEW_LINE for i in K : NEW_LINE INDENT if i not in dic_K : NEW_LINE INDENT dic_K [ i ] = 1 NEW_LINE DEDENT else : NEW_LINE INDENT dic_K [ i ] += 1 NEW_LINE DEDENT DEDENT cou = 0 NEW_LINE for i in dic_N : NEW_LINE INDENT ni = dic_N [ i ] NEW_LINE if i not in dic_K : NEW_LINE INDENT cou = - 1 NEW_LINE break NEW_LINE DEDENT ki = dic_K [ i ] NEW_LINE re = ni // ki NEW_LINE if ni % ki != 0 : NEW_LINE INDENT re += 1 NEW_LINE DEDENT cou = max ( cou , re ) NEW_LINE DEDENT print ( cou ) NEW_LINE

I = input ; I ( ) ; s , t = I ( ) , I ( ) ; print ( - ( len ( set ( s ) - set ( t ) ) > 0 ) or - min ( - s . count ( c ) // t . count ( c ) for c in s ) ) NEW_LINE

import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE from collections import Counter NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE name = input ( ) . rstrip ( ) NEW_LINE kit = input ( ) . rstrip ( ) NEW_LINE name_cnt = Counter ( name ) NEW_LINE kit_cnt = Counter ( kit ) NEW_LINE for key , val in name_cnt . items ( ) : NEW_LINE INDENT if kit_cnt [ key ] == 0 : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE for key , val in name_cnt . items ( ) : NEW_LINE INDENT d = kit_cnt [ key ] NEW_LINE ans = max ( ans , ( val + d - 1 ) // d ) NEW_LINE DEDENT print ( ans ) NEW_LINE

def b_uncle ( N , M , Name , Kit ) : NEW_LINE INDENT from collections import defaultdict NEW_LINE name_usechar = defaultdict ( int ) NEW_LINE for c in Name : NEW_LINE INDENT name_usechar [ c ] += 1 NEW_LINE DEDENT kit_chars = defaultdict ( int ) NEW_LINE for c in Kit : NEW_LINE INDENT kit_chars [ c ] += 1 NEW_LINE DEDENT ans = 0 NEW_LINE for key in name_usechar . keys ( ) : NEW_LINE INDENT if kit_chars [ key ] == 0 : NEW_LINE INDENT ans = - 1 NEW_LINE break NEW_LINE DEDENT ans = max ( ans , ( name_usechar [ key ] + kit_chars [ key ] - 1 ) // kit_chars [ key ] ) NEW_LINE DEDENT return ans NEW_LINE DEDENT N , M = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE Name = input ( ) NEW_LINE Kit = input ( ) NEW_LINE print ( b_uncle ( N , M , Name , Kit ) ) NEW_LINE

N , M = map ( int , input ( ) . split ( ) ) NEW_LINE n = input ( ) NEW_LINE k = input ( ) NEW_LINE A = [ " A " , " B " , " C " , " D " , " E " , " F " , " G " , " H " , " I " , " J " , " K " , " L " , " M " , " N " , " O " , " P " , " Q " , " R " , " S " , " T " , " U " , " V " , " W " , " X " , " Y " , " Z " ] NEW_LINE a = [ 0 for i in range ( 26 ) ] NEW_LINE for i in range ( len ( n ) ) : NEW_LINE INDENT for j in range ( 26 ) : NEW_LINE INDENT if n [ i ] == A [ j ] : NEW_LINE INDENT a [ j ] += 1 NEW_LINE DEDENT DEDENT DEDENT b = [ 0 for i in range ( 26 ) ] NEW_LINE for l in range ( len ( k ) ) : NEW_LINE INDENT for m in range ( 26 ) : NEW_LINE INDENT if k [ l ] == A [ m ] : NEW_LINE INDENT b [ m ] += 1 NEW_LINE DEDENT DEDENT DEDENT for x in range ( 1 , 51 ) : NEW_LINE INDENT cnt = 0 NEW_LINE for y in range ( 26 ) : NEW_LINE INDENT if a [ y ] <= b [ y ] * x : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if cnt == 26 : NEW_LINE INDENT print ( x ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT print ( - 1 ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; System . out . println ( a + " s " ) ; } }

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

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . ArrayDeque ; import java . util . Queue ; 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 ) { out . println ( in . next ( ) + " s " ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

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

W = input ( ' ' ) NEW_LINE print ( W + ' s ' ) NEW_LINE

def start_process ( ) : NEW_LINE INDENT X , Y , Z , K = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT print ( input ( ) + ' s ' ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

def plural ( w : str ) -> str : NEW_LINE INDENT return w + ' s ' NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT w = input ( ) NEW_LINE ans = plural ( w ) NEW_LINE print ( ans ) NEW_LINE DEDENT

w = input ( ) NEW_LINE w = w + " s " NEW_LINE print ( w ) NEW_LINE

print ( input ( ) . strip ( ) + ' s ' ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long k = sc . nextLong ( ) ; int [ ] p = new int [ 44 ] ; long [ ] a1 = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { long a = sc . nextLong ( ) ; a1 [ i ] = a ; int count = 0 ; while ( a > 0 ) { if ( ( a & 1 ) == 1 ) { p [ count ] ++ ; } a >>= 1 ; count ++ ; } } long [ ] pow = new long [ 44 ] ; pow [ 0 ] = 1 ; for ( int i = 1 ; i < 44 ; i ++ ) { pow [ i ] = pow [ i - 1 ] * 2 ; } long ans = 0 ; for ( int i = 43 ; i >= 0 ; i -- ) { if ( p [ i ] * 2 <= n ) { if ( ans + pow [ i ] <= k ) { ans += pow [ i ] ; } } } long an = 0 ; for ( int i = 0 ; i < n ; i ++ ) { an += ans ^ a1 [ i ] ; } System . out . println ( an ) ; } }

import java . util . * ; import static java . lang . System . * ; public class Main { public static final int MAX_BIT = 39 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long K = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } int [ ] oneBitNums = new int [ MAX_BIT + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j <= MAX_BIT ; j ++ ) { if ( ( A [ i ] >> j & 1 ) == 1 ) { oneBitNums [ j ] ++ ; } } } int [ ] xBits = new int [ MAX_BIT + 1 ] ; for ( int i = MAX_BIT ; i >= 0 ; i -- ) { if ( oneBitNums [ i ] <= N / 2 ) { xBits [ i ] = 1 ; } } long X = 0 ; for ( int i = MAX_BIT ; i >= 0 ; i -- ) { if ( xBits [ i ] == 1 ) { long num = ( long ) Math . pow ( 2.0 , i ) ; if ( X + num <= K ) { X += num ; } } } long ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { ans += X ^ A [ i ] ; } out . println ( ans ) ; } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String [ ] nm = sc . nextLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( nm [ 0 ] ) ; long k = Long . parseLong ( nm [ 1 ] ) ; String [ ] alist = sc . nextLine ( ) . split ( " ▁ " ) ; long [ ] aary = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { aary [ i ] = Long . parseLong ( alist [ i ] ) ; } String [ ] bsary = new String [ n ] ; int maxbslen = 0 ; for ( int i = 0 ; i < n ; i ++ ) { bsary [ i ] = Long . toBinaryString ( aary [ i ] ) ; maxbslen = Math . max ( maxbslen , bsary [ i ] . length ( ) ) ; } long bitcount [ ] = new long [ maxbslen ] ; for ( String bs : bsary ) { for ( int j = bs . length ( ) - 1 ; j >= 0 ; j -- ) { if ( bs . charAt ( j ) == '1' ) { bitcount [ bs . length ( ) - 1 - j ] ++ ; } } } int xdigit = Long . toBinaryString ( k ) . length ( ) ; long x = 0 ; for ( int i = xdigit - 1 ; i >= 0 ; i -- ) { long next = x + ( long ) Math . pow ( 2 , i ) ; if ( next <= k ) { if ( i >= bitcount . length ) { x = next ; } else { if ( bitcount [ i ] <= n / 2 ) { x = next ; } } } } long f = 0 ; for ( long a : aary ) { f += x ^ a ; } System . out . println ( f ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; long K = scanner . nextLong ( ) ; int [ ] digits = new int [ 41 ] ; int t = 0 ; while ( K > 0 ) { if ( K % 2 == 1 ) digits [ t ] = 1 ; K /= 2 ; t ++ ; } int [ ] numOnes = new int [ 41 ] ; for ( int i = 0 ; i < N ; i ++ ) { long a = scanner . nextLong ( ) ; int j = 0 ; while ( a > 0 ) { if ( a % 2 == 1 ) numOnes [ j ] ++ ; a /= 2 ; j ++ ; } } long [ ] [ ] dp = new long [ 42 ] [ 2 ] ; for ( int i = 40 ; i >= 0 ; i -- ) { long d = 1L << i ; int ones = numOnes [ i ] ; int zeros = N - ones ; if ( digits [ i ] == 0 ) { dp [ i ] [ 0 ] = dp [ i + 1 ] [ 0 ] + d * ones ; if ( dp [ i + 1 ] [ 1 ] > 0 ) dp [ i ] [ 1 ] = dp [ i + 1 ] [ 1 ] + d * Math . max ( ones , zeros ) ; } else { dp [ i ] [ 0 ] = dp [ i + 1 ] [ 0 ] + d * zeros ; dp [ i ] [ 1 ] = dp [ i + 1 ] [ 0 ] + d * ones ; if ( dp [ i + 1 ] [ 1 ] > 0 ) dp [ i ] [ 1 ] = Math . max ( dp [ i ] [ 1 ] , dp [ i + 1 ] [ 1 ] + d * Math . max ( ones , zeros ) ) ; } } System . out . println ( Math . max ( dp [ 0 ] [ 0 ] , dp [ 0 ] [ 1 ] ) ) ; } }

import java . util . Scanner ; public class Main { static int MAX_DIGIT = 60 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long k = Long . parseLong ( sc . next ( ) ) ; long [ ] A = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = Long . parseLong ( sc . next ( ) ) ; } sc . close ( ) ; long res = 0 ; for ( int d = MAX_DIGIT ; d >= - 1 ; -- d ) { if ( d != - 1 && ! ( ( k & 1L << d ) != 0 ) ) continue ; long tmp = 0 ; for ( int e = MAX_DIGIT ; e >= 0 ; -- e ) { long mask = 1L << e ; int num = 0 ; for ( int i = 0 ; i < n ; ++ i ) if ( ( A [ i ] & mask ) != 0 ) ++ num ; if ( e > d ) { if ( ( k & mask ) != 0 ) tmp += mask * ( n - num ) ; else tmp += mask * num ; } else if ( e == d ) { tmp += mask * num ; } else { tmp += mask * Math . max ( num , n - num ) ; } } res = Math . max ( res , tmp ) ; } System . out . println ( res ) ; } }

n , k = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE cnt = [ 0 ] * 50 NEW_LINE for i in a : NEW_LINE INDENT for j in range ( 50 ) : NEW_LINE INDENT if i & ( 1 << j ) == 0 : NEW_LINE INDENT cnt [ j ] += 1 << j NEW_LINE DEDENT else : NEW_LINE INDENT cnt [ j ] -= 1 << j NEW_LINE DEDENT DEDENT DEDENT gg = [ ] NEW_LINE for i in range ( 50 ) : NEW_LINE INDENT gg . append ( [ cnt [ i ] , i ] ) NEW_LINE DEDENT gg . sort ( reverse = True ) NEW_LINE ans = 0 NEW_LINE for i in gg : NEW_LINE INDENT if i [ 0 ] < 0 : NEW_LINE INDENT break NEW_LINE DEDENT if ( 1 << i [ 1 ] ) <= k : NEW_LINE INDENT k -= 1 << i [ 1 ] NEW_LINE ans += i [ 0 ] NEW_LINE DEDENT DEDENT print ( ans + sum ( a ) ) NEW_LINE

num_terms , max_value = map ( int , input ( ) . split ( ) ) NEW_LINE coef = [ int ( a ) for a in input ( ) . split ( ) ] NEW_LINE res = 0 NEW_LINE for i in range ( 40 , - 1 , - 1 ) : NEW_LINE INDENT num_bits = 0 NEW_LINE for a in coef : NEW_LINE INDENT num_bits += ( ( a >> i ) & 1 ) NEW_LINE DEDENT cand = 2 ** i NEW_LINE if ( num_terms - num_bits ) > num_bits and cand <= max_value : NEW_LINE INDENT res += ( num_terms - num_bits ) * cand NEW_LINE max_value -= cand NEW_LINE DEDENT else : NEW_LINE INDENT res += num_bits * cand NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE

from functools import lru_cache NEW_LINE def get_bit ( n , d ) : NEW_LINE INDENT return ( n >> d ) & 1 NEW_LINE DEDENT @ lru_cache ( maxsize = None ) NEW_LINE def xor ( bit , digit ) : NEW_LINE INDENT assert bit in [ 0 , 1 ] NEW_LINE if bit == 0 : NEW_LINE INDENT return bit_counts [ digit ] << digit NEW_LINE DEDENT else : NEW_LINE INDENT return ( N - bit_counts [ digit ] ) << digit NEW_LINE DEDENT DEDENT N , K = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE DIGIT = 50 NEW_LINE bit_counts = [ sum ( [ get_bit ( a , d = d ) for a in A ] ) for d in range ( DIGIT ) ] NEW_LINE dp = [ [ - float ( ' inf ' ) for _ in range ( 2 ) ] for _ in range ( DIGIT + 1 ) ] NEW_LINE dp [ - 1 ] [ 0 ] = 0 NEW_LINE for d in reversed ( range ( DIGIT ) ) : NEW_LINE INDENT k = get_bit ( K , d = d ) NEW_LINE dp [ d ] [ 0 ] = max ( dp [ d ] [ 0 ] , dp [ d + 1 ] [ 0 ] + xor ( bit = k , digit = d ) ) NEW_LINE if k == 1 : NEW_LINE INDENT dp [ d ] [ 1 ] = max ( dp [ d ] [ 1 ] , dp [ d + 1 ] [ 0 ] + xor ( bit = 0 , digit = d ) ) NEW_LINE DEDENT dp [ d ] [ 1 ] = max ( dp [ d ] [ 1 ] , dp [ d + 1 ] [ 1 ] + xor ( bit = 0 , digit = d ) ) NEW_LINE dp [ d ] [ 1 ] = max ( dp [ d ] [ 1 ] , dp [ d + 1 ] [ 1 ] + xor ( bit = 1 , digit = d ) ) NEW_LINE DEDENT print ( max ( dp [ 0 ] ) ) NEW_LINE

def solve ( string ) : NEW_LINE INDENT n , k , * a = map ( int , string . split ( ) ) NEW_LINE if k == 0 : NEW_LINE INDENT x = 0 NEW_LINE DEDENT else : NEW_LINE INDENT l = len ( " { : b } " . format ( k ) ) NEW_LINE base = [ 2 ** ( l - i - 1 ) for i in range ( l ) ] NEW_LINE count = [ 0 ] * l NEW_LINE for _a in a : NEW_LINE INDENT tmp = " { : b } " . format ( _a ) NEW_LINE for i , _f in enumerate ( tmp [ : : - 1 ] ) : NEW_LINE INDENT if i >= l : NEW_LINE INDENT break NEW_LINE DEDENT if _f == "1" : NEW_LINE INDENT count [ l - i - 1 ] += 1 NEW_LINE DEDENT DEDENT DEDENT x = 0 NEW_LINE for _c , _b in zip ( count , base ) : NEW_LINE INDENT if _c < n / 2 and x + _b <= k : NEW_LINE INDENT x += _b NEW_LINE DEDENT DEDENT DEDENT return str ( sum ( [ x ^ _a for _a in a ] ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT print ( solve ( ' \n ' . join ( [ input ( ) , input ( ) ] ) ) ) NEW_LINE DEDENT

import math NEW_LINE n , k = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE bit_num = math . floor ( math . log2 ( max ( max ( a ) , k ) ) ) + 1 NEW_LINE num_one = [ ] NEW_LINE for i in range ( bit_num ) : NEW_LINE INDENT num_one_tmp = 0 NEW_LINE for j in a : NEW_LINE INDENT num_one_tmp += ( j >> i ) & 1 NEW_LINE DEDENT num_one . append ( num_one_tmp ) NEW_LINE DEDENT if k == 0 : NEW_LINE INDENT bit_k = 1 NEW_LINE DEDENT else : NEW_LINE INDENT bit_k = math . floor ( math . log2 ( k ) ) + 1 NEW_LINE DEDENT constant_ans = 0 NEW_LINE for i in range ( bit_k , bit_num ) : NEW_LINE INDENT constant_ans += num_one [ i ] * 2 ** i NEW_LINE DEDENT ans = 0 NEW_LINE for i in range ( bit_k ) [ : : - 1 ] : NEW_LINE INDENT if 2 ** i > k : NEW_LINE INDENT constant_ans += num_one [ i ] * 2 ** i NEW_LINE DEDENT else : NEW_LINE INDENT variant_ans = num_one [ i ] * 2 ** i NEW_LINE for j in range ( i ) : NEW_LINE INDENT if num_one [ j ] >= ( n + 1 ) // 2 : NEW_LINE INDENT variant_ans += num_one [ j ] * 2 ** j NEW_LINE DEDENT else : NEW_LINE INDENT variant_ans += ( n - num_one [ j ] ) * 2 ** j NEW_LINE DEDENT DEDENT ans = max ( ans , constant_ans + variant_ans ) NEW_LINE constant_ans += ( n - num_one [ i ] ) * 2 ** i NEW_LINE k -= 2 ** i NEW_LINE DEDENT DEDENT ans = max ( ans , constant_ans ) NEW_LINE print ( ans ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N == 1 ) { System . out . println ( " Hello ▁ World " ) ; } else { int A = sc . nextInt ( ) , B = sc . nextInt ( ) ; System . out . println ( A + B ) ; } sc . close ( ) ; } }

import java . util . Optional ; import java . util . Scanner ; public class Main { private static final String HELLO_WORLD = " Hello ▁ World " ; public static String process ( TestCase testCase ) { final int N = testCase . N ; switch ( N ) { case 1 : return HELLO_WORLD ; case 2 : { final int A = unsafeGet ( testCase . A , " A " ) ; final int B = unsafeGet ( testCase . B , " B " ) ; return String . valueOf ( A + B ) ; } default : { throw unknownN ( N ) ; } } } private static int unsafeGet ( Optional < Integer > argument , String argumentName ) { return argument . orElseThrow ( ( ) -> new IllegalArgumentException ( " Missing ▁ Argument ▁ " + argumentName ) ) ; } public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final String result = process ( testCase ) ; output ( result ) ; } private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; switch ( N ) { case 1 : { sc . close ( ) ; return new TestCase ( N ) ; } case 2 : { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; sc . close ( ) ; return new TestCase ( N , A , B ) ; } default : { throw unknownN ( N ) ; } } } private static IllegalArgumentException unknownN ( int N ) { return new IllegalArgumentException ( " Unknown ▁ N : ▁ " + N ) ; } private static void output ( String result ) { System . out . println ( result ) ; } public static class TestCase { final int N ; final Optional < Integer > A ; final Optional < Integer > B ; public TestCase ( int N ) { this . N = N ; this . A = Optional . empty ( ) ; this . B = Optional . empty ( ) ; } public TestCase ( int N , int A , int B ) { this . N = N ; this . A = Optional . of ( A ) ; this . B = Optional . of ( B ) ; } } }

import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; if ( n == 1 ) { out . println ( " Hello ▁ World " ) ; } else { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; out . println ( a + b ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int n ; n = Integer . parseInt ( sc . next ( ) ) ; if ( n == 1 ) { System . out . println ( " Hello ▁ World " ) ; } if ( n == 2 ) { int a , b ; a = Integer . parseInt ( sc . next ( ) ) ; b = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( a + b ) ; } } catch ( Exception e ) { System . out . println ( " out " ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; String result = " " ; if ( N == 1 ) { result = " Hello ▁ World " ; } else { int A = reader . nextInt ( ) ; int B = reader . nextInt ( ) ; result = Integer . toString ( A + B ) ; } reader . close ( ) ; System . out . print ( result ) ; } }

N = int ( input ( ) ) NEW_LINE if N == 1 : NEW_LINE INDENT print ( " Hello ▁ World " ) NEW_LINE DEDENT else : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE B = int ( input ( ) ) NEW_LINE print ( A + B ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE if ( N == 2 ) : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE B = int ( input ( ) ) NEW_LINE print ( int ( A + B ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Hello ▁ World " ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE if N == 1 : NEW_LINE INDENT print ( ' Hello ▁ World ' ) NEW_LINE exit ( ) NEW_LINE DEDENT else : NEW_LINE INDENT l = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT l . append ( int ( input ( ) ) ) NEW_LINE DEDENT DEDENT print ( sum ( l ) ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( " Hello ▁ World " ) NEW_LINE DEDENT if n == 2 : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE print ( a + b ) NEW_LINE DEDENT DEDENT

a = int ( input ( ) ) NEW_LINE if a == 1 : NEW_LINE INDENT print ( " Hello ▁ World " ) NEW_LINE DEDENT elif a == 2 : NEW_LINE INDENT b = int ( input ( ) ) NEW_LINE c = int ( input ( ) ) NEW_LINE print ( b + c ) NEW_LINE DEDENT


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m , p , q , r ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; p = sc . nextInt ( ) ; q = sc . nextInt ( ) ; r = sc . nextInt ( ) ; int [ ] [ ] mat = new int [ n ] [ m ] ; for ( int i = 0 ; i < r ; ++ i ) { int x , y , z ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; z = sc . nextInt ( ) ; -- x ; -- y ; mat [ x ] [ y ] = z ; } int ans = 0 ; for ( int s = 0 ; s < 1 << n ; ++ s ) { if ( Integer . bitCount ( s ) != p ) continue ; int [ ] a = new int [ m ] ; for ( int i = 0 ; i < m ; ++ i ) { for ( int j = 0 ; j < n ; ++ j ) { if ( ( ( s >> j ) & 1 ) > 0 ) { a [ i ] += mat [ j ] [ i ] ; } } } Arrays . sort ( a ) ; int tmp = 0 ; for ( int i = 0 ; i < q ; ++ i ) { tmp += a [ a . length - 1 - i ] ; } ans = Math . max ( ans , tmp ) ; } System . out . println ( ans ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; final int P = sc . nextInt ( ) ; final int Q = sc . nextInt ( ) ; final int R = sc . nextInt ( ) ; int [ ] x = new int [ R ] ; int [ ] y = new int [ R ] ; int [ ] z = new int [ R ] ; for ( int i = 0 ; i < R ; i ++ ) { x [ i ] = sc . nextInt ( ) - 1 ; y [ i ] = sc . nextInt ( ) - 1 ; z [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int max = ( int ) Math . pow ( 2 , N ) ; int ans = 0 ; for ( int i = 1 ; i < ( int ) Math . pow ( 2 , N ) ; i ++ ) { String comb = Integer . toBinaryString ( i ) ; int count = 0 ; while ( comb . length ( ) < N ) comb = "0" + comb ; for ( int j = 0 ; j < N ; j ++ ) if ( comb . charAt ( j ) == '1' ) count ++ ; if ( count == P ) { int [ ] boy = new int [ M ] ; for ( int j = 0 ; j < R ; j ++ ) { if ( comb . charAt ( x [ j ] ) == '1' ) boy [ y [ j ] ] += z [ j ] ; } Arrays . sort ( boy ) ; int tmp = 0 ; for ( int j = M - 1 ; j >= M - Q ; j -- ) tmp += boy [ j ] ; ans = Math . max ( tmp , ans ) ; } } System . out . println ( ans ) ; } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int P = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; int [ ] [ ] z = new int [ n ] [ m ] ; for ( int i = 0 ; i < R ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; z [ x - 1 ] [ y - 1 ] = sc . nextInt ( ) ; } HashSet < Integer > boyCan = new HashSet < > ( ) ; calCan ( boyCan , m , Q ) ; int ans = 0 ; for ( Integer w : boyCan ) { int cur = w ; ArrayList < Integer > boys = new ArrayList < > ( ) ; for ( int i = 0 ; i < 19 ; i ++ ) { if ( ( cur & ( 1 << i ) ) > 0 ) boys . add ( i ) ; } int sum = 0 ; PriorityQueue < Integer > pq = new PriorityQueue < > ( ) ; for ( int girl = 0 ; girl < n ; girl ++ ) { int now = 0 ; for ( int boy : boys ) now += z [ girl ] [ boy ] ; pq . add ( now ) ; sum += now ; if ( pq . size ( ) > P ) sum -= pq . poll ( ) ; } ans = Math . max ( ans , sum ) ; } System . out . println ( ans ) ; } static void calCan ( HashSet < Integer > boyCan , int m , int Q ) { for ( int i = 1 ; i <= ( 1 << m ) - 1 ; i ++ ) { if ( numOfOne ( i ) == Q ) boyCan . add ( i ) ; } } static int numOfOne ( int s ) { int cnt = 0 ; while ( s > 0 ) { if ( s % 2 == 1 ) cnt ++ ; s = s / 2 ; } return cnt ; } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , M = sc . nextInt ( ) , P = sc . nextInt ( ) , Q = sc . nextInt ( ) , R = sc . nextInt ( ) ; int choco [ ] [ ] = new int [ N ] [ M ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { choco [ i ] [ j ] = 0 ; } } for ( int i = 0 ; i < R ; i ++ ) { int x = sc . nextInt ( ) - 1 , y = sc . nextInt ( ) - 1 , z = sc . nextInt ( ) ; choco [ x ] [ y ] = z ; } int ans = 0 ; int comb = ( 1 << P ) - 1 ; while ( comb < ( 1 << N ) ) { int men [ ] = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { men [ i ] = 0 ; } for ( int i = 0 ; i < N ; i ++ ) { if ( ( comb >> i & 1 ) == 1 ) { for ( int j = 0 ; j < M ; j ++ ) { men [ j ] += choco [ i ] [ j ] ; } } } Arrays . sort ( men ) ; int cand = 0 ; for ( int i = 0 ; i < Q ; i ++ ) { cand += men [ M - i - 1 ] ; } ans = Math . max ( ans , cand ) ; int x = comb & - comb , y = comb + x ; comb = ( ( comb & ~ y ) / x >> 1 ) | y ; } System . out . println ( ans ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int p = s . nextInt ( ) ; int q = s . nextInt ( ) ; int r = s . nextInt ( ) ; int [ ] [ ] score = new int [ n ] [ m ] ; for ( int i = 0 ; i < r ; i ++ ) { int x = s . nextInt ( ) - 1 ; int y = s . nextInt ( ) - 1 ; score [ x ] [ y ] = s . nextInt ( ) ; } int topScore = 0 ; for ( int i = 0 ; i < ( 1 << n ) ; i ++ ) { boolean [ ] xSelected = new boolean [ n ] ; int xSelectedCount = 0 ; for ( int j = 0 ; j < n ; j ++ ) { xSelected [ j ] = ( i & ( 1 << j ) ) != 0 ; if ( xSelected [ j ] ) { xSelectedCount ++ ; } } if ( xSelectedCount != p ) { continue ; } int [ ] yScore = new int [ m ] ; for ( int k = 0 ; k < m ; k ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( xSelected [ j ] ) { yScore [ k ] += score [ j ] [ k ] ; } } } Arrays . sort ( yScore ) ; int sumScore = 0 ; for ( int k = 0 ; k < q ; k ++ ) { sumScore += yScore [ m - 1 - k ] ; } topScore = Math . max ( topScore , sumScore ) ; } System . out . println ( topScore ) ; } }

import itertools NEW_LINE n , m , p , q , r = map ( int , input ( ) . split ( ) ) NEW_LINE x = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( r ) ] NEW_LINE c = list ( itertools . combinations ( range ( n ) , p ) ) NEW_LINE wata = [ [ 0 ] * m for i in range ( n ) ] NEW_LINE MAX = 0 NEW_LINE for i in x : NEW_LINE INDENT wata [ i [ 0 ] - 1 ] [ i [ 1 ] - 1 ] += i [ 2 ] NEW_LINE DEDENT for i in c : NEW_LINE INDENT mora = [ 0 ] * m NEW_LINE for j in i : NEW_LINE INDENT for k in range ( m ) : NEW_LINE INDENT mora [ k ] += wata [ j ] [ k ] NEW_LINE DEDENT DEDENT mora . sort ( ) NEW_LINE mora = mora [ : : - 1 ] NEW_LINE mora = mora [ : q ] NEW_LINE MAX = max ( MAX , sum ( mora ) ) NEW_LINE DEDENT print ( MAX ) NEW_LINE

N , M , P , Q , R = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE Z = [ [ ] for x in range ( N ) ] NEW_LINE for i in range ( R ) : NEW_LINE INDENT x , y , z = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE Z [ x - 1 ] . append ( ( y - 1 , z ) ) NEW_LINE DEDENT from itertools import combinations NEW_LINE ans = 0 NEW_LINE for C in combinations ( range ( N ) , P ) : NEW_LINE INDENT man = [ 0 ] * M NEW_LINE for c in C : NEW_LINE INDENT for z in Z [ c ] : NEW_LINE INDENT man [ z [ 0 ] ] += z [ 1 ] NEW_LINE DEDENT DEDENT man . sort ( reverse = True ) NEW_LINE ans = max ( ans , sum ( man [ : Q ] ) ) NEW_LINE DEDENT print ( ans ) NEW_LINE

def d_valentine ( N , M , P , Q , R , C ) : NEW_LINE INDENT from itertools import combinations NEW_LINE choco = [ [ 0 ] * M for _ in range ( N ) ] NEW_LINE for row in C : NEW_LINE INDENT choco [ row [ 0 ] - 1 ] [ row [ 1 ] - 1 ] = row [ 2 ] NEW_LINE DEDENT ans = 0 NEW_LINE for girl in combinations ( range ( N ) , P ) : NEW_LINE INDENT target = [ 0 ] * M NEW_LINE for i in girl : NEW_LINE INDENT for j in range ( M ) : NEW_LINE INDENT target [ j ] += choco [ i ] [ j ] NEW_LINE DEDENT DEDENT ans = max ( ans , sum ( sorted ( target , reverse = True ) [ : Q ] ) ) NEW_LINE DEDENT return ans NEW_LINE DEDENT N , M , P , Q , R = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE C = [ [ int ( i ) for i in input ( ) . split ( ) ] for j in range ( R ) ] NEW_LINE print ( d_valentine ( N , M , P , Q , R , C ) ) NEW_LINE

from itertools import combinations NEW_LINE n , m , p , q , r = map ( int , input ( ) . split ( ) ) NEW_LINE combos = list ( combinations ( list ( range ( 0 , n ) ) , p ) ) NEW_LINE ans = 0 NEW_LINE info = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT info . append ( [ 0 ] * m ) NEW_LINE DEDENT for i in range ( r ) : NEW_LINE INDENT a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE info [ a - 1 ] [ b - 1 ] = c NEW_LINE DEDENT combos = list ( combinations ( list ( range ( 0 , n ) ) , p ) ) NEW_LINE for combo in combos : NEW_LINE INDENT temp = [ 0 ] * m NEW_LINE for i in range ( m ) : NEW_LINE INDENT for w in combo : NEW_LINE INDENT temp [ i ] += info [ w ] [ i ] NEW_LINE DEDENT DEDENT temp = sorted ( temp , reverse = True ) NEW_LINE ans = max ( ans , sum ( temp [ : q ] ) ) NEW_LINE DEDENT print ( ans ) NEW_LINE

import itertools NEW_LINE import numpy as np NEW_LINE N , M , P , Q , R = map ( int , input ( ) . split ( ) ) NEW_LINE choco = np . zeros ( ( N , M ) ) NEW_LINE for i in range ( R ) : NEW_LINE INDENT x , y , z = map ( int , input ( ) . split ( ) ) NEW_LINE choco [ x - 1 ] [ y - 1 ] = z NEW_LINE DEDENT seq = [ i for i in range ( N ) ] NEW_LINE ans = 0 NEW_LINE for girls in itertools . combinations ( seq , P ) : NEW_LINE INDENT happiness = np . sum ( choco [ list ( girls ) ] , axis = 0 ) NEW_LINE happiness = sorted ( happiness , key = lambda x : - x ) NEW_LINE ans = max ( ans , sum ( happiness [ : Q ] ) ) NEW_LINE DEDENT print ( int ( ans ) ) NEW_LINE


import java . util . * ; public class Main { static final long MOD = 1000000007L ; static long [ ] [ ] dp ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( n > k ) { dp = new long [ n + k ] [ k + 1 ] ; System . out . println ( combination ( n + k - 1 , k ) ) ; } else { dp = new long [ n + 1 ] [ k % n + 1 ] ; System . out . println ( combination ( n , k % n ) ) ; } } static long combination ( int left , int right ) { if ( right > left - right ) { return combination ( left , left - right ) ; } if ( right == 0 ) { return 1 ; } if ( right == 1 ) { return left ; } if ( dp [ left ] [ right ] != 0 ) { return dp [ left ] [ right ] ; } long val = combination ( left - 1 , right ) + combination ( left - 1 , right - 1 ) ; val %= MOD ; dp [ left ] [ right ] = val ; return val ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int N = sn . nextInt ( ) ; int K = sn . nextInt ( ) ; if ( N > K ) { System . out . println ( nCr ( N + K - 1 , K ) ) ; return ; } int c = K % N ; int r = N - c ; System . out . println ( nCr ( N , r ) ) ; } public static long nCr ( int n , int r ) { long M = 1000000007L ; long dp [ ] [ ] = new long [ 502 ] [ 502 ] ; for ( int i = 0 ; i < 502 ; ++ i ) { for ( int j = 0 ; j < 502 ; ++ j ) { dp [ i ] [ j ] = 0 ; } } dp [ 0 ] [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; ++ i ) { dp [ i ] [ 0 ] = 1 ; for ( int j = 1 ; j <= i + 1 ; ++ j ) { dp [ i ] [ j ] = ( dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j ] ) % M ; } } return dp [ n ] [ r ] ; } }

import math NEW_LINE N , K = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE if K < N : NEW_LINE INDENT ans = math . factorial ( N + K - 1 ) // ( math . factorial ( N + K - 1 - K ) * math . factorial ( K ) ) % ( 10 ** 9 + 7 ) NEW_LINE DEDENT else : NEW_LINE INDENT ans = math . factorial ( N ) // ( math . factorial ( N - K % N ) * math . factorial ( K % N ) ) % ( 10 ** 9 + 7 ) NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE class FactMod ( ) : NEW_LINE INDENT def __init__ ( self , n , mod ) : NEW_LINE INDENT self . mod = mod NEW_LINE self . f = [ 1 ] * ( n + 1 ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT self . f [ i ] = self . f [ i - 1 ] * i % mod NEW_LINE DEDENT self . inv = [ pow ( self . f [ - 1 ] , mod - 2 , mod ) ] NEW_LINE for i in range ( 1 , n + 1 ) [ : : - 1 ] : NEW_LINE INDENT self . inv . append ( self . inv [ - 1 ] * i % mod ) NEW_LINE DEDENT self . inv . reverse ( ) NEW_LINE DEDENT def fact ( self , n ) : NEW_LINE INDENT return self . f [ n ] NEW_LINE DEDENT def comb ( self , n , r ) : NEW_LINE INDENT ret = self . f [ n ] * self . inv [ n - r ] * self . inv [ r ] NEW_LINE ret %= self . mod NEW_LINE return ret NEW_LINE DEDENT DEDENT N , K = map ( int , input ( ) . split ( ) ) NEW_LINE F = FactMod ( N + K , 10 ** 9 + 7 ) NEW_LINE if K >= N : NEW_LINE INDENT print ( F . comb ( N , K % N ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( F . comb ( N - 1 + K , K ) ) NEW_LINE DEDENT

MOD = 10 ** 9 + 7 NEW_LINE N , K = map ( int , input ( ) . split ( ) ) NEW_LINE def nCk ( n , k ) : NEW_LINE INDENT res = 1 NEW_LINE k = min ( n , n - k ) NEW_LINE for i in range ( k ) : NEW_LINE INDENT res *= ( n - i ) NEW_LINE DEDENT for i in range ( k ) : NEW_LINE INDENT res //= ( k - i ) NEW_LINE DEDENT return res NEW_LINE DEDENT res = 0 NEW_LINE if N > K : NEW_LINE INDENT res = nCk ( N - 1 + K , K ) % MOD NEW_LINE DEDENT elif N == K : NEW_LINE INDENT res = 1 NEW_LINE DEDENT else : NEW_LINE INDENT K %= N NEW_LINE res = nCk ( N , K ) % MOD NEW_LINE DEDENT print ( res ) NEW_LINE

class Combination : NEW_LINE INDENT def __init__ ( self , n , mod ) : NEW_LINE INDENT self . fact = [ 1 ] NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT self . fact . append ( self . fact [ - 1 ] * i % mod ) NEW_LINE DEDENT self . inv_fact = [ pow ( self . fact [ i ] , mod - 2 , mod ) for i in range ( n + 1 ) ] NEW_LINE self . mod = mod NEW_LINE DEDENT def factorial ( self , i ) : NEW_LINE INDENT return self . fact [ i ] NEW_LINE DEDENT def inverse_factorial ( self , i ) : NEW_LINE INDENT return self . inv_fact [ i ] NEW_LINE DEDENT def combination ( self , i , j ) : NEW_LINE INDENT return ( self . fact [ i ] * self . inv_fact [ i - j ] * self . inv_fact [ j ] ) % self . mod NEW_LINE DEDENT DEDENT n , k = map ( int , input ( ) . split ( ) ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE comb = Combination ( n + k , MOD ) NEW_LINE if k // n == 0 : NEW_LINE INDENT print ( comb . combination ( k + n - 1 , k ) ) NEW_LINE DEDENT else : NEW_LINE INDENT otoku_enji_num = n - k % n NEW_LINE son_enji_num = n - otoku_enji_num NEW_LINE print ( comb . combination ( n , otoku_enji_num ) ) NEW_LINE DEDENT

N , K = map ( int , input ( ) . split ( ) ) NEW_LINE MOD = int ( 1e9 + 7 ) NEW_LINE M = N + K + 10 NEW_LINE fac , finv , inv = [ 1 ] * M , [ 1 ] * M , [ 1 ] * M NEW_LINE def COMinit ( MAX ) : NEW_LINE INDENT fac [ 0 ] , fac [ 1 ] = 1 , 1 NEW_LINE finv [ 0 ] , finv [ 1 ] = 1 , 1 NEW_LINE inv [ 1 ] = 1 NEW_LINE for i in range ( 2 , MAX ) : NEW_LINE INDENT fac [ i ] = fac [ i - 1 ] * i % MOD NEW_LINE inv [ i ] = MOD - inv [ MOD % i ] * ( MOD // i ) % MOD NEW_LINE finv [ i ] = finv [ i - 1 ] * inv [ i ] % MOD NEW_LINE DEDENT DEDENT def COM ( n , k ) : NEW_LINE INDENT if n < k or n < 0 or k < 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT return fac [ n ] * ( finv [ k ] * finv [ n - k ] % MOD ) % MOD NEW_LINE DEDENT COMinit ( M ) NEW_LINE if N > K : NEW_LINE INDENT print ( COM ( N + K - 1 , N - 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT a = K % N NEW_LINE print ( COM ( N , a ) ) NEW_LINE DEDENT


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] candies = new int [ 2 ] [ n ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { candies [ i ] [ j ] = sc . nextInt ( ) ; } } int max = maxCandies ( candies ) ; System . out . println ( max ) ; } private static int maxCandies ( int [ ] [ ] candies ) { int topSum = 0 ; int bottomDelta = 0 ; int i = 0 ; for ( ; i < candies [ 0 ] . length - 1 ; i ++ ) { bottomDelta += candies [ 1 ] [ i ] - candies [ 0 ] [ i + 1 ] ; if ( bottomDelta < 0 ) bottomDelta = 0 ; topSum += candies [ 0 ] [ i ] ; } topSum += candies [ 0 ] [ i ] + candies [ 1 ] [ i ] ; return topSum + bottomDelta ; } }

import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . function . Consumer ; import java . util . stream . IntStream ; import static java . util . stream . Collectors . toList ; public class Main { private static final Scanner scanner = new Scanner ( System . in ) ; private static final Consumer < List < String > > consumer = solve ( ) ; public static void main ( String [ ] args ) { consumer . accept ( readInput ( ) ) ; } private static List < String > readInput ( ) { final List < String > lineList = new ArrayList < > ( ) ; while ( scanner . hasNextLine ( ) ) { lineList . add ( scanner . nextLine ( ) ) ; } return lineList ; } private static Consumer < List < String > > solve ( ) { return args -> { final List < Integer > firstRow = Arrays . stream ( args . get ( 1 ) . split ( " ▁ " ) ) . map ( Integer :: valueOf ) . collect ( toList ( ) ) ; final List < Integer > secondRow = Arrays . stream ( args . get ( 2 ) . split ( " ▁ " ) ) . map ( Integer :: valueOf ) . collect ( toList ( ) ) ; final Integer ans = IntStream . range ( 0 , firstRow . size ( ) ) . map ( index -> firstRow . subList ( 0 , index + 1 ) . stream ( ) . mapToInt ( Integer :: intValue ) . sum ( ) + secondRow . subList ( index , secondRow . size ( ) ) . stream ( ) . mapToInt ( Integer :: intValue ) . sum ( ) ) . max ( ) . orElse ( - 1 ) ; System . out . println ( ans ) ; } ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] [ ] grid = new int [ 2 ] [ N ] ; for ( int i = 0 ; i < 2 ; i ++ ) { String [ ] temp = reader . readLine ( ) . split ( " [ ▁ ] " ) ; for ( int j = 0 ; j < N ; j ++ ) { grid [ i ] [ j ] = Integer . parseInt ( temp [ j ] ) ; } } System . out . println ( solution ( grid , N ) ) ; } public static int solution ( int [ ] [ ] grid , int N ) { for ( int i = 1 ; i >= 0 ; i -- ) { for ( int j = N - 1 ; j >= 0 ; j -- ) { int current = 0 ; if ( j + 1 < N ) { current = Math . max ( current , grid [ i ] [ j + 1 ] ) ; } if ( i + 1 < 2 ) { current = Math . max ( current , grid [ i + 1 ] [ j ] ) ; } grid [ i ] [ j ] += current ; } } return grid [ 0 ] [ 0 ] ; } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int candies_a = 0 ; int candies_b = 0 ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; a [ 0 ] = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i ++ ) { int tmp = sc . nextInt ( ) ; a [ i ] = a [ i - 1 ] + tmp ; } b [ 0 ] = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i ++ ) { int tmp = sc . nextInt ( ) ; b [ i ] = b [ i - 1 ] + tmp ; } int candies = a [ 0 ] + b [ n - 1 ] ; for ( int i = 1 ; i < n ; i ++ ) { int tmp = a [ i ] + ( b [ n - 1 ] - b [ i - 1 ] ) ; if ( tmp > candies ) { candies = tmp ; } } System . out . print ( candies ) ; } }

import java . util . Scanner ; public class Main { public void main ( Scanner sc ) { int n = sc . nextInt ( ) ; int map [ ] [ ] = new int [ 2 ] [ n ] ; int sum [ ] [ ] = new int [ 2 ] [ n ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { map [ i ] [ j ] = sc . nextInt ( ) ; } } sum [ 0 ] [ 0 ] = map [ 0 ] [ 0 ] ; for ( int j = 1 ; j < n ; j ++ ) { sum [ 0 ] [ j ] = sum [ 0 ] [ j - 1 ] + map [ 0 ] [ j ] ; } sum [ 1 ] [ 0 ] = sum [ 0 ] [ 0 ] + map [ 1 ] [ 0 ] ; for ( int j = 1 ; j < n ; j ++ ) { sum [ 1 ] [ j ] = Math . max ( sum [ 0 ] [ j ] , sum [ 1 ] [ j - 1 ] ) + map [ 1 ] [ j ] ; } System . out . println ( sum [ 1 ] [ n - 1 ] ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } }

N = int ( input ( ) ) NEW_LINE A1 = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE A2 = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE now_gain = sum ( A2 ) + A1 [ 0 ] NEW_LINE max_gain = now_gain NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT now_gain = now_gain - A2 [ i - 1 ] + A1 [ i ] NEW_LINE max_gain = max ( max_gain , now_gain ) NEW_LINE DEDENT print ( max_gain ) NEW_LINE

import numpy as np NEW_LINE def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE N = int ( input ( ) ) NEW_LINE A1 = np . cumsum ( np . array ( inpl ( ) ) ) NEW_LINE A2 = np . cumsum ( np . array ( inpl ( ) ) ) NEW_LINE ans = A1 [ 0 ] + A2 [ - 1 ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT ans = max ( ans , A1 [ i ] + A2 [ - 1 ] - A2 [ i - 1 ] ) NEW_LINE DEDENT print ( ans ) NEW_LINE

n = int ( input ( ) ) NEW_LINE a = [ None ] * 2 NEW_LINE a [ 0 ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a [ 1 ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE dp = [ [ 0 ] * n for i in range ( 2 ) ] NEW_LINE dp [ 0 ] [ 0 ] = a [ 0 ] [ 0 ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT dp [ 1 ] [ i ] = dp [ 0 ] [ i ] + a [ 1 ] [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT dp [ 0 ] [ i ] = dp [ 0 ] [ i - 1 ] + a [ 0 ] [ i ] NEW_LINE dp [ 1 ] [ i ] = max ( dp [ 0 ] [ i ] , dp [ 1 ] [ i - 1 ] ) + a [ 1 ] [ i ] NEW_LINE DEDENT DEDENT print ( dp [ 1 ] [ n - 1 ] ) NEW_LINE

n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; print ( max ( sum ( a [ : i + 1 ] + a [ n + i : ] ) for i in range ( n ) ) ) NEW_LINE

N = int ( input ( ) ) NEW_LINE A = list ( ) NEW_LINE for i in range ( 2 ) : NEW_LINE INDENT A . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT dp = [ [ 0 for i in range ( N + 1 ) ] for j in range ( 2 ) ] NEW_LINE dp [ 0 ] [ 0 ] = A [ 0 ] [ 0 ] NEW_LINE dp [ 1 ] [ 0 ] = A [ 0 ] [ 0 ] + A [ 1 ] [ 0 ] NEW_LINE for j in range ( N - 1 ) : NEW_LINE INDENT dp [ 0 ] [ j + 1 ] = dp [ 0 ] [ j ] + A [ 0 ] [ j + 1 ] NEW_LINE DEDENT for j in range ( N - 1 ) : NEW_LINE INDENT dp [ 1 ] [ j + 1 ] = max ( dp [ 0 ] [ j + 1 ] + A [ 1 ] [ j + 1 ] , dp [ 1 ] [ j ] + A [ 1 ] [ j + 1 ] ) NEW_LINE DEDENT print ( dp [ 1 ] [ N - 1 ] ) 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 = b % a ; if ( c == 0 ) System . out . println ( a + b ) ; else System . out . println ( b - 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 count = 0 ; if ( b % a == 0 ) { count = a + b ; } else { count = b - a ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( count ) ; out . flush ( ) ; scan . close ( ) ; } }

import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( B % A == 0 ) { System . out . println ( A + B ) ; } else { System . out . println ( B - A ) ; } } }

import java . util . Scanner ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { final int A = s . nextInt ( ) ; final int B = s . nextInt ( ) ; System . out . println ( B % A == 0 ? A + B : B - A ) ; } }

import java . util . * ; import java . util . List ; import java . util . ArrayList ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; if ( B % A == 0 ) { System . out . println ( A + B ) ; } else { System . out . println ( B - A ) ; } } }

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

A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( [ A + B , B - A ] [ not ( B % A == 0 ) ] ) NEW_LINE

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

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( a + b if b % a == 0 else b - a ) NEW_LINE

i = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if ( i [ 1 ] % i [ 0 ] ) == 0 : NEW_LINE INDENT print ( i [ 0 ] + i [ 1 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( i [ 1 ] - i [ 0 ] ) NEW_LINE DEDENT


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

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int N = sc . nextInt ( ) ; System . out . println ( " ABC " + N ) ; } }

import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; String S = sc . next ( ) ; out . println ( " ABC " + S ) ; out . flush ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( " ABC " + N ) ; } }

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

N = input ( ) NEW_LINE print ( ' ABC ' + N ) NEW_LINE

print ( ' ABC { } ' . format ( input ( ) ) ) NEW_LINE

n = input ( ) NEW_LINE print ( " ABC " + str ( n ) ) NEW_LINE

a = input ( ) NEW_LINE print ( " ABC " + a ) NEW_LINE

N = input ( ) NEW_LINE print ( " ABC " + N ) NEW_LINE