import java . io . * ; import java . util . * ;   public class Main { static PrintWriter out = new PrintWriter ( System . out ) ; static Scanner sc = new Scanner ( System . in ) ; static BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long mod = 998244353 ; long inv2 = 1 ; int step = 1 ; long [ ] ans ;   List < int [ ] > [ ] graph ;    public static void main ( String [ ] args ) throws IOException { Main main = new Main ( ) ;   main . solve ( ) ;

from sys import stdin , stdoutfrom math import inf     def main ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n NEW_LINE

from sys import stdinfrom math import inf     def main ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n NEW_LINE

from sys import stdinfrom math import inf     def readline ( ) : return map ( int , stdin . readline ( ) . strip ( ) . split ( ) )     def dijkstra ( ) : NEW_LINE

from sys import stdinfrom math import inf def readline ( ) : return map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) def dijkstra ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n for i in range ( n ) : x [ i ] , y [ i ] = readline ( ) lower_cost = [ inf ] * n lower_cost [ 0 ] = 0 visited = [ False ] * n for i in range ( n - 1 ) : lower_value = inf position = 0 for j in range ( n ) : if not visited [ j ] and lower_value > lower_cost [ j ] : lower_value = lower_cost [ j ] position = j if position == n - 1 : break visited [ position ] = True for k in range ( n ) : if not visited [ k ] : diff = lower_cost [ position ] + d * ( abs ( x [ k ] - x [ position ] ) + abs ( y [ k ] - y [ position ] ) ) - a [ position ] if lower_cost [ k ] > diff : lower_cost [ k ] = diff return lower_cost [ - 1 ] if __name__ == ' _ _ main _ _ ' : print ( dijkstra ( ) ) NEW_LINE


import java . io . * ; import java . util . * ; import java . math . * ;   public class Salemstick { public static void main ( String arg [ ] ) throws IOException { CustomInputReader sc = new CustomInputReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int a [ ] = sc . nextIntArr ( n ) ; int ans = Integer . MAX_VALUE , ft = 0 ;   for ( int t = 1 ; t < 101 ; ++ t ) { int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( a [ i ] != t ) sum += Math . abs ( t - a [ i ] ) - 1 ; }   if ( ans > sum ) { ans = sum ; ft = t ; } }   pw . println ( ft + " ▁ " + ans ) ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) sum1 = int ( 100000000 ) ans = int ( 0 ) for i in range ( 1 , 200 ) : sum2 = int ( 0 ) for j in range ( 0 , n ) : sum2 = sum2 + min ( int ( abs ( a [ j ] - ( i - 1 ) ) ) , int ( abs ( a [ j ] - ( i + 1 ) ) ) , int ( abs ( a [ j ] - i ) ) ) if sum2 < sum1 : sum1 = sum2 ans = iprint ( ans , end = " ▁ " ) print ( sum1 ) NEW_LINE

n = int ( input ( ) ) a = [ int ( o ) for o in input ( ) . split ( ) ] ans = [ ] for i in range ( 1 , 101 ) : su = 0 for j in range ( n ) : su += min ( abs ( i - a [ j ] ) , abs ( i + 1 - a [ j ] ) , abs ( i - 1 - a [ j ] ) ) ans . append ( [ su , i ] ) lol = min ( ans [ : ] ) print ( * lol [ : : - 1 ] ) NEW_LINE

def check_cost ( num ) : totCost = 0 for i in range ( len ( sticks ) ) : totCost += abs ( num - sticks [ i ] ) if num != sticks [ i ] : totCost -= 1 return totCost                   numSticks = int ( input ( ) ) sticks = input ( ) . split ( ) sticks = [ int ( x ) for x in sticks ] sticksSet = set ( sticks ) sticksSet = list ( sticksSet ) sticks . sort ( ) checkList = [ ] for i in range ( len ( sticksSet ) ) : if sticksSet [ i ] - 1 > 0 and sticksSet [ i ] not in checkList : checkList . append ( sticksSet [ i ] - 1 ) if sticksSet [ i ] + 1 not in checkList : checkList . append ( sticksSet [ i ] + 1 ) checkList . sort ( ) minPrice = 999999999999999999999 minStick = 0 for i in range ( len ( checkList ) ) : curCost = check_cost ( checkList [ i ] ) if curCost == 0 : print ( checkList [ i ] , curCost ) exit ( ) if curCost < minPrice : minPrice = curCost minStick = checkList [ i ] print ( minStick , minPrice ) NEW_LINE

n = int ( input ( ) ) stk = list ( map ( int , input ( ) . split ( ) ) ) t , mn = 0 , 1000000 for i in range ( 1 , 101 ) : s = 0 for j in range ( n ) : s += min ( abs ( stk [ j ] - i ) , abs ( stk [ j ] - i - 1 ) , abs ( stk [ j ] - i + 1 ) ) if mn > s : t , mn = i , sprint ( t , mn ) NEW_LINE

n = input ( ) a = list ( map ( int , input ( ) . split ( ) ) )   t = 0 count = 1000000 for i in range ( 1 , 101 ) : cost = sum ( 0 if k == i else abs ( i - k ) - 1 for k in a ) if cost < count : count = cost t = iprint ( t , count ) NEW_LINE


import java . util . * ; public class tw { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] V = new int [ n + 1 ] [ n + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; V [ a ] [ b ] = 1 ; V [ b ] [ a ] = 1 ; } Queue < Integer > q = new LinkedList < > ( ) ; q . add ( 1 ) ; int [ ] d = new int [ n + 1 ] ; while ( ! q . isEmpty ( ) ) { int vertex = q . poll ( ) ; for ( int i = 2 ; i <= n ; i ++ ) { if ( d [ i ] == 0 && V [ vertex ] [ i ] != V [ 1 ] [ n ] ) { d [ i ] = d [ vertex ] + 1 ; q . add ( i ) ; } } } if ( d [ n ] == 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( d [ n ] ) ; } } }

import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE

from collections import defaultdictimport heapqn , m = map ( int , input ( " " ) . split ( ) ) rail_list = defaultdict ( list )   for i in range ( m ) : start , end = map ( int , input ( " " ) . split ( ) ) rail_list [ start ] . append ( end ) rail_list [ end ] . append ( start )   def dijkstra_on_road ( ) : dist_road = { i : float ( ' inf ' ) for i in range ( 1 , n + 1 ) } towns = set ( range ( 1 , n + 1 ) ) H_road = [ ( 0 , 1 ) ] while len ( H_road ) != 0 : curr_road_dist , curr_road_id = heapq . heappop ( H_road ) if curr_road_dist <= dist_road [ curr_road_id ] : road_neighbours = towns - set ( rail_list [ curr_road_id ] + [ curr_road_id ] ) for road_neigbour_id in road_neighbours : new_road_distance = curr_road_dist + 1 if new_road_distance < dist_road [ road_neigbour_id ] : dist_road [ road_neigbour_id ] = new_road_distance heapq . heappush ( H_road , ( new_road_distance , road_neigbour_id ) )   return dist_road [ n ]   def dijkstra_on_rail ( ) : dist_rail = { i : float ( ' inf ' ) for i in range ( 1 , n + 1 ) } H_rail = [ ( 0 , 1 ) ] while len ( H_rail ) != 0 : curr_rail_dist , curr_rail_id = heapq . heappop ( H_rail ) if curr_rail_dist <= dist_rail [ curr_rail_id ] : for rail_neighbour_id in rail_list [ curr_rail_id ] : new_rail_distance = curr_rail_dist + 1 if new_rail_distance < dist_rail [ rail_neighbour_id ] : dist_rail [ rail_neighbour_id ] = new_rail_distance heapq . heappush ( H_rail , ( new_rail_distance , rail_neighbour_id ) )   return dist_rail [ n ]   if n in rail_list [ 1 ] : road_time = dijkstra_on_road ( ) if road_time != float ( ' inf ' ) : print ( road_time ) else : print ( ' - 1' ) else : rail_time = dijkstra_on_rail ( ) if rail_time != float ( ' inf ' ) : print ( rail_time ) else : print ( ' - 1' )         NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   A = [ [ 0 for i in range ( n ) ] for i in range ( n ) ]   for i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) u -= 1 v -= 1 A [ u ] [ v ] = 1 A [ v ] [ u ] = 1           dist = [ - 1 for i in range ( n ) ] dist [ 0 ] = 0   Q = [ 0 ]   while len ( Q ) != 0 : u = Q . pop ( 0 ) for v in range ( n ) : if dist [ v ] == - 1 and A [ v ] [ u ] != A [ 0 ] [ n - 1 ] : dist [ v ] = dist [ u ] + 1 Q . append ( v ) print ( dist [ n - 1 ] ) NEW_LINE

from collections import deque   n , m = map ( int , input ( ) . split ( ) )   rail_network = [ [ 0 ] * ( n + 1 ) for _ in range ( n + 1 ) ]   for _ in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) rail_network [ u ] [ v ] = rail_network [ v ] [ u ] = 1   que = deque ( )   dis = [ - 1 ] * ( n + 1 ) dis [ 1 ] = 0   que . append ( 1 )   while que : temp = que . popleft ( )   for i in range ( 1 , n + 1 ) : if rail_network [ temp ] [ i ] != rail_network [ 1 ] [ n ] and dis [ i ] == - 1 : dis [ i ] = dis [ temp ] + 1 que . append ( i )   print ( dis [ - 1 ] ) NEW_LINE

import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE


import java . io . File ; import java . io . FileNotFoundException ; import java . util . * ;    public class Main {   public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int DorU [ ] = new int [ n + m ] ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; int all [ ] = new int [ n + m ] ; for ( int i = 0 ; i < n + m ; i ++ ) { all [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { DorU [ i ] = input . nextInt ( ) ; if ( DorU [ i ] == 1 ) { map . put ( all [ i ] , 0 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( DorU [ i ] == 0 ) { int res = - 1 ; if ( all [ i ] < map . firstKey ( ) ) { res = map . ceilingKey ( all [ i ] ) ; } else if ( all [ i ] > map . lastKey ( ) ) { res = map . floorKey ( all [ i ] ) ; } else { int left = map . floorKey ( all [ i ] ) ; int right = map . ceilingKey ( all [ i ] ) ; if ( Math . abs ( left - all [ i ] ) <= Math . abs ( right - all [ i ] ) ) { res = left ; } else res = right ; } map . put ( res , map . getOrDefault ( res , 0 ) + 1 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( DorU [ i ] == 1 ) { System . out . print ( map . get ( all [ i ] ) + " ▁ " ) ; } } System . out . println ( " " ) ; }   }

import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; long a [ ] = new long [ n + m + 2 ] ; long b [ ] = new long [ n + m + 2 ] ; a [ 0 ] = ( int ) ( - Math . pow ( 10 , 15 ) ) ; a [ n + m + 1 ] = ( int ) ( Math . pow ( 10 , 15 ) ) ; b [ 0 ] = b [ n + m + 1 ] = 1 ; for ( int i = 1 ; i < n + m + 1 ; i ++ ) a [ i ] = in . nextLong ( ) ; for ( int i = 1 ; i < n + m + 1 ; i ++ ) b [ i ] = in . nextLong ( ) ; int ind = 0 ; long c [ ] = new long [ n + m + 2 ] ; long d [ ] = new long [ n + m + 2 ] ; d [ 0 ] = 1 ; for ( int i = 1 ; i < n + m + 2 ; i ++ ) { d [ i ] = d [ i - 1 ] + b [ i ] ; if ( b [ i ] == 1 ) { c [ ind ] = i ; ind = i ; } }

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 ;

import java . io . File ; import java . io . FileNotFoundException ; import java . util . * ;    public class Main {   public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int a [ ] = new int [ n + m ] ; int b [ ] = new int [ n + m ] ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; for ( int i = 0 ; i < n + m ; i ++ ) { a [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { b [ i ] = input . nextInt ( ) ; if ( b [ i ] == 1 ) map . put ( a [ i ] , 0 ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { if ( b [ i ] == 0 ) { int res = - 1 ; if ( a [ i ] < map . firstKey ( ) ) { res = map . ceilingKey ( a [ i ] ) ; } else if ( a [ i ] > map . lastKey ( ) ) { res = map . floorKey ( a [ i ] ) ; } else { int left = map . floorKey ( a [ i ] ) ; int right = map . ceilingKey ( a [ i ] ) ; if ( Math . abs ( left - a [ i ] ) <= Math . abs ( right - a [ i ] ) ) { res = left ; } else res = right ; } map . put ( res , map . getOrDefault ( res , 0 ) + 1 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( b [ i ] == 1 ) System . out . print ( map . get ( a [ i ] ) + " ▁ " ) ; } System . out . println ( " " ) ; }   }

n , m = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) t = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in range ( n + m ) : if t [ i ] == 1 : d [ i ] = 0 aux = [ float ( ' inf ' ) ] * ( n + m ) c = - 1 for i in range ( n + m ) : if t [ i ] == 1 : c = i else : if c != - 1 : aux [ i ] = x [ i ] - x [ c ] c = - 1 left = 0 i1 = t . index ( 1 ) i2 = t [ : : - 1 ] . index ( 1 ) d [ i1 ] += i1d [ n + m - ( i2 + 1 ) ] += i2for i in range ( n + m - 1 , - 1 , - 1 ) : if t [ i ] == 1 : c = i d [ c ] += left left = 0 else : if c != - 1 : y = x [ c ] - x [ i ] if y < aux [ i ] and aux [ i ] != float ( ' inf ' ) : d [ c ] += 1 else : left += 1 ans = [ ] for i in d : ans . append ( d [ i ] ) print ( * ans ) NEW_LINE

import sys , bisectn , m = map ( int , sys . stdin . readline ( ) . split ( ) ) arr = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) temp = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) taxi = [ ] rider = [ ] for i in range ( n + m ) : if temp [ i ] : taxi . append ( arr [ i ] ) else : rider . append ( arr [ i ] )   ans = [ 0 ] * mfor i in rider : idx = bisect . bisect_left ( taxi , i ) if idx == 0 : ans [ idx ] += 1 elif idx == m : ans [ idx - 1 ] += 1 else : left_dist = i - taxi [ idx - 1 ] right_dist = taxi [ idx ] - i if left_dist <= right_dist : ans [ idx - 1 ] += 1 else : ans [ idx ] += 1   print ( ' ▁ ' . join ( map ( str , ans ) ) ) NEW_LINE

import sysn , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) b = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) d = dict ( ) p = [ ] if m == 1 : print ( n ) else : for j in range ( n + m ) : if b [ j ] == 1 : p . append ( a [ j ] ) d [ a [ j ] ] = 0 k = 0 for v in a : if v in d : continue while k < m and p [ k ] < v : k = k + 1 NEW_LINE

''' https : / / codeforces . com / problemset / problem / 1075 / B '''     def solv ( coords , roles ) -> int : r_nearest = [ float ( ' inf ' ) ] * len ( coords ) l_nearest = [ float ( ' inf ' ) ] * len ( coords )   drivers = sum ( roles )   if roles [ 0 ] == 1 : l_nearest [ 0 ] = coords [ 0 ] for i in range ( 1 , len ( l_nearest ) ) : if roles [ i ] == 1 : l_nearest [ i ] = coords [ i ] else : l_nearest [ i ] = l_nearest [ i - 1 ]   last_idx = len ( coords ) - 1 if roles [ last_idx ] == 1 : r_nearest [ last_idx ] = coords [ last_idx ] for i in range ( last_idx - 1 , - 1 , - 1 ) : if roles [ i ] == 1 : r_nearest [ i ] = coords [ i ] else : r_nearest [ i ] = r_nearest [ i + 1 ]   idx_map = dict ( ) idx = 0 for i in range ( len ( coords ) ) : if roles [ i ] == 1 : idx_map [ coords [ i ] ] = idx idx += 1   rezult = [ - 1 ] * drivers for i in range ( len ( coords ) ) : if abs ( coords [ i ] - l_nearest [ i ] ) <= abs ( coords [ i ] - r_nearest [ i ] ) : rezult [ idx_map [ l_nearest [ i ] ] ] += 1 else : rezult [ idx_map [ r_nearest [ i ] ] ] += 1   return rezult     input ( ) coords_str = input ( ) roles_str = input ( )   coords = [ int ( v ) for v in coords_str . split ( ) ] roles = [ int ( v ) for v in roles_str . split ( ) ]   rez = solv ( coords , roles ) print ( ' ▁ ' . join ( map ( str , rez ) ) ) NEW_LINE

n , m = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) t = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) l1 = [ ] l2 = [ ] for i in range ( n + m ) : if t [ i ] == 0 : l1 . append ( x [ i ] ) else : l2 . append ( x [ i ] ) l1 . sort ( ) l2 . sort ( ) if len ( l2 ) == 1 : print ( n ) else : l3 = [ 0 ] * m j = 0 i = 0 while ( i < n ) : if l1 [ i ] < l2 [ j ] : l3 [ j ] += 1 i += 1 elif j < m - 1 and l1 [ i ] > l2 [ j ] and l1 [ i ] < l2 [ j + 1 ] : if ( l1 [ i ] - l2 [ j ] ) <= ( l2 [ j + 1 ] - l1 [ i ] ) : l3 [ j ] += 1 i += 1 else : l3 [ j + 1 ] += 1 i += 1 elif j == m - 1 : l3 [ - 1 ] += 1 i += 1 else : j += 1 f = 0 while ( j < m ) : if l1 [ i ] > l2 [ j ] : j += 1 else : f = 1 break j -= 1 for j in range ( m ) : print ( l3 [ j ] , end = " ▁ " ) print ( ) NEW_LINE


import java . awt . * ; import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . List ;   import static java . lang . Math . max ; import static java . lang . Math . min ;    public class B implements Runnable {

n , m = map ( int , input ( ) . split ( ) ) covers_all = set ( range ( 1 , n + 1 ) ) in_there = set ( [ ] ) occurred = set ( [ ] ) minus_delete_candidates = set ( [ ] ) plus_delete_candidates = set ( [ ] ) for i in range ( m ) : a , b = input ( ) . split ( ) b = int ( b ) if a == ' + ' : in_there . add ( b ) covers_all -= ( plus_delete_candidates - in_there ) plus_delete_candidates = set ( [ ] ) if occurred and b not in occurred : covers_all . discard ( b ) else : if b in in_there : in_there . remove ( b ) else : covers_all -= minus_delete_candidates minus_delete_candidates = set ( [ ] ) if in_there : covers_all . discard ( b ) else : plus_delete_candidates . add ( b ) occurred . add ( b ) if b in covers_all : minus_delete_candidates . add ( b ) print ( len ( covers_all ) ) if covers_all : print ( ' ▁ ' . join ( map ( str , sorted ( list ( covers_all ) ) ) ) ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int n = nextInt ( ) ; int a = nextInt ( ) ; int d = nextInt ( ) ; int t [ ] = new int [ n + 1 ] ; int v [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { t [ i ] = nextInt ( ) ; v [ i ] = nextInt ( ) ; } double time = - 1 ; for ( int i = 1 ; i <= n ; i ++ ) { double x = ( double ) v [ i ] / a ; double y = Math . sqrt ( ( double ) ( 2 * d ) / a ) ; double curr = t [ i ] + Math . min ( x , y ) ; double z = d - ( double ) ( 1l * v [ i ] * v [ i ] ) / ( 2 * a ) ; if ( z > 0 ) curr += z / v [ i ] ; if ( curr <= time ) { curr = time ; } else time = curr ; out . println ( curr ) ; } }

import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;     public class p167a { public static void main ( String [ ] args ) { FS in = new FS ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; double a = in . nextInt ( ) ; double d = in . nextInt ( ) ; double time = 0.0 ; while ( n -- > 0 ) { double t = in . nextInt ( ) ; double v = in . nextInt ( ) ; double curr = 0 ; if ( v * v / ( 2.0 * a ) >= d ) { curr = Math . sqrt ( 2.0 * d / a ) ; } else { curr = 1.0 * v / a + ( d - v * v / ( 2.0 * a ) ) / v ; } curr = Math . max ( curr + t , time ) ; out . println ( curr ) ; time = curr ; } out . close ( ) ; } static class FS { BufferedReader in ; StringTokenizer t ; public FS ( InputStream i ) { in = new BufferedReader ( new InputStreamReader ( i ) ) ; } public String next ( ) { try { while ( t == null || ! t . hasMoreElements ( ) ) { t = new StringTokenizer ( in . readLine ( ) ) ; } } catch ( Exception e ) { } return t . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;     public class p167a { public static void main ( String [ ] args ) { FS in = new FS ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; double a = in . nextInt ( ) ; double d = in . nextInt ( ) ; double time = 0.0 ; while ( n -- > 0 ) { double t = in . nextInt ( ) ; double v = in . nextInt ( ) ; double curr = 0 ; if ( v * v / ( 2.0 * a ) >= d ) { curr = Math . sqrt ( 2.0 * d / a ) ; } else { curr = v / a + ( d - v * v / ( 2.0 * a ) ) / v ; } curr = Math . max ( curr + t , time ) ; out . println ( curr ) ; time = curr ; } out . close ( ) ; } static class FS { BufferedReader in ; StringTokenizer t ; public FS ( InputStream i ) { in = new BufferedReader ( new InputStreamReader ( i ) ) ; } public String next ( ) { try { while ( t == null || ! t . hasMoreElements ( ) ) { t = new StringTokenizer ( in . readLine ( ) ) ; } } catch ( Exception e ) { } return t . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . io . * ; import java . util . * ;   public class test { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int d = Integer . parseInt ( st . nextToken ( ) ) ; double [ ] timeToMax = new double [ n ] ; int [ ] leaveTime = new int [ n ] ; int [ ] maxSpeed = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; leaveTime [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; maxSpeed [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; timeToMax [ i ] = ( double ) maxSpeed [ i ] / a ; } double [ ] normalTime = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( 0.5 * a * timeToMax [ i ] * timeToMax [ i ] < d ) { normalTime [ i ] = timeToMax [ i ] + ( d - 0.5 * a * timeToMax [ i ] * timeToMax [ i ] ) / maxSpeed [ i ] ; } else { normalTime [ i ] = Math . pow ( ( double ) 2 * d / a , 0.5 ) ; } normalTime [ i ] += leaveTime [ i ] ; } double [ ] actualTime = new double [ n ] ; actualTime [ 0 ] = normalTime [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( normalTime [ i ] >= actualTime [ i - 1 ] ) { actualTime [ i ] = normalTime [ i ] ; } else { actualTime [ i ] = actualTime [ i - 1 ] ; } } for ( int i = 0 ; i < n ; i ++ ) System . out . println ( actualTime [ i ] ) ; } }

n , a , d = map ( int , input ( ) . split ( ) ) p = [ 0 ] * nfor i in range ( n ) : t , v = map ( int , input ( ) . split ( ) ) x = v / a y = ( 2 * d / a ) ** 0.5 p [ i ] = t + y if y < x else t + d / v + x / 2 p [ i ] = max ( p [ i - 1 ] , p [ i ] ) print ( ' \n ' . join ( map ( str , p ) ) ) NEW_LINE

from sys import stdin , stdoutinput = stdin . readline   n , a , d = map ( int , input ( ) . split ( ) ) arr = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ] res = [ 0 ] * nfor i in range ( n ) : t , v = arr [ i ] x = v / a y = ( 2 * d / a ) ** 0.5 res [ i ] = ( t + y if y < x else t + d / v + x / 2 ) res [ i ] = max ( res [ i - 1 ] , res [ i ] ) print ( ' \n ' . join ( map ( str , res ) ) ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ar [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int f = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ar [ i ] == 1 ) { System . out . println ( " HARD " ) ; f = 1 ; break ; } } if ( f == 0 ) { System . out . println ( " EASY " ) ; } } }

import java . util . Scanner ;   public class In_Search_of_an_Easy_Problem {   static Scanner sc = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; boolean m = false ; while ( n > 0 ) { int k = sc . nextInt ( ) ; if ( k > 0 ) { m = true ; n = - 1 ; } n -- ; } if ( m ) { System . out . println ( " HARD " ) ; } else { System . out . println ( " EASY " ) ; } } }

import java . util . Scanner ; public class CF800 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; boolean y = false ; int [ ] k = new int [ x ] ; for ( int i = 0 ; i < x ; i ++ ) { k [ i ] = input . nextInt ( ) ; if ( k [ i ] == 1 ) { y = true ; } } if ( y == true ) { System . out . println ( " Hard " ) ; } else { System . out . println ( " Easy " ) ; } } }

import java . util . * ; public class easy { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 , d = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x == 0 ) c ++ ; else d ++ ; } if ( d == 0 ) System . out . println ( " EASY " ) ; else System . out . println ( " HARD " ) ; } }

n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li . sort ( ) if li [ n - 1 ] == 1 : print ( " HARD " ) else : print ( " EASY " ) NEW_LINE

_ = input ( ) l = map ( int , input ( ) . split ( ) )   if any ( l ) : print ( " HARD " ) else : print ( " EASY " ) NEW_LINE

import matht = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) [ : t ] h = 0 for i in a : if ( i == 1 ) : h = h + 1 if ( h > 0 ) : print ( " HARD " ) else : print ( " EASY " ) NEW_LINE

n = int ( input ( ) ) ; p = str ( input ( ) . split ( ) ) ; c = 0 for i in p : if i == "0" : c += 1 if n - c == 0 : print ( " EASY " ) else : print ( " HARD " )       NEW_LINE

n = int ( input ( ) ) s = input ( ) . split ( ) for i in s : if i == '1' : print ( ' HARD ' ) breakelse : print ( " EASY " ) NEW_LINE


import java . util . * ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; int x = Math . max ( a , Math . max ( b , Math . max ( c , d ) ) ) ; if ( d != x ) System . out . print ( x - d + " ▁ " ) ; if ( c != x ) System . out . print ( x - c + " ▁ " ) ; if ( b != x ) System . out . print ( x - b + " ▁ " ) ; if ( a != x ) System . out . print ( x - a + " ▁ " ) ; } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int max = a [ 0 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( a [ i ] > max ) { max = a [ i ] ; } } for ( int i = 0 ; i < 4 ; i ++ ) { if ( max - a [ i ] != 0 ) { System . out . println ( max - a [ i ] + " ▁ " ) ; } }   } }

import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; int c = str . length ( ) ; int x = Integer . parseInt ( str . substring ( 0 , str . indexOf ( " ▁ " ) ) ) ; int y = Integer . parseInt ( str . substring ( str . indexOf ( " ▁ " ) + 1 , str . indexOf ( " ▁ " , str . indexOf ( " ▁ " ) + 1 ) ) ) ; int z = Integer . parseInt ( str . substring ( str . indexOf ( " ▁ " , str . indexOf ( " ▁ " ) + 2 ) + 1 , str . lastIndexOf ( " ▁ " ) ) ) ; int t = Integer . parseInt ( str . substring ( str . lastIndexOf ( " ▁ " ) + 1 , c ) ) ; int a = Math . max ( Math . max ( x , y ) , Math . max ( z , t ) ) ; if ( t == a ) { System . out . println ( ( a - x ) + " ▁ " + ( a - y ) + " ▁ " + ( a - z ) ) ; } if ( x == a ) { System . out . println ( ( a - y ) + " ▁ " + ( a - z ) + " ▁ " + ( a - t ) ) ; } if ( y == a ) { System . out . println ( ( a - x ) + " ▁ " + ( a - z ) + " ▁ " + ( a - t ) ) ; } if ( z == a ) { System . out . println ( ( a - x ) + " ▁ " + ( a - y ) + " ▁ " + ( a - t ) ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Math . * ; import static java . lang . System . out ; import java . util . * ; import java . io . PrintStream ; import java . io . PrintWriter ; public class A { static final int N = ( int ) ( 1e5 + 100 ) ; static final int mod = 1000000007 ; static final long temp = 998244353 ; static final long MOD = 1000000007 ; static final long M = ( long ) 1e9 + 7 ; static class Pair implements Comparable < Pair > { long first , second ; public Pair ( long aa , long bb ) { first = aa ; second = bb ; } public int compareTo ( Pair o ) { return ( int ) ( o . first - this . first ) ; } } static class Tuple implements Comparable < Tuple > { long first , second , third ; public Tuple ( long first , long second , long third ) { this . first = first ; this . second = second ; this . third = third ; } public int compareTo ( Tuple o ) { return ( int ) ( o . third - this . third ) ; } } public static class DSU { int [ ] parent ; int [ ] rank ;

l = list ( ( map ( int , input ( ) . split ( ) ) ) ) l = sorted ( l ) k_ = [ ]   for i in range ( 3 ) : k_ . append ( l [ 3 ] - l [ i ] ) print ( * k_ ) NEW_LINE

a = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) mx = max ( a ) for i in list ( map ( lambda x : mx - x , a ) ) : if i : print ( i , end = " ▁ " ) print ( ) NEW_LINE

numbers = list ( map ( int , input ( ) . split ( ) ) ) max_ = max ( numbers ) output = [ ]   for num in numbers : if num != max_ : print ( max_ - num , end = " ▁ " ) NEW_LINE

s = [ int ( i ) for i in input ( ) . split ( ) ] s . sort ( )   a = s [ 0 ] b = s [ 1 ] c = s [ 2 ] d = s [ 3 ] NEW_LINE

l = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) l = sorted ( l ) print ( abs ( l [ 3 ] - l [ 1 ] ) , abs ( l [ 3 ] - l [ 2 ] ) , abs ( l [ 3 ] - l [ 0 ] ) ) NEW_LINE


import java . util . Scanner ;   public class MishkaAndGame { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int chris = 0 ; int mishka = 0 ; while ( n -- > 0 ) { int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( m > c ) mishka ++ ; else if ( m < c ) chris ++ ; } if ( mishka > chris ) System . out . println ( " Mishka " ) ; else if ( chris > mishka ) System . out . println ( " Chris " ) ; else System . out . println ( " Friendship ▁ is ▁ magic ! ^ ^ " ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Mishka_and_Game { static class RealScanner { 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 ( ) ) ; } }   public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n = sc . nextInt ( ) ; int countM = 0 , countC = 0 , countS = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a , b ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a < b ) { countC ++ ; } if ( a > b ) { countM ++ ; } if ( a == b ) { countS ++ ; } } if ( countM > countC ) { System . out . println ( " Mishka " ) ; } else if ( countM < countC ) { System . out . println ( " Chris " ) ; } else { System . out . println ( " Friendship ▁ is ▁ magic ! ^ ^ " ) ; }   } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 , c = 0 , a , b ; for ( int i = 0 ; i < n ; i ++ ) { a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a > b ) m ++ ; else if ( b > a ) c ++ ; } if ( m > c ) { System . out . println ( " Mishka " ) ; } else if ( m < c ) { System . out . println ( " Chris " ) ; } else { System . out . println ( " Friendship ▁ is ▁ magic ! ^ ^ " ) ; } } }

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 . * ; import java . util . * ; import java . lang . * ; import java . io . * ; public class A703 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int mish [ ] = new int [ n ] ; int chris [ ] = new int [ n ] ; int ans , abc , xyz ; ans = abc = xyz = 0 ; for ( int i = 0 ; i < n ; i ++ ) { mish [ i ] = sc . nextInt ( ) ; chris [ i ] = sc . nextInt ( ) ; } for ( int a = 0 ; a < n ; a ++ ) { if ( mish [ a ] > chris [ a ] ) { ans ++ ; } else if ( mish [ a ] < chris [ a ] ) { abc ++ ; } else { xyz ++ ; } } if ( ans > abc ) { System . out . println ( " Mishka " ) ; } else if ( abc > ans ) { System . out . println ( " Chris " ) ; } else { System . out . println ( " Friendship ▁ is ▁ magic ! ^ ^ " ) ; } } }

import java . util . Scanner ; import java . util . StringTokenizer ;   public class Mishka { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int rounds = Integer . parseInt ( scanner . nextLine ( ) ) ;   int m = 0 ; for ( int i = 0 ; i < rounds ; i ++ ) { String line = scanner . nextLine ( ) ; StringTokenizer tokenizer = new StringTokenizer ( line ) ; int r1 = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int r2 = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   if ( r1 > r2 ) { m ++ ; } else if ( r1 < r2 ) { m -- ; } }   if ( m == 0 ) { System . out . println ( " Friendship ▁ is ▁ magic ! ^ ^ " ) ; } else if ( m > 0 ) { System . out . println ( " Mishka " ) ; } else { System . out . println ( " Chris " ) ; } } }

a = int ( input ( ) ) res = 0 for i in range ( a ) : r = list ( map ( int , input ( ) . split ( ) ) ) res = res + int ( r [ 0 ] > r [ 1 ] ) - int ( r [ 0 ] < r [ 1 ] ) print ( [ ' Friendship ▁ is ▁ magic ! ^ ^ ' , ' Mishka ' , ' Chris ' ] [ res if not ( res ) else abs ( res ) // res ] ) NEW_LINE

n = int ( input ( ) ) c1 , c2 = 0 , 0 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) if a > b : c1 += 1 elif a < b : c2 += 1 if c1 > c2 : print ( " Mishka " ) elif c1 < c2 : print ( " Chris " ) else : print ( " Friendship ▁ is ▁ magic ! ^ ^ " ) NEW_LINE

n = int ( input ( ) ) c_score , m_score = 0 , 0 for i in range ( n ) : m , c = map ( int , input ( ) . split ( ) ) if c > m : c_score += 1 elif c < m : m_score += 1 else : continueif c_score > m_score : print ( " Chris " ) elif c_score < m_score : print ( " Mishka " ) else : print ( " Friendship ▁ is ▁ magic ! ^ ^ " ) NEW_LINE

mishka = 0 chris = 0 for i in range ( int ( input ( ) ) ) : m , c = map ( int , input ( ) . split ( ) ) if m > c : mishka += 1 elif m < c : chris += 1 else : continue   if mishka > chris : print ( ' Mishka ' ) elif mishka < chris : print ( ' Chris ' ) else : print ( ' Friendship ▁ is ▁ magic ! ^ ^ ' ) NEW_LINE


import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ;   public static void main ( String [ ] args ) {

import java . util . Scanner ;   public class MoneySpender { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ;   for ( int i = 0 ; i <= n ; i += 1234567 ) { for ( int j = 0 ; j <= n ; j += 123456 ) { int sum = i + j ;   if ( sum > n ) break ;   if ( ( n - sum ) % 1234 == 0 ) { System . out . println ( " YES " ) ; return ; } } }   System . out . println ( " NO " ) ; } }

import static java . lang . Math . max ; import static java . lang . Math . min ; import static java . lang . Math . abs ; import java . util . * ; import java . io . * ; import java . math . * ;   public class B { public static final long A = 1234567 ; public static final long B = 123456 ; public static final long C = 1234 ; public static void main ( String hi [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; for ( int v = 0 ; v <= 1000 ; v ++ ) { if ( A * v > N ) break ; long left = N - A * v ; for ( int b = 0 ; b <= 100000 ; b ++ ) { if ( B * b > left ) break ; if ( ( left - B * b ) % C == 0 ) { System . out . println ( " YES " ) ; return ; } } } System . out . println ( " NO " ) ; } public static long gcd ( long a , long b ) { if ( a > b ) { long t = a ; a = b ; b = t ; } if ( a == 0L ) return b ; return gcd ( b % a , a ) ; } }

n = int ( input ( ) )   a = 1234567 b = 123456 c = 1234   nat = ' NO ' for i in range ( n // a + 1 ) : n2 = n - a * i           for i2 in range ( n2 // b + 1 ) :                   if ( n2 - b * i2 ) % c == 0 : nat = ' YES ' print ( nat )                             NEW_LINE

s = int ( input ( ) ) n = 0 l = [ ] for i in range ( 0 , s , 1234567 ) : for j in range ( 0 , s , 123456 ) : n = s - i - j l . append ( n ) if any ( i >= 0 and i % 1234 == 0 for i in l ) : print ( " YES " ) elif s % 1234567 == 0 or s % 123456 == 0 or s % 1234 == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

n = int ( input ( ) ) for i in range ( 0 , n + 1 , 1234567 ) : for j in range ( 0 , n + 1 , 123456 ) : if ( n - ( i + j ) ) % 1234 == 0 and i + j <= n : print ( ' YES ' ) exit ( ) print ( ' NO ' ) NEW_LINE


import java . io . * ; import java . util . StringTokenizer ;   public class Main { public void solve ( ) { int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = ni ( ) ; } long l = ni ( ) ;   long total = ( l + 1 ) * ( l + 2 ) * ( l + 3 ) / 6 ;

import java . util . Scanner ;    public class Main { public static Scanner in = new Scanner ( System . in ) ; public static int a , b , c , L ; public static long cal ( int l ) { int ti [ ] = new int [ 3 ] ; ti [ 0 ] = ( l + a + b - c + 1 ) / 2 ; ti [ 1 ] = ( l + a + c - b + 1 ) / 2 ; ti [ 2 ] = ( l + c + b - a + 1 ) / 2 ; for ( int i = 0 ; i < 3 ; i ++ ) if ( ti [ i ] <= 0 ) return 0 ;

import java . util . * ;   public class A {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] a = new long [ 3 ] ; a [ 0 ] = sc . nextLong ( ) ; a [ 1 ] = sc . nextLong ( ) ; a [ 2 ] = sc . nextLong ( ) ; long l = sc . nextLong ( ) ; long total = ( l + 1 ) * ( l + 2 ) * ( l + 3 ) / 6 ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( long la = 0L ; la <= l ; la ++ ) { long x = Math . min ( a [ i ] - a [ ( i + 1 ) % 3 ] - a [ ( i + 2 ) % 3 ] + la , l - la ) ; if ( x >= 0 ) { total -= ( x + 1 ) * ( x + 2 ) / 2 ; } } } System . out . println ( " " + total ) ; }   }

a , b , c , l = map ( int , input ( ) . split ( ) ) cnt = ( l + 3 ) * ( l + 2 ) * ( l + 1 ) // 3 for i in ( a , b , c ) : s = 2 * i - a - b - c for x in range ( max ( 0 , - s ) , l + 1 ) : m = min ( s + x , l - x ) cnt -= ( m + 1 ) * ( m + 2 ) print ( cnt // 2 )   NEW_LINE

''' import ▁ syssys . stdin ▁ = ▁ open ( " input . txt " , ▁ " r " ) sys . stdout ▁ = ▁ open ( " output . txt " , ▁ " w " ) ''' def Solve ( a , b , c , l ) : delta = a - b - c if delta < 0 : return 0 k = min ( l , delta ) + 1 return k * ( k + 1 ) // 2   a , b , c , l = map ( int , input ( ) . split ( ) )   ans = ( l + 3 ) * ( l + 2 ) * ( l + 1 ) // 6   for d in range ( l + 1 ) : ans -= Solve ( a + d , b , c , l - d ) + Solve ( b + d , a , c , l - d ) + Solve ( c + d , a , b , l - d ) print ( ans ) NEW_LINE

a , b , c , l = map ( int , input ( ) . split ( ) ) ans = ( l + 3 ) * ( l + 2 ) // 2 * ( l + 1 ) // 3 for z in ( a , b , c ) : s = 2 * z - a - b - c for x in range ( l + 1 ) : m = min ( s + x , l - x ) if m >= 0 : ans -= ( m + 1 ) * ( m + 2 ) >> 1 print ( ans ) NEW_LINE

a , b , c , l = map ( int , input ( ) . split ( ) ) ans = ( l + 3 ) * ( l + 2 ) * ( l + 1 ) // 3 for z in ( a , b , c ) : s = 2 * z - a - b - c for x in range ( max ( 0 , - s ) , l + 1 ) : m = min ( s + x , l - x ) ans -= ( m + 1 ) * ( m + 2 ) print ( ans // 2 ) NEW_LINE


import java . io . * ; import java . util . * ; import java . lang . * ; import java . math . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ;

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   void run ( FastScanner in , PrintWriter out ) {   int N = in . nextInt ( ) ; int [ ] a = new int [ N ] ; int allSet = 0 ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = in . nextInt ( ) ; allSet |= a [ i ] ; }   Set < Integer > s = new HashSet < > ( ) ; int [ ] prev = new int [ N ] ; Arrays . fill ( prev , - 1 ) ; for ( int l = 0 ; l < N ; l ++ ) { int x = 0 ; for ( int r = l ; r < N ; r ++ ) { x |= a [ r ] ; if ( x == prev [ r ] ) break ; s . add ( x ) ; prev [ r ] = x ; } }   out . println ( s . size ( ) ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   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 ( ) ) ; } } }

n , a , b = input ( ) , set ( ) , set ( ) for i in map ( int , input ( ) . split ( ) ) : b = set ( i | j for j in b ) b . add ( i ) a . update ( b ) print ( len ( a ) ) NEW_LINE

import sys , math , osfrom io import BytesIO , IOBase NEW_LINE

n = int ( input ( ) ) a , b = set ( ) , set ( ) for i in list ( map ( int , input ( ) . split ( ) ) ) : a = { i | j for j in a } a . add ( i ) b . update ( a ) print ( len ( b ) ) NEW_LINE

n = input ( ) r = set ( ) s = set ( ) l = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) for i in l : s = { i | a for a in s } s . add ( i ) r |= sprint ( len ( r ) )   NEW_LINE


import java . math . BigInteger ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . InputMismatchException ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; public class Main { static InputReader rd = new InputReader ( System . in ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; outer : while ( t -- > 0 ) { int n = sc . nextInt ( ) ; ArrayList < Helper > A = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { A . add ( new Helper ( sc . nextInt ( ) , i ) ) ; } Collections . sort ( A , new Comparator < Helper > ( ) { @ Override public int compare ( Helper o1 , Helper o2 ) {

import java . io . * ; import java . util . * ;   public final class test { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; StringBuilder result = new StringBuilder ( " " ) ;   int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) p [ i ] = sc . nextInt ( ) ; boolean flag = false ;   for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( p [ i ] < p [ i + 1 ] && p [ i + 1 ] != 1 + p [ i ] ) { flag = true ; result . append ( " No \n " ) ; break ; } }   if ( ! flag ) result . append ( " Yes \n " ) ; }   System . out . println ( result ) ; } }   class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream stream ) { br = new BufferedReader ( new InputStreamReader ( stream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   public String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   public int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } }

import java . util . * ; import java . io . * ; import java . math . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int cas = Integer . parseInt ( st . nextToken ( ) ) ; StringBuilder res = new StringBuilder ( ) ; while ( cas -- > 0 ) { st = new StringTokenizer ( infile . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( infile . readLine ( ) ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } int min = n , to = n , ok = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( min > arr [ i ] ) min = arr [ i ] ; if ( arr [ i ] != to ) { if ( i == n - 1 || arr [ i ] != arr [ i + 1 ] - 1 ) { ok = 0 ; } } else if ( arr [ i ] == to ) to = min - 1 ; } if ( ok == 1 ) res . append ( " Yes " ) ; else res . append ( " No " ) ; res . append ( ' \n ' ) ; } System . out . println ( res ) ; } }

import java . math . * ; import java . io . * ; import java . util . * ; import java . awt . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t - -> 0 ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; boolean flag = true ; for ( int i = 1 ; i < n ; i + + ) { int b = sc . nextInt ( ) ; if ( a < b & & b - a > 1 ) flag = false ; a = b ; } if ( flag ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } NEW_LINE

import sysinput = sys . stdin . buffer . readline NEW_LINE

import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , copy , functools NEW_LINE

from operator import itemgetter   t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) pi = list ( map ( int , input ( ) . split ( ) ) ) ans = [ " Yes " , " No " ] if n < 3 : print ( ans [ 0 ] ) continue pi2 = [ [ pi [ i ] , i ] for i in range ( n ) ] pi2 . sort ( key = itemgetter ( 0 ) ) i = 0 num = 0 while i < n : j = pi2 [ i ] [ 1 ] + 1 while j < n : if pi [ j ] > pi [ j - 1 ] + 1 : ans [ 0 ] = ans [ 1 ] i = n if pi [ j ] < pi [ j - 1 ] : break j += 1 i = pi [ j - 1 ] print ( ans [ 0 ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class A_Map_of_the_Cat_1800 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String Response ; int numnos = 0 ; try { for ( int i = 0 ; i <= 9 ; i ++ ) { System . out . println ( i ) ; Response = br . readLine ( ) ; if ( Response . equals ( " cool " ) || Response . equals ( " great ! " ) || Response . equals ( " not ▁ bad " ) || Response . equals ( " don ' t ▁ think ▁ so " ) || Response . equals ( " don ' t ▁ touch ▁ me ! " ) ) { System . out . println ( " normal " ) ; break ; } else if ( Response . equals ( " terrible " ) || Response . equals ( " worse " ) || Response . equals ( " no ▁ way " ) || Response . equals ( " don ' t ▁ even " ) || Response . equals ( " are ▁ you ▁ serious ? " ) || Response . equals ( " go ▁ die ▁ in ▁ a ▁ hole " ) ) { System . out . println ( " grumpy " ) ; break ; } if ( Response . equals ( " no " ) ) { if ( ++ numnos > 3 ) { System . out . println ( " normal " ) ; } } } } catch ( Exception e ) { e . printStackTrace ( ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Scanner ;   public class Main {    public static String NORMALS [ ] = { " cool " , " not ▁ bad " , " don ' t ▁ touch ▁ me " , " don ' t ▁ think ▁ so " , " great " } ; public static String NO = " no " ; public static String NORMAL = " normal " ; public static String GRUMPY = " grumpy " ; public static void main ( String [ ] args ) throws IOException { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i <= 9 ; ++ i ) { System . out . println ( i ) ; System . out . flush ( ) ; String line = bufferedReader . readLine ( ) ; if ( ! line . startsWith ( NO ) ) { for ( String w : NORMALS ) { if ( line . startsWith ( w ) ) { System . out . println ( NORMAL ) ; System . out . flush ( ) ; return ; } } System . out . println ( GRUMPY ) ; System . out . flush ( ) ; return ; } }   } }

import java . util . * ; public class name { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 9 ; for ( int i = 0 ; i <= 9 ; i ++ ) { System . out . println ( i ) ; String x = scan . nextLine ( ) ; if ( x . equals ( " worse " ) || x . equals ( " terrible " ) || x . equals ( " don ' t ▁ even " ) || x . equals ( " are ▁ you ▁ serious ? " ) || x . equals ( " go ▁ die ▁ in ▁ a ▁ hole " ) || x . equals ( " no ▁ way " ) ) { System . out . println ( " grumpy " ) ; break ; } if ( x . equals ( " great " ) || x . equals ( " cool " ) || x . equals ( " not ▁ bad " ) || x . equals ( " don ' t ▁ touch ▁ me ! " ) || x . equals ( " don ' t ▁ think ▁ so " ) ) { System . out . println ( " normal " ) ; break ; } else System . out . flush ( ) ; } } }

import java . util . * ; public class name { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 9 ; for ( int i = 0 ; i <= 9 ; i ++ ) { System . out . println ( i ) ; String x = scan . nextLine ( ) ; if ( x . equals ( " worse " ) || x . equals ( " terrible " ) || x . equals ( " don ' t ▁ even " ) || x . equals ( " are ▁ you ▁ serious ? " ) || x . equals ( " go ▁ die ▁ in ▁ a ▁ hole " ) || x . equals ( " no ▁ way " ) ) { System . out . println ( " grumpy " ) ; break ; } if ( x . equals ( " great " ) || x . equals ( " cool " ) || x . equals ( " not ▁ bad " ) || x . equals ( " don ' t ▁ touch ▁ me ! " ) || x . equals ( " don ' t ▁ think ▁ so " ) ) { System . out . println ( " normal " ) ; break ; } } } }

from sys import stdout   def ask ( index ) : print ( index ) stdout . flush ( ) x = input ( ) return x   normal = [ " cool " , " not ▁ bad " , " don ' t ▁ think ▁ so " , " don ' t ▁ touch ▁ me " , " great " ] grumpy = [ " terrible " , " worse " , " go ▁ die ▁ in ▁ a ▁ hole " , " are ▁ you ▁ serious " , " don ' t ▁ even " , " no ▁ way " ] normal . sort ( ) grumpy . sort ( )   ans = [ ] for i in range ( 10 ) : s = ask ( i ) if s == " no " : continue if s in normal : ans = " normal " else : ans = " grumpy " breakprint ( ans ) NEW_LINE

good = set ( [ ' great ' , ' great ! ' , " don ' t ▁ think ▁ so " , ' not ▁ bad ' , ' cool ' ] ) grumpy = set ( [ ' are ▁ you ▁ serious ' , ' are ▁ you ▁ serious ? ' , ' go ▁ die ▁ in ▁ a ▁ hole ' , ' worse ' , ' terrible ' , ' no ▁ way ' , " don ' t ▁ even " ] ) for i in range ( 10 ) : print ( i ) ans = input ( ) . lower ( ) . strip ( ) if ans in good : print ( ' normal ' ) break elif ans in grumpy : print ( ' grumpy ' ) break NEW_LINE

normal = [ " don ' t ▁ think ▁ so " , " don ' t ▁ touch ▁ me " , " not ▁ bad " , " cool " , " great " ] grumpy = [ " are ▁ you ▁ serious ? " , " go ▁ die ▁ in ▁ a ▁ hole " , " worse " , ' terrible ' , " don ' t ▁ even " ] for i in range ( 0 , 10 ) : print ( i ) S = input ( ) if S in normal : print ( " normal " ) break elif S in grumpy : print ( " grumpy " ) break NEW_LINE

for i in range ( 10 ) : print ( i ) s = input ( ) if s in [ " great ! " , " don ' t ▁ think ▁ so " , " not ▁ bad " , " cool " , " don ' t ▁ touch ▁ me " ] : print ( " normal " ) exit ( 0 ) if s in [ " no ▁ way " , " don ' t ▁ even " , " are ▁ you ▁ serious ? " , " worse " , " terrible " ] : print ( " grumpy " ) exit ( 0 ) NEW_LINE

import sysa = [ ' cool ' , ' not ▁ bad ' , ' great ' , " don ' t ▁ think ▁ so " , " don ' t ▁ touch ▁ me " ] b = [ ' terrible ' , ' worse ' , ' go ▁ die ▁ in ▁ a ▁ hole ' , ' are ▁ you ▁ serious ' , " don ' t ▁ even " , ' no ▁ way ' ] i = 1 while i < 10 : print ( i ) sys . stdout . flush ( ) q = input ( ) if q == ' no ' : i += 1 elif q in a : print ( ' normal ' ) sys . stdout . flush ( ) exit ( ) elif q in b : print ( ' grumpy ' ) sys . stdout . flush ( ) exit ( ) NEW_LINE


import java . awt . image . AreaAveragingScaleFilter ; import java . util . * ; import java . io . * ; import java . text . * ;   public class CF_464B {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . stream . LongStream ;   public class Solution { static int [ ] [ ] a ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ;

import itertoolsfrom itertools import permutations as perm   l = [ [ int ( x ) for x in input ( ) . split ( ) ] for i in range ( 8 ) ]   def dist2 ( p0 , p1 ) : return sum ( [ ( p0 [ i ] - p1 [ i ] ) ** 2 for i in range ( 3 ) ] )   def sub ( p0 , p1 ) : return [ p0 [ i ] - p1 [ i ] for i in range ( 3 ) ]   def add ( p0 , p1 ) : return [ p0 [ i ] + p1 [ i ] for i in range ( 3 ) ]   def div ( p0 , x ) : return [ p0 [ i ] // x for i in range ( 3 ) ]   def cross ( p0 , p1 ) : return [ p0 [ ( i + 1 ) % 3 ] * p1 [ ( i + 2 ) % 3 ] - p0 [ ( i + 2 ) % 3 ] * p1 [ ( i + 1 ) % 3 ] for i in range ( 3 ) ]   def match ( p0 , p1 ) : return sorted ( p0 ) == sorted ( p1 )   solved = Falsefor l2 in perm ( l , 3 ) : p0 = l2 [ 0 ] for p1 in perm ( l2 [ 1 ] ) : s2 = dist2 ( p0 , p1 ) if s2 == 0 : continue s = round ( s2 ** .5 ) NEW_LINE

import itertoolsfrom itertools import permutations as permimport copy   def getPerm ( it , index ) : if index == 0 : return it elif index == 1 : return [ it [ 0 ] , it [ 2 ] , it [ 1 ] ] elif index == 2 : return [ it [ 1 ] , it [ 0 ] , it [ 2 ] ] elif index == 3 : return [ it [ 1 ] , it [ 2 ] , it [ 0 ] ] elif index == 4 : return [ it [ 2 ] , it [ 0 ] , it [ 1 ] ] elif index == 5 : return [ it [ 2 ] , it [ 1 ] , it [ 0 ] ]   def distance ( coord1 , coord2 ) : return ( ( coord2 [ 0 ] - coord1 [ 0 ] ) ** 2 + ( coord2 [ 1 ] - coord1 [ 1 ] ) ** 2 + ( coord2 [ 2 ] - coord1 [ 2 ] ) ** 2 )   dists = ( [ 0 ] * 6 ) * 7   pointList = [ [ int ( x ) for x in input ( ) . split ( ) ] for y in range ( 0 , 8 ) ]   p0 = pointList [ 0 ]   for x in range ( 0 , 7 ) : y = 0 for pt in perm ( pointList [ x + 1 ] , 3 ) : NEW_LINE

from itertools import permutations as p       d = lambda a , b : sum ( ( i - j ) ** 2 for i , j in zip ( a , b ) )   f = lambda a , b : [ i + j - k for i , j , k in zip ( a , b , q ) ]   g = lambda t : sorted ( sorted ( q ) for q in t )       v = [ sorted ( map ( int , input ( ) . split ( ) ) ) for i in range ( 8 ) ]   q = v . pop ( )       def yes ( t , v ) :   print ( ' YES ' )   d = { }   for q in t :   s = str ( sorted ( q ) )   d [ s ] = d . get ( s , [ ] ) + [ q ]   for q in v :   i , j , k = d [ str ( q ) ] . pop ( )   print ( i , j , k )   exit ( )       u = g ( v )   for a , b , c in p ( v , 3 ) :   for x in p ( a ) :   s = 2 * d ( q , x )   if s == 0 : continue   for y in p ( b ) :   if not 2 * d ( q , y ) == d ( x , y ) == s : continue   for z in p ( c ) :   if not 2 * d ( q , z ) == d ( x , z ) == d ( y , z ) == s : continue   t = [ x , y , z ] + [ f ( x , y ) , f ( x , z ) , f ( y , z ) , f ( f ( x , y ) , z ) ]   if g ( t ) == u : yes ( t + [ q ] , v + [ q ] )       print ( ' NO ' )       NEW_LINE


import java . io . * ; public class p374B { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; char s [ ] = in . readLine ( ) . toCharArray ( ) ; long c = 1 , a = 1 ; for ( int i = 1 ; i < s . length ; i ++ ) if ( s [ i ] + s [ i - 1 ] == ' i ' ) c ++ ; else { if ( c % 2 == 1 ) a *= c / 2 + 1 ; c = 1 ; } if ( c % 2 == 1 ) a *= ( c / 2 + 1 ) ; out . write ( a + " " ) ; out . flush ( ) ; } }

import java . util . Scanner ;   public class A {   public static int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) {   Scanner scanner = new Scanner ( System . in ) ; long ans = 1 ;   char [ ] a = scanner . next ( ) . toCharArray ( ) ; int n = a . length ; int count = 0 ; for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( a [ i ] - '0' + a [ i + 1 ] - '0' == 9 ) { if ( count == 0 ) count += 2 ; else count ++ ; } else { if ( count % 2 == 1 ) ans *= ( 1 + count / 2 ) ; count = 0 ; } }   if ( count % 2 == 1 ) ans *= ( 1 + count / 2 ) ; System . out . println ( ans ) ; } }

import java . io . * ; import java . util . * ; public final class code

a = input ( ) n = len ( a ) ans = 1 c = 0 for i in range ( n - 1 ) : if int ( a [ i + 1 ] ) + int ( a [ i ] ) == 9 : c += 1 else : if c % 2 == 0 and c != 0 : NEW_LINE

s , a , c = input ( ) , 1 , 1 for i in range ( 1 , len ( s ) ) : if int ( s [ i ] ) + int ( s [ i - 1 ] ) == 9 : c += 1 elif c % 2 : a *= c // 2 + 1 ; c = 1 else : c = 1 if ( c % 2 ) : a *= c // 2 + 1 print ( a ) NEW_LINE

p = 10 cnt = 0 r = 1 for c in input ( ) : c = int ( c ) if c + p == 9 : cnt += 1 else : if cnt > 0 and cnt % 2 == 0 : r *= cnt // 2 + 1 cnt = 0 p = cif cnt > 0 and cnt % 2 == 0 : r *= cnt // 2 + 1 print ( r ) NEW_LINE


import java . util . * ; public class First { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ;   int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; int d = s . nextInt ( ) ; int l = s . nextInt ( ) ; int d1 = ( int ) Math . floor ( n * 1.0 / 2 ) , d2 = ( int ) Math . ceil ( n * 1.0 / 2 ) ; int temp1 = d2 * l - d1 ; int temp2 = d2 - d1 * l ; if ( temp1 < d || d < temp2 ) System . out . println ( - 1 ) ; else { for ( int i = 0 ; i < n ; i ++ ) { if ( d > 0 ) { a [ i ] = l ; d = a [ i ] - d ; } else { a [ i ] = 1 ; d = a [ i ] - d ; } } a [ n - 1 ] -= d ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] + " ▁ " ) ; } System . out . println ( ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;

import java . util . * ; import java . io . * ; public class Main2 { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; int t = 1 ;

def magic ( n , d , l ) : arr = [ 1 ] * ( n ) odd = arr [ 0 : : 2 ] even = arr [ 1 : : 2 ] if d > 0 : val = d - ( sum ( odd ) - sum ( even ) ) while val : for i in range ( len ( odd ) ) : if val : odd [ i ] += 1 val -= 1 else : break if d <= 0 : val = abs ( d ) - ( sum ( even ) - sum ( odd ) ) while val : for i in range ( len ( even ) ) : if val : even [ i ] += 1 val -= 1 else : break if max ( odd ) > l or max ( even ) > l : return - 1 arr [ 0 : : 2 ] = odd arr [ 1 : : 2 ] = even print ( * arr ) return " " a , b , c = map ( int , input ( ) . strip ( ) . split ( ) ) print ( magic ( a , b , c ) ) NEW_LINE

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE

def magic ( n , d , l ) : ans = [ d ] flag = 0 for i in range ( n - 1 ) : temp = ans [ i ] if temp < 1 : ans [ i ] = 1 ans . append ( 1 - temp ) else : ans [ i ] = l ans . append ( l - temp ) if not 1 <= ans [ n - 1 ] <= l : flag = 1 if flag == 0 : return ans else : return - 1     if __name__ == " _ _ main _ _ " : n , d , l = map ( int , input ( ) . split ( ) ) magic = magic ( n , d , l ) if magic != - 1 : for i in range ( n ) : print ( magic [ i ] , end = " ▁ " ) else : print ( - 1 ) NEW_LINE


import java . util . Scanner ; public class WayTooLongWords { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int num = in . nextInt ( ) ; int limit = in . nextInt ( ) ; int x = 0 ; while ( limit > 0 ) { limit = limit - num ; x ++ ; } System . out . println ( x ) ; } }

import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . MathContext ; import java . util . ArrayList ; import java . util . Locale ; import java . util . Scanner ;   public class CodeForces { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int count = 0 ; int sum = 0 ;   for ( int i = n ; i >= 0 ; ) {   sum += i ; if ( sum <= s ) { count ++ ; if ( sum == s ) { System . out . println ( count ) ; break ; } } else { sum -= i ; i -- ; } }    } }

import java . io . * ; import java . util . * ;   public class Codeforces { public static void main ( String [ ] args ) throws UnsupportedEncodingException , IOException , Exception { StringBuilder out = new StringBuilder ( ) ; StringTokenizer tk ; Reader . init ( System . in ) ; int n = Reader . nextInt ( ) ; int s = Reader . nextInt ( ) ; if ( s % n == 0 ) { System . out . println ( s / n ) ; } else { System . out . println ( ( s / n ) + 1 ) ; }   } }   class Reader {   static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) throws UnsupportedEncodingException { reader = new BufferedReader ( new InputStreamReader ( input , " UTF - 8" ) ) ; tokenizer = new StringTokenizer ( " " ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) {

import java . io . IOException ; import java . util . Scanner ;   public class Codeforce {   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) , y = input . nextInt ( ) ; System . out . println ( ( x + y - 1 ) / x ) ; } }

import mathn , S = map ( int , input ( ) . split ( " ▁ " ) ) print ( math . ceil ( S / n ) ) NEW_LINE

n , s = map ( int , input ( ) . split ( " ▁ " ) ) ans = 1 ans = ( s + n - 1 ) / nprint ( int ( ans ) ) NEW_LINE

max_coin , aim = map ( int , input ( ) . split ( ) ) need_more = aimcoins_used = 0   while ( max_coin > 0 ) : coins_used += need_more // max_coin need_more = need_more % max_coin max_coin -= 1   print ( coins_used ) NEW_LINE

n , s = map ( int , input ( ) . split ( ) ) count = s // nif ( s % n == 0 ) : print ( count ) else : print ( count + 1 ) NEW_LINE


import java . util . * ; public class Test1 { public static int gcd ( int a , int b ) { while ( b != 0 ) { int p = a % b ; a = b ; b = p ; } return a ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int l = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int v = 0 ; if ( y % x == 0 ) { y = y / x ; for ( int i = 1 ; i * i <= y ; i ++ ) { int p = y / i ; if ( y % i == 0 && gcd ( p , i ) == 1 && ( x * i ) >= l && ( x * i ) <= r && ( x * p ) >= l && ( x * p ) <= r ) { if ( p != i ) { v = v + 2 ; } else { v ++ ; } } } } System . out . println ( v ) ; } }

import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; long l = Integer . parseInt ( st . nextToken ( ) ) ; long r = Integer . parseInt ( st . nextToken ( ) ) ; long gcd = Integer . parseInt ( st . nextToken ( ) ) ; long lcm = Integer . parseInt ( st . nextToken ( ) ) ; long n = gcd * lcm ; long res = 0 ; long sqrt = ( long ) ( Math . sqrt ( n ) ) ; for ( long i = gcd ; i <= sqrt ; i += gcd ) { long j = n / i ; if ( i >= l && i <= r && j >= l && j <= r ) { if ( gcd ( i , j ) == gcd && lcm ( i , j ) == lcm ) { if ( i == j ) { res ++ ; } else { res += 2 ; } } } } System . out . println ( res ) ; } static long gcd ( long p , long q ) { if ( q == 0 ) return p ; else return gcd ( q , p % q ) ; } static long lcm ( long a , long b ) { return ( a * b ) / ( gcd ( a , b ) ) ; } }

import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashSet ; import java . util . InputMismatchException ; import java . util . Set ;   public class Main {   private static final int MAXN = 5000 ; private static final String NO = " NO " ; private static final String YES = " YES " ; InputStream is ; PrintWriter out ; String INPUT = " " ;   private static long MOD = 1000000009 ;   void solve ( ) { long l = nl ( ) ; long r = nl ( ) ; long gcd = nl ( ) ; long lcm = nl ( ) ;   long m = lcm / gcd ;   int ans = 0 ; if ( lcm % gcd == 0 ) for ( int a = 1 ; a <= Math . sqrt ( m ) ; a ++ ) { if ( m % a == 0 && a * gcd <= r && a * gcd >= l && m / a * gcd <= r && m / a * gcd >= l && gcd ( a , m / a ) == 1 ) {

import java . util . * ;   public class CodeForces992B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int l = input . nextInt ( ) ; int r = input . nextInt ( ) ; int x = input . nextInt ( ) ; int y = input . nextInt ( ) ;    if ( y % x != 0 ) { System . out . println ( 0 ) ; } else { int ans = 0 ; int n = y / x ; for ( int d = 1 ; d * d <= n ; d ++ ) { if ( n % d == 0 ) { int c = n / d ; if ( l <= c * x && c * x <= r && l <= d * x && d * x <= r && gcd ( c , d ) == 1 ) { if ( d * d == n ) { ans ++ ; } else { ans += 2 ; } } } }   System . out . println ( ans ) ; } }   public static int gcd ( int a , int b ) { while ( b > 0 ) { int t = a % b ; a = b ; b = t ; } return a ; } }

from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE

def gcd ( a , b ) : while b : a %= b a , b = b , a return al , r , x , y = map ( int , input ( ) . split ( ) ) if y % x != 0 : print ( 0 ) exit ( ) ans = 0 n = y // xi = 1 while i * i <= n : if n % i == 0 : c = n // i if l <= c * x <= r and l <= i * x <= r and gcd ( i , c ) == 1 : if i * i == n : ans += 1 else : ans += 2 i += 1 print ( ans ) NEW_LINE

def make_divisors ( n ) : divisors = [ ] for i in range ( 1 , int ( n ** 0.5 ) + 1 ) : if n % i == 0 : divisors . append ( i ) if i != n // i : divisors . append ( n // i )   NEW_LINE

from math import * l , r , x , y = map ( int , input ( ) . split ( ) ) m = int ( sqrt ( y ) - 0.1 ) + 1 s = list ( i for i in range ( 1 , m ) if y % i == 0 ) s += list ( y // i for i in s ) if m * m == y : s += [ m ] print ( sum ( sum ( int ( l <= i <= r and l <= j <= r and i * j == x * y and gcd ( i , j ) == x ) for i in s ) for j in s ) ) NEW_LINE


import java . util . * ; import java . io . * ; public class A { public static FastReader sc = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void taskSolver ( ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int num = arr [ i ] ; int coins = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( num % 2 == 0 ) { if ( arr [ j ] % 2 != 0 ) coins ++ ; } else { if ( arr [ j ] % 2 == 0 ) coins ++ ; } } min = Math . min ( min , coins ) ; } out . println ( min ) ; } public static void main ( String args [ ] ) throws java . lang . Exception { taskSolver ( ) ; out . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

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

import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; long [ ] arr = new long [ n ] ; int cntO = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scan . nextLong ( ) ; if ( arr [ i ] % 2 != 0 ) cntO += 1 ; } System . out . println ( Math . min ( cntO , n - cntO ) ) ; } }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) ev = 0 od = 0   for i in range ( len ( l ) ) : if ( l [ i ] % 2 == 0 ) : ev += 1 else : od += 1   print ( min ( ev , od ) ) NEW_LINE

import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapifyfrom copy import deepcopymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return list ( tmp [ : x ] ) def err ( x ) : print ( x ) ; exit ( )   n = inp ( ) a = inpl ( ) e = [ 0 , 0 ] for x in a : e [ x % 2 ] += 1 print ( min ( e ) ) NEW_LINE

n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) k = 0 l = 0 for i in range ( len ( x ) ) : if x [ i ] % 2 == 0 : k = k + 1 else : l = l + 1 m = min ( k , l ) print ( m ) NEW_LINE

import mathimport sysinput = sys . stdin . readlinedef inp ( ) : return ( int ( input ( ) ) ) def inlt ( ) : return ( list ( map ( int , input ( ) . split ( ) ) ) ) def insr ( ) : s = input ( ) . strip ( ) return ( list ( s [ : len ( s ) ] ) ) def invr ( ) : return ( map ( int , input ( ) . split ( ) ) ) n = inp ( ) l = inlt ( ) n_eve = 0 n_odd = 0 for i in range ( n ) : if l [ i ] % 2 == 0 : n_eve += 1 else : n_odd += 1 print ( min ( n_eve , n_odd ) ) NEW_LINE


import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n , sum = 0 , minsum = Integer . MAX_VALUE , man = 0 ; int [ ] a = new int [ 101 ] ; n = in . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } for ( int x = 1 ; x <= n ; x ++ ) { sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { man = 0 ; man += 2 * ( Math . abs ( i - x ) + Math . abs ( i - 1 ) + Math . abs ( 1 - x ) ) ; sum += man * a [ i ] ; } if ( sum < minsum ) { minsum = sum ; } } System . out . println ( minsum ) ; in . close ( ) ; } }

import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; }   int min = 0 ; for ( int i = 0 ; i < n ; i ++ ) {   int temp = 0 ; for ( int j = 0 ; j < n ; j ++ ) { temp += 2 * ( Math . abs ( i - j ) + i + j ) * a [ j ] ; } if ( i == 0 || temp < min ) { min = temp ; } } System . out . println ( min ) ; } }

n = int ( input ( ) ) a = [ 1 ] + [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ] res = 0 power = [ ] for i in range ( 1 , n + 1 ) : for j in range ( 1 , n + 1 ) : if j > i : res = a [ j ] * ( ( j - i ) * 2 + ( j - 1 ) * 2 ) * 2 + res else : res = a [ j ] * ( j - 1 ) * 2 * 2 + res power . append ( res ) res = 0   ans = min ( power ) print ( ans )   NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) pas = 0 for i in range ( n ) : pas += a [ i ] * i * 4 print ( pas ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( 1 , n ) : ans += 4 * a [ i ] * iprint ( ans ) NEW_LINE

n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) ans = 10 ** 18 for i in range ( n ) : x = i + 1 temp = 0 for j in range ( n ) : k = j + 1 temp += ( abs ( k - x ) + abs ( k - 1 ) + abs ( x - 1 ) ) * A [ j ] temp += ( abs ( 1 - x ) + abs ( 1 - k ) + abs ( k - x ) ) * A [ j ] y = abs ( k - x ) + abs ( x - 1 ) + abs ( x - 1 ) + abs ( 1 - x ) + abs ( 1 - k ) + abs ( k - x ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t != 0 ) { int n = sc . nextInt ( ) ; long s1 = 0 , s2 = 0 ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( i % 2 == 0 ) s1 += arr [ i ] ; else s2 += arr [ i ] ; } if ( s1 < s2 ) { for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) arr [ i ] = 1 ; System . out . print ( arr [ i ] ) ; System . out . print ( " ▁ " ) ; } } else { for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 1 ) arr [ i ] = 1 ; System . out . print ( arr [ i ] ) ; System . out . print ( " ▁ " ) ; } } System . out . println ( ) ; t = t - 1 ; } } }

import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {   public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int tc = input . nextInt ( ) ; while ( tc -- > 0 ) { int n = input . nextInt ( ) ; long sum = 0 ; int a [ ] = new int [ n ] ; int max = 0 ; int maxIndex = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; sum += a [ i ] ; if ( max <= a [ i ] ) { max = a [ i ] ; maxIndex = i ; } } long total1 = 0 , total2 = 0 ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Zad1463B {   public static void main ( String [ ] args ) {

import java . io . * ; import java . lang . * ; import java . util . * ; import java . io . * ; import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int t = scanner . nextInt ( ) ; while ( t -- > 0 ) { StringBuilder sb = new StringBuilder ( ) ; int n = scanner . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = scanner . nextInt ( ) ; int b [ ] = new int [ n ] , c [ ] = new int [ n ] ; long compare = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { compare += a [ i ] - 1 ; b [ i ] = 1 ; } else { b [ i ] = a [ i ] ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 1 ) { compare -= a [ i ] - 1 ; c [ i ] = 1 ; } else { c [ i ] = a [ i ] ; } } if ( compare < 0 ) { for ( int i = 0 ; i < n ; i ++ ) sb . append ( b [ i ] + " ▁ " ) ; } else { for ( int i = 0 ; i < n ; i ++ ) sb . append ( c [ i ] + " ▁ " ) ; } System . out . println ( sb ) ; } } }

import bisectimport NEW_LINE sysinput = sys . stdin . readline   t = int ( input ( ) ) NEW_LINE pow2 = [ 1 ] NEW_LINE for _ in range ( 32 ) : pow2 . append ( 2 * pow2 [ - 1 ] ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = [ ] NEW_LINE for i in a : j = bisect . bisect_left ( pow2 , i + 0.5 ) - 1 NEW_LINE if i - pow2 [ j ] <= pow2 [ j + 1 ] - i or j >= 29 : NEW_LINE INDENT b . append ( pow2 [ j ] ) else : NEW_LINE b . append ( pow2 [ j + 1 ] ) NEW_LINE DEDENT print ( * b ) NEW_LINE

import math   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE print ( ' ▁ ' . join ( [ str ( 1 << int ( math . log2 ( x ) ) ) for x in a ] ) ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sum_e = sum_o = 0 NEW_LINE for i in range ( n ) : if NEW_LINE i % 2 == 0 : sum_e += l [ i ] else : sum_o += l [ i ] NEW_LINE if sum_e < sum_o : NEW_LINE INDENT t = 1 else : NEW_LINE t = 0 NEW_LINE DEDENT ans = [ ] NEW_LINE for i in range ( n ) : if NEW_LINE i % 2 == t : ans . append ( l [ i ] ) else : ans . append ( 1 )   print ( * ans ) NEW_LINE

def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = read ( ) NEW_LINE res = [ ] NEW_LINE t = 1 NEW_LINE for i in a : while NEW_LINE t <= i / 2 : t <<= 1 NEW_LINE while t >= i * 1.5 : t >>= 1 NEW_LINE res . append ( t ) NEW_LINE print ( * res ) NEW_LINE

import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline   NEW_LINE def check ( arr ) : cur = 0 NEW_LINE for i in range ( n ) : cur += ( l [ i ] - arr [ i ] ) NEW_LINE return ( 2 * cur ) <= s   t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = sum ( l ) NEW_LINE b1 = [ 1 for _ in range ( n ) ] NEW_LINE b2 = [ 1 for _ in range ( n ) ] NEW_LINE for i in range ( 0 , n , 2 ) : b1 [ i ] = l [ i ] NEW_LINE for i in range ( 1 , n , 2 ) : b2 [ i ] = l [ i ] NEW_LINE if ( check ( b1 ) ) : NEW_LINE INDENT print ( * b1 ) else : NEW_LINE print ( * b2 ) NEW_LINE DEDENT t -= 1 NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BSameParitySummands solver = new BSameParitySummands ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BSameParitySummands { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int t = in . nextInt ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; int k = in . nextInt ( ) ;

import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class Learn { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int t = cin . nextInt ( ) ; while ( t -- > 0 ) { int n , k ; n = cin . nextInt ( ) ; k = cin . nextInt ( ) ; if ( n % 2 == 0 && n >= 2 * k ) { int ans = n / 2 ; if ( ans >= k ) { System . out . println ( " YES " ) ; for ( int i = 1 ; i < k ; i ++ ) { System . out . print ( 2 + " ▁ " ) ; } System . out . println ( n - k * 2 + 2 ) ; continue ; } } if ( n >= k && k % 2 == n % 2 ) { System . out . println ( " YES " ) ; for ( int i = 1 ; i < k ; i ++ ) { System . out . print ( 1 + " ▁ " ) ; } System . out . println ( n - k + 1 ) ; continue ; } System . out . println ( " NO " ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) throws IOException { Solution solution = new Solution ( ) ; solution . solve ( ) ; } }   class Solution { Solution ( ) { }   void solve ( ) throws IOException { int t = Reader . nextInt ( ) ; int count = 0 ; while ( count < t ) { int n = Reader . nextInt ( ) ; int k = Reader . nextInt ( ) ; boolean flag = false ; ArrayList < Integer > arrayList = new ArrayList < > ( ) ; if ( n >= k ) { if ( ( n - ( k - 1 ) ) % 2 == 1 ) { flag = true ; arrayList . add ( n - ( k - 1 ) ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) { arrayList . add ( 1 ) ; } } } if ( n >= k * 2 ) { if ( ( n - 2 * ( k - 1 ) ) % 2 == 0 ) { flag = true ; arrayList . add ( n - 2 * ( k - 1 ) ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) { arrayList . add ( 2 ) ; } } }   if ( flag ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( arrayList . get ( i ) + " ▁ " ) ; } System . out . println ( ) ; } else { System . out . println ( " NO " ) ; } count ++ ; } } }   class Reader { static BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer tokenizer = new StringTokenizer ( " " ) ; static String nextLine ( ) throws IOException {

for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) if n < k : print ( " NO " ) continue if ( n // k + n % k ) % 2 == ( n // k ) % 2 : print ( " YES " ) print ( * ( [ n // k + n % k ] + [ n // k ] * ( k - 1 ) ) ) elif ( n // k > 1 ) & ( ( k - 1 ) % 2 == 0 ) : print ( " YES " ) print ( * ( [ n // k + n % k ] + [ n // k - 1 , n // k + 1 ] * ( ( k - 1 ) // 2 ) ) ) else : print ( " NO " ) NEW_LINE

def answer ( n , k ) : if k > n : print ( ' NO ' ) return if k == n : print ( ' YES ' ) lst = [ '1' for i in range ( k ) ] print ( ' ▁ ' . join ( lst ) ) return NEW_LINE

def p ( k , n ) : r = n // k print ( ' YES ' ) for _ in range ( k - 1 ) : print ( r , end = ' ▁ ' ) print ( r + ( n % k ) ) def raf ( ) : n , k = map ( int , input ( ) . split ( ) ) if n < k : print ( ' NO ' ) ; return if n % k == 0 : print ( ' YES ' ) for _ in range ( k ) : print ( n // k , end = ' ▁ ' ) print ( ) return if k % 2 == 1 : if n % 2 == 0 : if ( n // k ) % 2 == 0 : p ( k , n ) else : if n // k == 1 : print ( ' NO ' ) else : print ( ' YES ' ) r = ( n // k ) - 1 a = ( n // k ) + ( n % k ) + ( k - 1 ) for _ in range ( k - 1 ) : print ( r , end = " ▁ " ) print ( a ) else : if ( n // k ) % 2 == 0 : if n // k == 1 : print ( ' NO ' ) else : print ( ' YES ' ) r = ( n // k ) - 1 a = ( n // k ) + ( n % k ) + ( k - 1 ) for _ in range ( k - 1 ) : print ( r , end = " ▁ " ) print ( a ) else : p ( k , n ) else : if n % 2 == 0 : p ( k , n ) else : print ( ' NO ' ) def main ( ) : for _ in range ( int ( input ( ) ) ) : raf ( ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) a = [ 1 ] * ( k - 1 ) + [ ( n - k + 1 ) ] if a [ - 1 ] % 2 == 1 and a [ - 1 ] > 0 : print ( " YES " ) print ( * a ) continue a = [ 2 ] * ( k - 1 ) + [ n - 2 * ( k - 1 ) ] if a [ - 1 ] % 2 == 0 and a [ - 1 ] > 0 : print ( " YES " ) print ( * a ) continue print ( " NO " ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) if k > n : print ( " NO " ) elif ( ( n - k + 1 ) % 2 != 0 ) : print ( " YES " ) for i in range ( 1 , k ) : print ( 1 , end = ' ▁ ' ) print ( n - k + 1 ) elif ( ( n - 2 * ( k - 1 ) ) % 2 == 0 and ( n - 2 * ( k - 1 ) ) > 0 ) : print ( " YES " ) for i in range ( 1 , k ) : print ( 2 , end = ' ▁ ' ) print ( n - 2 * ( k - 1 ) ) else : print ( " NO " ) NEW_LINE


import java . util . Scanner ;   public class Balloons {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } if ( n == 1 ) { System . out . println ( - 1 ) ; } else if ( n == 2 && a [ 0 ] == a [ 1 ] ) { System . out . println ( - 1 ) ; } else { int mn = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ mn ] > a [ i ] ) { mn = i ; } } System . out . println ( "1" ) ; System . out . println ( mn + 1 ) ; } } }

import java . util . * ; import java . math . * ; 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 Node [ ] nodes ; 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 ) 1e9 + 5 ; static long mod = 998244353l ;

import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int n = in . nextInt ( ) ; int a [ ] = in . nextArray ( n ) ; int sum1 = 0 , sum2 = 0 ; int min = Integer . MAX_VALUE , ind = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < min ) { min = a [ i ] ; ind = i ; } sum1 = sum1 + a [ i ] ; } sum1 = sum1 - a [ ind ] ; sum2 = a [ ind ] ; if ( sum1 != sum2 && sum1 != 0 && sum2 != 0 ) { System . out . println ( 1 ) ; System . out . println ( ind + 1 ) ; } else System . out . println ( - 1 ) ; }

import java . util . Scanner ;   public class Balloons { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , a [ ] = new int [ n ] , s = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; s += a [ i ] ; } in . close ( ) ;   for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] != s - a [ i ] && s != a [ i ] ) {   System . out . println ( 1 + " \n " + ( i + 1 ) ) ; return ; } } System . out . println ( - 1 ) ; } }

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) total = sum ( a ) if n == 1 : print ( - 1 ) else : ans = - 1 for i in range ( n ) : if a [ i ] != total - a [ i ] : ans = i break if ans == - 1 : print ( - 1 ) else : print ( 1 ) print ( ans + 1 ) NEW_LINE

import sysn = int ( input ( ) ) arr = list ( map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( " ▁ " ) ) ) l = len ( arr ) g = 0 a = 0 if n == 1 : print ( " - 1" ) elif n == 2 : for i in range ( l - 1 ) : if int ( arr [ i ] ) != int ( arr [ i + 1 ] ) : print ( "1" ) print ( "1" ) else : print ( " - 1" ) else : for i in range ( l - 1 ) : if int ( arr [ i ] <= arr [ i + 1 ] ) : print ( "1" ) print ( "1" ) break else : print ( "1" ) j = arr . index ( arr [ i + 1 ] ) print ( j + 1 ) break   NEW_LINE

import sysn = int ( sys . stdin . readline ( ) . strip ( ) ) arr = list ( map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( " ▁ " ) ) ) a1 = [ ] a2 = [ ] s1 = s2 = 0 val = min ( arr ) index = arr . index ( val ) a1 . append ( index )   for i in range ( 0 , len ( arr ) ) : a2 . append ( i )   for j in a1 : s1 = s1 + arr [ int ( j ) ] for k in a2 : s2 = s2 + arr [ int ( k ) ] s2 = s2 - val   NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) g = d = 0 lst = [ ] for i in range ( n ) : if i % 2 == 0 : g += a [ i ] lst . append ( a [ i ] ) else : d += a [ i ] if d > 0 and g > 0 and g != d : print ( 1 ) print ( 2 ) elif g == d and n > 2 : print ( 1 ) print ( 1 ) else : print ( - 1 ) NEW_LINE


import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; HashSet < Integer > h = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; h . add ( arr [ i ] ) ; } int p = 0 ; int [ ] a1 = new int [ n ] ; if ( h . size ( ) >= k ) { System . out . println ( " YES " ) ; HashMap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! hm . containsKey ( arr [ i ] ) ) { hm . put ( arr [ i ] , 1 ) ; a1 [ p ] = i + 1 ; p ++ ; } } for ( int i = 0 ; i < k ; i ++ ) System . out . print ( a1 [ i ] + " ▁ " ) ; } else System . out . println ( " NO " ) ; } }

import java . util . ArrayList ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class DiverseTeam { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; ArrayList < Integer > a = new ArrayList < > ( ) ; int count = 0 ; Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( ! set . contains ( arr [ i ] ) ) { set . add ( arr [ i ] ) ; a . add ( i ) ; } } int [ ] arr1 = a . stream ( ) . mapToInt ( i -> i ) . toArray ( ) ; if ( set . size ( ) >= k ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( arr1 [ i ] + 1 + " ▁ " ) ; } } else { System . out . println ( " NO " ) ; } } }

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 Seg { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = sc . nextArr ( n ) ; boolean isHere [ ] = new boolean [ 101 ] ; int c = 0 ; int [ ] temp = new int [ n + 1 ] ; int j = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! isHere [ a [ i ] ] ) { c ++ ; isHere [ a [ i ] ] = true ; temp [ j ] = i + 1 ; j ++ ; if ( c >= k ) { break ; }   } }   if ( c >= k ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < j ; i ++ ) { System . out . print ( temp [ i ] + " ▁ " ) ; } } else { System . out . println ( " NO " ) ; }   pw . flush ( ) ; pw . close ( ) ; }   public static int findMaxSumSubarray ( int [ ] arr , int k ) { int maxValue = Integer . MIN_VALUE ; int currentRunningSum = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { currentRunningSum += arr [ i ] ; if ( i >= k - 1 ) { maxValue = Math . max ( maxValue , currentRunningSum ) ; currentRunningSum -= arr [ i - ( k - 1 ) ] ;

import java . util . ArrayList ; import java . util . Scanner ;    public class DiverseTeam {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; ArrayList < Integer > p1 = new ArrayList < > ( ) ; ArrayList < Integer > p2 = new ArrayList < > ( ) ; int a [ ] = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( ! p1 . contains ( a [ i ] ) ) { p1 . add ( a [ i ] ) ; p2 . add ( i + 1 ) ; } } if ( p2 . size ( ) >= m ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . print ( p2 . get ( i ) + " ▁ " ) ; } } else { System . out . println ( " NO " ) ; } } }

R = lambda : map ( int , input ( ) . split ( ) ) n , k = R ( ) d = dict ( zip ( R ( ) , range ( 1 , n + 1 ) ) ) if len ( d ) < k : print ( ' NO ' ) else : print ( ' YES ' ) ; print ( * list ( d . values ( ) ) [ : k ] ) NEW_LINE

n , k = list ( map ( int , input ( ) . split ( ) ) ) arreglo = list ( map ( int , input ( ) . split ( ) ) )   set1 = set ( arreglo )   if len ( set1 ) >= k : print ( " YES " ) for i in range ( k ) : print ( arreglo . index ( set1 . pop ( ) ) + 1 , end = " ▁ " ) else : print ( " NO " ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = list ( set ( a ) ) if len ( s ) >= k : print ( " YES " ) for r in range ( k ) : print ( a . index ( s [ r ] ) + 1 , end = ' ▁ ' ) else : print ( " NO " ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in l : if ( i in d ) : d [ i ] += 1 else : d [ i ] = 1 if ( len ( d ) < k ) : print ( ' NO ' ) else : print ( ' YES ' ) d1 = { } c = 0 for i in range ( n ) : if ( c < k and l [ i ] not in d1 ) : c += 1 print ( i + 1 , end = ' ▁ ' ) d1 [ l [ i ] ] = 1   NEW_LINE


import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int sum = 0 ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int n1 = sc . nextInt ( ) ; list . add ( n1 ) ; sum += n1 ; } int u1 = ( int ) Math . round ( ( double ) sum / n ) ;

import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; sum += a [ i ] ; } for ( int i = 0 ; ; i ++ ) { long rd = Math . round ( ( i * k + sum * 1.0 ) / ( i + n * 1.0 ) ) ; if ( rd == k ) { System . out . println ( i ) ; return ; } } }       }

a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( y ) for y in input ( ) . split ( ) ] sum1 = 0 for z in b : sum1 = sum1 + zavg = sum1 / a [ 0 ] if ( avg >= ( a [ 1 ] - 0.5 ) ) : print ( 0 ) else : print ( ( ( 2 * a [ 1 ] - 1 ) * a [ 0 ] ) - ( 2 * sum1 ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )     i = 0 avg = round ( sum ( a ) / n , 10 )   while avg < k - 0.5 : i += 1 avg = round ( ( sum ( a ) + i * k ) / ( n + i ) , 10 )           print ( i )   NEW_LINE

n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) temp = max ( a ) ans = 0 while sum ( a ) / len ( a ) < ( k - 0.5 ) : NEW_LINE

import sys   n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0 sum_ = sum ( a ) len_ = len ( a ) while sum_ / len_ < k - 0.5 : sum_ += k len_ += 1 c += 1 print ( c ) NEW_LINE

def grade ( ar ) : z = sum ( ar ) / len ( ar ) f = int ( z ) s = z - f if ( s >= 0.5 ) : return f + 1 else : return f   x , y = map ( int , input ( ' ' ) . split ( ) ) ar = list ( map ( int , input ( ' ' ) . split ( ) ) ) q = grade ( ar ) ct = 0 while ( q < y ) : ct = ct + 1 ar . append ( y ) q = grade ( ar )   print ( ct )   NEW_LINE