import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] arr = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextLong ( ) ; }

import java . util . Scanner ;   public class FIbonacciSegment {   private static int dp ( int n , int [ ] a ) { if ( n == 1 || n == 2 ) return n ; int [ ] dp = new int [ n ] ; dp [ 0 ] = 1 ; dp [ 1 ] = 2 ; int max = 0 ; for ( int i = 2 ; i < n ; i ++ ) { if ( a [ i ] == a [ i - 1 ] + a [ i - 2 ] ) dp [ i ] = dp [ i - 1 ] + 1 ; else dp [ i ] = 2 ; max = Math . max ( max , dp [ i ] ) ; } return max ; }   private static int solve ( int n , int [ ] a ) { int max = 0 ; if ( n == 1 || n == 2 ) max = n ; else { int i , j = 0 ; for ( i = 2 ; i < n ; i ++ ) { if ( a [ i ] != ( a [ i - 1 ] + a [ i - 2 ] ) ) { max = Math . max ( max , i - j ) ; j = i - 1 ; } } max = Math . max ( max , i - j ) ; } return max == 0 ? 2 : max ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } System . out . println ( dp ( n , a ) ) ; sc . close ( ) ; } }

import java . util . Scanner ;   public class FIbonacciSegment {   private static int solve ( int n , int [ ] a ) { int max = 0 ; if ( n == 1 || n == 2 ) max = n ; else { int i , j = 0 ; for ( i = 2 ; i < n ; i ++ ) { if ( a [ i ] != ( a [ i - 1 ] + a [ i - 2 ] ) ) { max = Math . max ( max , i - j ) ; j = i - 1 ; } } max = Math . max ( max , i - j ) ; } return max == 0 ? 2 : max ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } System . out . println ( solve ( n , a ) ) ; sc . close ( ) ; } }

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

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

a = int ( input ( ) ) I = lambda : list ( map ( int , input ( ) . split ( ) ) ) b = I ( ) if a >= 2 : ma = 2 current = 2 for i in range ( 2 , len ( b ) ) : if b [ i - 2 ] + b [ i - 1 ] == b [ i ] : current += 1 else : current = 2 if current > ma : ma = current print ( ma ) elif a == 1 : print ( 1 ) else : print ( 0 ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 cnt = 2 for i in range ( 2 , n ) : if a [ i ] == ( a [ i - 1 ] + a [ i - 2 ] ) : cnt += 1 else : cnt = 2 ans = max ( ans , cnt ) if n <= 2 : ans = nprint ( ans )           NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   if n <= 2 : print ( n ) else : max_seg = 2 curr = 2   for i in range ( 2 , len ( arr ) ) : if arr [ i - 2 ] + arr [ i - 1 ] == arr [ i ] : curr += 1 else : max_seg = max ( curr , max_seg ) curr = 2 max_seg = max ( curr , max_seg ) print ( max_seg ) NEW_LINE

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


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

import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ;   public class Endsem { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int sum = 0 , sum1 = 0 ; if ( n >= 1 && n <= 100 ) { for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( a >= 1 && a <= 100 ) arr [ i ] = a ; } int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( max <= arr [ i ] ) max = arr [ i ] ; sum += arr [ i ] ; } int x = max ; while ( true ) { sum1 = 0 ; for ( int j = 0 ; j < n ; j ++ ) { sum1 += ( x - arr [ j ] ) ; } if ( sum1 > sum ) { System . out . println ( x ) ; break ; } else x ++ ; } } }   }

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

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ;    public class Solution {    public static void main ( String [ ] args ) throws Exception {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String input = br . readLine ( ) ; int n = Integer . parseInt ( input . replaceAll ( " , " , " " ) ) ; input = br . readLine ( ) ; int [ ] a = Arrays . stream ( input . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int k = a [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > k ) k = a [ i ] ; } int A = 0 ; int B = 0 ; for ( int i = 0 ; i < n ; i ++ ) { B += a [ i ] ; A += k - a [ i ] ;   } int diff = B - A ; if ( diff >= 0 ) {   System . out . println ( ( diff / n ) + k + 1 ) ;   } else { System . out . println ( k ) ; }   }    }

def Awruk_wins ( stds_votes , max_vote ) : Elodreip_votes = sum ( stds_votes ) Awruk_votes = ( len ( stds_votes ) * max_vote ) - Elodreip_votes if Awruk_votes > Elodreip_votes : return True return False       no_of_stds = int ( input ( ) )   votes = list ( map ( int , input ( ) . split ( ) ) )   max_votes = max ( votes )   while not ( Awruk_wins ( votes , max_votes ) ) : max_votes += 1   print ( max_votes )   NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) x = max ( a ) s = 0 while ( sum ( a ) >= s ) : c = 0 for i in a : c = c + ( x - i ) s = c x = x + 1 print ( x - 1 ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   given = sum ( arr ) needed = given * 2 + 1   for_each = ( needed + n - 1 ) // n   print ( max ( for_each , max ( arr ) ) )   NEW_LINE

n = int ( input ( ) ) lst = [ int ( i ) for i in input ( ) . split ( ) ] print ( max ( ( 2 * sum ( lst ) + n ) // n , max ( lst ) ) ) NEW_LINE

x = int ( input ( ) ) votes1 = list ( map ( int , input ( ) . split ( ) ) ) votes2 = [ ] pivot = max ( votes1 ) for i in range ( pivot , 202 ) : for j in range ( len ( votes1 ) ) : vote = i - votes1 [ j ] votes2 . append ( vote ) if sum ( votes2 ) > sum ( votes1 ) : print ( i ) break else : votes2 = [ ] NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = 3 ; long ans = 0 , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long b = fs . nextLong ( ) ; sum += b ; } ans = sum - 1 ; System . out . println ( ans ) ; } } static class FastScanner { 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 . io . * ; import java . util . * ; public class Temp { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ; public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;

import java . util . Scanner ;   public class A1422 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; int D = Math . max ( A , Math . max ( B , C ) ) ; System . out . println ( D ) ; } }   }

import java . util . * ; public class fence { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; long d = a + b + c - 1 ; System . out . println ( d ) ; } } }

for _ in range ( int ( input ( ) ) ) : a , b , c = sorted ( [ int ( x ) for x in input ( ) . split ( ) ] ) NEW_LINE print ( a + b + c - 1 ) NEW_LINE

for i in range ( int ( input ( ) ) ) : L = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE L . sort ( ) NEW_LINE a = L [ 0 ] NEW_LINE b = L [ 1 ] NEW_LINE c = L [ 2 ] NEW_LINE print ( int ( ( ( c - a ) ** 2 + b ** 2 ) ** 0.5 + 0.5 ) ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE d = a + b + c - 1 NEW_LINE if a < b + c + d and b < a + c + d and c < a + b + d and d < a + b + c : print ( d ) NEW_LINE

import sys ; NEW_LINE import collections ; NEW_LINE import math ; NEW_LINE import bisect ; NEW_LINE import heapqinf = sys . maxsizedef NEW_LINE get_ints ( ) : NEW_LINE return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) NEW_LINE def get_array ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def input ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE mod = 1000000007   for _ in range ( int ( input ( ) ) ) : a , b , c = sorted ( get_ints ( ) ) NEW_LINE print ( c + 1 ) NEW_LINE

a = int ( input ( ) ) NEW_LINE for i in range ( a ) : b , c , d = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( max ( b , c , d ) ) NEW_LINE


import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . * ; import java . math . * ; public class Main { InputStream is ; PrintWriter out ; String INPUT = " " ;

from types import GeneratorTypedef bootstrap ( f , stack = [ ] ) : def wrappedfunc ( * args , ** kwargs ) : if stack : return f ( * args , ** kwargs ) else : to = f ( * args , ** kwargs ) while True : if type ( to ) is GeneratorType : stack . append ( to ) to = next ( to ) else : stack . pop ( ) if not stack : break to = stack [ - 1 ] . send ( to ) return to return wrappedfunc   def main ( ) : n = int ( input ( ) ) p = [ - 1 for _ in range ( n + 1 ) ] c = [ - 1 for _ in range ( n + 1 ) ] children = [ [ ] for _ in range ( n + 1 ) ] for i in range ( 1 , n + 1 ) : pp , cc = readIntArr ( ) p [ i ] = pp c [ i ] = cc if pp == 0 : NEW_LINE

n = int ( input ( ) ) g = [ [ ] for _ in range ( n + 1 ) ] c = [ 0 ] for i in range ( 1 , n + 1 ) : p , ci = map ( int , input ( ) . split ( ) ) g [ p ] . append ( i ) c . append ( ci ) b = True   def dfs ( i ) : global b l = [ ] for j in g [ i ] : l . extend ( dfs ( j ) )   if c [ i ] > len ( l ) : b = False l . insert ( c [ i ] , i ) return l   l = dfs ( g [ 0 ] [ 0 ] ) NEW_LINE

import ioimport osimport sys     from collections import Counter , defaultdict , deque   sys . setrecursionlimit ( 10 ** 5 )     def solve ( N , PC ) : children = [ [ ] for i in range ( N ) ] cost = [ None for i in range ( N ) ] root = None for i , ( p , c ) in enumerate ( PC ) : cost [ i ] = c p -= 1 if p != - 1 : children [ p ] . append ( i ) else : root = i   def getOrder ( node ) : ret = [ ] for child in children [ node ] : ret . extend ( getOrder ( child ) ) i = cost [ node ] if not ( 0 <= i <= len ( ret ) ) : print ( " NO " ) exit ( ) return ret [ : i ] + [ node ] + ret [ i : ]   order = getOrder ( root )   nodeToVal = { } for v , node in enumerate ( order ) : nodeToVal [ node ] = str ( v + 1 )   return " YES \n " + " ▁ " . join ( nodeToVal [ i ] for i in range ( N ) )     if __name__ == " _ _ main _ _ " : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   ( N , ) = [ int ( x ) for x in input ( ) . split ( ) ] PC = [ [ int ( x ) for x in input ( ) . split ( ) ] for i in range ( N ) ] ans = solve ( N , PC ) print ( ans ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ;   public class antiqueItems { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long total_items = sc . nextLong ( ) ; long total_money = sc . nextLong ( ) ; int count = 0 ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( int i = 0 ; i < total_items ; i ++ ) { int a = sc . nextInt ( ) ; boolean flag = false ; for ( int j = 0 ; j < a ; j ++ ) { long b = sc . nextLong ( ) ; if ( flag == false ) { if ( b < total_money ) { count ++ ; flag = true ; al . add ( i + 1 ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int n = ni ( ) ; int v = ni ( ) ; int count = 0 ; boolean status [ ] = new boolean [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { boolean check = false ; int k = ni ( ) ; for ( int j = 0 ; j < k ; ++ j ) { int a = ni ( ) ; if ( a < v ) { check = true ; status [ i ] = true ; } } if ( check ) { ++ count ; } } out ( count ) ; for ( int i = 0 ; i < n ; ++ i ) { if ( status [ i ] ) { ou ( i + 1 + " ▁ " ) ; } } out ( ) ; }

import java . util . HashSet ; import java . util . Iterator ; import java . util . Scanner ; import java . util . Set ; import java . util . TreeSet ;   public class _0653ValeraandAntiqueItems {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; Set < Integer > sellers = new TreeSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int k = sc . nextInt ( ) ; for ( int j = 0 ; j < k ; j ++ ) { int price = sc . nextInt ( ) ; if ( price < v ) { sellers . add ( i + 1 ) ; } } } System . out . println ( sellers . size ( ) ) ; Iterator < Integer > it = sellers . iterator ( ) ; while ( it . hasNext ( ) ) { System . out . print ( it . next ( ) + " ▁ " ) ; } }   }

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

n , v = map ( int , input ( ) . split ( ) ) l1 = [ ]   for i in range ( n ) : l = list ( map ( int , input ( ) . split ( ) ) ) if ( min ( l [ 1 : ] ) < v ) : l1 . append ( ( i , min ( l [ 1 : ] ) ) ) sorted ( l1 , key = lambda l1 : l1 [ 1 ] ) print ( len ( l1 ) ) for i in l1 : print ( i [ 0 ] + 1 , end = " ▁ " ) NEW_LINE

import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappushfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as permfrom bisect import bisect_left as bl , bisect_right as br , bisect , insortfrom time import perf_counterfrom fractions import Fractionimport copyfrom copy import deepcopyimport timestarttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353   def data ( ) : return sys . stdin . readline ( ) . strip ( ) def out ( * var , end = " \n " ) : sys . stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def L ( ) : return list ( sp ( ) ) def sl ( ) : return list ( ssp ( ) ) def sp ( ) : return map ( int , data ( ) . split ( ) ) def ssp ( ) : return map ( str , data ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( n , val ) for j in range ( m ) ] try : NEW_LINE

n = [ int ( x ) for x in input ( ) . split ( ) ] l = n [ 0 ] u = n [ 1 ] counter = 0 list1 = ' ' ind = 1 for i in range ( l ) : s = [ int ( x ) for x in input ( ) . split ( ) ] ni = s [ 0 ] i = s [ 1 : ] i . sort ( ) for e in range ( s [ 0 ] ) : if u > i [ 0 ] : counter += 1 list1 += str ( ind ) + ' ▁ ' break ind += 1 print ( counter ) print ( list1 ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) ans = [ ] r = lambda : list ( map ( int , input ( ) . split ( ) ) ) for x in range ( n ) : seller , * prices = r ( ) if any ( i < k for i in prices ) : ans . append ( x + 1 )     print ( len ( ans ) ) print ( * ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   import static java . lang . Math . max ;   public class Test { public static void main ( String [ ] args ) {   Reader input = new Reader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; }   int sum = 0 ; for ( int x : a ) { sum += x ; }   int result = 0 ; for ( int x : a ) { if ( ( sum - x ) % 2 == 0 ) { result ++ ; } } out . println ( result ) ; out . close ( ) ; }   static class Reader { BufferedReader br ; StringTokenizer st ;   public Reader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) {   while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   String nextLine ( ) {   String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } return str ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }

import java . util . Scanner ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Cv {

import java . util . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int bags = sc . nextInt ( ) ; int odds = 0 ; int evens = 0 ; for ( int i = 0 ; i < bags ; i ++ ) { int cookies = sc . nextInt ( ) ;   if ( cookies % 2 == 0 ) { evens ++ ; } else odds ++ ; }   if ( odds % 2 == 1 ) { System . out . print ( odds ) ; } else System . out . print ( evens ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class experiment {   static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) ce = 0 co = 0 s = 0 for i in l : if i % 2 == 0 : ce += 1 else : co += 1 s += i   if s % 2 == 0 : print ( ce ) else : print ( co ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = 0 if ( sum ( l ) % 2 == 0 ) : for i in l : if ( i % 2 == 0 ) : c = c + 1 else : for i in l : if ( i % 2 != 0 ) : c = c + 1 print ( c ) NEW_LINE

n = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] [ : n ] NEW_LINE

n = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] [ : n ] count = 0 for i in l : s = sum ( l ) - i if ( s % 2 == 0 ) : count += 1   print ( count )   NEW_LINE

n , y , x , mm , count = int ( input ( ) ) , 0 , 0 , input ( ) , 0 arr = mm . split ( " ▁ " ) while ( n != 0 ) : m = int ( arr [ count ] ) if ( m % 2 == 0 ) : x += 1 else : y += 1 n -= 1 count += 1 if ( y % 2 == 1 ) : print ( y ) else : print ( x ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { int t = 1 ;

n = int ( input ( ) ) t1 = [ ] t2 = [ ] for _ in range ( n ) : t , w = map ( int , input ( ) . split ( ) ) if t == 1 : t1 . append ( w ) else : t2 . append ( w ) t1 . sort ( ) t2 . sort ( ) n1 = len ( t1 ) n2 = len ( t2 ) p1 = [ 0 ] p2 = [ 0 ] for i in range ( n1 ) : p1 . append ( p1 [ - 1 ] + t1 [ i ] ) for i in range ( n2 ) : p2 . append ( t2 [ i ] + p2 [ - 1 ] ) ans = 1 while True : am = False b = 0 while 2 * b <= ans : a = ans - 2 * b if a <= n1 and b <= n2 : if p1 [ n1 - a ] + p2 [ n2 - b ] <= ans : am = True break b += 1 if am : print ( ans ) break ans += 1 NEW_LINE

n = int ( input ( ) )   t = [ ] for i in range ( n ) : e = list ( map ( int , input ( ) . split ( ) ) ) t . append ( e )   size = 0 size2 = 0 for i in t : size += i [ 0 ] size2 += i [ 1 ]   matrix = [ [ - 1000 ] * ( size + 1 ) for i in range ( n ) ] for i in range ( n ) : matrix [ i ] [ 0 ] = 0   for i in range ( n ) : for j in range ( 1 , size + 1 ) : if t [ i ] [ 0 ] <= j : matrix [ i ] [ j ] = max ( matrix [ i - 1 ] [ j ] , matrix [ i - 1 ] [ j - t [ i ] [ 0 ] ] + t [ i ] [ 1 ] ) else : matrix [ i ] [ j ] = matrix [ i - 1 ] [ j ]           for i in range ( 1 , size + 1 ) : if i >= size2 - matrix [ - 1 ] [ i ] : print ( i ) break NEW_LINE

n = int ( input ( ) )   t = [ ] for i in range ( n ) : e = list ( map ( int , input ( ) . split ( ) ) ) t . append ( e )   size = 0 size2 = 0 for i in t : size += i [ 0 ] size2 += i [ 1 ]   matrix = [ [ - 1000 ] * ( size + 1 ) for i in range ( n ) ] for i in range ( n ) : matrix [ i ] [ 0 ] = 0   for i in range ( n ) : for j in range ( 1 , size + 1 ) : if t [ i ] [ 0 ] <= j : matrix [ i ] [ j ] = max ( matrix [ i - 1 ] [ j ] , matrix [ i - 1 ] [ j - t [ i ] [ 0 ] ] + t [ i ] [ 1 ] ) else : matrix [ i ] [ j ] = matrix [ i - 1 ] [ j ] NEW_LINE


import java . util . * ; import java . io . * ; public class PartialReplacement {    public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( ch == ' H ' || ch == ' Q ' || ch == '9' ) { c = 1 ; System . out . println ( " YES " ) ; break ; } } if ( c == 0 ) { System . out . println ( " NO " ) ; } } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class A_HQ9_ { public static void main ( String [ ] args ) throws java . lang . Exception { FastReader fs = new FastReader ( ) ; char c [ ] = fs . nextLine ( ) . toCharArray ( ) ; boolean hh = false ; for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ i ] == ' H ' || c [ i ] == ' Q ' || c [ i ] == '9' ) hh = true ;   } if ( hh ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } 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 . Scanner ; import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; int n = s . length ( ) ; String l = " ▁ " ; int i = 0 ; while ( n -- != 0 ) { if ( s . charAt ( i ) == ' H ' ) { l = " YES " ; break ; } else if ( s . charAt ( i ) == ' Q ' ) { l = " YES " ; break ; } else if ( s . charAt ( i ) == '9' ) { l = " YES " ; break ; } i ++ ; } if ( n == - 1 ) { System . out . print ( " NO " ) ; } else { System . out . print ( l ) ; } scan . close ( ) ; } }

import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; import java . util . * ; public class A133 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String inp = sc . nextLine ( ) ; int ans = 0 ; int len = inp . length ( ) ; int i = 0 ; while ( len > 0 ) { int ah = inp . charAt ( i ) ; if ( ah == 72 || ah == 57 || ah == 81 ) { ans ++ ; } len -- ; i ++ ; }

s = input ( ) if ' H ' in s or ' Q ' in s or '9' in s : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

s = input ( ) count = 0 for i in range ( len ( s ) ) : if s [ i ] == " H " or s [ i ] == " Q " or s [ i ] == "9" : count = count + 1 if count >= 1 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

command = input ( )   if " H " in command or " Q " in command or "9" in command : print ( " YES " ) else : print ( " NO " ) NEW_LINE

command = str ( input ( ) ) if " H " in command or " Q " in command or "9" in command : print ( " YES " ) else : print ( " NO " ) NEW_LINE

s = input ( ) f = 0 for i in s : if ( i == ' H ' ) : f = 1 break elif ( i == ' Q ' ) : f = 1 break elif ( i == '9' ) : f = 1 breakif ( f == 1 ) : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; ArrayList < Long > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a . add ( input . nextLong ( ) ) ; } Collections . sort ( a , Collections . reverseOrder ( ) ) ; if ( a . get ( 0 ) >= ( a . get ( 1 ) + a . get ( 2 ) ) ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i != 1 ) System . out . print ( a . get ( i ) + " ▁ " ) ; } System . out . println ( a . get ( 1 ) ) ; } } }

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 long [ ] darr ; static long [ ] [ ] mat , mat1 ; static int x ; static long maxl ; static double dec ; static String s ;

import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; int n = in . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ n - 1 ] >= a [ n - 3 ] + a [ n - 2 ] ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; int i ; for ( i = 0 ; i < n ; i += 2 ) { System . out . print ( a [ i ] + " ▁ " ) ; } if ( i == n + 1 ) for ( i = n - 2 ; i > 0 ; i -= 2 ) { System . out . print ( a [ i ] + " ▁ " ) ; } else { for ( i = n - 1 ; i > 0 ; i -= 2 ) { System . out . print ( a [ i ] + " ▁ " ) ; } } } }   class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = reader . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) if l [ - 3 ] + l [ - 2 ] > l [ - 1 ] : l [ - 2 ] , l [ - 1 ] = l [ - 1 ] , l [ - 2 ] print ( ' YES ' ) print ( * l ) else : print ( ' NO ' ) NEW_LINE

import bisectimport collectionsimport copyimport functoolsimport heapqimport itertoolsimport mathimport randomimport reimport sysimport timeimport stringfrom typing import List NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) if a [ n - 1 ] >= a [ n - 2 ] + a [ n - 3 ] : print ( " NO " ) else : print ( " YES " ) for i in range ( n - 1 , - 1 , - 2 ) : print ( a [ i ] , end = " ▁ " ) for i in range ( n % 2 , n , 2 ) : print ( a [ i ] , end = " ▁ " ) NEW_LINE

n = int ( input ( ) ) mas = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) if mas [ n - 1 ] >= mas [ n - 2 ] + mas [ n - 3 ] : print ( " NO " ) exit ( ) print ( " YES " ) for i in range ( n - 1 , - 1 , - 2 ) : print ( mas [ i ] , end = " ▁ " ) for i in range ( n % 2 , n , 2 ) : print ( mas [ i ] , end = " ▁ " ) NEW_LINE

import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) . split ( ) ) ) n = iinput ( ) a = listinput ( ) a . sort ( ) if a [ - 2 ] + a [ - 3 ] <= a [ - 1 ] : print ( " NO " ) else : print ( " YES " ) print ( * a [ : - 2 ] , a [ - 1 ] , a [ - 2 ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . LinkedList ; import java . util . Queue ;

import java . util . * ; import java . io . * ;   public class one {   public static void main ( String [ ] args ) throws IOException , FileNotFoundException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;

s = input ( ) x = 0 y = 0 d = dict ( ) d [ ( x , y ) ] = - 1 f = 0 for j in range ( len ( s ) ) : if s [ j ] == " L " : x += - 1 elif s [ j ] == " R " : x += 1 elif s [ j ] == " U " : y += 1 else : y += - 1 if ( x , y ) in d . keys ( ) : f = 1 break elif ( x - 1 , y ) in d . keys ( ) and ( j - d [ x - 1 , y ] ) > 1 : f = 1 break elif ( x + 1 , y ) in d . keys ( ) and ( j - d [ x + 1 , y ] ) > 1 : f = 1 break elif ( x , y + 1 ) in d . keys ( ) and ( j - d [ x , y + 1 ] ) > 1 : f = 1 break elif ( x , y - 1 ) in d . keys ( ) and ( j - d [ x , y - 1 ] ) > 1 : f = 1 break   d [ x , y ] = jif f == 1 : print ( ' BUG ' ) else : print ( " OK " )       NEW_LINE

import sys   path = input ( ) visited = set ( )   def move ( s , x , y ) : if i == ' L ' : x -= 1 elif i == ' R ' : x += 1 elif i == ' U ' : y += 1 else : y -= 1 return x , y x , y = 0 , 0 start = ( x , y ) parent = ( x , y ) visited . add ( start ) for i in path : parent = ( x , y ) x , y = move ( i , x , y ) if ( x , y ) in visited : print ( ' BUG ' ) sys . exit ( ) else : for i in " LRUD " : check = move ( i , x , y ) if check != parent and check in visited : print ( ' BUG ' ) sys . exit ( ) visited . add ( ( x , y ) ) print ( ' OK ' ) NEW_LINE

a = input ( ) b = [ [ 0 , 0 ] ] x = 0 y = 0 z = 1 for i in range ( len ( a ) ) : if a [ i ] == ' R ' : x += 1 if [ x , y ] in b or [ x + 1 , y ] in b or [ x , y + 1 ] in b or [ x , y - 1 ] in b : z = 0 break if a [ i ] == ' L ' : x -= 1 if [ x , y ] in b or [ x - 1 , y ] in b or [ x , y + 1 ] in b or [ x , y - 1 ] in b : z = 0 break if a [ i ] == ' U ' : y += 1 if [ x , y ] in b or [ x + 1 , y ] in b or [ x , y + 1 ] in b or [ x - 1 , y ] in b : z = 0 break if a [ i ] == ' D ' : y -= 1 if [ x , y ] in b or [ x + 1 , y ] in b or [ x - 1 , y ] in b or [ x , y - 1 ] in b : z = 0 break b . append ( [ x , y ] ) if z == 1 : print ( ' OK ' ) else : print ( ' BUG ' ) NEW_LINE

from collections import namedtuple   Pos = namedtuple ( ' Pos ' , ' x ▁ y ' )   s = input ( ) g = { }     def add ( last , pos ) : if last not in g : g [ last ] = set ( ) g [ last ] . add ( pos )   if pos not in g : g [ pos ] = set ( ) g [ pos ] . add ( last )     start = Pos ( 100 , 100 ) last = startok = True   for ch in s : pos = Pos ( 0 , 0 ) if ch == ' L ' : pos = Pos ( last . x - 1 , last . y ) elif ch == ' R ' : pos = Pos ( last . x + 1 , last . y ) elif ch == ' U ' : pos = Pos ( last . x , last . y - 1 ) elif ch == ' D ' : pos = Pos ( last . x , last . y + 1 )   if pos == start : ok = False break   if pos in g : ok = False break   p1 = Pos ( pos . x - 1 , pos . y ) p2 = Pos ( pos . x + 1 , pos . y ) p3 = Pos ( pos . x , pos . y + 1 ) p4 = Pos ( pos . x , pos . y - 1 )     def not_good ( pc ) : return pc != last and pc in g     if not_good ( p1 ) or not_good ( p2 ) or not_good ( p3 ) or not_good ( p4 ) : ok = False break   add ( last , pos ) last = pos NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class Main {   final static int mod = 1000000007 ; static FastReader sc ; static PrintWriter out ; static boolean test_case_input = false ;   public static void solution ( ) throws IOException { long n = sc . nextLong ( ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ;   int len = Long . toBinaryString ( n ) . length ( ) ; if ( n == 1 ) len = 1 ;

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 ( ) {

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

import java . util . * ; import java . io . * ; import java . math . * ;   public class Main {   private static int MAX = Integer . MAX_VALUE ; private static int MIN = Integer . MIN_VALUE ; private static int MOD = 1000000007 ; static FastScanner sc = new FastScanner ( ) ;   public static void main ( String [ ] args ) throws IOException {

def cz ( m ) : global ws , n if ( m % 2 == 1 ) : return 1 else : s = 2 i = 1 while ( m % ( s * 2 ) == 0 ) : s *= 2 i += 1 i = ws - i NEW_LINE

import sys , math   def func ( n , m , q ) : if m == 1 : return 1 x = m // 2 if x + 1 == q : return n % 2 else : if q > x + 1 : q -= ( x + 1 ) return func ( n // 2 , m // 2 , q )     def main ( ) :   n , l , r = map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) )   count = 0   if n >= 1 : m = 2 ** ( int ( math . log ( n , 2 ) ) + 1 ) - 1 for i in range ( l , r + 1 ) : if func ( n , m , i ) == 1 : count += 1   sys . stdout . write ( str ( count ) + ' \n ' )     main ( ) NEW_LINE


import java . util . Scanner ;   public class Main { static int [ ] hash = new int [ 100 ] ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; in . nextLine ( ) ; String s = in . nextLine ( ) ; char [ ] a = s . toCharArray ( ) ; int ans = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( a [ i ] >= ' a ' && a [ i ] <= ' z ' ) { hash [ a [ i ] - ' a ' ] ++ ; } else { if ( hash [ a [ i ] - ' A ' ] > 0 ) { hash [ a [ i ] - ' A ' ] -- ; } else { ans ++ ; } } } System . out . println ( ans ) ; }   }

import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ;   public class Solution {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; HashMap < Character , Integer > m = new HashMap < Character , Integer > ( ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String s = br . readLine ( ) . trim ( ) ; int l = s . length ( ) ; int count = 0 ; int ar [ ] = new int [ 26 ] ; for ( char ch : s . toCharArray ( ) ) { if ( ch >= 97 ) { ar [ ch - 97 ] ++ ; } else if ( ch < 97 && ar [ ch - 65 ] > 0 ) { ar [ ch - 65 ] -- ; } else { count ++ ; } }

import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException , InterruptedException { PrintWriter pw = new PrintWriter ( System . out ) ; Scanner sc = new Scanner ( System . in ) ; HashMap < Character , Integer > hm = new HashMap < > ( ) ; int n = sc . nextInt ( ) ; String s = sc . nextLine ( ) ; s = s . toLowerCase ( ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i += 2 ) { if ( s . charAt ( i ) != s . charAt ( i + 1 ) ) { if ( hm . containsKey ( s . charAt ( i + 1 ) ) && hm . get ( s . charAt ( i + 1 ) ) > 0 ) { hm . replace ( s . charAt ( i + 1 ) , hm . get ( s . charAt ( i + 1 ) ) - 1 ) ; } else {

from collections import defaultdictd = defaultdict ( int ) n = int ( input ( ) ) s = input ( ) . strip ( ) s1 = [ ] s2 = [ ] for i in range ( 65 , 91 ) : s1 . append ( chr ( i ) ) for i in range ( 97 , 123 ) : s2 . append ( chr ( i ) ) res = 0 for i in range ( 0 , len ( s ) , 2 ) : if ( ord ( s [ i ] ) - ord ( ' a ' ) == ord ( s [ i + 1 ] ) - ord ( ' A ' ) ) or ( ord ( s [ i ] ) - ord ( ' A ' ) == ord ( s [ i + 1 ] ) - ord ( ' a ' ) ) : continue elif s [ i + 1 ] in s1 and d [ s2 [ ord ( s [ i + 1 ] ) - ord ( ' A ' ) ] ] != 0 : d [ s2 [ ord ( s [ i + 1 ] ) - ord ( ' A ' ) ] ] -= 1 d [ s [ i ] ] += 1 continue elif s [ i + 1 ] in s2 and d [ s1 [ ord ( s [ i + 1 ] ) - ord ( ' a ' ) ] ] != 0 : d [ s1 [ ord ( s [ i + 1 ] ) - ord ( ' a ' ) ] ] -= 1 d [ s [ i ] ] += 1 continue else : res += 1 d [ s [ i ] ] += 1 print ( res ) NEW_LINE

n = int ( input ( ) ) KD = input ( )   current_keys = { chr ( ord ( ' a ' ) + key ) : 0 for key in range ( 26 ) } keysToBuy = 0   for i in range ( n - 1 ) : door = KD [ i * 2 + 1 ] key = KD [ i * 2 ] current_keys [ key ] += 1 req_key = door . lower ( )   if current_keys [ req_key ] > 0 : current_keys [ req_key ] -= 1 else : keysToBuy += 1   print ( keysToBuy )   NEW_LINE

from collections import defaultdict   t = 1   for _ in range ( t ) : n = input ( ) s = input ( ) keys = defaultdict ( int ) ans = 0 for i in s : if i . islower ( ) : keys [ i ] += 1 else : if keys [ i . lower ( ) ] > 0 : keys [ i . lower ( ) ] -= 1 else : ans += 1 print ( ans ) NEW_LINE


import java . util . Scanner ;   public class B257 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; int score1 = solve ( N - 1 , M , 0 , false ) ; int score2 = solve ( N , M - 1 , 1 , false ) ; int score = Math . max ( score1 , score2 ) ; System . out . println ( score + " ▁ " + ( N + M - 1 - score ) ) ; }   static int solve ( int N , int M , int last , boolean petya ) { int next ; if ( N == 0 ) { if ( M == 0 ) { return 0 ; } else { next = 1 ; } } else { if ( M == 0 ) { next = 0 ; } else { if ( petya ) { next = last ; } else { next = 1 - last ; } } } if ( next == 0 ) { N -- ; } else { M -- ; } int diff = ( last == next ) ? 1 : 0 ; return diff + solve ( N , M , next , ! petya ) ; } }

import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { int n = ni ( ) ; int m = ni ( ) ; pn ( ( Math . max ( n , m ) - 1 ) + " ▁ " + Math . min ( m , n ) ) ; }   static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;

import java . util . * ; import java . math . * ; import java . lang . * ; import javafx . util . Pair ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int max = Math . max ( n , m ) ; int min = Math . min ( n , m ) ; System . out . println ( max - 1 + " ▁ " + min ) ; } }

import java . util . Scanner ;   public class PlayingCubes { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int min = Math . min ( n , m ) ; int max = Math . max ( n , m ) ;   System . out . println ( ( max - 1 ) + " ▁ " + ( min ) ) ; }   }

a , b = map ( int , input ( ) . split ( ) ) print ( max ( a , b ) - 1 , min ( a , b ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) print ( ( n + m ) - 1 - min ( n , m ) , min ( n , m ) ) NEW_LINE

red , blue = map ( int , input ( ) . split ( ) ) total_point = red + blue - 1 vasya = min ( red , blue ) petya = total_point - vasyaprint ( petya , vasya ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) print ( n + m - min ( n , m ) - 1 , min ( n , m ) ) NEW_LINE

n , m = list ( map ( int , input ( ) . split ( ) ) ) petaya = 0 NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; PriorityQueue < Integer > pq = new PriorityQueue < > ( new Comparator < Integer > ( ) { public int compare ( Integer a , Integer b ) { return Integer . compare ( b , a ) ; } } ) ; for ( int i = 0 ; i < n ; i ++ ) { int p = ni ( ) ; if ( p % 2 == 0 ) pq . add ( p ) ; } int ans = 0 ; while ( pq . size ( ) > 0 ) { int p = pq . poll ( ) / 2 ;

import java . awt . Desktop ;    import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; } }

import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int t = fr . nextInt ( ) ; while ( t -- > 0 ) { int n = fr . nextInt ( ) ; int a [ ] = new int [ n ] ; Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = fr . nextInt ( ) ; if ( a [ i ] % 2 == 0 ) set . add ( a [ i ] ) ; } Arrays . sort ( a ) ;

import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . * ; import java . util . stream . Collectors ;   public class absolute { static int [ ] ar ; static int total ; static void generatePrimes ( ) { ar = new int [ total + 2 ] ; Arrays . fill ( ar , 1 ) ; ar [ 1 ] = 1 ; ar [ 2 ] = 1 ; for ( int i = 2 ; i <= Math . sqrt ( total ) ; i ++ ) { if ( ar [ i ] == 1 ) { for ( int j = i * i ; j <= total ; j += i ) ar [ j ] = 2 ; } } } public static void main ( String [ ] args ) {

import java . util . * ; import java . math . * ; public class MakeThemOdd { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int size = sc . nextInt ( ) ; TreeSet < Integer > arr = new TreeSet < Integer > ( ) ; while ( size -- > 0 ) { Integer num = sc . nextInt ( ) ; if ( num % 2 == 0 ) arr . add ( num ) ; } long out = 0 ; while ( arr . size ( ) > 0 ) { Integer temp = arr . pollLast ( ) ; temp /= 2 ; if ( temp % 2 == 0 ) arr . add ( temp ) ; out ++ ; } System . out . println ( out ) ; } } }

I = lambda : map ( int , input ( ) . split ( ) ) INT = lambda : int ( input ( ) )   T = INT ( ) NEW_LINE

from math import * import sysinput = sys . stdin . readlinea = int ( input ( ) ) for x in range ( a ) : b = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) j = list ( set ( c ) ) n = 0 d = { } for z in range ( len ( j ) ) : if j [ z ] & 1 == 0 : d [ j [ z ] ] = 1   j . sort ( ) for y in range ( len ( j ) ) : if j [ y ] & 1 == 0 : j [ y ] = int ( j [ y ] / 2 ) n += 1 while ( j [ y ] & 1 == 0 and d . get ( j [ y ] ) == None ) : d [ j [ y ] ] = 1 j [ y ] = int ( j [ y ] / 2 ) n += 1   print ( n ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( set ( a ) ) d = { } c = 0 for i in range ( len ( b ) ) : if ( b [ i ] & 1 == 0 ) : d [ b [ i ] ] = 1 b . sort ( reverse = True ) for i in range ( len ( b ) ) : if b [ i ] & 1 == 0 : b [ i ] = b [ i ] // 2 c += 1 while ( b [ i ] & 1 == 0 and d . get ( b [ i ] ) == None ) : d [ b [ i ] ] = 1 b [ i ] = b [ i ] // 2 c += 1 print ( c ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : input ( ) l = list ( map ( int , input ( ) . split ( ) ) ) s = set ( ) for x in l : while x % 2 == 0 and x not in s : s . add ( x ) x //= 2 print ( len ( s ) ) NEW_LINE


import java . util . Scanner ;   public class DigitCounter { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   long n = scanner . nextLong ( ) ; long count = 0 ;   for ( int i = 1 ; i <= n ; i *= 10 ) { count += n - i + 1 ; }   System . out . println ( count ) ; } }

import java . util . Scanner ;   public class CF552_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int l = String . valueOf ( n ) . length ( ) ; long c = 1 ; long sum = 0 ; int rem = n ; for ( int i = 0 ; i < l - 1 ; i ++ ) { int count = ( int ) ( 9 * Math . pow ( 10 , i ) ) ; rem -= count ; sum += count * c ; c ++ ; } sum += rem * c ;   System . out . println ( sum ) ; } }

import java . util . * ;   public class a { public static void main ( String [ ] arg ) { Scanner in = new Scanner ( System . in ) ; long x = in . nextLong ( ) ; long at = 0 , aux = x , u = 1 , cnt = 1 ; while ( aux >= 10 ) { at += x - u ; aux /= 10 ; u *= 10 ; cnt ++ ; } at += ( x - u + cnt ) ;   System . out . printf ( " % d \n " , at ) ; } }

import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = ( int ) Math . floor ( Math . log10 ( n ) + 1 ) ; if ( n < 9 ) System . out . println ( n ) ; else { double i = 1 ; long sum = 0 , res = 0 ; while ( i < d ) { long k = ( long ) ( 9 * Math . pow ( 10 , i - 1 ) ) ; sum = sum + ( k ) ; res = ( long ) ( res + ( k * i ) ) ; i ++ ; } res = ( long ) ( res + ( ( n - sum ) * i ) ) ; System . out . println ( res ) ; } } }

def digitsof ( n ) : lst = [ ] while n > 0 : lst . append ( n % 10 ) n //= 10 return lst     def answer ( n ) : NEW_LINE

n = int ( input ( ) ) p = ni = 1 l = 1 sd = 0 s = 0j = 1 while ( n > 9 ) : n = int ( n / 10 ) i *= 10 l += 1 if p > 9 : while i != 1 : s = p - i if j == 1 : s = s + 1 sd += s * l p = i i = i / 10 l -= 1 j += 1 p = 9 print ( int ( p + sd ) ) NEW_LINE

n = int ( input ( ) ) i = 10 count = 0 c2 = 0 while True :   if n >= i : count += 9 * ( i // 10 ) * ( len ( str ( i // 10 ) ) ) i *= 10   elif n < i : i = i // 10   count += ( ( n - i ) + 1 ) * ( len ( str ( i ) ) ) break   print ( count ) NEW_LINE

n = int ( input ( ) ) ans = 0 i = 9 while n > 0 : ans += n n -= i i *= 10 print ( ans )     NEW_LINE


import java . util . * ; public class george { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; if ( ( q - p ) >= 2 ) c ++ ; } System . out . println ( c ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;    public class CF467AGeorgeAndAccommodation {   static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws IOException { byte n = Byte . parseByte ( in . readLine ( ) ) ; String [ ] l ; int p , q , rooms = 0 ; while ( n -- > 0 ) { l = in . readLine ( ) . split ( " \\ s " ) ; p = Byte . parseByte ( l [ 0 ] ) ; q = Byte . parseByte ( l [ 1 ] ) ; if ( q - p > 1 ) { rooms ++ ; } } out . print ( rooms ) ; out . close ( ) ; } }

import java . util . Scanner ;   public class George_and_Accommodation {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int number = sc . nextInt ( ) ; int count = 0 ; while ( number > 0 ) { int into = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; if ( ( max - into ) >= 2 ) { count ++ ; } number -- ; } System . out . println ( count ) ; } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int cnt = 0 ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < b - 1 ) { cnt ++ ; } } System . out . println ( cnt ) ; } }

rooms = int ( input ( ' ' ) ) count = 0 for room in range ( rooms ) : x = input ( ' ' ) . split ( ) if int ( x [ 1 ] ) - int ( x [ 0 ] ) >= 2 : count += 1 print ( count ) NEW_LINE

n = int ( input ( ) ) i = 0 for _ in range ( n ) : p , q = tuple ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) if p < q - 1 : i += 1 print ( i ) NEW_LINE

a = int ( input ( ) ) o = 0 while a > 0 : N = [ i for i in input ( ) ] i = 1 while i < len ( N ) : if N [ i ] != ' ▁ ' : N [ i - 1 ] = int ( N [ i - 1 ] ) * 10 + int ( N [ i ] ) N . pop ( i ) else : N [ 0 ] = int ( N [ 0 ] ) N . pop ( i ) i = i + 1 N [ - 1 ] = int ( N [ - 1 ] ) if N [ 0 ] + 2 <= N [ 1 ] : o = o + 1 a = a - 1 print ( o ) NEW_LINE

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

n = int ( input ( ) ) b = 0 for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) if ( a [ 1 ] - a [ 0 ] >= 2 ) : b += 1 print ( b ) NEW_LINE


import java . util . Scanner ;   public class PolycarpsPockets { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ 110 ] ; for ( int i = 0 ; i < n ; i ++ ) { ++ a [ scan . nextInt ( ) ] ; } int res = 0 ; for ( int i = 0 ; i < 110 ; i ++ ) { res = Math . max ( a [ i ] , res ) ; } System . out . println ( res ) ; } }

import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; HashMap < Integer , Integer > h = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( h . containsKey ( arr [ i ] ) ) { int count = h . get ( arr [ i ] ) ; h . put ( arr [ i ] , count + 1 ) ; } else h . put ( arr [ i ] , 1 ) ; } int max = ( Collections . max ( h . values ( ) ) ) ; System . out . println ( max ) ; } }

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 discounts {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int b = fs . nextInt ( ) ; map . put ( b , map . getOrDefault ( b , 0 ) + 1 ) ; ans = Math . max ( ans , map . get ( b ) ) ; } System . out . println ( ans ) ; } static class FastScanner { 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 ( ) ) ; } } }

from collections import Countern = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = Counter ( l ) print ( max ( c . values ( ) ) ) NEW_LINE

num = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li2 = [ ] for i in range ( num ) : a = li . count ( li [ i ] ) li2 . append ( a ) print ( max ( li2 ) ) NEW_LINE

a = input ( ) coins = [ int ( x ) for x in input ( ) . split ( ) ] numbers = dict ( )   for d in coins : if d in numbers : numbers [ d ] += 1 else : numbers [ d ] = 1 pockets = 0 for v in numbers . values ( ) : if v > pockets : pockets = vprint ( pockets ) NEW_LINE

num_numbers = int ( input ( ) ) integers = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) num_nums = [ ] for number in set ( integers ) : num_nums . append ( integers . count ( number ) ) num_nums = sorted ( num_nums , reverse = True ) print ( num_nums [ 0 ] ) NEW_LINE


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 , count2 ; static int [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr , farr ; static Character [ ] [ ] mat , mat1 ; static long x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e6 ; static long mod = 998244353l ;

t = int ( input ( ) ) for _ in range ( t ) : s = str ( input ( ) ) l = [ ] u = [ ] d = [ ] for i , c in enumerate ( s ) : if c . islower ( ) : l . append ( i ) elif c . isupper ( ) : u . append ( i ) else : d . append ( i ) s = list ( s ) if l and u and d : pass elif not l and u and d : if len ( u ) > len ( d ) : s [ u [ 0 ] ] = ' a ' else : s [ d [ 0 ] ] = ' a ' elif l and not u and d : if len ( l ) > len ( d ) : s [ l [ 0 ] ] = ' A ' else : s [ d [ 0 ] ] = ' A ' elif l and u and not d : if len ( l ) > len ( u ) : s [ l [ 0 ] ] = '1' else : s [ u [ 0 ] ] = '1' elif l and not u and not d : s [ l [ 0 ] ] = ' A ' s [ l [ 1 ] ] = '1' elif not l and u and not d : s [ u [ 0 ] ] = ' a ' s [ u [ 1 ] ] = '1' elif not l and not u and d : s [ d [ 0 ] ] = ' a ' s [ d [ 1 ] ] = ' A ' print ( ' ' . join ( s ) ) NEW_LINE

''' lobeli ▁ code  ANSWER ▁ EXISTS ▁ FOR ▁ SURE  '''   T = int ( input ( ) ) for testis in range ( T ) : s = list ( input ( ) ) CL = - 1 L = - 1 D = - 1 for i in range ( len ( s ) ) : if ' A ' <= s [ i ] and s [ i ] <= ' Z ' : CL = i if ' a ' <= s [ i ] and s [ i ] <= ' z ' : L = i if '0' <= s [ i ] and s [ i ] <= '9' : D = i if D == - 1 : for i in range ( len ( s ) ) : if i != L and i != CL : NEW_LINE

def solve ( s ) : f1 = False f2 = False f3 = False for i in range ( len ( s ) ) : s1 = s [ i ] if s1 . isupper ( ) : f1 = True if s1 . islower ( ) : f2 = True if s1 . isdigit ( ) : f3 = True if f1 and f2 and f3 : break if f1 and f2 and f3 : return True else : return Falsefor _ in range ( int ( input ( ) ) ) : s = input ( ) if solve ( s ) : print ( s ) else : f = True t = list ( s ) for i in range ( len ( t ) ) : z = t [ i ] t [ i ] = '1' if solve ( ' ' . join ( map ( str , t ) ) ) : print ( ' ' . join ( map ( str , t ) ) ) f = False break t [ i ] = ' a ' if solve ( ' ' . join ( map ( str , t ) ) ) : print ( ' ' . join ( map ( str , t ) ) ) f = False break t [ i ] = ' A ' if solve ( ' ' . join ( map ( str , t ) ) ) : print ( ' ' . join ( map ( str , t ) ) ) f = False break t [ i ] = z if f : if s [ 2 ] . isupper ( ) : print ( ' a1' + s [ 2 : ] ) continue if s [ 2 ] . islower ( ) : print ( ' A1' + s [ 2 : ] ) continue if s [ 2 ] . isdigit ( ) : print ( ' aA ' + s [ 2 : ] ) continue NEW_LINE


import javax . swing . plaf . IconUIResource ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class codeforces { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int [ ] arr = new int [ n * m ] ; boolean flag = true ; int count = 0 , sum = 0 ; for ( int i = 0 ; i < ( n * m ) ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum += arr [ i ] ; } if ( m * n == 1 ) { System . out . println ( "0" ) ; return ; } Arrays . sort ( arr ) ; int cmp = arr [ ( m * n ) / 2 ] ; for ( int i = 0 ; i < ( m * n ) ; i ++ ) { if ( ( cmp - arr [ i ] ) % d == 0 ) { count += Math . abs ( cmp - arr [ i ] ) / d ; } else { flag = false ; break ; } } if ( flag == false ) System . out . println ( " - 1" ) ; else System . out . println ( count ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ;   public class PoloMatrix {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] temp = br . readLine ( ) . split ( " ▁ " ) ; int rows = Integer . parseInt ( temp [ 0 ] ) ; int columns = Integer . parseInt ( temp [ 1 ] ) ; int diff = Integer . parseInt ( temp [ 2 ] ) ; int [ ] numbers = new int [ rows * columns ] ; for ( int i = 0 ; i < rows ; i ++ ) { String [ ] temp2 = br . readLine ( ) . split ( " ▁ " ) ; for ( int j = 0 ; j < columns ; j ++ ) { numbers [ i * columns + j ] = Integer . parseInt ( temp2 [ j ] ) ; } } boolean possible = true ; int mod = numbers [ 0 ] % diff ; for ( int i = 0 ; i < numbers . length ; i ++ ) { if ( numbers [ i ] % diff != mod ) { possible = false ; break ; } } if ( possible ) { Arrays . sort ( numbers ) ; int median = numbers [ numbers . length / 2 ] ; int moves = 0 ; for ( int i = 0 ; i < numbers . length ; i ++ ) { moves += ( Math . abs ( median - numbers [ i ] ) ) / diff ; } System . out . println ( moves ) ; } else { System . out . println ( " - 1" ) ; } }   }

import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class Problem_289B { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int rows = s . nextInt ( ) ; int cols = s . nextInt ( ) ;   double d = s . nextDouble ( ) ;   int [ ] nums = new int [ rows * cols ] ; for ( int i = 0 ; i < rows * cols ; i ++ ) nums [ i ] = s . nextInt ( ) ;   Arrays . sort ( nums ) ; int median = nums . length % 2 == 0 ? ( nums [ nums . length / 2 - 1 ] ) : nums [ nums . length / 2 ] ;   double moves = 0 ; for ( int i = 0 ; i < rows * cols ; i ++ ) { if ( nums [ i ] != median ) moves += Math . abs ( ( nums [ i ] - median ) / d ) ; }   if ( moves == Math . ceil ( moves ) ) System . out . println ( ( int ) moves ) ; else System . out . println ( " - 1" ) ; } }

n , m , d = map ( int , input ( ) . split ( ) ) A = [ ] for i in range ( n ) : A += list ( map ( int , input ( ) . split ( ) ) )   A = sorted ( A ) median = A [ m * n // 2 ]   rem = A [ 0 ] % d sum = 0 for i in range ( n * m ) : if A [ i ] % d != rem : print ( - 1 ) exit ( ) else : sum += abs ( A [ i ] - median ) / d   print ( int ( sum ) ) NEW_LINE

n , m , d = [ int ( e ) for e in input ( ) . split ( " ▁ " ) ] mat = [ ] for _ in range ( n ) : mat . append ( [ int ( e ) for e in input ( ) . split ( " ▁ " ) ] ) r = mat [ 0 ] [ 0 ] % da = [ ] for i in range ( n ) : for j in range ( m ) : if mat [ i ] [ j ] % d != r : print ( - 1 ) exit ( ) a . append ( mat [ i ] [ j ] )   a . sort ( ) m = len ( a ) // 2 ans = 0 for i in range ( len ( a ) ) : ans += abs ( a [ i ] - a [ m ] )   print ( ans // d )   NEW_LINE

n , m , d = map ( int , input ( ) . split ( ) ) a = [ 0 ] for i in range ( n ) : a += list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) s = set ( ) for i in range ( 1 , len ( a ) ) : s . add ( a [ i ] % d ) if len ( s ) >= 2 : print ( - 1 ) exit ( ) aa = [ 0 ] * ( n * m + 1 ) for i in range ( 1 , n * m + 1 ) : aa [ i ] = aa [ i - 1 ] + a [ i ] ans = 10 ** 18 for i in range ( 1 , n * m + 1 ) : ans = min ( ans , ( aa [ - 1 ] - 2 * aa [ i ] - ( n * m - 2 * i ) * a [ i ] ) // d ) print ( ans ) NEW_LINE

def median ( arr ) : n = len ( arr ) return ( n - 1 ) // 2 from math import ceil , floor   n , m , d = map ( int , input ( ) . split ( ' ▁ ' ) ) arr = [ ] for i in range ( n ) : x = [ int ( w ) for w in input ( ) . split ( ' ▁ ' ) ] for item in x : arr . append ( item ) arr . sort ( )   if ( n * m ) % 2 == 0 : x = arr [ median ( arr ) ] y = arr [ median ( arr ) + 1 ] ans = 0 for item in arr : f = ( abs ( item ) - x ) / d if ceil ( f ) == floor ( f ) : ans = ans + abs ( f ) else : ans = - 1 break ans1 = 0 for item in arr : f = ( abs ( item ) - y ) / d if ceil ( f ) == floor ( f ) : ans1 = ans1 + abs ( f ) else : ans1 = - 1 break if ans == - 1 and ans1 == - 1 : ans = - 1 else : if ans == - 1 : ans = ans1 elif ans1 == - 1 : ans = ans else : ans = min ( ans1 , ans )   else : ans = 0 x = arr [ median ( arr ) ] for item in arr : f = ( abs ( item ) - x ) / d if ceil ( f ) == floor ( f ) : ans = ans + abs ( f ) else : ans = - 1 breakprint ( int ( ans ) ) NEW_LINE


import java . util . Scanner ; public class p1496A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; l : for ( int t = sc . nextInt ( ) ; t -- > 0 ; ) { int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . substring ( 0 , k ) . equals ( reverse ( s . substring ( n - k , n ) ) ) && k * 2 < n ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } static String reverse ( String s ) { return new StringBuilder ( s ) . reverse ( ) . toString ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; String str = s . next ( ) ; int count = 0 ; int range = ( n - 1 ) / 2 ; for ( int j = 0 ; j < range ; j ++ ) { if ( str . charAt ( j ) != str . charAt ( n - 1 - j ) ) { break ; } else { count ++ ; } } if ( k <= count ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

import java . util . Scanner ; public class A { 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 ( ) ; int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; String s = scanner . nextLine ( ) ; boolean b = n > 2 * k ; for ( int j = 0 ; j < k ; j ++ ) b = b && ( s . charAt ( j ) == s . charAt ( s . length ( ) - 1 - j ) ) ; if ( b ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

import java . util . Scanner ; public class javaProject { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int test = input . nextInt ( ) ; while ( test -- > 0 ) { int n = input . nextInt ( ) , k = input . nextInt ( ) ; String s = input . next ( ) ; int count = 0 ; for ( int i = 0 ; i < ( n % 2 == 1 ? n / 2 : n / 2 - 1 ) ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( n - 1 - i ) ) { count ++ ; } else { break ; } } if ( count >= k ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

import java . util . * ; public class A1496 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; char ch = ' ▁ ' ; char ch2 = ' ▁ ' ; int sum = 0 ; int min = 0 , max = n - 1 ; while ( ( max - min ) >= 2 ) { ch = s . charAt ( min ) ; ch2 = s . charAt ( max ) ; if ( ch == ch2 ) sum ++ ; else break ; max -- ; min ++ ; } if ( sum >= k ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

I = input NEW_LINE exec ( int ( I ( ) ) * " n , k = map ( int , I ( ) . split ( ) ) ; s = I ( ) ; print ( ' YNEOS ' [ s [ : k ] ! = s [ : ~ k : -1 ] or ▁ 2 * k = = n : :2 ] ) ; " ) NEW_LINE

I = input NEW_LINE for _ in ' ▁ ' * int ( I ( ) ) : NEW_LINE INDENT n , k = map ( int , I ( ) . split ( ) ) NEW_LINE s = I ( ) NEW_LINE print ( ' YNEOS ' [ 2 * k == n or s [ : k ] != s [ - 1 : - k - 1 : - 1 ] : : 2 ] ) NEW_LINE DEDENT

I = input NEW_LINE exec ( int ( I ( ) ) * " n , k = map ( int , I ( ) . split ( ) ) ; s = I ( ) ; i = 0 \n while ▁ i < k ▁ and ▁ s [ i ] = = s [ ~ i ] : i + = 1 \n print ( ' NYOE ▁ S ' [ n > 2 * k < = 2 * i : :2 ] ) \n " ) NEW_LINE


import java . util . * ; import java . io . * ;   public class B1137 {   static int [ ] prefixFunction ( char [ ] s )

import java . io . * ; import java . util . * ;     public class D {   static int longestPrefixSuffix ( String s ) { int n = s . length ( ) ; int lps [ ] = new int [ n ] ;

import java . util . * ; import java . io . * ;   public class Div680 {

def z_func ( s : str ) : z = [ 0 ] * len ( s ) left , right = 0 , 0 for i in range ( 1 , len ( s ) ) : z [ i ] = max ( 0 , min ( z [ i - left ] , right - i ) ) while i + z [ i ] < len ( s ) and s [ z [ i ] ] == s [ i + z [ i ] ] : z [ i ] += 1 if i + z [ i ] > right : left , right = i , i + z [ i ] return z     def get_zeros_ones_count ( s : str ) : zeros_count = 0 ones_count = 0 for digit in s : if digit == '0' : zeros_count += 1 else : ones_count += 1 return zeros_count , ones_count     cur_timetable = input ( ) ideal_timetable = input ( )   cur_zeros_count , cur_ones_count = get_zeros_ones_count ( cur_timetable )   ideal_z_values = z_func ( ideal_timetable ) ideal_length = len ( ideal_z_values ) max_pref_len = 0   for i in range ( ideal_length - 1 , ideal_length // 2 - 1 , - 1 ) : if ideal_z_values [ i ] + i == ideal_length : if ideal_z_values [ i ] > max_pref_len : max_pref_len = ideal_z_values [ i ]   period = ideal_timetable [ : ( ideal_length - max_pref_len ) ] if max_pref_len != 0 else ideal_timetablesuffix = ideal_timetable [ : max_pref_len ] if max_pref_len != 0 else ' '   period_zeros , period_ones = get_zeros_ones_count ( period ) suffix_zeros , suffix_ones = get_zeros_ones_count ( suffix )   res = [ ] while True : if period_ones > cur_ones_count or period_zeros > cur_zeros_count : break res . append ( period ) cur_ones_count -= period_ones cur_zeros_count -= period_zeros   if cur_zeros_count >= suffix_zeros and cur_ones_count >= suffix_ones : res . append ( suffix ) cur_ones_count -= suffix_ones cur_zeros_count -= suffix_zeros   if cur_ones_count != 0 : res += [ '1' ] * cur_ones_count   if cur_zeros_count != 0 : res += [ '0' ] * cur_zeros_count   print ( ' ' . join ( res ) ) NEW_LINE

import sysinput = sys . stdin . readline     def MP ( s ) : a = [ 0 ] * ( len ( s ) + 1 ) a [ 0 ] = - 1 j = - 1 for i in range ( len ( s ) ) : while j >= 0 and s [ i ] != s [ j ] : j = a [ j ] j += 1 a [ i + 1 ] = j return a     s = input ( ) [ : - 1 ] t = input ( ) [ : - 1 ] cnt = [ 0 , 0 ] for char in s : cnt [ int ( char ) ] += 1   tbl = MP ( t ) lap = len ( t ) - tbl [ len ( t ) ] t = t [ 0 : lap ]   ans = [ ] while True : for char in t : if cnt [ int ( char ) ] > 0 : ans . append ( char ) cnt [ int ( char ) ] -= 1 else : break else : continue break   for i in range ( cnt [ 0 ] ) : ans . append ( "0" ) for i in range ( cnt [ 1 ] ) : ans . append ( "1" )   print ( ' ' . join ( ans ) ) NEW_LINE


import java . util . * ; import java . io . * ; public class Solution { static int rock = 0 ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) throws Exception {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashSet ; import java . util . StringTokenizer ; import java . util . Collections ; import java . lang . Math ;    public class Main { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int k = scanner . nextInt ( ) ; String N = scanner . next ( ) ; int L = N . length ( ) , total = 0 , current = 0 ; int count [ ] = new int [ 15 ] ;   for ( int idx = 0 ; idx < N . length ( ) ; ++ idx ) { count [ N . charAt ( idx ) - '0' ] ++ ; current += N . charAt ( idx ) - '0' ; }   for ( int digit = 0 , avail , req , take ; digit < 10 && current < k ; ++ digit ) { avail = count [ digit ] ; req = ( k - current + 8 - digit ) / ( 9 - digit ) ; take = Math . min ( avail , req ) ;   total += take ; current += take * ( 9 - digit ) ; }   System . out . println ( total ) ; return ; }   static class FastScanner { 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import static java . util . Arrays . sort ; import javafx . util . Pair ;   public class Main { public static int SumOfDigits ( char s [ ] ) { int sum = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { sum += ( s [ i ] - '0' ) ; } return sum ; }   public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; int k = input . nextInt ( ) ; char s [ ] = input . next ( ) . toCharArray ( ) ; int sum = SumOfDigits ( s ) ; if ( sum >= k ) { System . out . println ( "0" ) ; return ; } Arrays . sort ( s ) ; int count = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { int ch = s [ i ] - '0' ; if ( ch != 9 ) { sum -= ch ; sum += 9 ; count ++ ; if ( sum >= k ) { System . out . println ( count ) ; return ; } } } }   static class FastScanner {   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 ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }

k = int ( input ( ) ) n = input ( ) sum = 0 for i in n : sum += int ( i ) cnt = 0 n = sorted ( n ) i = 0 while ( k > sum ) : if n [ i ] != '9' : sum += ( 9 - int ( n [ i ] ) ) cnt += 1 i += 1 print ( cnt ) NEW_LINE

k = int ( input ( ) ) p = input ( ) n = sorted ( map ( int , p ) ) s = sum ( n ) if s >= k : print ( 0 ) else : i = 0 while ( s < k ) : s = s + 9 - n [ i ] i += 1 print ( i ) NEW_LINE

import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) ) ) k = iinput ( ) n = listinput ( ) n . sort ( ) i = 0 s = sum ( n ) while s < k : s += 9 - n [ i ] i += 1 print ( i ) NEW_LINE

k = int ( input ( ) ) digits = [ int ( i ) for i in input ( ) ] digits . sort ( ) cur = sum ( digits ) ans = 0 for d in digits : if cur < k : cur += 9 - d ans += 1 print ( ans ) NEW_LINE

n = int ( input ( ) ) num = input ( ) s = [ ] for ch in num : s . append ( int ( ch ) ) s . sort ( ) total = sum ( s ) if total >= n : print ( 0 ) exit ( ) total = n - totali , count = 0 , 1   while i < len ( s ) : if ( 9 - s [ i ] ) < total : total -= 9 - s [ i ] count += 1 i += 1 else : print ( count ) exit ( ) NEW_LINE


import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } long sum = a [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( a [ i ] <= sum ) b [ i ] = ( int ) ( sum ) - a [ i ] + 1 ; else if ( a [ i ] > sum ) { sum = a [ i ] ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( b [ i ] + " ▁ " ) ; } System . out . println ( " " ) ; }   }

import java . util . Scanner ;   public class Practice { public static Scanner input = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int n = input . nextInt ( ) ; int [ ] arr = new int [ n ] ; int m [ ] = new int [ n ] ; int maxi = arr [ n - 1 ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = input . nextInt ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { m [ i ] = Math . max ( 0 , maxi - arr [ i ] + 1 ) ; if ( maxi < arr [ i ] ) maxi = arr [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) System . out . print ( m [ i ] + " ▁ " ) ; }  	  }

import java . util . Scanner ;   public class Codeforces581BLuxeryHouse {   public static void main ( String [ ] args ) { int a , b , sum = 0 ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; int [ ] arr = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; } int [ ] answer = new int [ a ] ; answer [ a - 1 ] = 0 ; for ( int i = a - 2 ; i >= 0 ; i -- ) { if ( arr [ i + 1 ] >= arr [ i ] ) { answer [ i ] = arr [ i + 1 ] - arr [ i ] + 1 ; arr [ i ] = arr [ i ] + arr [ i + 1 ] - arr [ i ] ; }   else answer [ i ] = 0 ;   } for ( int j : answer ) { System . out . print ( j + " ▁ " ) ; } }   }

import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long a [ ] [ ] = new long [ n ] [ 2 ] ; long max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = input . nextLong ( ) ; } max = a [ n - 1 ] [ 0 ] ; a [ n - 1 ] [ 1 ] = max ; for ( int i = n - 2 ; i >= 0 ; i -- ) { a [ i ] [ 1 ] = max ; max = Math . max ( max , a [ i ] [ 0 ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( i == n - 1 ) { System . out . println ( "0" ) ; return ; } System . out . print ( ( ( a [ i ] [ 1 ] - a [ i ] [ 0 ] ) < 0 ) ? 0 + " ▁ " : ( ( ( a [ i ] [ 1 ] - a [ i ] [ 0 ] ) + 1 ) ) + " ▁ " ) ; } } }

n = int ( input ( ) ) h = list ( map ( int , input ( ) . split ( ) ) ) r = [ 0 ] m = h [ - 1 ]   for i in range ( n - 2 , - 1 , - 1 ) : if h [ i ] <= m : r . append ( m + 1 - h [ i ] ) else : r . append ( 0 ) m = h [ i ] for i in range ( n - 1 , - 1 , - 1 ) : print ( r [ i ] , end = ' ▁ ' ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) max1 = 0 arr1 = [ ] for i in range ( n - 1 , - 1 , - 1 ) : if l [ i ] > max1 : max1 = l [ i ] arr1 . append ( 0 ) elif l [ i ] == max1 : arr1 . append ( 1 ) else : arr1 . append ( max1 - l [ i ] + 1 ) arr1 = arr1 [ : : - 1 ] print ( * arr1 ) NEW_LINE

n = int ( input ( ) ) houses = [ int ( h ) for h in input ( ) . split ( ) ] [ : : - 1 ]   maxheight = houses [ 0 ]   res = [ ] res . append ( 0 )   for house in houses [ 1 : ] : if house <= maxheight : res . append ( maxheight - house + 1 ) else : res . append ( 0 ) maxheight = max ( maxheight , house )   res1 = [ str ( r ) for r in res [ : : - 1 ] ]   print ( ' ▁ ' . join ( res1 ) ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) l = [ 0 ] * nm = a [ n - 1 ] for i in range ( n - 2 , - 1 , - 1 ) : l [ i ] = max ( 0 , m - a [ i ] + 1 ) m = max ( m , a [ i ] ) print ( * l ) NEW_LINE


import java . util . * ; import java . io . * ; public class EdA {   public static void main ( String [ ] args ) throws Exception { int num = 998244353 ;

import java . io . * ; import java . util . * ; import java . math . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Reader pm = new Reader ( ) ;

from heapq import heappush , heappopn , k1 , k2 = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) pq = [ ] for i in range ( n ) : if abs ( a [ i ] - b [ i ] ) > 0 : heappush ( pq , - abs ( a [ i ] - b [ i ] ) ) tot = k1 + k2while pq and tot > 0 : ce = - heappop ( pq ) tot -= 1 if ce == 1 : continue heappush ( pq , - ( ce - 1 ) ) ans = 0 if tot > 0 : ans = tot % 2 elif pq : for elm in pq : ans += elm ** 2 print ( ans ) NEW_LINE

n , oa , ob = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) diff = [ ] for i , j in zip ( a , b ) : diff . append ( abs ( i - j ) ) k = oa + obwhile k > 0 : diff . sort ( ) if diff [ len ( diff ) - 1 ] == 0 : break diff [ len ( diff ) - 1 ] = diff [ len ( diff ) - 1 ] - 1 k = k - 1 if k & 1 == 1 : print ( 1 ) else : ans = [ i ** 2 for i in diff ] print ( sum ( ans ) ) NEW_LINE

R = lambda : map ( int , input ( ) . split ( ) ) n , k1 , k2 = R ( )   diff = [ abs ( x1 - x2 ) for x1 , x2 in zip ( R ( ) , R ( ) ) ]   for _ in range ( k1 + k2 ) : diff . sort ( ) diff [ - 1 ] = abs ( diff [ - 1 ] - 1 )   print ( sum ( i ** 2 for i in diff ) ) NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( ) ; System . out . println ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int maxSoFar = Integer . MIN_VALUE ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; maxSoFar = Math . max ( maxSoFar , a [ i ] ) ; max = Math . max ( max , maxSoFar - a [ i ] ) ; } int ans = 0 ; while ( max > 0 ) { max /= 2 ; ans ++ ; } System . out . println ( ans ) ; }   }   static void sort ( int [ ] a ) { ArrayList < Integer > l = new ArrayList < > ( ) ; for ( int i : a ) l . add ( i ) ; Collections . sort ( l ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = l . get ( i ) ; }   }   class Scanner { BufferedReader br ; StringTokenizer st ;   Scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) throws IOException { while ( st == null || ! st . hasMoreElements ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   int nextInt ( ) throws NumberFormatException , IOException { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) throws NumberFormatException , IOException { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) throws NumberFormatException , IOException { return Double . parseDouble ( next ( ) ) ; } }

from sys import stdint = int ( stdin . readline ( ) ) # t = 1   for _ in xrange ( t ) : # a , b = map ( int , stdin . readline ( ) . split ( ) ) n = int ( stdin . readline ( ) ) a = map ( int , stdin . readline ( ) . split ( ) ) # b = map ( int , stdin . readline ( ) . split ( ) ) pr = a [ 0 ] dif = 0 for i in a : pr = max ( pr , i ) dif = max ( dif , pr - i ) cur = 0 while True : if ( 1 << cur ) > dif : break cur += 1 print cur

import java . util . Scanner ;   public class Solution { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int totalCases = input . nextInt ( ) ;   for ( int caseNumber = 1 ; caseNumber <= totalCases ; caseNumber ++ ) { int arrayLength = input . nextInt ( ) ; int previousElement = Integer . MIN_VALUE ; int maximumDifference = 0 ;   for ( int index = 0 ; index < arrayLength ; index ++ ) { int currentElement = input . nextInt ( ) ;   if ( previousElement > currentElement ) { maximumDifference = Math . max ( maximumDifference , previousElement - currentElement ) ; } else { previousElement = currentElement ; } }   System . out . println ( ( int ) Math . ceil ( Math . log ( maximumDifference + 1 ) / Math . log ( 2 ) ) ) ; } } }

import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Sol { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; Long [ ] ar = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextLong ( ) ; } Long curMax = Long . MIN_VALUE ; Long max = Long . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { if ( ar [ i ] > curMax ) { curMax = ar [ i ] ; } if ( ar [ i ] < curMax ) { max = Math . max ( curMax - ar [ i ] , max ) ; } } int ans = 0 ; for ( int i = 0 ; i <= 32 ; i ++ ) { Long x = ( long ) Math . pow ( 2 , i ) ; if ( x <= max ) { ans ++ ; } else { break ; } } System . out . println ( ans ) ; } } }

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] x = 0 add = 0 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : diff = a [ i - 1 ] - a [ i ] while diff > add : add += 2 ** x x += 1 a [ i ] = a [ i - 1 ] print ( x ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] maxi = 0 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : maxi = max ( maxi , a [ i - 1 ] - a [ i ] ) a [ i ] = a [ i - 1 ] temp = bin ( maxi ) if temp [ 2 ] == '0' : print ( len ( temp ) - 3 ) else : print ( len ( temp ) - 2 ) NEW_LINE

from math import logfor _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE

import mathfrom collections import defaultdict , Counter , deque   INF = float ( ' inf ' )   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   peak = - INF diff = 0 for i in range ( n ) : peak = max ( peak , arr [ i ] ) diff = max ( diff , peak - arr [ i ] )   p = 1 cnt = 0 while p <= diff : p *= 2 cnt += 1   print ( cnt )   NEW_LINE


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

import java . util . * ; import java . io . * ;   public class _practise { public static void main ( String args [ ] ) { FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = 1 ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int min = 101 , s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; min = Math . min ( a [ i ] , min ) ; if ( i > 0 && a [ i ] == a [ i - 1 ] ) s ++ ; } if ( n != 2 ) { boolean flag = true ; int c = 0 ; int ans = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % min == 0 ) c ++ ; } if ( c == n ) { ans = min ; flag = false ; } if ( flag ) for ( int i = 2 ; i <= min ; i ++ ) { c = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( a [ j ] % i == 0 ) c ++ ; } if ( c == n ) { ans = i ; flag = false ; break ; } }

import java . util . Scanner ;   public class _0714FoxandNumberGame { static boolean isPrime ( int n ) {

import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] ar = new int [ t ] ; int gcd = 0 ; for ( int i = 0 ; i < t ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; gcd = ( int ) gcd ( ar [ i ] , gcd ) ; } System . out . println ( gcd * t ) ;          }     public static long power ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = ans * a ; ans %= c ; } a = a * a ; a %= c ; b /= 2 ; } return ans ; }   public static long power1 ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = multiply ( ans , a , c ) ; } a = multiply ( a , a , c ) ; b /= 2 ;   } return ans ;   }   public static long multiply ( long a , long b , long c ) { long res = 0 ; a %= c ; while ( b > 0 ) { if ( b % 2 == 1 ) { res = ( res + a ) % c ; } a = ( a + a ) % c ; b /= 2 ; }   return res % c ;   }   public static long totient ( long n ) { long result = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) {

import java . util . Scanner ; import java . lang . * ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int largest ; int smallest ; int help ; int z1 = 0 ; int arr1 [ ] = new int [ n ] ; for ( int i1 = 0 ; i1 < n ; i1 ++ ) { arr1 [ i1 ] = sc . nextInt ( ) ; } for ( int i2 = 0 ; i2 < n ; i2 ++ ) { for ( int i3 = i2 ; i3 < n ; i3 ++ ) { int o1 = ( arr1 [ i2 ] > arr1 [ i3 ] ) ? ( arr1 [ i2 ] ) : ( arr1 [ i3 ] ) ; arr1 [ i3 ] = ( arr1 [ i2 ] < arr1 [ i3 ] ) ? ( arr1 [ i2 ] ) : ( arr1 [ i3 ] ) ; arr1 [ i2 ] = o1 ; } } largest = arr1 [ 0 ] ; smallest = arr1 [ n - 1 ] ;

def hcfnaive ( a , b ) : if ( b == 0 ) : return a else : return hcfnaive ( b , a % b ) n = int ( input ( ) ) li = [ int ( x ) for x in input ( ) . split ( ) ] a = li [ 0 ] for _ in range ( n - 1 ) : a = hcfnaive ( a , li [ _ + 1 ] ) print ( a * n ) NEW_LINE

""" Handle : ▁ shashank - sharmaCreated ▁ at : ▁ 12-03-2021T17:16:49 """   import sysinput = sys . stdin . readline   NEW_LINE

n = input ( ) n1 = int ( n ) c = list ( map ( int , input ( ) . split ( ) [ : n1 ] ) ) c . sort ( reverse = True ) l = len ( c ) i = - 1 while i < l - 2 : i = i + 1 if i == l - 1 : break if c [ i ] > c [ i + 1 ] : c [ i ] = c [ i ] - c [ i + 1 ] c . sort ( reverse = True ) i = - 1 print ( sum ( c ) ) NEW_LINE

def hcf ( x , y ) : while ( y ) : x , y = y , x % y return x   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) h = hcf ( l [ 0 ] , l [ 1 ] ) for i in range ( 2 , n ) : h = hcf ( h , l [ i ] ) print ( h * n ) NEW_LINE

try : n = int ( input ( ) ) k = [ int ( i ) for i in input ( ) . split ( ) ] k . sort ( ) while ( min ( k ) != max ( k ) ) : k [ n - 1 ] = k [ n - 1 ] - k [ 0 ] k . sort ( ) print ( min ( k ) * n ) except : pass NEW_LINE


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char a = sc . next ( ) . charAt ( 0 ) ; char b = sc . next ( ) . charAt ( 0 ) ; int n = sc . nextInt ( ) ; int x = 0 , y = 0 ; if ( a == ' v ' ) x = 1 ; else if ( a == ' < ' ) x = 2 ; else if ( a == ' ^ ' ) x = 3 ; else if ( a == ' > ' ) x = 4 ; if ( b == ' v ' ) y = 1 ; else if ( b == ' < ' ) y = 2 ; else if ( b == ' ^ ' ) y = 3 ; else if ( b == ' > ' ) y = 4 ; int d = ( ( y - x ) + 4 ) % 4 ; if ( d == 0 || d == 2 ) { System . out . println ( " undefined " ) ; } else if ( d == n % 4 ) { System . out . println ( " cw " ) ; } else { System . out . println ( " ccw " ) ; } } }

import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; int n = scan . nextInt ( ) ; Integer start = state ( s . charAt ( 0 ) ) ; Integer end = state ( s . charAt ( 2 ) ) ; n = n % 4 ; List < Integer > cw = Arrays . asList ( 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 ) ; List < Integer > ccw = Arrays . asList ( 1 , 4 , 3 , 2 , 1 , 4 , 3 , 2 ) ; String result ; boolean isCw = cw . get ( cw . indexOf ( start ) + n ) == end ; boolean isCcw = ccw . get ( ccw . indexOf ( start ) + n ) == end ; if ( isCw && ! isCcw ) { result = " cw " ; } else if ( isCcw && ! isCw ) { result = " ccw " ; } else { result = " undefined " ; } System . out . println ( result ) ; } private static int state ( char ch ) { if ( ch == ' v ' ) { return 1 ; } else if ( ch == ' < ' ) { return 2 ; } else if ( ch == ' ^ ' ) { return 3 ; } else if ( ch == ' > ' ) { return 4 ; } else { return - 1 ; } } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String s1 = s . nextLine ( ) ; int n = s . nextInt ( ) ; char ch [ ] = { ' ^ ' , ' > ' , ' v ' , ' < ' } ; int p1 = 0 , p2 = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( ch [ i ] == s1 . charAt ( 0 ) ) p1 = i ; if ( ch [ i ] == s1 . charAt ( 2 ) ) p2 = i ; } int step = n % 4 ; if ( step != 0 && step != 2 ) { if ( ch [ ( p1 + step ) % 4 ] == ch [ p2 ] ) { System . out . println ( " cw " ) ; } else if ( ch [ Math . abs ( p2 + step ) % 4 ] == ch [ p1 ] ) System . out . println ( " ccw " ) ; else System . out . println ( " undefined " ) ; } else System . out . println ( " undefined " ) ; } }

DIRS = [ ' v ' , ' < ' , ' ^ ' , ' > ' ] a , b = map ( DIRS . index , input ( ) . split ( ) ) n = int ( input ( ) ) delta = ( b - a + 4 ) % 4 if delta == 0 or delta == 2 : print ( ' undefined ' ) elif delta == n % 4 : print ( ' cw ' ) else : print ( ' ccw ' ) NEW_LINE

a , b = input ( ) . split ( ) n = int ( input ( ) ) l = [ ' v ' , ' < ' , ' ^ ' , ' > ' ] i = l . index ( a ) j = l . index ( b ) if ( j - i + 4 ) % 4 == 0 or ( j - i + 4 ) % 4 == 2 : print ( ' undefined ' ) elif ( j - i + 4 ) % 4 == n % 4 : print ( ' cw ' ) else : print ( ' ccw ' ) NEW_LINE

a , c , b = list ( str ( input ( ) ) ) n = int ( input ( ) ) s = [ 94 , 62 , 118 , 60 ] if n % 2 == 0 : print ( " undefined " ) else : k = s . index ( ord ( a ) ) if s [ ( k + n ) % 4 ] == ord ( b ) : print ( " cw " ) else : print ( " ccw " )     NEW_LINE

start , end = map ( str , input ( ) . split ( ) ) rotating_time = int ( input ( ) )   array = [ " < " , " ^ " , " > " , " v " ]   if ( rotating_time == 1 ) : start_ix = array . index ( start ) end_idx = start_ix + 1 if ( end_idx > 3 ) : end_idx = 0 if ( end == array [ end_idx ] ) : print ( " cw " ) else : end_idx = start_ix - 1 if ( start_ix == - 1 ) : start_ix = 3 if ( end == array [ end_idx ] ) : print ( " ccw " ) else : print ( " undefined " ) else : rotating_time -= 2 time_left = rotating_time % 4 start_ix = array . index ( start ) flag = 0 while True : end_idx = start_ix + time_left if ( end_idx > 3 ) : end_idx = end_idx - 4 if ( end == array [ end_idx ] ) : print ( " ccw " ) flag = - 1 break while flag == 0 : end_idx = start_ix - time_left if ( end_idx < 0 ) : end_idx = 4 + end_idx if ( end == array [ end_idx ] ) : print ( " cw " ) flag = 1 else : print ( " undefined " ) flag = 1 break NEW_LINE


import java . util . * ; public class Cifera { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = sc . nextLong ( ) ; long l = sc . nextLong ( ) ; sc . close ( ) ;

import java . util . Scanner ;   public class Ciferia {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = sc . nextLong ( ) ; long num = sc . nextLong ( ) ; Cafe ( k , num ) ; }   public static void Cafe ( long k , long num ) { boolean check = false ; long ans = 0 ; long a = k ; if ( k == num ) { ans = 0 ; check = true ; } else { while ( a * k <= num ) { ans ++ ; if ( a * k == num ) { check = true ; break ; } k = a * k ; } }   if ( check ) { System . out . println ( " YES " ) ; System . out . println ( ans ) ; } else { System . out . println ( " NO " ) ; } }   }

import java . util . Scanner ;   public class cifera { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int number = sc . nextInt ( ) ; int i = 1 ; if ( number % n != 0 ) { System . out . println ( " NO " ) ; return ; } else { while ( Math . pow ( n , i ) <= number ) { i ++ ;

import java . util . Scanner ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long l = sc . nextLong ( ) ; int z1 = 0 ; int z2 = 0 ; long po = n ; if ( n == 1 ) { if ( l == 1 ) { System . out . println ( " YES " ) ; System . out . println ( 0 ) ; } else { System . out . println ( " NO " ) ; } } else { while ( po <= l ) { if ( po == l ) { System . out . println ( " YES " ) ; System . out . println ( z1 ) ; z2 ++ ; po = po * n ; } else { po = po * n ; z1 ++ ; } } if ( z2 == 0 ) { System . out . println ( " NO " ) ; } } } }

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

import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappushfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as permfrom bisect import bisect_left as bl , bisect_right as br , bisect , insortfrom time import perf_counterfrom fractions import Fractionimport copyfrom copy import deepcopyimport timestarttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353   def data ( ) : return sys . stdin . readline ( ) . strip ( ) def out ( * var , end = " \n " ) : sys . stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def L ( ) : return list ( sp ( ) ) def sl ( ) : return list ( ssp ( ) ) def sp ( ) : return map ( int , data ( ) . split ( ) ) def ssp ( ) : return map ( str , data ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( n , val ) for j in range ( m ) ] try : NEW_LINE

k = int ( input ( ) ) l = int ( input ( ) ) i = 1 c = 0 while k ** i < l + 1 : if k ** i == l : c = i break i += 1 if c == 0 : print ( " NO " ) else : print ( " YES " ) print ( c - 1 ) NEW_LINE

k = int ( input ( ) ) l = int ( input ( ) ) i = 0 while l > 1 : l /= k ; i += 1 if l == 1 : print ( " YES " ) print ( i - 1 ) else : print ( " NO " ) NEW_LINE

import math   k , l = int ( input ( ) ) , int ( input ( ) ) p = 0 while l >= k and l % k == 0 : l //= k p += 1   if p > 0 and l == 1 : print ( ' YES ' ) print ( p - 1 ) else : print ( ' NO ' ) NEW_LINE

a = int ( input ( ) ) b = int ( input ( ) ) c = 0 x = awhile a * x <= b : c += 1 a *= x     if a == b : print ( " YES \n " , c ) else : print ( " NO " ) NEW_LINE