# import ipdb   class ReaderHelper ( object ) :   def __init__ ( self ) : self . currentLine = None self . currentIndex = - 1   def __call__ ( self ) : try : # ipdb . set_trace ( ) self . currentIndex += 1 if not self . currentLine or self . currentIndex >= len ( self . currentLine ) : self . currentIndex = 0 self . currentLine = raw_input ( ) . split ( ) return self . currentLine [ self . currentIndex ]   except EOFError : return None   next = ReaderHelper ( ) def next_int ( ) : return int ( next ( ) )    def main ( ) : n , m = next_int ( ) , next_int ( ) cluster1 , cluster2 = [ ] , [ ] size_a , size_b = 0 , 0   for i in xrange ( n ) : cluster1 . append ( next_int ( ) ) size_a += cluster1 [ i ]   for i in xrange ( m ) : cluster2 . append ( next_int ( ) ) size_b += cluster2 [ i ] cluster1 . sort ( ) cluster2 . sort ( ) max_a , max_b = size_b + size_a - cluster1 [ n - 1 ] , size_b + size_a - cluster2 [ m - 1 ] # moving from B to A i = 1 while i < n and max_a + size_b - cluster1 [ n - i - 1 ] < max_a : max_a = max_a + size_b - cluster1 [ n - i - 1 ] i += 1 # moving from A to B i = 1 while i < m and max_b + size_a - cluster2 [ m - i - 1 ] < max_b : max_b = max_b + size_a - cluster2 [ m - i - 1 ] i += 1 if max_a > max_b : max_a = max_b print max_a   " " " ▁ ▁ ▁ ▁ Suppose ▁ that ▁ we ▁ move ▁ all ▁ elements ▁ from ▁ B ▁ to ▁ A . ▁ ▁ ▁ ▁ ▁ then ▁ we ▁ need ▁ to ▁ maximize ▁ B * k + A - a _ 1 - a _ 2 - a _ 3 - . . . - a _ k TABSYMBOL " " "     	    main ( )

import java . util . List ; import java . util . Scanner ; import java . io . OutputStream ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } }   class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int m , n ; m = in . nextInt ( ) ; n = in . nextInt ( ) ; ArrayList < Long > Ai = new ArrayList < Long > ( m ) ; Long sumA = new Long ( 0 ) ; for ( int i = 0 ; i < m ; ++ i ) { Ai . add ( in . nextLong ( ) ) ; sumA += Ai . get ( i ) ; } ArrayList < Long > Bi = new ArrayList < Long > ( n ) ; Long sumB = new Long ( 0 ) ; for ( int i = 0 ; i < n ; ++ i ) { Bi . add ( in . nextLong ( ) ) ; sumB += Bi . get ( i ) ; } Collections . sort ( Ai ) ; Collections . sort ( Bi ) ; Long As = sumA ; Long Bs = sumB ; for ( int i = 0 ; i < Ai . size ( ) - 1 ; ++ i ) { Bs += min ( Ai . get ( i ) , sumB ) ; } for ( int i = 0 ; i < Bi . size ( ) - 1 ; ++ i ) { As += min ( Bi . get ( i ) , sumA ) ; } out . println ( min ( As , Bs ) ) ; } private Long min ( Long a , Long b ) { return a > b ? b : a ; } }

import java . util . * ; import java . io . * ; public class b { public static void main ( String [ ] args ) throws IOException { input . init ( System . in ) ; int n = input . nextInt ( ) , m = input . nextInt ( ) ; int [ ] as = new int [ n ] , bs = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) as [ i ] = input . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) bs [ i ] = input . nextInt ( ) ; System . out . println ( Math . min ( go ( as , bs ) , go ( bs , as ) ) ) ; } static long go ( int [ ] a , int [ ] b ) { long sum = 0 ; for ( int x : b ) sum += x ; long res = 0 ; int max = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { max = Math . max ( max , a [ i ] ) ; res += Math . min ( a [ i ] , sum ) ; } return res + sum - Math . min ( max , sum ) ; } public static class input { static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( " " ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) {

m , n = [ int ( x ) for x in raw_input ( ) . strip ( ) . split ( ) ] pm = [ int ( x ) for x in raw_input ( ) . strip ( ) . split ( ) ] pn = [ int ( x ) for x in raw_input ( ) . strip ( ) . split ( ) ] pm . sort ( ) pn . sort ( ) best = 10 ** 20   def coalesce ( first , second ) : ss = sum ( second ) totalcost = ss biggestb = max ( second ) coal = first [ - 1 ] ss = sum ( second ) for i in range ( len ( first ) - 1 ) : if coal < biggestb : coal += first [ i ] totalcost += first [ i ] continue if first [ i ] <= ss : coal += first [ i ] totalcost += first [ i ] else : totalcost += ss if coal < biggestb : return 10 ** 20 return totalcost best = min ( best , coalesce ( pm , pn ) ) best = min ( best , coalesce ( pn , pm ) )   if best == 10 ** 20 : best = 0 for i in pm : for j in pn : best += min ( i , j )   print best NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; Main m = new Main ( ) ; while ( t -- > 0 ) { m . run ( in , out ) ; } out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import java . util . StringTokenizer ; import java . util . TreeMap ;    public class Main implements Runnable { int n , m ; static boolean use_n_tests = true ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) {

import java . util . Scanner ;   public class MemeProblem { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long p = 1 , c = 0 ; while ( Math . pow ( 10 , p ) - 1 <= b ) { c += a ; p ++ ; } System . out . println ( c ) ; } } }

t = int ( input ( ) ) for _ in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) m = str ( m ) if len ( set ( m ) ) == 1 and m [ - 1 ] == '9' : print ( n * ( len ( m ) ) ) else : print ( n * ( len ( m ) - 1 ) ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : c = 0 a , b = input ( ) . split ( ) a = int ( a ) b = int ( b ) flg = 0 if ( b < 9 ) : print ( "0" ) else : while ( b != 0 ) : x = b % 10 if ( x != 9 ) : flg = 1 c = c + 1 b = int ( b / 10 ) if ( flg == 1 ) : c = c - 1 v = a * c print ( v ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : l = list ( input ( ) . split ( ) ) a = l [ 0 ] b = l [ 1 ] x = len ( b ) if ( '9' * len ( b ) != b ) : x = x - 1 print ( int ( a ) * x ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) print ( a * ( len ( str ( b + 1 ) ) - 1 ) ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ; import java . util . Stack ;    public class Main { public static class FastReader { BufferedReader br ; StringTokenizer root ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( root == null || ! root . hasMoreTokens ( ) ) { try { root = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception r ) { r . printStackTrace ( ) ; } } return root . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( Exception r ) { r . printStackTrace ( ) ; } return str ; } } public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static int mod = ( int ) ( 1e9 + 7 ) ; static long cf = 998244353 ; static final int MAX = ( int ) ( 1e5 + 1 ) ; static int dfs = 0 , bridges = 0 ; public static List < Integer > [ ] edges ; public static int [ ] [ ] parent ; public static int col = 20 ; public static long [ ] Bit ; public static long [ ] fac , inv ; public static int [ ] prime ; public static long [ ] dp , idx , low ; public static boolean found = false ; public static boolean [ ] vis ; public static TreeSet < Pair > st = new TreeSet < > ( ) ; public static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) {

import java . io . * ; import java . util . * ; @ SuppressWarnings ( " unused " ) public class Solution {

import randomimport sys   def valid ( st ) : return len ( set ( x for x in st ) ) == 4   def comp ( guess , secret ) : b , c = 0 , 0 for i in range ( 4 ) : if secret [ i ] == guess [ i ] : b += 1 elif secret [ i ] in guess : c += 1 return ( b , c )   def check ( guess , secret , bulls , cows ) : b , c = comp ( guess , secret ) return bulls == b and cows == c   def filtered ( candidates , history ) : ret = [ ] for c in candidates : good = True for query , res in history : if not check ( c , query , res [ 0 ] , res [ 1 ] ) : good = False if good : ret . append ( c ) return ret   def next_guess ( candidates , step ) : if step < 2 : return candidates [ random . randint ( 0 , len ( candidates ) - 1 ) ] NEW_LINE

import sys   Secret = "7321" testing = False     def get_response ( query ) : if testing : print ( query ) bulls = 0 cows = 0 for x in range ( len ( query ) ) : if query [ x ] == Secret [ x ] : bulls += 1 elif query [ x ] in Secret : cows += 1 return [ bulls , cows ] else : print ( query ) sys . stdout . flush ( ) return [ int ( x ) for x in input ( ) . split ( " ▁ " ) ]     class CodeforcesTask753BSolution : def __init__ ( self ) : self . result = ' '   def read_input ( self ) : pass   def process_task ( self ) : l = - 1 digi_cnt = [ 0 for x in range ( 10 ) ] mak = False while True : NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int arr [ ] = new int [ n ] ; int prefix [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( i < 2 ) { prefix [ i ] = arr [ i ] ; } else { prefix [ i ] = prefix [ i - 2 ] + arr [ i ] ; } } int suffix [ ] = new int [ n ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( i + 2 >= n ) { suffix [ i ] = arr [ i ] ;   } else { suffix [ i ] = suffix [ i + 2 ] + arr [ i ] ; } } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int left = 0 , right = 0 ; if ( i > 0 ) { left = prefix [ i - 1 ] ; } if ( i + 2 < n ) { left += suffix [ i + 2 ] ; } if ( i > 1 ) { right = prefix [ i - 2 ] ; } if ( i + 1 < n ) { right += suffix [ i + 1 ] ; } if ( left == right ) { count ++ ; }   } System . out . println ( count ) ;   } }

import java . io . * ; import java . util . * ;    public class D { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int n = sc . nextInt ( ) ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } long a [ ] [ ] = new long [ 4 ] [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { a [ 0 ] [ i + 1 ] = arr [ i ] + ( i - 2 < 0 ? 0 : a [ 0 ] [ i - 1 ] ) ;

import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class temp4 { 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 ; } } static class Print { private final BufferedWriter bw ; public Print ( ) { bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; } public void print ( String str ) throws IOException { bw . append ( str ) ; } public void println ( String str ) throws IOException { print ( str ) ; bw . append ( " \n " ) ; } public void close ( ) throws IOException { bw . close ( ) ; } } public static void main ( String [ ] args ) throws IOException { FastReader scn = new FastReader ( ) ;

import java . util . * ; import java . io . * ; public class B { public static FastReader sc = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void taskSolver ( ) { int n = sc . nextInt ( ) ; int ans = 0 ; int arr [ ] = new int [ n + 1 ] ; int oddsuff = 0 ; int evensuff = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( i % 2 == 0 ) evensuff += arr [ i ] ; else oddsuff += arr [ i ] ; } int oddpref = 0 , evenpref = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) evensuff -= arr [ i ] ; else oddsuff -= arr [ i ] ; if ( oddpref + evensuff == evenpref + oddsuff ) ans ++ ; if ( i % 2 == 0 ) evenpref += arr [ i ] ; else oddpref += arr [ i ] ; } out . println ( ans ) ; } public static void main ( String args [ ] ) throws java . lang . Exception { taskSolver ( ) ; out . close ( ) ; } 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 . lang . * ; import java . io . * ;   public class Code { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int odd = 0 ; int even = 0 ; int next = 0 ; int interchange = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( i % 2 == 0 ) { even = even + a [ i ] ; } else { odd = odd + a [ i ] ; } } int count = 0 ; even = even - a [ 0 ] ; interchange = even ; even = odd ; odd = interchange ; if ( odd == even ) { count ++ ; } next = a [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { odd = odd - a [ i ] + next ; } else { even = even - a [ i ] + next ; } if ( odd == even ) { count ++ ; } next = a [ i ] ; } System . out . println ( count ) ; } }

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s1 , s2 = 0 , 0 for i in range ( n ) : if i % 2 == 0 : s1 += a [ i ] else : s2 += a [ i ]   ans = 0 pre = 0 ev , od = 0 , 0 for i in range ( n ) : if i % 2 == 0 : s1 -= a [ i ] od += pre else : s2 -= a [ i ] ev += pre if ev + s2 == od + s1 : ans += 1 pre = a [ i ] print ( ans ) NEW_LINE

n = int ( input ( ) ) d = [ 0 ] arr = list ( map ( int , input ( ) . split ( ) ) ) for i , c in enumerate ( arr ) : if i % 2 == 0 : d . append ( d [ - 1 ] + c ) else : d . append ( d [ - 1 ] - c ) ans = 0 for i in range ( 1 , len ( d ) ) : if d [ i - 1 ] == d [ - 1 ] - d [ i ] : ans += 1 print ( ans ) NEW_LINE

n = int ( input ( ) ) A = [ int ( i ) for i in input ( ) . split ( ) ] ans = 0 S = [ 0 , 0 ] for i , a in enumerate ( A ) : S [ i % 2 ] += a S [ 0 ] -= A [ 0 ] if S [ 0 ] == S [ 1 ] : ans += 1 for i in range ( 1 , n ) : S [ i % 2 ] -= A [ i ] S [ i % 2 ] += A [ i - 1 ] if S [ 0 ] == S [ 1 ] : ans += 1 print ( ans ) NEW_LINE

'''   ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Online ▁ Python ▁ Compiler . ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Code , ▁ Compile , ▁ Run ▁ and ▁ Debug ▁ python ▁ program ▁ online . Write ▁ your ▁ code ▁ in ▁ this ▁ editor ▁ and ▁ press ▁ " Run " ▁ button ▁ to ▁ execute ▁ it .   '''   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) m = [ 0 ] * ne = 0 o = 0 for i in range ( n ) : if ( ( i + 1 ) % 2 == 0 ) : e += l [ i ] m [ i ] = 1 else : o += l [ i ] m [ i ] = 2 o -= l [ 0 ] c = 0 if ( e == o ) : c += 1 for i in range ( 1 , n ) : if ( m [ i ] == 1 ) : e -= l [ i ] e += l [ i - 1 ] if ( e == o ) : c += 1 else : o -= l [ i ] o += l [ i - 1 ] if ( e == o ) : c += 1 print ( c ) NEW_LINE


import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . Writer ; import java . util . InputMismatchException ;   public class SpiderMan {   public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ;

import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . Writer ; import java . util . InputMismatchException ; import java . util . Scanner ;   public class SpiderMan {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) odd = 0 even = 0 turn = 0 for i in range ( n ) : if a [ i ] % 2 == 0 : even += 1 if even % 2 != 0 : print ( 1 ) else : print ( 2 ) NEW_LINE

import math   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   e = 0 for i in range ( n ) : e += a [ i ] - 1 if e % 2 == 0 : print ( 2 ) else : print ( 1 ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) v = 0 for i in l : v ^= i - 1 if ( v & 1 ) : print ( 1 ) else : print ( 2 ) NEW_LINE


import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; long k = sc . nextInt ( ) ; if ( k == 1 ) { System . out . println ( n + 1 ) ; return ; } if ( n % k == 0 ) ++ n ; long x = n % k ; System . out . println ( n + ( k - x ) ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class johny { public static void main ( String [ ] args ) { FastScanner scan = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;   long n = scan . nextInt ( ) , k = scan . nextInt ( ) ; out . println ( n + ( k - n % k ) ) ; out . close ( ) ; } static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { try { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }   public String next ( ) { if ( st . hasMoreTokens ( ) ) return st . nextToken ( ) ; try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   public String nextLine ( ) { String line = " " ; if ( st . hasMoreTokens ( ) ) line = st . nextToken ( ) ; else try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } while ( st . hasMoreTokens ( ) ) line += " ▁ " + st . nextToken ( ) ; return line ; } } }

import java . util . * ; import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; out . println ( ( n / k + 1 ) * k ) ; out . close ( ) ; } }

import java . util . * ; import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( ( n / k + 1 ) * k ) ; } }

import java . math . * ; import java . util . * ; import java . io . * ; public class er105b {

n , m = map ( int , input ( ) . split ( ) ) x = n % mif ( x == 0 ) : print ( n + m ) else : print ( n + ( m - x ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ' ▁ ' ) ) if n % k == 0 : print ( n + k ) else : ans = 0 i = n // k while ans < n : ans = k * i i += 1 print ( ans ) NEW_LINE

n , k = map ( int , input ( ) . split ( ' ▁ ' ) ) if n % k == 0 : print ( n + k ) else : ans = 0 i = n // k print ( k * ( i + 1 ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) print ( n + k - ( n % k ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) ceil = ( n + k - 1 ) // kif ceil * k > n : print ( ceil * k ) else : print ( ceil * k + k ) NEW_LINE


import java . util . Scanner ;   public class _30_Chips {   public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ;   int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; boolean [ ] row = new boolean [ n ] ; boolean [ ] col = new boolean [ n ] ; for ( int i = 0 ; i < k ; i ++ ) { int val = scn . nextInt ( ) ; int val2 = scn . nextInt ( ) ; row [ val - 1 ] = true ; col [ val2 - 1 ] = true ; } long ans = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( n % 2 == 1 && i == n / 2 ) { if ( ! row [ i ] || ! col [ i ] ) { ans ++ ; } } else if ( ! row [ i ] || ! col [ i ] ) { ans = ans + ( ( ! row [ i ] && ! col [ i ] ) ? 2 : 1 ) ; } } System . out . println ( ans ) ; }   }

import java . io . * ; import java . util . * ;   public class icpc { public static void main ( String [ ] args ) throws IOException { Reader in = new Reader ( ) ;

import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class Chips {   public static void main ( String [ ] args ) {   InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader sc = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ;

I = inputn , m = map ( int , I ( ) . split ( ) ) b = [ 1 ] * n * 2 b [ 0 ] = b [ n - 1 ] = b [ n ] = b [ 2 * n - 1 ] = 0 for i in range ( m ) : r , c = map ( int , I ( ) . split ( ) ) b [ r - 1 ] = b [ n + c - 1 ] = 0 if n % 2 and b [ n // 2 ] and b [ n + n // 2 ] : b [ n // 2 ] = 0 print ( sum ( b ) ) NEW_LINE


import java . util . Scanner ;   public class RegBracketSeq { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) , d = in . nextInt ( ) ;   in . close ( ) ; System . out . println ( a == d ? c > 0 ? a > 0 ? 1 : 0 : 1 : 0 ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Regular_B_Seq { 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 ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; long cnt1 = in . nextLong ( ) ; long cnt2 = in . nextLong ( ) ; long cnt3 = in . nextLong ( ) ; long cnt4 = in . nextLong ( ) ;   if ( cnt1 == cnt4 ) { if ( cnt3 > 0 ) { if ( cnt1 > 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( 0 ) ; } } else { System . out . println ( 1 ) ; } } else { System . out . println ( 0 ) ; } } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( " " ) ; String next ( ) throws IOException { if ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } long mod = 1000000007 ; void solve ( ) throws IOException { int a = ni ( ) , b = ni ( ) , c = ni ( ) , d = ni ( ) ; if ( a == d && ( c == 0 || a > 0 ) ) out . println ( 1 ) ; else out . println ( 0 ) ; out . flush ( ) ; } int gcd ( int a , int b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long gcd ( long a , long b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long mp ( long a , long p ) { long r = 1 ; while ( p > 0 ) { if ( ( p & 1 ) == 1 ) r = ( r * a ) % mod ; p >>= 1 ; a = ( a * a ) % mod ; } return r ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } }

import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class a { static int [ ] count , count1 ; static long [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr ; static Character [ ] [ ] mat , mat1 ; static int x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e6 ; static long mod = 998244353l ;

cnt = [ ]   for i in range ( 4 ) : cnt . append ( int ( input ( ) ) ) if ( cnt [ 0 ] == cnt [ 3 ] and ( cnt [ 2 ] == 0 or cnt [ 0 ] > 0 ) ) : print ( 1 ) else : print ( 0 ) NEW_LINE

import sysimport mathimport itertoolsimport functoolsimport collectionsimport operatorimport fileinputimport copyfrom collections import * ORDA = 97 NEW_LINE

cnt1 = int ( input ( ) ) cnt2 = int ( input ( ) ) cnt3 = int ( input ( ) ) cnt4 = int ( input ( ) ) if cnt1 == cnt4 and ( cnt3 == 0 or cnt1 ) : print ( 1 ) else : print ( 0 ) NEW_LINE

import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) ''' cnt1 = int ( input ( ) ) cnt2 = int ( input ( ) ) cnt3 = int ( input ( ) ) cnt4 = int ( input ( ) ) if cnt1 + cnt3 + cnt4 == 0 : print ( 1 ) elif ( cnt1 * 2 + cnt3 == cnt3 + cnt4 * 2 ) and cnt1 != 0 and cnt4 != 0 : print ( 1 ) else : print ( 0 ) NEW_LINE


import java . util . Scanner ;   public class B1447 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; int sum = 0 ; int min = Integer . MAX_VALUE ; int negative = 0 ; for ( int r = 0 ; r < R ; r ++ ) { for ( int c = 0 ; c < C ; c ++ ) { int a = in . nextInt ( ) ; if ( a < 0 ) { negative ++ ; } a = Math . abs ( a ) ; sum += a ; min = Math . min ( min , a ) ; } } int answer = ( negative % 2 == 0 ) ? sum : ( sum - 2 * min ) ; System . out . println ( answer ) ; } }   }

import java . util . Scanner ;   public class _0712NumbersBox {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long min = Long . MAX_VALUE ; long sum = 0 ; long pos = 0 ; long neg = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { long temp = sc . nextLong ( ) ; if ( temp > 0 ) { pos ++ ; } else { neg ++ ; } sum += Math . abs ( temp ) ; min = Math . min ( min , Math . abs ( temp ) ) ; } } if ( neg % 2 != 0 ) { sum -= 2 * min ; } System . out . println ( sum ) ; cases -- ; } } }

import java . util . * ; import static java . lang . Math . abs ; import static java . lang . Math . min ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ;   while ( t -- > 0 ) {   int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = input . nextInt ( ) ; } }   int sum = 0 , neg = 0 , min = abs ( a [ 0 ] [ 0 ] ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) {   if ( a [ i ] [ j ] < 0 ) { neg ++ ; } min = min ( abs ( a [ i ] [ j ] ) , min ) ; sum += abs ( a [ i ] [ j ] ) ; } } System . out . println ( ( neg % 2 == 0 ) ? sum : sum - 2 * min ) ; } } }

import java . io . * ; import java . util . StringTokenizer ;

for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE d = list ( ) NEW_LINE s = 0 NEW_LINE ans = 0 NEW_LINE l = list ( ) NEW_LINE for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for k in a : if NEW_LINE k < 0 : ans += 1 NEW_LINE s += abs ( k ) NEW_LINE l . append ( abs ( k ) ) NEW_LINE if ans % 2 == 1 : s = s - 2 * min ( l ) NEW_LINE print ( s ) NEW_LINE

def solve ( ) : pass NEW_LINE   t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE cnt_negative , min_value , sm = 0 , 100 , 0 NEW_LINE for i in range ( n ) : for NEW_LINE x in map ( int , input ( ) . split ( ) ) : min_value = min ( min_value , abs ( x ) ) NEW_LINE sm += abs ( x ) NEW_LINE if x < 0 : cnt_negative += 1 NEW_LINE if cnt_negative % 2 == 0 : NEW_LINE INDENT print ( sm ) else : NEW_LINE print ( sm - 2 * min_value ) NEW_LINE DEDENT

R = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE t , = R ( ) NEW_LINE for _ in [ 0 ] * t : n , m = R ( ) ; a = [ ] ; f = 0 NEW_LINE for _ in [ 0 ] * n : for NEW_LINE x in R ( ) : a += abs ( x ) , ; NEW_LINE f ^= x < 0 NEW_LINE print ( sum ( a ) - 2 * min ( a ) * f ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE c = 0 NEW_LINE s = 0 NEW_LINE min1 = 999999 NEW_LINE for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for j in a : if NEW_LINE INDENT ( j < 0 ) : c += 1 NEW_LINE DEDENT s += abs ( j ) NEW_LINE min1 = min ( min1 , abs ( j ) ) NEW_LINE


import java . util . * ; import java . io . * ;   public class AlyonaAndTree { static int n ; static int [ ] a ; static ArrayList < Edge > [ ] tree ;   static int [ ] [ ] lift ; static long [ ] depth ; static int d ; static int [ ] add ; static int [ ] low ; static int [ ] hig ; static int [ ] ans ;   public static void main ( String [ ] args ) { JS scan = new JS ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; n = scan . nextInt ( ) ; a = new int [ n ] ; tree = new ArrayList [ n ] ; add = new int [ n ] ; low = new int [ n ] ; hig = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; tree [ i ] = new ArrayList < Edge > ( ) ; } d = Integer . numberOfTrailingZeros ( Integer . highestOneBit ( n ) ) + 1 ; depth = new long [ n ] ; lift = new int [ d ] [ n ] ; for ( int k = 0 ; k < d ; k ++ ) Arrays . fill ( lift [ k ] , - 1 ) ; for ( int i = 1 ; i < n ; i ++ ) { int p = scan . nextInt ( ) - 1 ; int w = scan . nextInt ( ) ; tree [ p ] . add ( new Edge ( i , w ) ) ; } dfs ( 0 ) ; for ( int k = 1 ; k < d ; k ++ ) for ( int i = 0 ; i < n ; i ++ ) if ( lift [ k - 1 ] [ i ] != - 1 ) lift [ k ] [ i ] = lift [ k - 1 ] [ lift [ k - 1 ] [ i ] ] ; for ( int i = 0 ; i < n ; i ++ ) { int lo = 0 ; int hi = d - 1 ; int at = i ; int count = 0 ;

from itertools import accumulatefrom math import * import os , sysimport threadingfrom io import BytesIOfrom bisect import bisect_left   input = BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) e = { } g = [ [ ] for i in range ( n ) ] d = [ 0 ] * ( n + 5 ) ans = [ 0 ] * np = [ 0 ] * ( n + 5 ) for i in range ( n - 1 ) : c , w = map ( int , input ( ) . split ( ) ) c -= 1 g [ c ] . append ( i + 1 ) e [ i + 1 ] = w def dfs ( i , h ) : global ans , a , e , g , d , p p [ h ] = 0 for j in g [ i ] : d [ h + 1 ] = d [ h ] + e [ j ] dfs ( j , h + 1 ) x = bisect_left ( d , d [ h ] - a [ i ] , 0 , h + 1 ) NEW_LINE

import sysimport threadingfrom bisect import bisect_left   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) e = { } g = [ [ ] for i in range ( n ) ] d = [ 0 ] * ( n + 5 ) ans = [ 0 ] * np = [ 0 ] * ( n + 5 )   for i in range ( n - 1 ) : c , w = map ( int , input ( ) . split ( ) ) c -= 1 g [ c ] . append ( i + 1 ) e [ i + 1 ] = w   def dfs ( i , h ) : global ans , a , e , g , d , p p [ h ] = 0 for j in g [ i ] : d [ h + 1 ] = d [ h ] + e [ j ] dfs ( j , h + 1 ) x = bisect_left ( d , d [ h ] - a [ i ] , 0 , h + 1 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class alpha1b {

import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class pca2 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;

import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;

import java . util . Locale ; import java . util . Scanner ;   public class B808 {   public static void main ( String [ ] args ) { Locale . setDefault ( Locale . US ) ; Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; double sum = 0 ; for ( int n = 1 ; n <= N ; n ++ ) { int a = in . nextInt ( ) ; double count = Math . min ( Math . min ( n , N + 1 - n ) , Math . min ( K , N - K + 1 ) ) ; sum += a * count ; } sum /= N - K + 1 ; System . out . println ( sum ) ; }   }

n , k = [ int ( j ) for j in input ( ) . split ( ) ] nums = [ int ( j ) for j in input ( ) . split ( ) ] s = sum ( nums [ : k ] ) tot = sp1 , p2 = 0 , kfor j in range ( n - k ) : s -= nums [ p1 ] s += nums [ p2 ] tot += s p1 += 1 p2 += 1 print ( tot / ( n - k + 1 ) ) NEW_LINE

n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) r , s , x = n - k + 1 , 0 , [ ] x . append ( a [ 0 ] ) for i in range ( 1 , n + 1 ) : x . append ( x [ i - 1 ] + a [ i - 1 ] ) for i in range ( k , n + 1 ) : s += x [ i ] - x [ i - k ] print ( s / r ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) )   A = list ( map ( int , input ( ) . split ( ) ) )   acc = sum ( [ min ( i + 1 , n - i , n - k + 1 , k ) * A [ i ] for i in range ( n ) ] )   print ( acc / ( n - k + 1 ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) )   ss = 0 c = 0 l = 0 f = 0 for i in range ( len ( x ) ) : ss += x [ i ] if ( i == m - 1 and l == 0 ) : c += ss l = 1 elif ( l == 1 ) : ss -= x [ f ] c += ss f += 1                     print ( c / ( n - m + 1 ) ) NEW_LINE

n , k = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   li = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) sum = 0 for x in range ( k ) : sum = sum + li [ x ]   i = 0j = kres = sumfor x in range ( n - k ) : sum = sum - li [ i ] + li [ j ] res = res + sum   i += 1 j += 1     print ( res / ( n - k + 1 ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . lang . * ;    public class graph { static long mod = 10000_00007 ; public static void main ( String [ ] args ) throws Exception { InputStreamReader ip = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( ip ) ;

import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . time . LocalTime ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ;    import java . math . * ;     public class A {   static boolean found ; public static void main ( String [ ] args ) { FastScanner scan = new FastScanner ( ) ; int t = 1 ;

n , m , k = map ( int , input ( ) . split ( ) ) e = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( m ) ] if k : a = set ( map ( int , input ( ) . split ( ) ) ) else : a = set ( ) ans = - 1 for i in e : if i [ 0 ] in a and i [ 1 ] not in a or i [ 1 ] in a and i [ 0 ] not in a : if ans == - 1 : ans = i [ 2 ] else : ans = min ( ans , i [ 2 ] ) print ( ans ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) if k == 0 : print ( - 1 ) else : city = [ 0 ] * ( n + 1 ) a = [ ] for i in range ( m ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( k ) : city [ b [ i ] ] = 1 mini = 10000000000 for i in range ( m ) : if city [ a [ i ] [ 0 ] ] == 1 and city [ a [ i ] [ 1 ] ] == 0 : if a [ i ] [ 2 ] < mini : mini = a [ i ] [ 2 ] elif city [ a [ i ] [ 0 ] ] == 0 and city [ a [ i ] [ 1 ] ] == 1 : if a [ i ] [ 2 ] < mini : mini = a [ i ] [ 2 ] if mini == 10000000000 : print ( - 1 ) else : print ( mini ) NEW_LINE

import sysinput = sys . stdin . readline   x , y , z = map ( int , input ( ) . split ( ) ) dict1 = { } for _ in range ( y ) : a , b , c = map ( int , input ( ) . split ( ) ) if a in dict1 . keys ( ) : dict1 [ a ] . append ( [ b , c ] ) else : dict1 [ a ] = [ [ b , c ] ] if b in dict1 . keys ( ) : dict1 [ b ] . append ( [ a , c ] ) else : dict1 [ b ] = [ [ a , c ] ] ans = 1e18 if z : * li , = map ( int , input ( ) . split ( ) ) li = set ( li ) for i in dict1 . keys ( ) : for j in dict1 [ i ] : if i in li and j [ 0 ] in li : continue elif i in li or j [ 0 ] in li : ans = min ( ans , j [ 1 ] ) print ( - 1 if ans == 1e18 else ans ) NEW_LINE

from sys import stdin   input_1 = stdin . readline ( ) . split ( )   cities = int ( input_1 [ 0 ] ) roads = int ( input_1 [ 1 ] ) warehouses = int ( input_1 [ 2 ] )   graph = [ dict ( ) for _ in range ( cities ) ]   if warehouses == 0 or warehouses >= cities :   print ( ' - 1' )   else :   for i in range ( roads ) :   new_road = stdin . readline ( ) . split ( )   city_1 = int ( new_road [ 0 ] ) city_2 = new_road [ 1 ] length = int ( new_road [ 2 ] )   if graph [ city_1 - 1 ] . setdefault ( city_2 , length ) > length : graph [ city_1 - 1 ] [ city_2 ] = length   city_1 , city_2 = int ( city_2 ) , str ( city_1 )   if graph [ city_1 - 1 ] . setdefault ( city_2 , length ) > length : graph [ city_1 - 1 ] [ city_2 ] = length   warehouse_cities = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   shortest_road = None   for warehouse_city in warehouse_cities :   for city , road in graph [ warehouse_city - 1 ] . items ( ) :   if int ( city ) not in warehouse_cities and ( not shortest_road or road < shortest_road ) : shortest_road = road     if shortest_road : print ( shortest_road ) else : print ( ' - 1' )   NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class DigestThread {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = in . nextInt ( ) ; int sumA = 0 , sumB = 0 ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; for ( int k = n - 1 ; k >= 0 ; k -- ) { if ( sumA >= sumB ) { sumB += a [ k ] ; } else { sumA += a [ k ] ; } } if ( sumA == sumB ) System . out . println ( " YES " ) ; else System . out . println ( " No " ) ; } } }

import java . util . Scanner ;   public class B1472 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) , weight = 0 ; for ( int j = 0 ; j < n ; j ++ ) { int a = scanner . nextInt ( ) ; weight += a ; } if ( n % 2 == 1 ) { if ( weight == 2 * n ) { System . out . println ( " NO " ) ; continue ; } } if ( weight % 2 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

import java . util . * ;   public class B_Fair_Division { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { int n = sc . nextInt ( ) ; int ar [ ] = new int [ n ] ; int i = 0 ; int s = 0 ; for ( i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; s += ar [ i ] ; } if ( s % 2 != 0 ) { System . out . println ( " NO " ) ; continue ; } boolean dp [ ] [ ] = new boolean [ n + 1 ] [ s + 1 ] ; int j = 0 ; for ( i = 0 ; i <= s ; i ++ ) { dp [ 0 ] [ i ] = false ; } for ( i = 0 ; i <= n ; i ++ ) { dp [ i ] [ 0 ] = true ; } for ( i = 1 ; i <= n ; i ++ ) { for ( j = 1 ; j <= s ; j ++ ) { dp [ i ] [ j ] = dp [ i - 1 ] [ j ] ; if ( j - ar [ i - 1 ] >= 0 ) dp [ i ] [ j ] = dp [ i ] [ j ] || dp [ i - 1 ] [ j - ar [ i - 1 ] ] ; } } if ( dp [ n ] [ s / 2 ] ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( n -- > 0 ) { int m = sc . nextInt ( ) ; int ones = 0 ; int twos = 0 ; while ( m -- > 0 ) { if ( sc . nextInt ( ) == 1 ) { ones ++ ; } else { twos ++ ; } } if ( twos % 2 == 1 ) { if ( ones % 2 == 0 ) { if ( ones >= 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { if ( ones % 2 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int c1 = 0 , c2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int m = sc . nextInt ( ) ; if ( m == 1 ) c1 ++ ; else c2 ++ ; } if ( c1 % 2 == 0 && c1 != 0 ) { System . out . println ( " YES " ) ; continue ; } if ( c1 == 0 && c2 % 2 == 0 ) { System . out . println ( " YES " ) ; continue ; } System . out . println ( " NO " ) ; } } }

n = int ( input ( ) ) NEW_LINE for i in range ( n ) : input ( ) NEW_LINE ls = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = sum ( ls ) NEW_LINE if s % 2 == 1 : NEW_LINE INDENT print ( ' NO ' ) elif s % 2 == 0 : NEW_LINE s = s / 2 NEW_LINE DEDENT if s % 2 == 0 : NEW_LINE INDENT print ( ' YES ' ) elif s % 2 == 1 : NEW_LINE if NEW_LINE DEDENT 1 in ls : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE i = [ int ( a ) for a in input ( ) . split ( ) ] NEW_LINE t , o = i . count ( 1 ) , i . count ( 2 ) NEW_LINE if t % 2 == 0 and ( o % 2 == 0 or t >= 2 ) : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sum = 0 NEW_LINE c1 = 0 NEW_LINE c2 = 0 NEW_LINE for j in range ( len ( a ) ) : sum = sum + a [ j ] NEW_LINE if sum % 2 != 0 : NEW_LINE INDENT print ( ' NO ' ) else : NEW_LINE for NEW_LINE DEDENT j in a : NEW_LINE if j == 1 : NEW_LINE INDENT c1 += 1 else : NEW_LINE c2 += 1 NEW_LINE DEDENT if ( sum % 4 == 0 or ( sum % 4 == 2 and c1 != 0 ) ) : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT

import sys , mathimport NEW_LINE heapq   from collections import NEW_LINE INDENT dequeinput = sys . stdin . readline   NEW_LINE DEDENT

t = int ( input ( ) ) NEW_LINE otv = list ( ) NEW_LINE while ( t != 0 ) : t -= 1 NEW_LINE konf = int ( input ( ) ) NEW_LINE cpisok_konf = list ( ) NEW_LINE cpisok_konf = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sum_konf = sum ( cpisok_konf ) NEW_LINE if ( sum_konf % 2 == 0 and cpisok_konf . count ( 1 ) >= 2 ) : otv . append ( " YES " ) NEW_LINE continue NEW_LINE if ( sum_konf % 2 == 0 and konf % 2 == 0 ) : NEW_LINE INDENT otv . append ( " YES " ) else : NEW_LINE otv . append ( " NO " )   for i in otv : print ( i ) NEW_LINE DEDENT


import java . util . Scanner ;   public class JavaApplication1 {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) ; long k = input . nextLong ( ) ; if ( n % 2 != 0 ) { if ( k <= n / 2 + 1 ) System . out . println ( 2 * k - 1 ) ; else System . out . println ( 2 * ( k - n / 2 - 1 ) ) ; } else { if ( k <= n / 2 ) System . out . println ( 2 * k - 1 ) ; else System . out . println ( 2 * ( k - n / 2 ) ) ; } input . close ( ) ; } }

import java . util . Scanner ;   public class EvenOdds { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( k <= ( n + 1 ) / 2 ) { System . out . println ( k * 2 - 1 ) ; } else { System . out . println ( ( k - ( n + 1 ) / 2 ) * 2 ) ; }   } }

import java . util . * ; import java . lang . Math ;   public class NewClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) , k = sc . nextLong ( ) ; if ( k > Math . ceil ( n / 2.0 ) ) { long num = 0 ; k -= Math . ceil ( n / 2.0 ) ; num += 2 * k ; System . out . println ( num ) ; } else { k -- ; long num = 1 ; num += k * 2 ; System . out . println ( num ) ; } } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {

from math import ceilx = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE

n , k = map ( int , input ( ) . split ( ) )   if k <= ( n + 1 ) // 2 : print ( ( k * 2 ) - 1 ) else : print ( ( k - ( n + 1 ) // 2 ) * 2 ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) if a % 2 == 0 : if b > a / 2 : print ( int ( ( b - a / 2 ) * 2 ) ) else : print ( int ( b * 2 - 1 ) ) else : if b > a // 2 + 1 : print ( int ( ( b - ( a // 2 + 1 ) ) * 2 ) ) else : print ( int ( b * 2 - 1 ) ) NEW_LINE

from math import ceiln , k = map ( int , input ( ) . split ( ) ) if k <= ceil ( n / 2 ) : print ( 2 * k - 1 ) else : print ( ( k - ceil ( n / 2 ) ) * 2 ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Vector ; import java . util . Scanner ; import java . util . Collections ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { Vector < Integer > vec = new Vector < > ( ) ;   void generate ( long number ) { if ( number > ( long ) 1e9 ) return ; vec . add ( ( int ) number ) ; generate ( number * 10 + 4 ) ; generate ( number * 10 + 7 ) ; }   int length ( int l , int r ) { if ( l > r ) return 0 ; return r - l + 1 ; }   int intersect ( int l1 , int r1 , int l2 , int r2 ) { int l = Math . max ( l1 , l2 ) ; int r = Math . min ( r1 , r2 ) ; return length ( l , r ) ; }   public void solve ( int testNumber , Scanner in , PrintWriter out ) { int pl = in . nextInt ( ) , pr = in . nextInt ( ) , vl = in . nextInt ( ) , vr = in . nextInt ( ) , k = in . nextInt ( ) ; generate ( 4 ) ; generate ( 7 ) ; Collections . sort ( vec ) ; double ans = 0 ; for ( int i = k - 1 ; i < vec . size ( ) ; i ++ ) { int bfl , bfr , afl , afr , idx = i - k + 1 ; bfr = vec . elementAt ( idx ) ; if ( idx - 1 < 0 ) bfl = 1 ; else bfl = vec . elementAt ( idx - 1 ) + 1 ; afl = vec . elementAt ( i ) ; if ( i + 1 == vec . size ( ) ) afr = ( int ) 1e9 ; else afr = vec . elementAt ( i + 1 ) - 1 ;

s = list ( ) def rec ( x ) : if x > 100000000000 : return s . append ( x ) rec ( x * 10 + 4 ) rec ( x * 10 + 7 )     def f ( l1 , r1 , l2 , r2 ) : l1 = max ( l1 , l2 ) r1 = min ( r1 , r2 ) return max ( r1 - l1 + 1 , 0 )     def main ( ) : rec ( 0 ) s . sort ( ) args = input ( ) . split ( ) pl , pr , vl , vr , k = int ( args [ 0 ] ) , int ( args [ 1 ] ) , int ( args [ 2 ] ) , int ( args [ 3 ] ) , int ( args [ 4 ] ) ans = 0 i = 1 while i + k < len ( s ) : l1 = s [ i - 1 ] + 1 r1 = s [ i ] l2 = s [ i + k - 1 ] r2 = s [ i + k ] - 1 a = f ( l1 , r1 , vl , vr ) * f ( l2 , r2 , pl , pr ) b = f ( l1 , r1 , pl , pr ) * f ( l2 , r2 , vl , vr ) ans += a + b if k == 1 and a > 0 and b > 0 : ans -= 1 i += 1 all = ( pr - pl + 1 ) * ( vr - vl + 1 ) print ( 1.0 * ans / all )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

import itertools as it       all_lucky = [ ]   for length in range ( 1 , 10 ) : for comb in it . product ( [ '7' , '4' ] , repeat = length ) : all_lucky += [ int ( ' ' . join ( comb ) ) ]   all_lucky . sort ( )   NEW_LINE

def gen_len ( l ) : gen = [ ] for i in range ( 2 ** l ) : k = int ( bin ( i ) [ 2 : ] . rjust ( l , '0' ) . replace ( '0' , '4' ) . replace ( '1' , '7' ) ) if k <= 10 ** 9 : gen . append ( k ) return gen     def pairs_with_k_len ( a , k ) : l = 0 r = k - 1 while r < len ( a ) : yield l , r l += 1 r += 1     def get_intersection_length ( l1 , r1 , l2 , r2 ) : return max ( min ( r1 , r2 ) - max ( l1 , l2 ) + 1 , 0 )     def main ( ) : gen = set ( ) for i in range ( 1 , 10 ) : for e in gen_len ( i ) : gen . add ( e ) gen = list ( sorted ( gen ) )   pl , pr , vl , vr , k = map ( int , input ( ) . split ( ) ) denominator = ( pr - pl + 1 ) * ( vr - vl + 1 ) p = ( pl , pr ) v = ( vl , vr )   count = 0 for l , r in pairs_with_k_len ( gen , k ) : if gen [ l ] >= min ( pl , vl ) and gen [ r ] <= max ( pr , vr ) : l1 = gen [ l - 1 ] if l != 0 else 0 r1 = gen [ l ] l2 = gen [ r ] r2 = gen [ r + 1 ] if r != len ( gen ) - 1 else 10 ** 9 + 1 count += ( get_intersection_length ( l1 + 1 , r1 , pl , pr ) * get_intersection_length ( l2 , r2 - 1 , vl , vr ) ) count += ( get_intersection_length ( l1 + 1 , r1 , vl , vr ) * get_intersection_length ( l2 , r2 - 1 , pl , pr ) ) if k == 1 and get_intersection_length ( vl , vr , pl , pr ) != 0 : count -= 1   print ( f " { ( count ▁ / ▁ denominator ) : . {12 } f } " )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


import java . math . BigInteger ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . InputMismatchException ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; public class Main { static InputReader rd = new InputReader ( System . in ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; solve ( l , r , 1l ) ; System . out . println ( c ) ; } static HashMap < Long , Integer > map = new HashMap < Long , Integer > ( ) ; static int c = 0 ; static void solve ( long l , long r , long n ) { if ( r < n ) { return ; } if ( l <= n && r >= n ) { if ( ! map . containsKey ( n ) ) { c ++ ;

import java . util . HashSet ; import java . util . Scanner ;   public class numbers23 {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; HashSet < Integer > h = new HashSet < Integer > ( ) ; for ( int j = 0 ; Math . pow ( 2 , j ) <= b ; j ++ ) { if ( Math . pow ( 2 , j ) >= a && Math . pow ( 2 , j ) <= b ) { h . add ( ( int ) Math . pow ( 2 , j ) ) ; } if ( Math . pow ( 3 , j ) >= a && Math . pow ( 3 , j ) <= b ) { h . add ( ( int ) Math . pow ( 3 , j ) ) ; }   } for ( int i = 0 ; Math . pow ( 2 , i ) <= b ; i ++ ) { for ( int j = 0 ; Math . pow ( 3 , j ) <= b ; j ++ ) { if ( Math . pow ( 3 , j ) * Math . pow ( 2 , i ) >= a && Math . pow ( 3 , j ) * Math . pow ( 2 , i ) <= b ) { h . add ( ( int ) Math . pow ( 3 , j ) * ( int ) Math . pow ( 2 , i ) ) ; } }   } System . out . println ( h . size ( ) ) ;   } }

count = 0 l , r = map ( int , input ( ) . split ( ) ) for i in range ( 50 ) : for j in range ( 50 ) : if l <= ( 2 ** i ) * ( 3 ** j ) <= r : count += 1 if ( 2 ** i ) * ( 3 ** j ) > r : break   print ( count ) NEW_LINE

import mathl , r = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) NEW_LINE

l , r = map ( int , input ( ) . split ( ) ) max_pow = 0 while 2 ** max_pow <= r : max_pow += 1 ans = set ( ) for i in range ( 0 , max_pow + 1 ) : for j in range ( 0 , max_pow + 1 ) : num = 2 ** i * 3 ** j if l <= num <= r : ans . add ( num ) print ( len ( ans ) ) NEW_LINE

l , r = [ int ( j ) for j in input ( ) . split ( ) ] count = 0 for j in range ( 32 ) : for k in range ( 32 ) : res = ( 2 ** j ) * ( 3 ** k ) if res >= l and res <= r : count += 1 print ( count ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x [ ] = new int [ n + 1 ] ; int y [ ] = new int [ n + 1 ] ; int arr [ ] = new int [ n ] ; int ans = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 0 ) { dfs ( x , y , arr , i ) ; ans ++ ; } } System . out . println ( ans ) ; }   private static void dfs ( int [ ] x , int [ ] y , int [ ] arr , int a ) { arr [ a ] = 1 ; for ( int i = 0 ; i < x . length ; i ++ ) { if ( ( x [ a ] == x [ i ] || y [ a ] == y [ i ] ) && arr [ i ] == 0 ) { dfs ( x , y , arr , i ) ; } } } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Node [ ] gr = new Node [ 4005 ] ; for ( int i = 0 ; i < n ; i ++ ) { int u = sc . nextInt ( ) ; int v = 2000 + sc . nextInt ( ) ; if ( gr [ u ] == null ) { gr [ u ] = new Node ( ) ; } if ( gr [ v ] == null ) { gr [ v ] = new Node ( ) ; } gr [ u ] . adj . add ( v ) ; gr [ v ] . adj . add ( u ) ; } int count = - 1 ; for ( int i = 0 ; i < gr . length ; i ++ ) { if ( gr [ i ] != null && ! gr [ i ] . visited ) { count ++ ; recur ( i , gr ) ; } } System . out . println ( count ) ; } static void recur ( int idx , Node [ ] graph ) { if ( graph [ idx ] . visited ) return ; graph [ idx ] . visited = true ; for ( int adj : graph [ idx ] . adj ) { recur ( adj , graph ) ; } } static class Node { boolean visited ; HashSet < Integer > adj ; public Node ( ) { visited = false ; adj = new HashSet < > ( ) ; } } }

import java . awt . * ; import java . util . * ;   public class Main { static boolean [ ] vis ; public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Point [ ] p = new Point [ n ] ; for ( int i = 0 ; i < n ; i ++ ) p [ i ] = new Point ( sc . nextInt ( ) , sc . nextInt ( ) ) ; vis = new boolean [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! vis [ i ] ) { dfs ( i , n , p ) ; count ++ ; } } System . out . println ( count - 1 ) ; } static void dfs ( int i , int n , Point [ ] p ) { vis [ i ] = true ; for ( int j = 0 ; j < n ; j ++ ) { if ( ! vis [ j ] ) { if ( p [ i ] . x == p [ j ] . x || p [ i ] . y == p [ j ] . y ) { dfs ( j , n , p ) ; } } } } }

n = int ( input ( ) ) a = [ ] k = [ 0 for i in range ( n ) ] for i in range ( n ) : x , y = [ int ( i ) for i in input ( ) . split ( ) ] a . append ( ( x , y ) ) count = 0 queue = [ ] for i in range ( n ) : if ( k [ i ] == 0 ) : queue . append ( i ) k [ i ] = 1 count += 1 while queue : node = queue . pop ( 0 ) for j in range ( n ) : if k [ j ] == 1 : continue if a [ node ] [ 0 ] == a [ j ] [ 0 ] or a [ node ] [ 1 ] == a [ j ] [ 1 ] : queue . append ( j ) k [ j ] = 1 print ( count - 1 ) NEW_LINE

n = int ( input ( ) )   val = 110 x = [ 0 ] * valy = [ 0 ] * valf = [ 0 ] * valcont = 0 def result ( i ) : f [ i ] = 1 for j in range ( 1 , n ) : if ( f [ j ] != 1 and ( x [ i ] == x [ j ] or y [ i ] == y [ j ] ) ) : result ( j ) return for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) x [ i ] = a y [ i ] = b for i in range ( n ) : if ( f [ i ] != 1 ) : result ( i ) cont += 1 print ( cont - 1 ) NEW_LINE

snow_drifts = [ ]   def check_groups ( i ) : snow_drifts [ i ] [ 2 ] = True for j in range ( n ) : if not snow_drifts [ j ] [ 2 ] : if snow_drifts [ i ] [ 0 ] == snow_drifts [ j ] [ 0 ] or snow_drifts [ i ] [ 1 ] == snow_drifts [ j ] [ 1 ] : check_groups ( j )   n = int ( input ( ) ) for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) snow_drifts . append ( [ x , y , False ] )   groups = - 1 for i in range ( n ) : if not snow_drifts [ i ] [ 2 ] : check_groups ( i ) groups += 1   print ( groups ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . PriorityQueue ; import java . util . StringTokenizer ;    @ SuppressWarnings ( " unused " ) public class A { public static FastScannerA scan = new FastScannerA ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ;   public static void solve ( ) { int m = scan . nextInt ( ) , n = scan . nextInt ( ) ; double ans = m ; for ( int i = 1 ; i < m ; i ++ ) { ans -= Math . pow ( ( double ) i / m , n ) ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { solve ( ) ; out . close ( ) ; }   } class FastScannerA { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } void sort ( long [ ] a ) { ArrayList < Long > l = new ArrayList < > ( ) ; for ( long i : a ) l . add ( i ) ; Collections . sort ( l ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = l . get ( i ) ; }   }

m , n = map ( int , input ( ) . split ( ) ) res = 0 for i in range ( m ) : res += float ( ( i + 1 ) * ( pow ( float ( i + 1 ) / float ( m ) , n ) - pow ( float ( i ) / float ( m ) , n ) ) ) print ( res ) NEW_LINE

from math import pow   m , n = map ( int , input ( ) . split ( ) ) r = 0 for i in range ( m ) : r += ( i + 1 ) * ( pow ( ( i + 1 ) / m , n ) - pow ( i / m , n ) ) print ( r ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) sum = 0 for i in range ( 1 , a + 1 ) : sum += i * ( ( i / a ) ** b - ( ( i - 1 ) / a ) ** b ) print ( sum ) NEW_LINE

import math   if __name__ == ' _ _ main _ _ ' : m , n = [ int ( item ) for item in input ( ) . split ( ) ] res = 0 for i in range ( 1 , m + 1 ) : current = i * ( math . pow ( ( i / m ) , n ) - math . pow ( ( ( i - 1 ) / m ) , n ) ) res += current print ( res )   NEW_LINE

m , n = map ( int , input ( ) . split ( ) ) score = 0 for k in range ( 1 , m + 1 ) : score += k * ( ( k / m ) ** ( n ) - ( ( k - 1 ) / ( m ) ) ** n ) print ( score ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; StringBuilder res = new StringBuilder ( ) ; boolean skipped = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '0' && ! skipped ) { skipped = true ; continue ; } res . append ( s . charAt ( i ) ) ; } if ( ! skipped ) res . deleteCharAt ( res . length ( ) - 1 ) ; System . out . println ( res ) ; } }

import java . util . * ;    public class dummycodes {   public static class Pair { int l ; int r ; int index ; public Pair ( int x , int y , int i ) { l = x ; r = y ; index = i ; } } public static class sortByL implements Comparator < Pair > { @ Override public int compare ( Pair o1 , Pair o2 ) { return ( o1 . l == o2 . l ) ? o2 . r - o1 . r : o1 . l - o2 . l ; }   }   public static void solve ( ArrayList < Pair > arr , int sze , int maxR ) { Collections . sort ( arr , new sortByL ( ) ) ; Pair P = arr . get ( 0 ) ; int a = P . l ; int b = P . r ;   if ( a <= b && b >= maxR ) System . out . println ( P . index + 1 ) ; else System . out . println ( " - 1" ) ; }   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String res = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '0' ) { res += s . substring ( 0 , i ) ; res += s . substring ( i + 1 ) ; break ; } } if ( res != " " ) System . out . println ( res ) ; else System . out . println ( s . substring ( 0 , s . length ( ) - 1 ) ) ; } }

import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class absolute { public static String process ( String s ) { if ( s . length ( ) == 1 ) return "0" ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '0' ) return s . substring ( 0 , i ) + s . substring ( i + 1 ) ; } return s . substring ( 1 ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; System . out . println ( process ( s ) ) ; } }

import java . util . * ; import java . lang . * ;

import java . util . Scanner ;   public class A258 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String input = s . nextLine ( ) ; System . out . println ( input . replaceFirst ( input . contains ( "0" ) ? "0" : "1" , " " ) ) ; } }

def solution ( ) : st = input ( ) n = len ( st ) for i in range ( n ) : if st [ i ] == '0' : print ( st [ : i ] + st [ i + 1 : ] ) return print ( st [ : - 1 ] )     return 	 	       solution ( ) NEW_LINE

li = list ( map ( int , input ( ) ) ) n = len ( li ) st = Falseif 0 in li : li . remove ( 0 ) print ( * li , sep = ' ' ) else : li . pop ( ) print ( * li , sep = ' ' ) NEW_LINE

binary = input ( )   try : charIndex = binary . index ( "0" ) except : charIndex = 0   newBinary = f " { binary [ : charIndex ] } { binary [ charIndex ▁ + ▁ 1 : ] } "   print ( newBinary ) NEW_LINE

def answer ( a ) : al = list ( a ) NEW_LINE

ll = lambda : map ( int , input ( ) . split ( ) ) t = lambda : int ( input ( ) ) ss = lambda : input ( ) lx = lambda x : map ( int , input ( ) . split ( x ) ) NEW_LINE


import java . math . * ; import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = " Yes " ; private static final String no = " No " ;   void solve ( ) { int T = nextInt ( ) ;

import java . util . Arrays ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int test = sc . nextInt ( ) ; while ( test > 0 ) { int i , n ; n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) b [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; for ( i = 0 ; i < n ; i ++ ) System . out . print ( a [ i ] + " ▁ " ) ; System . out . println ( ) ; for ( i = 0 ; i < n ; i ++ ) System . out . print ( b [ i ] + " ▁ " ) ; System . out . println ( ) ; test -= 1 ; }   }   }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . LinkedList ; import java . util . Locale ; import java . util . Objects ; import java . util . Queue ; import java . util . Scanner ; import java . util . Stack ; import java . util . TreeSet ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Map ; import java . util . Vector ;   public class Main {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int cases = Integer . parseInt ( br . readLine ( ) ) ; while ( cases > 0 ) { int daughters = Integer . parseInt ( br . readLine ( ) ) ; int [ ] necklaces = Arrays . stream ( br . readLine ( ) . split ( " ▁ " ) ) . mapToInt ( x -> Integer . parseInt ( x ) ) . toArray ( ) ; int [ ] bracelets = Arrays . stream ( br . readLine ( ) . split ( " ▁ " ) ) . mapToInt ( x -> Integer . parseInt ( x ) ) . toArray ( ) ; Arrays . sort ( necklaces ) ; Arrays . sort ( bracelets ) ; for ( int i = 0 ; i < daughters ; i ++ ) { if ( i + 1 != daughters ) { System . out . print ( necklaces [ i ] + " ▁ " ) ; } else { System . out . println ( necklaces [ i ] ) ; } } for ( int i = 0 ; i < daughters ; i ++ ) { if ( i + 1 != daughters ) { System . out . print ( bracelets [ i ] + " ▁ " ) ; } else { System . out . println ( bracelets [ i ] ) ; } } cases -- ; } }   }

from sys import stdininput = stdin . readline   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] print ( * sorted ( a ) ) print ( * sorted ( b ) ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] a = [ str ( x ) for x in sorted ( a ) ] b = [ str ( x ) for x in sorted ( b ) ] print ( ' ▁ ' . join ( a ) ) print ( ' ▁ ' . join ( b ) ) NEW_LINE

import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) out = [ ] for i in range ( 2 , len ( inp ) , 3 ) : a = ' ▁ ' . join ( sorted ( inp [ i ] . split ( ) , key = int ) ) b = ' ▁ ' . join ( sorted ( inp [ i + 1 ] . split ( ) , key = int ) ) out . extend ( ( a , b ) ) return out print ( * main ( ) , sep = ' \n ' ) NEW_LINE


import java . util . Scanner ;   public class Game { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n ; String s ;   n = Integer . parseInt ( input . nextLine ( ) ) ; s = input . nextLine ( ) ;   for ( int i = 0 ; i < n ; ++ i ) { if ( s . charAt ( i ) != ' . ' ) { if ( s . charAt ( i ) == ' R ' ) { while ( s . charAt ( i ) == ' R ' ) { ++ i ; } System . out . println ( i + " ▁ " + ( i + 1 ) ) ; } else { System . out . println ( ( i + 1 ) + " ▁ " + i ) ; } break ; } } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . util . StringTokenizer ;    @ SuppressWarnings ( " unused " ) public class A { public static FastScannerA scan = new FastScannerA ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void solve ( ) { int t = scan . nextInt ( ) ; String str = scan . next ( ) ; int s = str . indexOf ( " R " ) ; int e = str . indexOf ( " L " ) ; if ( s >= 0 && e >= 0 ) out . println ( s + 1 + " ▁ " + e ) ; else if ( s >= 0 ) out . println ( s + 1 + " ▁ " + ( str . lastIndexOf ( " R " ) + 2 ) ) ; else out . println ( str . lastIndexOf ( " L " ) + 1 + " ▁ " + e ) ; } public static void main ( String [ ] args ) { solve ( ) ; out . close ( ) ; }   } class FastScannerA { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }

import java . util . * ; import java . math . * ; public class SnowFootprints { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int size = sc . nextInt ( ) ; String s = sc . next ( ) ;

n = int ( input ( ) ) a = input ( ) f = n - a . count ( ' . ' ) m = a . count ( ' L ' ) q0 = 0 flag = 1 for i in range ( n ) : if ( m == 0 ) : if ( a [ i ] == ' . ' and a [ i - 1 ] == ' R ' and i > 0 ) : q1 = i + 1 break if ( a [ i ] == ' . ' ) : continue else : if ( a [ i ] == ' L ' ) : q1 = i if ( flag and q0 == 0 ) : q0 = i + 1 break if ( flag ) : q0 = i + 1 flag -= 1 print ( q0 , q1 ) NEW_LINE

n = int ( input ( ) ) a = list ( input ( ) ) b = a [ : : - 1 ] if a . count ( " R " ) == 0 : s = 0 t = 0 for i in range ( 0 , len ( b ) ) : if b [ i ] == " L " : s = n - ( i ) break for i in range ( 0 , len ( a ) ) : if a [ i ] == " L " : t = i break print ( s , t ) elif a . count ( " L " ) == 0 : s = 0 t = 0 for i in range ( 0 , len ( a ) ) : if a [ i ] == " R " : s = i + 1 break for i in range ( 0 , len ( b ) ) : if b [ i ] == " R " : t = n - i + 1 break print ( s , t ) else : s = 0 t = 0 for i in range ( 0 , len ( a ) ) : if a [ i ] == " L " : t = i + 1 break for i in range ( t - 1 , len ( a ) ) : if a [ i ] != " L " : s = i break print ( s , t ) NEW_LINE

n = int ( input ( ) ) path = list ( input ( ) ) if path . count ( ' R ' ) == 0 : t = path . index ( ' L ' ) s = n - path [ : : - 1 ] . index ( ' L ' ) elif path . count ( ' L ' ) == 0 : s = path . index ( ' R ' ) + 1 t = n - path [ : : - 1 ] . index ( ' R ' ) + 1 else : s = path . index ( ' R ' ) + 1 t = path . index ( ' L ' ) print ( s , t ) NEW_LINE

n , footprint = int ( input ( ) ) , input ( )   for i in range ( n ) : if footprint [ i ] != ' . ' : first = i breakfor i in range ( n - 1 , 0 , - 1 ) : if footprint [ i ] != " . " : last = i break   if footprint [ first ] == footprint [ last ] and footprint [ first ] == ' R ' : print ( first + 1 , last + 2 )   elif footprint [ first ] == footprint [ last ] and footprint [ first ] == ' L ' : print ( last + 1 , first )   elif footprint [ first ] == ' R ' and footprint [ last ] == ' L ' : for i in range ( first , last ) : if footprint [ i ] != ' R ' : last = i break print ( first + 1 , last ) NEW_LINE

n = int ( input ( ) ) myStr = input ( ) tempListL = 0 tempListR = 0 if myStr . find ( " R " ) == - 1 : forRevarse = range ( len ( myStr ) , 0 , - 1 ) for i in forRevarse : if myStr [ i - 1 ] == " L " : tempListL = i break else : continue print ( tempListL , myStr . index ( " L " ) ) elif myStr . find ( " L " ) == - 1 : forRevarse = range ( len ( myStr ) , 0 , - 1 ) for i in forRevarse : if myStr [ i - 1 ] == " R " : tempListR = i break else : continue print ( myStr . find ( " R " ) + 1 , tempListR + 1 ) else : print ( myStr . index ( " R " ) + 1 , myStr . index ( " L " ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;    public class MainCP {   public static void main ( String [ ] args ) { FastReader s = new FastReader ( ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextInt ( ) ; }   int m = s . nextInt ( ) ;   for ( int i = 0 ; i < m ; i ++ ) { int x = s . nextInt ( ) - 1 ; int y = s . nextInt ( ) ; if ( x == 0 && a . length > 1 ) { a [ x + 1 ] += a [ x ] - y ; a [ x ] = 0 ; } else if ( x > 0 && x < n - 1 ) { a [ x - 1 ] += y - 1 ; a [ x + 1 ] += a [ x ] - y ; a [ x ] = 0 ; } else if ( x == n - 1 && a . length > 1 ) { a [ x - 1 ] += y - 1 ; a [ x ] = 0 ; } else { a [ x ] = 0 ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( a [ i ] ) ; }   }

import java . util . Scanner ;   public class CodeForces {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int totalLine = sc . nextInt ( ) ; int [ ] birdsPerLine = new int [ totalLine + 1 ] ; birdsPerLine [ 0 ] = 0 ; for ( int i = 1 ; i <= totalLine ; i ++ ) { birdsPerLine [ i ] = sc . nextInt ( ) ; } int totalShoot = sc . nextInt ( ) ; for ( int i = 0 ; i < totalShoot ; i ++ ) { int shootedLine = sc . nextInt ( ) ; int shootedBirdPosition = sc . nextInt ( ) ; if ( totalLine == 1 ) { birdsPerLine [ 1 ] = 0 ; break ; } if ( shootedLine == 1 ) { birdsPerLine [ shootedLine + 1 ] += ( birdsPerLine [ shootedLine ] - shootedBirdPosition ) ; } else if ( shootedLine == totalLine ) { birdsPerLine [ shootedLine - 1 ] += ( shootedBirdPosition - 1 ) ; } else { birdsPerLine [ shootedLine - 1 ] += ( shootedBirdPosition - 1 ) ; birdsPerLine [ shootedLine + 1 ] += ( birdsPerLine [ shootedLine ] - shootedBirdPosition ) ; } birdsPerLine [ shootedLine ] = 0 ; } for ( int i = 1 ; i <= totalLine ; i ++ ) { System . out . println ( birdsPerLine [ i ] ) ; } } }

import java . util . * ;   public class Runner { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nw = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] birds = stringToIntArray ( sc . nextLine ( ) ) ; int shots = sc . nextInt ( ) ; for ( int i = 0 ; i < shots ; i ++ ) { int wireNum = sc . nextInt ( ) - 1 ; int wirePosition = sc . nextInt ( ) ; if ( wireNum != 0 ) { birds [ wireNum - 1 ] += wirePosition - 1 ; } if ( wireNum != nw - 1 ) { birds [ wireNum + 1 ] += birds [ wireNum ] - wirePosition ; } birds [ wireNum ] = 0 ; } for ( int birdCount : birds ) { System . out . println ( birdCount ) ; } } private static int [ ] stringToIntArray ( String str ) { String [ ] strs = str . trim ( ) . split ( " ▁ " ) ; int [ ] intArr = new int [ strs . length ] ; for ( int i = 0 ; i < strs . length ; i ++ ) { intArr [ i ] = Integer . parseInt ( strs [ i ] ) ; } return intArr ; }   }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int arr [ ] = new int [ x ] ; for ( int i = 0 ; i < x ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int n = sc . nextInt ( ) ; while ( n -- > 0 ) { int wire = sc . nextInt ( ) ; int bird = sc . nextInt ( ) ; if ( wire != 1 ) { arr [ wire - 2 ] += bird - 1 ; } if ( wire != arr . length ) { arr [ wire ] += ( arr [ wire - 1 ] - bird ) ; } arr [ wire - 1 ] = 0 ; } for ( int i = 0 ; i < arr . length ; i ++ ) { System . out . println ( arr [ i ] ) ; } } }

for _ in range ( 1 ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   m = int ( input ( ) ) for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) if x == 1 : if x <= n - 1 : arr [ x ] += arr [ x - 1 ] - y arr [ x - 1 ] = 0 elif x == n : arr [ x - 2 ] += y - 1 arr [ x - 1 ] = 0 else : arr [ x ] += arr [ x - 1 ] - y arr [ x - 2 ] += y - 1 arr [ x - 1 ] = 0 for i in range ( n ) : print ( arr [ i ] ) NEW_LINE

n = int ( input ( ) ) wires = [ * map ( int , input ( ) . split ( " ▁ " ) ) ] m = int ( input ( ) ) for i in range ( m ) : x , y = map ( int , input ( ) . split ( " ▁ " ) ) if x > 1 : wires [ x - 2 ] += y - 1 if x < n : wires [ x ] += wires [ x - 1 ] - y wires [ x - 1 ] = 0 for n in wires : print ( n ) NEW_LINE

n = int ( input ( ) )   wires = [ * map ( int , input ( ) . split ( " ▁ " ) ) ]   m = int ( input ( ) )   for i in range ( m ) : value = [ * map ( int , input ( ) . split ( " ▁ " ) ) ] if value [ 0 ] < n : wires [ value [ 0 ] ] += ( wires [ value [ 0 ] - 1 ] - value [ 1 ] ) if value [ 0 ] >= 2 : wires [ value [ 0 ] - 2 ] += ( value [ 1 ] - 1 ) wires [ value [ 0 ] - 1 ] = 0   for i in wires : print ( i ) NEW_LINE

n = int ( input ( ) ) list = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) shot = int ( input ( ) ) for i in range ( shot ) : x , y = ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) if x - 2 >= 0 : list [ x - 2 ] += y - 1 if x <= n - 1 : list [ x ] += list [ x - 1 ] - y list [ x - 1 ] = 0   for i in list : print ( i ) NEW_LINE

def insertion_sort ( l ) : for i in range ( len ( l ) ) : for j in ( range ( i ) ) : k = i - j if l [ k ] >= l [ k - 1 ] : l [ k - 1 ] , l [ k ] = l [ k ] , l [ k - 1 ] else : break return l       def selection_sort ( l ) : for i in range ( len ( l ) ) : min_ind = i min_val = l [ i ] for j in range ( i , len ( l ) ) : if min_val > l [ j ] : min_val = l [ j ] min_ind = j l [ i ] , l [ min_ind ] = l [ min_ind ] , l [ i ] return l     def bubble_sort ( l ) : for i in range ( len ( l ) - 1 ) : for j in range ( len ( l ) - 1 - i ) : if l [ j ] > l [ j + 1 ] : l [ j ] , l [ j + 1 ] = l [ j + 1 ] , l [ j ] return l     NEW_LINE


import java . util . * ;    public class Practise {

import java . util . * ;   public class coverpoints { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int sum = scan . nextInt ( ) + scan . nextInt ( ) ; if ( sum > max ) max = sum ; } System . out . println ( max ) ; } }

import sysfrom collections import defaultdict   def getInts ( ) : return int ( input ( ) )   def getListOfInts ( ) : return list ( map ( int , input ( ) . split ( ' ▁ ' ) ) )   NEW_LINE

m = 0 n = int ( input ( ) ) for _ in range ( n ) : m = max ( m , sum ( map ( int , input ( ) . split ( ) ) ) ) print ( m ) NEW_LINE

T_ON = 0 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : n = read_int ( ) MAX = 0 for _ in range ( n ) : x , y = read_ints ( ) MAX = max ( MAX , x + y ) print ( MAX )     def main ( ) : T = read_int ( ) if T_ON else 1 for i in range ( T ) : solve ( )     def debug ( * xargs ) : if DEBUG_ON : print ( * xargs )     from collections import * import math     NEW_LINE

maxi = 0 for i in range ( int ( input ( ) ) ) : x , y = map ( int , input ( ) . split ( ' ▁ ' ) ) maxi = max ( x + y , maxi ) print ( maxi ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {

import java . util . Scanner ;   public class Main { public static String s , t ; public static int N , M ; public static int [ ] next ; public static final long MOD = ( long ) ( ( 1e9 ) + 7 ) ; public static long [ ] dp , s1 , s2 ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; s = sc . next ( ) ; t = sc . next ( ) ; N = s . length ( ) ; M = t . length ( ) ; next = new int [ M ] ; for ( int i = 1 , j = 0 ; i < M ; i ++ ) { while ( j > 0 && t . charAt ( i ) != t . charAt ( j ) ) j = next [ j - 1 ] ; if ( t . charAt ( i ) == t . charAt ( j ) ) j ++ ; next [ i ] = j ; } boolean [ ] flag = new boolean [ N + 1 ] ; for ( int i = 0 , j = 0 ; i < N ; i ++ ) { while ( j > 0 && ( j == M || s . charAt ( i ) != t . charAt ( j ) ) ) j = next [ j - 1 ] ; if ( s . charAt ( i ) == t . charAt ( j ) ) j ++ ; if ( j == M ) { flag [ i + 1 ] = true ; } } dp = new long [ N + 1 ] ; s1 = new long [ N + 1 ] ; s2 = new long [ N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { if ( ! flag [ i ] ) { dp [ i ] = dp [ i - 1 ] ; } else { dp [ i ] = ( ( i - M + 1 ) + s2 [ i - M ] ) % MOD ; } s1 [ i ] = ( s1 [ i - 1 ] + dp [ i ] ) % MOD ; s2 [ i ] = ( s2 [ i - 1 ] + s1 [ i ] ) % MOD ; } System . out . println ( s1 [ N ] ) ; } }

MOD = 10 ** 9 + 7 s , t = input ( ) , input ( )   p = t + ' # ' + sz = [ 0 ] * len ( p ) l = r = 0 for i in range ( 1 , len ( p ) ) : if i <= r : z [ i ] = min ( r - i + 1 , z [ i - l ] ) while i + z [ i ] < len ( p ) and p [ z [ i ] ] == p [ i + z [ i ] ] : z [ i ] += 1 if i + z [ i ] - 1 > r : l , r = i , i + z [ i ] - 1   f = [ 0 ] * ( len ( p ) + 1 ) fsum = [ 0 ] * ( len ( p ) + 1 ) fsum2 = [ 0 ] * ( len ( p ) + 1 ) for i in range ( len ( p ) - 1 , len ( t ) , - 1 ) : if z [ i ] == len ( t ) : f [ i ] = fsum2 [ i + z [ i ] ] + len ( p ) - i - z [ i ] + 1 else : f [ i ] = f [ i + 1 ] fsum [ i ] = ( fsum [ i + 1 ] + f [ i ] ) % MOD fsum2 [ i ] = ( fsum2 [ i + 1 ] + fsum [ i ] ) % MODprint ( fsum [ len ( t ) + 1 ] ) NEW_LINE

s , t = input ( ) , input ( ) n , m = len ( t ) , len ( s ) + 1   d = 1000000007 g = [ 1 ] * m   f = k = 0 for i in range ( 1 , m ) : if s [ i - n : i ] == t : k = i if k : f = ( f + g [ k - n ] ) % d g [ i ] += ( g [ i - 1 ] + f ) % d   print ( f ) NEW_LINE

s , t = input ( ) , input ( ) n , m = len ( t ) , len ( s ) + 1 d = 1000000007 g = [ 1 ] * mf = k = 0 for i in range ( 1 , m ) : if s [ i - n : i ] == t : k = i if k : f = ( f + g [ k - n ] ) % d g [ i ] += ( g [ i - 1 ] + f ) % dprint ( f ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( bf . readLine ( ) ) ; for ( int tc = 0 ; tc < t ; tc ++ ) { StringTokenizer st = new StringTokenizer ( bf . readLine ( ) ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < arr . length ; i ++ ) arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; int x = 0 ; int y = 0 ; x = arr [ 0 ] / arr [ 2 ] ;

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; double a , b ; int c , d , e ; while ( t -- != 0 ) { a = sc . nextDouble ( ) ; b = sc . nextDouble ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; e = sc . nextInt ( ) ; int pen = ( int ) Math . ceil ( a / c ) ; int pencil = ( int ) Math . ceil ( b / d ) ; if ( pen + pencil <= e ) { System . out . println ( pen + " ▁ " + pencil ) ; } else { System . out . println ( - 1 ) ; } } } }

import java . util . * ;    public class l700 {   public static void main ( String [ ] args ) {

n = int ( input ( ) ) import math as mfor i in range ( n ) : a , b , c , d , k = map ( int , input ( ) . split ( ) ) e = m . ceil ( a / c ) f = m . ceil ( b / d ) if e + f <= k : print ( e , f ) else : print ( - 1 ) NEW_LINE

from math import ceiln = int ( input ( ) ) for i in range ( n ) : a , b , c , d , k = map ( int , input ( ) . split ( ) ) pens = ceil ( a / c ) pencils = ceil ( b / d )   if pens + pencils <= k : print ( str ( pens ) + " ▁ " + str ( pencils ) ) else : print ( " - 1" ) NEW_LINE

from math import ceil   n_sets = int ( input ( ) ) for _ in range ( n_sets ) : a , b , c , d , k = map ( int , input ( ) . split ( ) ) n_pen = ceil ( a / c ) n_pencil = ceil ( b / d ) if n_pen + n_pencil <= k : print ( n_pen , n_pencil ) else : print ( - 1 ) NEW_LINE

for _ in [ 0 ] * int ( input ( ) ) : a , b , c , d , k = map ( int , input ( ) . split ( ) ) ; r = 0 - - a // c , 0 - - b // d ; print ( * ( r , [ - 1 ] ) [ sum ( r ) > k ] ) NEW_LINE


import java . sql . ClientInfoStatus ; import java . util . * ;    public class Practise {

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Problem428A { public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter writer = new PrintWriter ( System . out ) ;   StringTokenizer info = new StringTokenizer ( reader . readLine ( ) ) ; int n = Integer . parseInt ( info . nextToken ( ) ) ; int k = Integer . parseInt ( info . nextToken ( ) ) ;    int sum = 0 ; StringTokenizer aT = new StringTokenizer ( reader . readLine ( ) ) ; int [ ] a = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( aT . nextToken ( ) ) ; sum += a [ i ] ; int out = Math . min ( sum , 8 ) ; k -= out ; sum -= out ; count ++ ; if ( k <= 0 ) { break ; } } if ( k > 0 ) { writer . println ( " - 1" ) ; } else { writer . println ( count ) ; }    reader . close ( ) ; writer . close ( ) ; } }

import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;

n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   given = 0 ans = - 1 save = 0 for i , candy in enumerate ( arr , start = 1 ) : if candy >= 8 : k -= 8 save += candy - 8 else : need = 8 - candy available = min ( need , save ) k -= ( available + candy ) save -= available if k <= 0 : ans = i break   print ( ans ) NEW_LINE

n , k = input ( ) . split ( ' ▁ ' ) a = input ( ) . split ( ' ▁ ' ) k = int ( k ) count = 0 storage = 0 total = 0 for ai in a : total += int ( ai )   df = min ( 8 , total ) k -= df total -= df count += 1 if k <= 0 : break   if k > 0 : print ( - 1 ) else : print ( count ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) h = 0 for e , i in enumerate ( input ( ) . split ( ) ) : h += int ( i ) k -= min ( 8 , h ) h -= min ( 8 , h ) if k <= 0 : print ( e + 1 ) ; breakelse : print ( - 1 ) NEW_LINE

n , k = [ int ( i ) for i in input ( ) . split ( ) ] a = [ int ( i ) for i in input ( ) . split ( ) ] b = 0 c = 0 for i in range ( n ) : b += a [ i ] if b >= 8 : b -= 8 c += 8 else : c += b b = 0 if c >= k : print ( i + 1 ) breakelse : print ( - 1 ) NEW_LINE

n , k = ( int ( x ) for x in input ( ) . split ( ) ) n_lst = [ int ( x ) for x in input ( ) . split ( ) ] t = 0 counter = 0 for day in n_lst : t += day counter += 1 k -= ( min ( 8 , t ) ) t -= ( min ( 8 , t ) ) if k <= 0 : print ( counter ) breakelse : print ( ' - 1' ) NEW_LINE


import java . util . * ; import java . io . * ;   public class cf {   public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x1 = sc . nextInt ( ) , x2 = sc . nextInt ( ) ; pair [ ] arr = new pair [ n ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { long a = sc . nextInt ( ) , b = sc . nextInt ( ) ; arr [ i ] = new pair ( a * x1 + b , a * x2 + b ) ; } Arrays . sort ( arr ) ; long x = arr [ 0 ] . x , y = arr [ 0 ] . y ; boolean f = false ; for ( int i = 1 ; i < arr . length ; i ++ ) { if ( arr [ i ] . x > x && arr [ i ] . y < y ) { f = true ; break ; } if ( arr [ i ] . y > y ) { y = arr [ i ] . y ; x = arr [ i ] . x ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . PriorityQueue ; import java . util . StringTokenizer ;   public class AntonAndLines { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int x1 = Integer . parseInt ( st . nextToken ( ) ) ; int x2 = Integer . parseInt ( st . nextToken ( ) ) ; PriorityQueue < Line > pq = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; long k = Integer . parseInt ( st . nextToken ( ) ) ; long b = Integer . parseInt ( st . nextToken ( ) ) ; long y1 = k * x1 + b ; long y2 = k * x2 + b ; pq . add ( new Line ( y1 , y2 ) ) ; }   Line x = new Line ( 1 , 2 ) ; Line y = new Line ( 1 , 1 ) ; Line prev = pq . poll ( ) ; while ( ! pq . isEmpty ( ) ) { Line cur = pq . poll ( ) ; if ( prev . y2 > cur . y2 ) { System . out . println ( " YES " ) ; return ; } prev = cur ; } System . out . println ( " NO " ) ; }   static class Line implements Comparable < Line > { long y1 , y2 ;   public Line ( long Y1 , long Y2 ) { y1 = Y1 ; y2 = Y2 ; }   @ Override public int compareTo ( Line o ) { if ( this . y1 == o . y1 ) { return Long . compare ( this . y2 , o . y2 ) ; } return Long . compare ( this . y1 , o . y1 ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class AntonandLines { static final double EPS = ( 1e-15 ) ;   public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double x1 = sc . nextDouble ( ) + EPS ; double x2 = sc . nextDouble ( ) - EPS ; pair [ ] wX1 = new pair [ n ] ;   for ( int i = 0 ; i < n ; ++ i ) { int k = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; wX1 [ i ] = new pair ( i , k * x1 + b , k * x2 + b ) ; } Arrays . sort ( wX1 ) ; boolean can = true ; for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( wX1 [ i ] . y2 >= wX1 [ i + 1 ] . y2 ) { can = false ; break ; } }

import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; BigInteger x1 = BigInteger . valueOf ( scanner . nextLong ( ) ) ; BigInteger x2 = BigInteger . valueOf ( scanner . nextLong ( ) ) ;   ArrayList < Intersection > intersections = new ArrayList < Intersection > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { BigInteger k = BigInteger . valueOf ( scanner . nextLong ( ) ) ; BigInteger b = BigInteger . valueOf ( scanner . nextLong ( ) ) ; BigInteger y1 = k . multiply ( x1 ) . add ( b ) ; BigInteger y2 = k . multiply ( x2 ) . add ( b ) ; intersections . add ( new Intersection ( y1 , y2 ) ) ; } Collections . sort ( intersections ) ;   for ( int i = 1 ; i < intersections . size ( ) ; i ++ ) { if ( ( intersections . get ( i ) . y1 . subtract ( intersections . get ( i - 1 ) . y1 ) ) . signum ( ) * ( intersections . get ( i ) . y2 . subtract ( intersections . get ( i - 1 ) . y2 ) ) . signum ( ) < 0 ) { System . out . println ( " YES " ) ; return ; } } System . out . println ( " NO " ) ; }   private static class Intersection implements Comparable < Intersection > { BigInteger y1 ; BigInteger y2 ;   public Intersection ( BigInteger y1 , BigInteger y2 ) { this . y1 = y1 ; this . y2 = y2 ; }   @ Override public int compareTo ( Intersection intersection ) { if ( this . y1 . compareTo ( intersection . y1 ) == 0 ) { return this . y2 . compareTo ( intersection . y2 ) ; } else { return this . y1 . compareTo ( intersection . y1 ) ; } } } }

n = int ( input ( ) ) x1 , x2 = map ( int , input ( ) . split ( ) ) arr = [ ] for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) arr . append ( [ a * x1 + b , a * x2 + b ] ) arr . sort ( ) x = [ i [ 1 ] for i in arr ] if ( sorted ( x ) == x ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE

import sysinput = sys . stdin . readlinen = int ( input ( ) ) x1 , x2 = map ( int , input ( ) . split ( ) ) s = [ ] for _ in range ( n ) : k , b = map ( int , input ( ) . split ( ) ) s . append ( [ x1 * k + b , x2 * k + b ] ) s . sort ( ) ans = ' NO ' for i in range ( 1 , n ) : x1 , x2 = s [ i - 1 ] x3 , x4 = s [ i ] if x1 < x3 and x2 > x4 or x1 > x3 and x2 < x4 : ans = ' YES ' ; breakprint ( ans ) NEW_LINE

n = int ( input ( ) ) x1 , x2 = map ( int , input ( ) . split ( " ▁ " ) )   liste = [ ] for test in range ( n ) : k , b = map ( int , input ( ) . split ( " ▁ " ) ) liste . append ( ( k * x1 + b , k * x2 + b ) ) liste . sort ( )     flag = 0 i = 1 while i < n : if liste [ i ] [ 1 ] < liste [ i - 1 ] [ 1 ] : flag = 1 break   i += 1   print ( [ ' NO ' , ' YES ' ] [ flag ] ) NEW_LINE

ertekek = [ ] n = int ( input ( ) ) x1 , x2 = [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( n ) : k , b = [ int ( i ) for i in input ( ) . split ( ) ] bal = k * x1 + b jobb = k * x2 + b ertekek . append ( [ bal , jobb ] ) ertekek . sort ( ) szamlalo = 0 for i in range ( len ( ertekek ) - 1 ) : if ertekek [ i ] [ 0 ] < ertekek [ i + 1 ] [ 0 ] and ertekek [ i ] [ 1 ] > ertekek [ i + 1 ] [ 1 ] : szamlalo += 1 if szamlalo > 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

from sys import stdin   n = int ( stdin . readline ( ) ) x1 , x2 = map ( int , stdin . readline ( ) . split ( ) ) ys = [ ]   for i in range ( n ) : m , b = map ( int , stdin . readline ( ) . split ( ) ) ys . append ( [ x1 * m + b , x2 * m + b ] )   ys . sort ( )   intersect = Falsefor i in range ( 1 , n ) : if ys [ i - 1 ] [ 1 ] > ys [ i ] [ 1 ] : intersect = Trueif intersect : print ( " YES " ) else : print ( " NO " ) NEW_LINE