import java . io . BufferedReader ; 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 n = input . nextInt ( ) ;   int a [ ] [ ] = new int [ n ] [ 2 ] ; int freq [ ] = new int [ 2001 ] ; TreeSet < Integer > set = new TreeSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 1 ] = input . nextInt ( ) ; a [ i ] [ 0 ] = i ; freq [ a [ i ] [ 1 ] ] ++ ; set . add ( a [ i ] [ 1 ] ) ;   }   long total = 1 ; for ( Integer integer : set ) {   total *= freq [ integer ] ; if ( total >= 3 ) { break ; } } Arrays . sort ( a , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] t , int [ ] t1 ) { return t [ 1 ] - t1 [ 1 ] ; }   } ) ;

a = int ( input ( ) ) b = [ [ ] for _ in " ▁ " * ( 2001 ) ] ok2 = 0 ; ok3 = 0 ; k5 , k6 , k7 = 0 , 1 , 1 for i , j in enumerate ( map ( int , input ( ) . split ( ) ) ) : b [ j ] . append ( i + 1 ) k = [ [ ] for _ in " ▁ " * 3 ] for i in range ( 2001 ) : if len ( b [ i ] ) : if len ( b [ i ] ) > 2 : ok3 = 1 k2 , k3 , k4 = 0 , 1 , 2 for j in range ( len ( b [ i ] ) ) : k [ 0 ] . append ( b [ i ] [ ( j + k2 ) % len ( b [ i ] ) ] ) k [ 1 ] . append ( b [ i ] [ ( j + k3 ) % len ( b [ i ] ) ] ) k [ 2 ] . append ( b [ i ] [ ( j + k4 ) % len ( b [ i ] ) ] ) elif len ( b [ i ] ) == 2 : ok2 += 1 for j in range ( len ( b [ i ] ) ) : k [ 0 ] . append ( b [ i ] [ ( j + k5 ) % len ( b [ i ] ) ] ) k [ 1 ] . append ( b [ i ] [ ( j + k6 ) % len ( b [ i ] ) ] ) k [ 2 ] . append ( b [ i ] [ ( j + k7 ) % len ( b [ i ] ) ] ) k5 , k6 , k7 = 1 , 1 , 0 else : k [ 0 ] . append ( b [ i ] [ 0 ] ) k [ 1 ] . append ( b [ i ] [ 0 ] ) k [ 2 ] . append ( b [ i ] [ 0 ] )   if ok3 or ok2 > 1 : print ( " YES " ) for i in k : print ( * i ) else : print ( " NO " ) NEW_LINE


n , a , q , w , r = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) , [ ] , [ ] , [ 0 ] for i in range ( n ) : q . append ( [ a [ i ] , i + 1 ] ) q . sort ( ) for i in range ( 1 , n ) : if q [ i ] [ 0 ] == q [ i - 1 ] [ 0 ] : r [ 0 ] += 1 ; r . append ( i + 1 ) if r [ 0 ] == 2 : breakfor i in q : w . append ( i [ 1 ] ) if r [ 0 ] == 2 : print ( " YES " ) print ( * w ) for i in range ( 1 , 3 ) : w [ r [ i ] - 1 ] , w [ r [ i ] - 2 ] = w [ r [ i ] - 2 ] , w [ r [ i ] - 1 ] ; print ( * w ) else : print ( " NO " ) NEW_LINE


from collections import Counter n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) counter = Counter ( a ) extra = 0 for i in counter : extra += counter [ i ] - 1 if extra <= 1 : print ( ' NO ' ) else : b = [ ( a [ i ] , i + 1 ) for i in range ( n ) ] b . sort ( ) print ( ' YES ' ) x = [ b [ i ] [ 1 ] for i in range ( n ) ] print ( ' ▁ ' . join ( map ( str , x ) ) ) times = 0 for i in range ( n - 1 ) : if b [ i ] [ 0 ] == b [ i + 1 ] [ 0 ] : tmp = b [ i ] b [ i ] = b [ i + 1 ] b [ i + 1 ] = tmp times += 1 x = [ b [ j ] [ 1 ] for j in range ( n ) ] print ( ' ▁ ' . join ( map ( str , x ) ) ) if times == 2 : break NEW_LINE


n = int ( input ( ) ) arr = sorted ( enumerate ( map ( int , input ( ) . split ( ) ) , 1 ) , key = lambda x : x [ 1 ] ) ans = [ str ( x [ 0 ] ) for x in arr ] q = [ ' YES ' , ' ▁ ' . join ( ans ) ] for i in range ( n - 1 ) : if arr [ i ] [ 1 ] == arr [ i + 1 ] [ 1 ] : ans [ i ] , ans [ i + 1 ] = ans [ i + 1 ] , ans [ i ] q . append ( ' ▁ ' . join ( ans ) ) if len ( q ) > 3 : breakprint ( ' \n ' . join ( q ) if len ( q ) > 3 else " NO " ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = fs . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int b = fs . nextInt ( ) ; a . add ( b ) ; } Collections . sort ( a ) ; int ans = 0 ; int prev = 0 ; if ( n > 0 ) prev = a . get ( 0 ) ; for ( int i : a ) { if ( prev + 1 == i ) { ans ++ ; } prev = i ; } if ( ans > 0 ) { ans = 2 ; } else ans = 1 ; System . out . println ( ans ) ; } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

import sysinput = sys . stdin . readline   for test in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) ans = 1 for i in range ( n - 1 ) : if a [ i + 1 ] - a [ i ] == 1 : ans = 2 print ( ans ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] a . sort ( ) flag = 0 for i in range ( n - 1 ) : if a [ i + 1 ] == a [ i ] + 1 : flag = 1 break if flag : print ( 2 ) else : print ( 1 ) NEW_LINE


n = int ( input ( ) ) for i in range ( n ) : _ = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) res = list ( ) for i in range ( len ( a ) ) : if len ( res ) == 0 : res . append ( [ a [ i ] ] ) continue if a [ i ] - res [ - 1 ] [ - 1 ] > 1 : res [ - 1 ] . append ( a [ i ] ) else : if len ( res ) == 1 : res . append ( [ a [ i ] ] ) else : res [ - 2 ] . append ( a [ i ] ) print ( len ( res ) ) NEW_LINE


def teams_counter ( skills ) : res = 1 bucket_1 = [ skills [ 0 ] ] for i in range ( 1 , len ( skills ) ) : if abs ( skills [ i ] - bucket_1 [ - 1 ] ) > 1 : bucket_1 . append ( skills [ i ] ) else : res = 2 break return res                   q = int ( input ( ) )   for i in range ( q ) : size = int ( input ( ) ) skills = sorted ( map ( int , input ( ) . split ( ) ) ) print ( teams_counter ( skills ) )           NEW_LINE


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


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


import java . util . Arrays ; import java . util . Scanner ;   public class A1249 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int q = scanner . nextInt ( ) ; for ( int i = 0 ; i < q ; i ++ ) { int n = scanner . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = scanner . nextInt ( ) ; } Arrays . sort ( a ) ; boolean flag = false ; for ( int j = 1 ; j < n ; j ++ ) { if ( Math . abs ( a [ j - 1 ] - a [ j ] ) == 1 ) { flag = true ; break ; } else { flag = false ; } } System . out . println ( flag ? 2 : 1 ) ;   } } }


import java . io . File ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p015 { public static void main ( String args [ ] ) throws Exception { StringTokenizer stok = new StringTokenizer ( new Scanner ( System . in ) . useDelimiter ( " \\ A " ) . next ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( stok . nextToken ( ) ) ; int I = ( Integer . parseInt ( stok . nextToken ( ) ) * 8 ) / n ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( stok . nextToken ( ) ) ; } Arrays . sort ( a ) ; int [ ] b = new int [ n ] ; int cnt = 0 ; int i = 0 ; while ( i < n ) { b [ i ] = cnt ; while ( ++ i < n && a [ i ] . intValue ( ) == a [ i - 1 ] . intValue ( ) ) b [ i ] = cnt ; cnt ++ ; } cnt = 0 ; int v = b [ n - 1 ] ; for ( ; v > 0 ; cnt ++ , v >>= 1 ) ; if ( cnt <= I ) System . out . println ( "0" ) ; else { i = 0 ; int min = Integer . MAX_VALUE ; while ( i < n ) { int lo = i , hi = n ; while ( lo != hi ) { int md = ( lo + hi ) / 2 ; if ( b [ md ] < b [ i ] + ( 1 << I ) ) lo = md + 1 ; else hi = md ; } min = Math . min ( min , i + n - lo ) ; while ( ++ i < n && a [ i ] == a [ i - 1 ] ) ; } System . out . println ( min ) ; } } }

from math import ceil , log2from collections import Counterdef read ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE


import sys , os , iodef rs ( ) : return sys . stdin . readline ( ) . rstrip ( ) def ri ( ) : return int ( sys . stdin . readline ( ) ) def ria ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def ws ( s ) : sys . stdout . write ( s + ' \n ' ) def wi ( n ) : sys . stdout . write ( str ( n ) + ' \n ' ) def wia ( a ) : sys . stdout . write ( ' ▁ ' . join ( [ str ( x ) for x in a ] ) + ' \n ' ) import math , datetime , functools , itertools , operator , bisect , fractions , statisticsfrom collections import deque , defaultdict , OrderedDict , Counterfrom fractions import Fractionfrom decimal import Decimalfrom sys import stdoutfrom heapq import heappush , heappop , heapify , _heapify_max , _heappop_max , nsmallest , nlargest   def main ( ) : NEW_LINE


import osimport sysfrom io import BytesIO , IOBasefrom collections import Counterimport math NEW_LINE


import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n , d , m ; n = input . nextInt ( ) ; d = input . nextInt ( ) ; int a [ ] = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } m = input . nextInt ( ) ; Arrays . sort ( a ) ; if ( m <= n ) { for ( int i = 0 ; i < m ; i ++ ) { sum += a [ i ] ; } System . out . println ( sum ) ; } else { for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } sum = sum - ( ( m - n ) * d ) ; System . out . println ( sum ) ; } } }

datos_n_d = input ( ) . split ( ) n = int ( datos_n_d [ 0 ] ) d = int ( datos_n_d [ 1 ] )   costo_gancho = [ ] datos_gancho = input ( ) . split ( ) for dato in datos_gancho : costo_gancho . append ( int ( dato ) ) m = int ( input ( ) )   balance = 0 costo_gancho . sort ( ) if n >= m : for i in range ( m ) : balance = balance + costo_gancho [ i ] else : balance = sum ( costo_gancho ) - ( ( m - n ) * d )   print ( balance ) NEW_LINE


n , d = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) if m == n : print ( sum ( a ) ) elif m < n : a = sorted ( a ) print ( sum ( a [ : m ] ) ) else : x = sum ( a ) print ( x - ( m - len ( a ) ) * d ) NEW_LINE


n , d = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) a . sort ( ) k = 0 s = 0 for i in range ( m ) : if i < len ( a ) : k += a [ s ] s += 1 else : k -= dprint ( k )   NEW_LINE


n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) if m >= n : print ( sum ( l ) - ( m - n ) * x ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;    public class SerejaAndCoatRack {   public static void main ( String [ ] args ) {


import java . util . Arrays ; import java . util . Scanner ;   public class CoatRackProfit { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] price = new int [ n ] ;   int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { price [ i ] = scan . nextInt ( ) ; sum += price [ i ] ; }   int m = scan . nextInt ( ) ;   if ( m >= n ) { System . out . println ( sum - d * ( m - n ) ) ; } else { Arrays . sort ( price ) ;   sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { sum += price [ i ] ; } System . out . println ( sum ) ; } } }


import java . util . * ; public class SpecialOfferSuperPrice999Bourles { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long p = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; String s = Long . toString ( p ) ; long temp ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { s = Long . toString ( p ) ; if ( s . charAt ( i ) != '9' ) { temp = ( long ) Math . pow ( 10 , s . length ( ) - i - 1 ) * ( Long . parseLong ( " " + s . charAt ( i ) ) + 1 ) ; if ( d >= temp ) { d -= temp ; p -= temp ; } } } System . out . println ( p ) ; } }

a , b = map ( int , input ( ) . split ( ) ) a = a + 1 n = ak = 10 while ( True ) : if ( ( a % k ) > b ) : break n = a - ( a % k ) k *= 10 print ( n - 1 ) NEW_LINE


import mathimport sysimport collectionsimport bisectimport stringimport timedef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) def num ( arr ) : ans = " " for i in arr : ans += i return int ( ans ) for t in range ( 1 ) : n , m = get_ints ( ) ans = n no = str ( n ) pos = len ( no ) - 1 c = 0 while pos >= 0 : if no [ pos ] == "9" : c += 1 pos -= 1 else : break for k in range ( c + 1 , 20 ) : no = ( n ) - ( n % ( 10 ** k ) ) - 1 NEW_LINE


n , p = map ( int , input ( ) . split ( ) )   ans = n   l = len ( str ( n ) ) for nine in range ( 0 , l ) : m = int ( str ( n ) [ : l - nine ] + '9' * nine ) while m > n : m -= 10 ** nine if n - m <= p : ans = m   print ( ans ) NEW_LINE


p , d = ( int ( k ) for k in input ( ) . split ( ) )   test_price = presult = pmax_num_of_nines = 0 i = 1   while test_price >= p - d : test_price_size = len ( str ( test_price ) ) num_of_nines = 0 for c in range ( test_price_size ) : if str ( test_price ) [ - c - 1 ] == '9' : num_of_nines += 1 else : break if num_of_nines == test_price_size and num_of_nines > max_num_of_nines : result = test_price break else : if num_of_nines > max_num_of_nines : max_num_of_nines = num_of_nines result = test_price NEW_LINE


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


import java . util . * ; public class abc { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long p = sc . nextLong ( ) ; long d = sc . nextLong ( ) , ans = ++ p ; for ( long t = 10 ; ; t *= 10 ) { if ( p % t > d ) break ; ans = p - p % t ; } System . out . println ( ans - 1 ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ;   public class A {   public static void main ( String [ ] args ) throws IOException {   FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; ArrayList < String > lis = new ArrayList < String > ( ) ; String str = sc . next ( ) ; long cost = Long . parseLong ( str ) ; char [ ] extra = str . toCharArray ( ) ; long p = sc . nextLong ( ) ; int n = str . length ( ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { if ( extra [ i ] != '9' ) { extra [ i ] = '9' ; int j = i - 1 ; while ( j >= 0 ) { if ( extra [ j ] == '0' ) { extra [ j ] = '9' ; j -- ; continue ; } else { String val = ( extra [ j ] - '0' - 1 ) + " " ; extra [ j ] = val . charAt ( 0 ) ; break ; } } } StringBuilder ans = new StringBuilder ( ) ; for ( char e : extra ) ans . append ( e ) ; lis . add ( ans . toString ( ) ) ; } if ( lis . size ( ) == 0 ) { System . out . println ( cost ) ; return ; }


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


import java . util . * ; public class Main { public static double calcTime ( double d , int vd , int vp ) { return d / ( vd - vp ) ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner in = new Scanner ( System . in ) ;

vp = int ( input ( ) ) vd = int ( input ( ) ) t = int ( input ( ) ) f = int ( input ( ) ) c = int ( input ( ) )   dist = 0 cnt = 0 if vd <= vp : print ( 0 ) else : while True : time = t + vp * t / ( vd - vp ) if time * vp >= c : print ( cnt ) break else : t = t + 2 * ( time - t ) + f cnt += 1 NEW_LINE


vp = int ( input ( ) ) vd = int ( input ( ) ) t = int ( input ( ) ) f = int ( input ( ) ) c = int ( input ( ) )   pp = t * vpbijoux = 0 pd = 0 while ( pp < c ) : if vp >= vd : break pp = ( vd * pp ) / ( vd - vp ) if pp >= c : break bijoux += 1 pp += ( pp / vd + f ) * vpprint ( bijoux ) NEW_LINE


import sysimport mathimport collectionsimport bisectdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) princess = int ( input ( ) ) dragon = int ( input ( ) ) t = int ( input ( ) ) f = int ( input ( ) ) c = int ( input ( ) ) start = t * princesscount = 0 if dragon <= princess : print ( 0 ) quit ( ) while start < c : d1 = start + ( princess ) d2 = dragon time = start / ( dragon - princess ) start += princess * time if start < c : count += 1 start += princess * ( time + f ) print ( count ) NEW_LINE


x , y , t , f , c = [ int ( input ( ) ) for i in range ( 5 ) ] a = x * t NEW_LINE


p , vd , t , f , c = [ int ( input ( ) ) for i in range ( 5 ) ] if p >= vd : exit ( print ( 0 ) ) cur = ( p * t * vd ) / ( vd - p ) ans = 0 while c > cur : ans += 1 cur += p * ( 2 * cur + f * vd ) / ( vd - p ) print ( ans ) NEW_LINE


import java . util . Scanner ;   public class Run_Crazy {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; float vp , vd , t , f , c ; vp = in . nextFloat ( ) ; vd = in . nextFloat ( ) ; t = in . nextFloat ( ) ; f = in . nextFloat ( ) ; c = in . nextFloat ( ) ;   double posd , posp , time ; int cnt = 0 ; posp = vp * t ; posd = 0 ; if ( vp > vd ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } while ( true ) { time = Math . abs ( posd - posp ) / Math . abs ( vd - vp ) ; posp += vp * time ; if ( posp >= c ) break ; else cnt ++ ; posp += vp * ( time + f ) ; posd = 0 ; } System . out . println ( cnt ) ;   }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Escape { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int vp = fs . nextInt ( ) ; int vd = fs . nextInt ( ) ; int t = fs . nextInt ( ) ; int f = fs . nextInt ( ) ; int c = fs . nextInt ( ) ; if ( vd <= vp ) { System . out . println ( 0 ) ; return ; } int bijous = 0 ; double distance = vp * t ; double time = 0 ; while ( Double . compare ( c , distance ) > 0 ) { time = distance / ( vd - vp ) ; distance = time * vd ; if ( Double . compare ( c , distance ) <= 0 ) break ; bijous ++ ; distance += ( ( distance / vd ) + f ) * vp ; } System . out . println ( bijous ) ; }   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 ( ) ) ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } } }


import java . util . * ; import java . io . * ;     public class A {    public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int vp = sc . nextInt ( ) , vd = sc . nextInt ( ) , t = sc . nextInt ( ) , f = sc . nextInt ( ) , c = sc . nextInt ( ) ; int count = 0 ; double pd = vp * t ;   if ( vd > vp ) { while ( pd < c ) { double tt = pd / ( vd - vp ) ; pd = vd * tt ; if ( pd >= c ) break ; count ++ ; tt += f ; pd += vp * tt ;   } }   out . println ( count ) ; out . close ( ) ; } }


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

from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( " input . txt " , " r " ) import time , math NEW_LINE


def solution ( ) : n = int ( input ( ) ) count = { } arr = list ( map ( int , input ( ) . split ( ) ) )   for i in arr : if i not in count : count [ i ] = 1 else : count [ i ] += 1 	   mx = max ( arr ) mn = min ( arr ) if mx == mn : print ( 0 , int ( count [ mx ] * ( count [ mx ] - 1 ) / 2 ) ) else : print ( mx - mn , count [ mx ] * count [ mn ] )       solution ( ) NEW_LINE


n = int ( input ( ) ) flowers = list ( sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) ) madiff = flowers [ n - 1 ] - flowers [ 0 ] i = 0 count0 = countn = 0 while ( i < n and flowers [ i ] == flowers [ 0 ] ) : count0 += 1 i += 1 i = n - 1 while ( i >= 0 and flowers [ i ] == flowers [ n - 1 ] ) : countn += 1 i -= 1 if ( flowers [ 0 ] != flowers [ n - 1 ] ) : print ( madiff , count0 * countn ) else : print ( madiff , n * n - ( 1 + n ) * n // 2 ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class PashmakAndFlowers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] beauty = scanner . nextLine ( ) . split ( " ▁ " ) ; int [ ] bs = Arrays . stream ( beauty ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; long min = 0 , max = 0 ; for ( int i : bs ) { if ( i == bs [ 0 ] ) min ++ ; if ( i == bs [ n - 1 ] ) max ++ ; } if ( bs [ 0 ] != bs [ n - 1 ] ) { System . out . println ( ( bs [ n - 1 ] - bs [ 0 ] ) + " ▁ " + ( max * min ) ) ; } else { System . out . println ( "0 ▁ " + ( max * ( max - 1L ) ) / 2L ) ; } } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long minValue = Integer . MAX_VALUE ; long maxValue = Integer . MIN_VALUE ; long minCnt = 0 ; long maxCnt = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { long temp = sc . nextLong ( ) ; if ( temp < minValue ) { minValue = temp ; minCnt = 1 ; } else if ( temp == minValue ) { minCnt ++ ; } if ( temp > maxValue ) { maxValue = temp ; maxCnt = 1 ; } else if ( temp == maxValue ) { maxCnt ++ ; } }   if ( minValue == maxValue ) { System . out . println ( "0 ▁ " + n * ( n - 1 ) / 2 ) ; } else { System . out . println ( maxValue - minValue + " ▁ " + minCnt * maxCnt ) ; } } }


import java . util . * ;   public class solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] flower = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { flower [ i ] = sc . nextInt ( ) ; } HashMap < Integer , Integer > map = new HashMap < > ( ) ; long min = Integer . MAX_VALUE ; long max = 0 ; for ( long i : flower ) { min = Math . min ( min , i ) ; max = Math . max ( max , i ) ; } long count_max = 0 ; long count_min = 0 ; for ( long i : flower ) { if ( i == max ) { count_max ++ ; } if ( i == min ) { count_min ++ ; } } if ( max == min ) { if ( count_max % 2 == 0 ) { System . out . println ( 0 + " ▁ " + ( count_max / 2 ) * ( count_max - 1 ) ) ; } else { System . out . println ( 0 + " ▁ " + ( ( count_max - 1 ) / 2 ) * count_max ) ; } } else { System . out . print ( ( max - min ) + " ▁ " ) ; System . out . println ( count_max * count_min ) ; } } }


import java . util . Arrays ; import java . util . Scanner ;   public class _0633Towers {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ 1001 ] ; int max = 0 ; int pos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ sc . nextInt ( ) ] ++ ; } int count = 0 ; for ( int i = 1 ; i < arr . length ; i ++ ) { if ( arr [ i ] != 0 ) { count ++ ; } max = Math . max ( max , arr [ i ] ) ; } System . out . println ( max + " ▁ " + count ) ; }   }

n = int ( input ( ) ) m = list ( map ( int , input ( ) . split ( ) ) ) high = 0 x = [ ] for i in range ( n ) : if m [ i ] not in x : x . append ( m [ i ] ) if m . count ( m [ i ] ) > high : high = m . count ( m [ i ] ) print ( high , len ( x ) ) NEW_LINE


import sysdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_ints_lists ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) input ( ) li = get_ints_lists ( ) li1 = [ ] s = set ( li ) for i in s : p = li . count ( i ) li1 . append ( p ) print ( max ( li1 ) , len ( s ) )   NEW_LINE


t = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE


n = int ( input ( ) ) data = list ( map ( int , input ( ) . split ( ) ) )   uniqueness , great_l = [ ] , 0 for i in data : if i not in uniqueness : uniqueness . append ( i ) if data . count ( i ) > great_l : great_l = data . count ( i )   print ( great_l , len ( uniqueness ) )   NEW_LINE


n = int ( input ( ) ) data = list ( map ( int , input ( ) . split ( ) ) )   uniqueness , great_l = [ ] , 0 for i in data : if i not in uniqueness : uniqueness . append ( i ) if data . count ( i ) > great_l : great_l = data . count ( i )   print ( great_l , len ( uniqueness ) ) NEW_LINE


import java . io . * ; import java . util . * ;   public class MAIN {   private static BufferedReader reader = null ; private static BufferedWriter writer = null ;   public static void main ( String [ ] args ) throws Exception {


import java . util . Scanner ; import java . lang . Math ;   public class Day4_37A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] A = new int [ n ] ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = scan . nextInt ( ) ; if ( A [ i ] > max ) max = A [ i ] ; }   int [ ] count = new int [ max + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) count [ A [ i ] ] ++ ;   int [ ] res = new int [ 2 ] ; for ( int i = 0 ; i < max + 1 ; i ++ ) { if ( count [ i ] > 0 ) res [ 1 ] ++ ;   if ( count [ i ] > res [ 0 ] ) res [ 0 ] = count [ i ] ; }   for ( int a : res ) System . out . print ( a + " ▁ " ) ;   }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;


import java . util . * ; import java . math . * ; public class BeltedRooms { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int size = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] arr = s . toCharArray ( ) ; if ( ! ( s . contains ( " > " ) && s . contains ( " < " ) ) ) System . out . println ( size ) ; else { int count = 0 ; for ( int i = 0 ; i < size ; i ++ ) { if ( i == 0 ) { if ( arr [ size - 1 ] == ' - ' || arr [ i ] == ' - ' ) count ++ ; } else if ( i == size - 1 ) { if ( arr [ size - 2 ] == ' - ' || arr [ size - 1 ] == ' - ' ) count ++ ; } else { if ( arr [ i ] == ' - ' || arr [ i - 1 ] == ' - ' ) count ++ ; } } System . out . println ( count ) ; } } } }

t = int ( input ( ) ) NEW_LINE while t > 0 : n = int ( input ( ) ) NEW_LINE s = str ( input ( ) ) NEW_LINE flag1 = 1 NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] == ' < ' : flag1 = 0 NEW_LINE break NEW_LINE flag2 = 1 NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] == ' > ' : flag2 = 0 NEW_LINE break NEW_LINE if flag1 == 1 or flag2 == 1 : NEW_LINE INDENT ans = n else : NEW_LINE ans = 0 NEW_LINE DEDENT s = s + s [ 0 ] NEW_LINE for i in range ( 0 , n , + 1 ) : if NEW_LINE s [ i ] == ' - ' or s [ i + 1 ] == ' - ' : ans = ans + 1 NEW_LINE print ( ans )       t = t - 1 NEW_LINE


T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : N = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE c = N NEW_LINE if ' < ' not in s : NEW_LINE INDENT print ( N ) elif ' > ' not in s : NEW_LINE print ( N ) else : NEW_LINE l = srt = s . index ( ' > ' ) NEW_LINE DEDENT C = 0 NEW_LINE for i in range ( N ) : r = s [ ( i + 1 ) % N ] NEW_LINE if ' - ' in [ s [ i ] , r ] : C += 1 NEW_LINE print ( C ) NEW_LINE


from collections import defaultdict   for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = input ( )   d = " . " NEW_LINE ok = True NEW_LINE result = 0 NEW_LINE for i in range ( n ) : NEW_LINE


t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE ans = 0 NEW_LINE if " < " not in s or " > " not in s : NEW_LINE INDENT ans = n else : NEW_LINE char = set ( ) NEW_LINE DEDENT i = 0 NEW_LINE while True : if NEW_LINE i == n : NEW_LINE break NEW_LINE i = i % n NEW_LINE if s [ i ] == " - " : char . add ( i ) NEW_LINE char . add ( ( i + 1 ) % n ) NEW_LINE i += 1 NEW_LINE ans = len ( char ) NEW_LINE print ( ans ) NEW_LINE


import mathfrom NEW_LINE collections NEW_LINE import Countert = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE l = list ( input ( ) ) NEW_LINE if ( l . count ( ' > ' ) == 0 or l . count ( ' < ' ) == 0 ) : NEW_LINE INDENT print ( n ) else : NEW_LINE count = 0 NEW_LINE DEDENT for j in range ( n ) : if NEW_LINE INDENT ( l [ j ] == ' - ' or l [ j - 1 ] == ' - ' ) : count += 1 NEW_LINE DEDENT print ( count )   NEW_LINE


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


import java . util . * ; import java . io . * ; import java . lang . * ;    public class graph { static long mod = 10000_00007 ; public static void main ( String [ ] args ) throws Exception { InputStreamReader ip = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( ip ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; String str = ( br . readLine ( ) ) . trim ( ) ;   int cw = 0 , acw = 0 , bh = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . charAt ( i ) == ' - ' ) { if ( str . charAt ( ( ( i - 1 ) + n ) % n ) == str . charAt ( i ) ) { ans ++ ; } else { ans += 2 ; } bh ++ ; } else if ( str . charAt ( i ) == ' > ' ) { cw ++ ; } else { acw ++ ; } }   if ( acw == n || cw == n || bh == n ) { System . out . println ( n ) ; } else if ( ( acw + bh ) == n || ( cw + bh ) == n ) { System . out . println ( n ) ; } else { System . out . println ( ans ) ; } } }   }


import java . util . Scanner ;   public class B1428 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; String S = in . next ( ) ; boolean cycle = ( S . indexOf ( ' > ' ) == - 1 ) || ( S . indexOf ( ' < ' ) == - 1 ) ; int answer ; if ( cycle ) { answer = N ; } else { answer = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int next = ( n + 1 ) % N ; if ( S . charAt ( n ) == ' - ' || S . charAt ( next ) == ' - ' ) { answer ++ ; } } } System . out . println ( answer ) ; } }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class test6 {   public static final int mod = 1000000007 ; static LinkedList < Integer > idx = new LinkedList < > ( ) ; static int a , b , n ; static String s ; static int dp [ ] ; public static void main ( String [ ] args ) throws IOException { BufferedReader sc = new BufferedReader ( new InputStreamReader ( System . in ) ) ;

s = list ( input ( ) . split ( " . " ) ) if len ( s ) == 1 : print ( " NO " ) exit ( ) x = s [ 0 ] y = " " ans = [ ] for i in range ( 1 , len ( s ) - 1 ) : if not 1 <= len ( x ) <= 8 : print ( " NO " ) exit ( ) if 2 <= len ( s [ i ] ) <= 3 : y = s [ i ] [ : 1 ] ans . append ( x + " . " + y ) x = s [ i ] [ 1 : ] elif 4 <= len ( s [ i ] ) <= 11 : y = s [ i ] [ : 3 ] ans . append ( x + " . " + y ) x = s [ i ] [ 3 : ] else : print ( " NO " ) exit ( ) y = s [ - 1 ] if not ( 1 <= len ( x ) <= 8 and 1 <= len ( y ) <= 3 ) : print ( " NO " ) exit ( ) else : ans . append ( x + " . " + y ) print ( " YES " ) print ( * ans , sep = " \n " ) NEW_LINE


a = input ( ) . split ( " . " ) l = [ [ a [ 0 ] ] ] for i in a [ 1 : - 1 ] : m = min ( 3 , len ( i ) - 1 ) l [ - 1 ] += [ i [ : m ] ] l += [ [ i [ m : ] ] ] l [ - 1 ] += [ a [ - 1 ] ] if len ( a ) < 2 or any ( len ( i ) not in range ( 1 , 9 ) or len ( j ) not in range ( 1 , 4 ) for i , j in l ) : print ( " NO " ) else : print ( " YES " ) print ( " \n " . join ( " . " . join ( i ) for i in l ) ) NEW_LINE


import reimport sysexit = sys . exitfrom bisect import bisect_left as bsl , bisect_right as bsrfrom collections import Counter , defaultdict as ddict , dequefrom functools import lru_cachecache = lru_cache ( None ) from heapq import * from itertools import * from math import inffrom pprint import pprint as ppenum = enumerateri = lambda : int ( rln ( ) ) ris = lambda : list ( map ( int , rfs ( ) ) ) rln = sys . stdin . readlinerl = lambda : rln ( ) . rstrip ( ' \n ' ) rfs = lambda : rln ( ) . split ( ) mod = 1000000007 d4 = [ ( 0 , - 1 ) , ( 1 , 0 ) , ( 0 , 1 ) , ( - 1 , 0 ) ] d8 = [ ( - 1 , - 1 ) , ( 0 , - 1 ) , ( 1 , - 1 ) , ( - 1 , 0 ) , ( 1 , 0 ) , ( - 1 , 1 ) , ( 0 , 1 ) , ( 1 , 1 ) ] NEW_LINE


import java . util . Scanner ;   public class CF174B {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String input = sc . nextLine ( ) ; StringBuilder output = new StringBuilder ( " YES \n " ) ;   int pointer = 0 ; while ( pointer < input . length ( ) ) { int i = pointer ; while ( i < input . length ( ) && input . charAt ( i ) != ' . ' ) i ++ ; int noOfCharsInName = i - pointer ; if ( noOfCharsInName < 1 || noOfCharsInName > 8 || i >= input . length ( ) ) { System . out . println ( " NO " ) ; return ; }   pointer = i ++ ; int noOfCharsToConsiderAfterDot = 1 ; while ( i < input . length ( ) && input . charAt ( i ) != ' . ' && i < pointer + 4 ) i ++ ; if ( i >= input . length ( ) && i - pointer - 1 > 3 || i - pointer - 1 == 0 ) { System . out . println ( " NO " ) ; return ; }   if ( i >= input . length ( ) || input . charAt ( i ) != ' . ' ) noOfCharsToConsiderAfterDot = i - pointer - 1 ;   String completeFileName = input . substring ( pointer - noOfCharsInName , pointer + noOfCharsToConsiderAfterDot + 1 ) ; output . append ( completeFileName ) ; output . append ( " \n " ) ;   pointer += noOfCharsToConsiderAfterDot + 1 ; }   System . out . println ( output ) ; } }


import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n , d ; n = scanner . nextInt ( ) ; d = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { nums [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( nums ) ; int ans = n ; for ( int i = 0 , j = 0 ; j < n ; ++ i ) { for ( ; j < n && nums [ j ] - nums [ i ] <= d ; ++ j ) ; ans = Math . min ( ans , n - ( j - i ) ) ; } System . out . println ( " " + ans ) ; } }

n , d = ( int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ) a = [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ] a . sort ( ) res = nout = [ ] for i in range ( n ) : for j in range ( i , n ) : if abs ( a [ j ] - a [ i ] ) <= d : res = res - 1 out . append ( res ) res = n   print ( min ( out ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] l . sort ( ) if max ( l ) - min ( l ) <= k : print ( 0 ) exit ( ) maxlen = 0 for i in range ( n ) : for j in range ( i , n ) : if max ( l [ i : j + 1 ] ) - min ( l [ i : j + 1 ] ) <= k : maxlen = max ( maxlen , j - i + 1 ) print ( n - maxlen ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr = sorted ( arr ) ; d = [ 0 ] * ( 101 ) for i in arr : d [ i ] += 1 ans = 10 ** 18 for i in range ( 0 , 101 ) : if i + k + 1 > 101 : break else : ans = min ( n - sum ( d [ i : i + k + 1 ] ) , ans ) print ( ans ) NEW_LINE


n , d = map ( int , input ( ) . split ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) if n == 1 : print ( 0 ) exit ( ) ans = nfor i in range ( n ) : for j in range ( i , n ) : if a [ j ] - a [ i ] <= d : ans = min ( ans , i + n - j - 1 ) print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main { 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 ; } }   public static void main ( String [ ] args ) {

import osimport sysfrom math import * from collections import * NEW_LINE


s = input ( ) t = input ( )   if ( len ( s ) != len ( t ) ) : print ( - 1 ) exit ( )   dist = [ [ 10 ** 15 for j in range ( 26 ) ] for i in range ( 26 ) ]   for i in range ( 26 ) : dist [ i ] [ i ] = 0   n = int ( input ( ) ) for i in range ( n ) : a = input ( ) . split ( ) x = ord ( a [ 0 ] ) - 97 y = ord ( a [ 1 ] ) - 97 w = int ( a [ - 1 ] )   dist [ x ] [ y ] = min ( dist [ x ] [ y ] , w )   for k in range ( 26 ) : for i in range ( 26 ) : for j in range ( 26 ) : dist [ i ] [ j ] = min ( dist [ i ] [ j ] , dist [ i ] [ k ] + dist [ k ] [ j ] )   ans = ' ' res = 0   n = len ( s )   for i in range ( n ) : if ( s [ i ] == t [ i ] ) : ans += s [ i ] continue cost = 10 ** 15 pos = - 1   x = ord ( s [ i ] ) - 97 y = ord ( t [ i ] ) - 97   for j in range ( 26 ) : if ( dist [ x ] [ j ] + dist [ y ] [ j ] < cost ) : cost = dist [ x ] [ j ] + dist [ y ] [ j ] pos = j   if ( pos == - 1 ) : print ( - 1 ) exit ( ) res += cost ans += chr ( pos + 97 )   print ( res ) print ( ans ) NEW_LINE


def code ( c ) : return ord ( c ) - ord ( ' a ' )   def main ( ) : a = input ( ) b = input ( ) m = int ( input ( ) ) n = 26 d = [ [ 10 ** 9 for i in range ( n ) ] for j in range ( n ) ] for i in range ( n ) : d [ i ] [ i ] = 0 for i in range ( m ) : s , t , w = input ( ) . split ( ) w = int ( w ) s = code ( s ) t = code ( t ) d [ s ] [ t ] = min ( d [ s ] [ t ] , w )   for k in range ( n ) : for i in range ( n ) : for j in range ( n ) : d [ i ] [ j ] = min ( d [ i ] [ j ] , d [ i ] [ k ] + d [ k ] [ j ] )   if len ( a ) != len ( b ) : print ( - 1 ) else : ans = 0 res = [ ] for i in range ( len ( a ) ) : x = code ( a [ i ] ) y = code ( b [ i ] ) min_c = ' a ' min_cost = 10 ** 9 for j in range ( n ) : cur = d [ x ] [ j ] + d [ y ] [ j ] if cur < min_cost : min_cost = cur min_c = chr ( j + ord ( ' a ' ) ) res . append ( min_c ) ans += min_cost if ans >= 10 ** 9 : print ( - 1 ) else : print ( ans ) for j in res : print ( j , end = ' ' ) print ( )   main ( ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } 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 static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; Graph grafo = new Graph ( ) ; int respostaFinal = 0 ; StringBuilder sentençaFinal = new StringBuilder ( ) ; String str1 = in . next ( ) ; String str2 = in . next ( ) ; if ( str1 . length ( ) == str2 . length ( ) ) { for ( int contador = in . nextInt ( ) ; contador > 0 ; contador -- ) { String vertice1 = in . next ( ) ; String vertice2 = in . next ( ) ; int peso = in . nextInt ( ) ; grafo . setEdge ( vertice1 . charAt ( 0 ) , vertice2 . charAt ( 0 ) , peso ) ; }   int [ ] [ ] matriz = grafo . floydWarshall ( ) ;   for ( int contador = 0 ; contador < str1 . length ( ) ; contador ++ ) {


import java . util . HashMap ; import java . util . Map ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ;   String line1 = fs . nextLine ( ) ; String line2 = fs . nextLine ( ) ;   int n = fs . nextInt ( ) ;   int graph [ ] [ ] = new int [ 26 ] [ 26 ] ;


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

def main_function ( ) : n , m = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] s = list ( input ( ) ) d = { } for i in s : if i in d : d [ i ] += 1 else : d [ i ] = 1 if len ( d ) < m : return 0 f = min ( d , key = lambda i : d [ i ] ) return d [ f ] * m       print ( main_function ( ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( " ▁ " ) ) s = input ( ) l = [ ] for i in range ( k ) : l . append ( s . count ( chr ( i + ord ( " A " ) ) ) ) print ( min ( l ) * k ) NEW_LINE


n , k = map ( int , input ( ) . split ( " ▁ " ) ) s = input ( ) l = [ ] a = 0 for i in range ( k ) : NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( " Match ▁ at ▁ : ▁ " + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; int min = Integer . MAX_VALUE ; HashMap < Character , Integer > h = new HashMap < > ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( h . containsKey ( s1 . charAt ( i ) ) ) { h . put ( s1 . charAt ( i ) , h . get ( s1 . charAt ( i ) ) + 1 ) ; } else { h . put ( s1 . charAt ( i ) , 1 ) ; } } for ( Map . Entry e : h . entrySet ( ) ) { int a = ( int ) e . getValue ( ) ; if ( a < min ) min = a ; } int y = 0 ; if ( h . size ( ) == k ) y = min * k ; System . out . println ( y ) ; } }


import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Equality { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException {


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n , x , y , r ; int i , j ; n = in . nextInt ( ) ; x = in . nextInt ( ) ; y = in . nextInt ( ) ; r = n / 2 ; if ( ( x == r || x == r + 1 ) && ( y == r || y == r + 1 ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } }

x , y , z = list ( map ( int , input ( ) . split ( ) ) ) if x == 2 : print ( ' NO ' ) elif x > 2 : p = x // 2 if y in [ p , p + 1 ] and z in [ p , p + 1 ] : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ' ▁ ' ) ) if ( b == a // 2 or b == a // 2 + 1 ) and ( c == a // 2 or c == a // 2 + 1 ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE


x , y , z = [ int ( x ) for x in input ( " " ) . split ( ) ]   n = x / 2   if ( ( y == n or y == n + 1 ) and ( z == n or z == n + 1 ) ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE


import mathn , x , y = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) NEW_LINE


import java . util . * ; public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( ( x == n / 2 || x == n / 2 + 1 ) && ( y == n / 2 || y == n / 2 + 1 ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; }   }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int side = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( side == 2 ) System . out . println ( " NO " ) ; else { if ( ( x == side / 2 && y == side / 2 ) || ( x == side / 2 && y == side / 2 + 1 ) || ( x == side / 2 + 1 && y == side / 2 ) || ( x == side / 2 + 1 && y == side / 2 + 1 ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } }


import java . util . * ;   public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int h = n / 2 ; if ( x == h && y == h || x == h && y == h + 1 || x == h + 1 && y == h || x == h + 1 && y == h + 1 ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } }


import java . util . Scanner ; public class Codeforces112B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , x , y ; n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; boolean ok = true ; int row = n / 2 ; int col = n / 2 ; if ( ( row == x && col == y ) || ( row + 1 == x && col == y ) || ( row == x && col + 1 == y ) || ( row + 1 == x && col + 1 == y ) ) ok = false ; if ( ok ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T -- > 0 ) { int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } Arrays . sort ( a ) ; int v = a [ 0 ] + k ; int flag = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int d = Math . abs ( v - a [ i ] ) ; if ( d > k ) { flag = 1 ; break ; } } if ( flag == 1 ) { out . println ( - 1 ) ; } else { out . println ( v ) ; } } 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 ; } } }

T_ON = 1 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : n , k = read_ints ( ) A = read_ints ( ) MIN = min ( A ) MAX = max ( A ) if 2 * k < MAX - MIN : print ( - 1 ) return print ( MIN + k )     def main ( ) : T = read_int ( ) if T_ON else 1 for i in range ( T ) : solve ( )     def debug ( * xargs ) : if DEBUG_ON : print ( * xargs )     from collections import * import math     NEW_LINE


def check ( a , x ) : for i in a : if ( abs ( i - x ) > k ) : return False return True     for i in range ( int ( input ( ) ) ) : n , k = [ int ( u ) for u in input ( ) . split ( " ▁ " ) ] a = [ int ( u ) for u in input ( ) . split ( " ▁ " ) ] ans = - 1 low = max ( a ) - k high = min ( a ) + k while ( low <= high ) : mid = low + ( ( high - low ) // 2 ) if ( check ( a , mid ) ) : ans = mid low = mid + 1 else : high = mid - 1 print ( ans ) NEW_LINE


cases = int ( input ( ) ) while cases : cases -= 1 a , b = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   mn = min ( arr ) mx = max ( arr ) if mx - mn > 2 * b : print ( - 1 ) else : print ( mn + b ) NEW_LINE


import java . util . * ; public class EqualizePrices {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; if ( arr [ 0 ] + k >= arr [ n - 1 ] - k ) { System . out . println ( arr [ 0 ] + k ) ; } else { System . out . println ( - 1 ) ; } } }   }


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


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static FileWriter fw ; static long oo = Long . MAX_VALUE ;

def getSum ( n ) : ans = 0 while ( n != 0 ) : ans += int ( n % 10 ) n = int ( n // 10 ) return ansa , b , c = map ( int , input ( ) . split ( ) ) ans = [ ] for i in range ( 82 ) : x = b * ( i ** a ) + c if x > 0 and x < 1e9 and i == getSum ( x ) : ans . append ( x ) print ( len ( ans ) ) if len ( ans ) != 0 : print ( * ans ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) ans = [ ] for i in range ( 1 , 82 ) : t = b * i ** a + c if t > 0 and t <= 10 ** 9 : k = t s = 0 while k : s += k % 10 k //= 10 if s == i : ans . append ( t ) print ( len ( ans ) ) print ( * ans ) NEW_LINE


import sys , os , iodef rs ( ) : return sys . stdin . readline ( ) . rstrip ( ) def ri ( ) : return int ( sys . stdin . readline ( ) ) def ria ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def ws ( s ) : sys . stdout . write ( s + ' \n ' ) def wi ( n ) : sys . stdout . write ( str ( n ) + ' \n ' ) def wia ( a ) : sys . stdout . write ( ' ▁ ' . join ( [ str ( x ) for x in a ] ) + ' \n ' ) import math , datetime , functools , itertools , operator , bisect , fractions , statisticsfrom collections import deque , defaultdict , OrderedDict , Counterfrom fractions import Fractionfrom decimal import Decimalfrom sys import stdoutfrom heapq import heappush , heappop , heapify , _heapify_max , _heappop_max , nsmallest , nlargestsys . setrecursionlimit ( 111111 ) INF = 99999999999999999999999999999999   def main ( ) :   mod = 1000000007 NEW_LINE


def sumDigit ( n ) : n = str ( n ) answer = 0 for i in n : answer += int ( i ) return answer s = input ( ) . strip ( ) . split ( ) a , b , c = int ( s [ 0 ] ) , int ( s [ 1 ] ) , int ( s [ 2 ] ) answer = list ( ) for i in range ( 1 , 82 ) : _sum = i temp = _sum ** a x = temp * b + c if x < 0 or x > 10 ** 9 : continue if _sum == sumDigit ( x ) : answer . append ( x )   print ( len ( answer ) ) if len ( answer ) != 0 : for i in answer : print ( i , end = ' ▁ ' ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( " ▁ " ) )     ans = [ ] for s in range ( 1 , 81 ) : x = b * s ** a + c if x < 1 or x >= 10 ** 9 : continue z = len ( str ( x ) ) d = 0 for i in range ( z ) : d += int ( str ( x ) [ i ] ) if d == s : ans . append ( x )   print ( len ( ans ) ) for i in range ( len ( ans ) ) : print ( ans [ i ] , end = " ▁ " ) NEW_LINE


import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class a1 { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ;   public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;


import java . io . * ; import java . util . * ; public class test1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; long x = 1 , counter = 0 ; List < Long > result = new ArrayList < > ( ) ; for ( int digitSum = 1 ; digitSum <= 81 ; digitSum ++ ) { x = b * ( ( long ) Math . pow ( digitSum , a ) ) + c ;


import java . util . Scanner ;   public class GameShopping { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , m = in . nextInt ( ) , a [ ] = new int [ n ] , b [ ] = new int [ m ] , i , j = 0 , c = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } for ( i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; } in . close ( ) ; for ( i = 0 ; i < n ; i ++ ) { if ( j < m && b [ j ] >= a [ i ] ) { c ++ ; j ++ ; } } System . out . println ( c ) ; } }

import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) w = list ( map ( int , inp [ 2 ] . split ( ) ) ) c , j = 0 , 0 for i in map ( int , inp [ 1 ] . split ( ) ) : if j == len ( w ) : break if w [ j ] >= i : c += 1 ; j += 1 return c   print ( main ( ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = count = 0 for i in range ( n ) : if c [ i ] <= a [ j ] : j += 1 count += 1 else : continue if j == m : breakprint ( count ) NEW_LINE


import sysfrom array import array     def readline ( ) : return sys . stdin . buffer . readline ( ) . decode ( ' utf - 8' )     n , m = map ( int , readline ( ) . split ( ) ) c = list ( map ( int , readline ( ) . split ( ) ) ) a = list ( map ( int , readline ( ) . split ( ) ) ) i , ans = 0 , 0   for bill in a : while i < n and bill < c [ i ] : i += 1 if i < n : ans += 1 i += 1   print ( ans ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = 0 ans = 0 for i in c : if i <= a [ j ] : j += 1 ans += 1 if j == m : breakprint ( ans ) NEW_LINE


inp = input ( ) . split ( ' ▁ ' ) n , m = int ( inp [ 0 ] ) , int ( inp [ 1 ] ) c = input ( ) . split ( ' ▁ ' ) a = input ( ) . split ( ' ▁ ' ) bill = 0 for i in range ( n ) : if bill == len ( a ) : break if int ( a [ bill ] ) >= int ( c [ i ] ) : bill += 1 print ( bill ) NEW_LINE


import java . util . Scanner ;   public class GameShoping {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( c < b . length && b [ c ] >= a [ i ] ) { c += 1 ; } } System . out . println ( c ) ;   }   }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int [ ] arr = new int [ n ] ; int [ ] brr = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { brr [ i ] = s . nextInt ( ) ; } int count = 0 ; int ptr = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] <= brr [ ptr ] ) { count ++ ; ptr ++ ; } if ( ptr == m ) break ; } System . out . println ( count ) ; } }


import java . util . Scanner ;   public class main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int [ ] a = new int [ 1001 ] ; int [ ] b = new int [ 1001 ] ; int j = 0 ;   int o = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] <= b [ j ] ) { j ++ ; } } System . out . println ( j ) ; }   }


import javafx . collections . transformation . SortedList ; import javafx . util . Pair ;   import java . io . IOException ; import java . net . Inet4Address ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; while ( n -- > 0 ) { int s = scanner . nextInt ( ) ; Pair [ ] pairs = new Pair [ s ] ; for ( int i = 0 ; i < s ; i ++ ) { pairs [ i ] = new Pair ( scanner . nextInt ( ) , scanner . nextInt ( ) ) ; } Arrays . sort ( pairs ) ; int x = 0 , y = 0 ; boolean can = true ; String res = " " ; for ( int i = 0 ; i < s ; i ++ ) { if ( x <= pairs [ i ] . first && y <= pairs [ i ] . second ) { for ( int j = 0 ; j < pairs [ i ] . first - x ; j ++ ) { res += " R " ; } for ( int j = 0 ; j < pairs [ i ] . second - y ; j ++ ) { res += " U " ; } x = pairs [ i ] . first ; y = pairs [ i ] . second ; } else { can = false ; break ; } } if ( can ) { println ( " YES \n " + res ) ; } else { println ( " NO " ) ; } } } static class Pair implements Comparable < Pair > { int first ; int second ;   public Pair ( int first , int second ) { this . first = first ; this . second = second ; }   public int compareTo ( Pair o ) { if ( first != o . first ) return Integer . compare ( first , o . first ) ; return Integer . compare ( second , o . second ) ; } }

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) li = [ ] for i in range ( n ) : x = list ( map ( int , input ( ) . split ( ) ) ) li . append ( x ) li . sort ( ) s = ' R ' * li [ 0 ] [ 0 ] + ' U ' * li [ 0 ] [ 1 ] for i in range ( 1 , n ) : if li [ i - 1 ] [ 0 ] > li [ i ] [ 0 ] or li [ i - 1 ] [ 1 ] > li [ i ] [ 1 ] : print ( " NO " ) break x = li [ i ] [ 0 ] - li [ i - 1 ] [ 0 ] y = li [ i ] [ 1 ] - li [ i - 1 ] [ 1 ] s = s + ( ' R ' * x ) + ' U ' * y else : print ( " YES " ) print ( s )                     NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = " " shan = 0 sree = [ ] for i in range ( n ) : l , k = map ( int , input ( ) . split ( ) ) sree . append ( [ l , k ] ) sree . sort ( ) NEW_LINE


from sys import stdininput = stdin . readlinefrom heapq import heapify , heappush , heappop , heappushpopfrom collections import defaultdict as dd , deque as dq , Counter as Cfrom math import factorial as f , ceil , gcd , sqrt , logfrom bisect import bisect_left as bl , bisect_right as brfrom itertools import combinations as c , permutations as pfrom math import factorial as f , ceil , gcd , sqrt , logmp = lambda : map ( int , input ( ) . split ( ) ) it = lambda : int ( input ( ) ) ls = lambda : list ( input ( ) . strip ( ) . split ( ) ) mt = lambda r : [ list ( mp ( ) ) for _ in range ( r ) ] lcm = lambda a , b : ( a * b ) // gcd ( a , b ) def fibo_n ( n ) : return ( ( ( 1 + sqrt ( 5 ) ) / 2 ) ** n ) / sqrt ( 5 ) mod = 1000000007 for _ in range ( it ( ) ) : a = it ( ) v = [ ] for i in range ( a ) : v . append ( list ( mp ( ) ) ) v . sort ( ) x , y = 0 , 0 flag = 0 ans = " " v = dq ( v ) while v : x1 , y1 = v . popleft ( ) if x1 >= x and y1 >= y : k = x1 - x ans += " R " * k l = y1 - y ans += " U " * l x += k y += l else : flag = 1 break if flag : print ( " NO " ) else : print ( " YES " ) print ( ans ) NEW_LINE


import sysfrom collections import defaultdict   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Sol { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int robots = sc . nextInt ( ) ; TreeSet < Integer > xpoints = new TreeSet < > ( ) ; TreeSet < Integer > ypoints = new TreeSet < > ( ) ; HashMap < Integer , HashSet < Integer > > map = new HashMap < > ( ) ; for ( int i = 0 ; i < robots ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( map . containsKey ( x ) ) { map . get ( x ) . add ( y ) ; } else { HashSet < Integer > temp = new HashSet < > ( ) ; temp . add ( y ) ; map . put ( x , temp ) ; } xpoints . add ( x ) ; ypoints . add ( y ) ; } int count = 0 ; int max_x = 0 ; int max_y = 0 ; String direction = " " ; for ( int y : ypoints ) { for ( int x : xpoints ) { if ( map . containsKey ( x ) && map . get ( x ) . contains ( y ) && max_x <= x && max_y <= y ) { count ++ ; int i = x - max_x ; int j = y - max_y ; while ( i > 0 ) { direction += " R " ; i -- ; } while ( j > 0 ) { direction += " U " ; j -- ; } max_x = x ; max_y = y ; } } } if ( count == robots ) { System . out . println ( " YES " ) ; System . out . println ( direction ) ; } else { System . out . println ( " NO " ) ; } } } }


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

import syscoins = [ 4 , 7 ] sum = int ( input ( ) ) def minCoins ( coins , m , n ) : dp = [ [ 1e9 , 0 ] for i in range ( n + 1 ) ] dp [ 0 ] [ 0 ] = 0 for i in range ( n + 1 ) : for j in range ( 2 ) : NEW_LINE


n = int ( input ( ) ) count = n // 7 ans = float ( ' inf ' ) val = Nonefor i in range ( count , - 1 , - 1 ) : remaining = n - 7 * i if remaining % 4 == 0 : if ans > i + remaining // 4 : ans = i + remaining // 4 val = ( remaining // 4 , i ) NEW_LINE


n = int ( input ( ) ) base = ( n // 4 + 1 ) * '9' ans = basei = j = 1 f = Truefor i in range ( 0 , n + 1 ) : j = 0 while i * 4 + j * 7 < n : j += 1 if i * 4 + j * 7 == n : x = ( '4' * i + '7' * j ) print ( x ) f = False break     if f : print ( - 1 )     NEW_LINE


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . io . PrintWriter ;     public class A {   public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; double d = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double v = sc . nextDouble ( ) ; double e = sc . nextDouble ( ) ;   double v1 = 4 * v / ( Math . PI * d * d ) ; out . println ( e > v1 ? " NO " : " YES \n " + h / ( v1 - e ) ) ; out . close ( ) ; }

import mathd , h , v , e = tuple ( [ int ( num ) for num in input ( ) . split ( ) ] ) NEW_LINE


from math import pid , h , v , e = list ( map ( int , input ( ) . split ( ) ) ) a = ( d ** 2 / 4 ) * pi * hve = ( d ** 2 / 4 ) * pi * eif ( v > ve ) : print ( " YES " ) print ( a / ( v - ve ) ) else : print ( " NO " ) NEW_LINE


import sysimport math   d , h , v , e = ( map ( float , input ( ) . strip ( ) . split ( ) ) )   if not h : print ( " YES \n 0" ) else : drink_speed = v / ( math . pi * d ** 2 / 4 ) if drink_speed < e : print ( " NO " ) else : print ( f " YES \n { h ▁ / ▁ - ( e ▁ - ▁ drink _ speed ) } " ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class PouringRain_CodeForces {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] r = br . readLine ( ) . split ( " ▁ " ) ; double d = Double . parseDouble ( r [ 0 ] ) ; double h = Double . parseDouble ( r [ 1 ] ) ; double v = Double . parseDouble ( r [ 2 ] ) ; double e = Double . parseDouble ( r [ 3 ] ) ; double t = ( Math . PI * d * d * h ) / ( 4 * v - Math . PI * d * d * e ) ; out . println ( t >= 0 ? " YES " + " \n " + t : " NO " ) ; out . flush ( ) ; out . close ( ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class PouringRain {   public static void main ( String [ ] args ) { FastReader reader = new FastReader ( ) ;   int d = reader . nextInt ( ) ; int h = reader . nextInt ( ) ; int v = reader . nextInt ( ) ; int e = reader . nextInt ( ) ;   double area = ( Math . PI * d * d ) / 4.0 ; double drinking = v / area ;   if ( drinking < e ) { System . out . println ( " NO " ) ; } else { double time = h / ( drinking - e ) ; System . out . println ( " YES " ) ; System . out . printf ( " % .4f \n " , time ) ; } }   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 test { 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 ; } } public static void main ( String [ ] args ) { FastReader scan = new FastReader ( ) ; int d = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int v = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; double speed = ( double ) v / ( ( Math . PI * d * d ) / 4 ) ; if ( speed > ( double ) e ) { double seconds = ( double ) h / ( ( 4 * v ) / ( Math . PI * d * d ) - e ) ; if ( seconds > 0.0000 ) { System . out . println ( " YES " ) ; System . out . printf ( " % .12f " , seconds ) ; } else System . out . println ( " NO " ) ; } else System . out . println ( " NO " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class PouringRain { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int d = fs . nextInt ( ) ; int h = fs . nextInt ( ) ; int v = fs . nextInt ( ) ; double e = ( fs . nextInt ( ) * Math . PI * d * d ) / 4.0 ; if ( Double . compare ( e , v ) >= 0 ) { System . out . println ( " NO " ) ; return ; } else { double startAmount = Math . PI * d * d * h / 4.0 ; System . out . println ( " YES " ) ; System . out . println ( startAmount / ( v - e ) ) ; } }   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 ( ) ) ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } } }


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

n = int ( input ( ) ) check = [ 0 ] * 10005 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) for j in range ( a , b + 1 ) : check [ j ] = ic = int ( input ( ) ) print ( n - check [ c ] ) NEW_LINE


n = int ( input ( ) ) d = [ ] while ( n > 0 ) : l , r = map ( int , input ( ) . split ( ) ) n -= 1 z = [ l , r ] d . append ( z ) m = int ( input ( ) ) a = 0 for i in range ( len ( d ) ) : d1 = d [ i ] [ 0 ] d2 = d [ i ] [ 1 ] if ( m >= d1 or m <= d2 ) and m <= d2 : a += 1   print ( a ) NEW_LINE


import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) p = int ( inp [ - 1 ] ) n = int ( inp [ 0 ] ) for i in range ( 1 , n + 1 ) : x , y = map ( int , inp [ i ] . split ( ) ) if x <= p <= y : return n - i + 1   print ( main ( ) ) NEW_LINE


n = int ( input ( ) ) m = [ ] while n != 0 : l , r = map ( int , input ( ) . split ( ) ) m . append ( l ) m . append ( r ) n -= 1 k = int ( input ( ) ) for i in range ( len ( m ) ) : if k <= m [ i ] : print ( int ( ( ( len ( m ) - i ) + 1 ) / 2 ) ) break NEW_LINE


def string_list ( s , char ) : output_list = [ ] intermediator = " " for i in range ( len ( s ) ) : if s [ i ] != char : intermediator += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( intermediator ) ) else : if intermediator : output_list . append ( int ( intermediator ) ) intermediator = " " return output_list     def list_string ( l , char ) : output_str = " " for i in range ( len ( l ) - 1 ) : output_str += str ( l [ i ] ) + char output_str += str ( l [ len ( l ) - 1 ] ) return output_str     def merge_sort ( l ) : def merge ( l1 , l2 ) : i , j = 0 , 0 output_list = [ ] while i < len ( l1 ) and j < len ( l2 ) : if l1 [ i ] < l2 [ j ] : output_list . append ( l1 [ i ] ) i += 1 else : output_list . append ( l2 [ j ] ) j += 1 if i == len ( l1 ) : output_list += ( l2 [ j : ] ) else : output_list += ( l1 [ i : ] ) return output_list   def sorts ( l ) : if len ( l ) < 2 : return l else : mid = len ( l ) // 2 left = sorts ( l [ : mid ] ) right = sorts ( l [ mid : ] ) return merge ( left , right ) return sorts ( l )       def main_function ( ) : output_list = [ ] t = int ( input ( ) ) chapters = [ ] for i in range ( t ) : chapter = string_list ( input ( ) , " ▁ " ) chapters . append ( chapter ) page = int ( input ( ) ) already_red = 0 for i in range ( len ( chapters ) ) : if page > chapters [ i ] [ 1 ] : already_red += 1 else : break return len ( chapters ) - already_red   return list_string ( output_list , " ▁ " )       print ( main_function ( ) )   NEW_LINE


import java . util . * ; public class program { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] f = new int [ n ] ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { f [ i ] = sc . nextInt ( ) ; l [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( l [ i ] >= k ) { count ++ ; } } System . out . println ( count ) ; } }


import java . io . * ; import java . math . * ; import java . util . * ;        public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ; private static int dx1 [ ] = { 1 , 1 , 0 , - 1 , - 1 , - 1 , 0 , 1 } ; private static int dy1 [ ] = { 0 , - 1 , - 1 , - 1 , 0 , 1 , 1 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 200001 ; private static final int MAXA = 1000004 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;


import java . io . * ; import java . util . * ; import java . math . * ;   public class Natasha { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException {


import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int array [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; array [ i ] = r ; } int a = 0 ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( k - 1 >= array [ i ] ) { a ++ ; } }


import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) prev = 1 ans = 0 for x in a : if x == 1 : if ans == 0 or prev == 1 : ans += 1 else : ans += 2 prev = xprint ( ans ) NEW_LINE


import mathimport osimport randomimport reimport sysimport functoolsfrom operator import itemgetter , attrgetterfrom collections import Counter   if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) P = lambda : map ( int , input ( ) . split ( ) ) N = lambda : int ( input ( ) )   n = N ( ) a = Y ( ) f , cnt = 0 , 0 for i in a : if i : cnt += 1 f = 1 else : if f : cnt += 1 f = 0 print ( cnt if ( a [ n - 1 ] or not cnt ) else cnt - 1 ) NEW_LINE


n = int ( input ( ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] i = 0 while ( i < n and arr [ i ] == 0 ) : arr [ i ] = - 1 i = i + 1 i = n - 1 while ( arr [ i ] == 0 ) : arr [ i ] = - 1 i = i - 1 i , c = 0 , 0 while ( i < n ) : if arr [ i ] == 1 : c = c + 1 i = i + 1 elif arr [ i ] == 0 : c = c + 1 while ( arr [ i ] == 0 ) : i = i + 1 else : i = i + 1 print ( c ) NEW_LINE


import sysinput = sys . stdin . readlinen = int ( input ( ) ) l = input ( ) . split ( ) li = [ int ( i ) for i in l ] l = [ ] for i in range ( n ) : if ( li [ i ] == 1 ) : l . append ( i ) ans = 0 for i in range ( len ( l ) - 1 ) : ans += min ( l [ i + 1 ] - l [ i ] , 2 ) if ( l != [ ] ) : ans += 1 print ( ans ) NEW_LINE


import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) slmii = lambda : sorted ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def main ( ) : NEW_LINE


import java . util . Scanner ;   public class Inbox { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int squSize = scanner . nextInt ( ) ; int [ ] numbers = new int [ squSize ] ; int ones = 0 ; for ( int i = 0 ; i < squSize ; i ++ ) { numbers [ i ] = scanner . nextInt ( ) ; if ( numbers [ i ] == 1 ) { ones ++ ; } } int counter = 0 ; for ( int i = 0 ; i < squSize - 1 ; i ++ ) { if ( numbers [ i ] == 1 ) { ones -- ; if ( ones > 0 ) { counter += 2 ; if ( numbers [ i + 1 ] == 1 ) { counter -- ; } } else { counter ++ ; } } } if ( numbers [ squSize - 1 ] == 1 ) { counter ++ ; } System . out . println ( counter ) ; } }


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


import java . util . Scanner ;   public class Inbox100500 { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , d = 0 , c = 0 ; boolean b = false ; for ( i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; if ( x == 1 ) { b = true ; c += d == 0 ? 1 : 2 ; d = 0 ; } else if ( b ) { d ++ ; } } in . close ( ) ; System . out . println ( c ) ; } }


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; int lastin = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; if ( ar [ i ] == 1 ) { lastin = i ; } } long c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < n - 1 ) { if ( ar [ i ] == 1 ) { c ++ ; if ( ar [ i + 1 ] != 1 && ( i + 1 ) <= lastin ) { c ++ ; } } } else { if ( ar [ i ] == 1 ) { c ++ ; } } } System . out . println ( c ) ;    }   public static void Mybfs ( List < List < Integer > > lists , int source , int [ ] dist , boolean [ ] visited ) { dist [ source ] = 0 ;


import java . util . Scanner ;   public class StringEqualiser { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   String a = scanner . nextLine ( ) ; String b = scanner . nextLine ( ) ;   int seven = 0 , four = 0 , count = 0 ;   for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) != b . charAt ( i ) ) { if ( a . charAt ( i ) == '4' ) four ++ ; else seven ++ ;   count ++ ; } }   System . out . println ( count - Math . min ( four , seven ) ) ; } }

a = list ( input ( ) ) b = list ( input ( ) )   a_copy = a [ : ] a_copy . sort ( ) b_copy = b [ : ] b_copy . sort ( )   replace_counter = 0 swap_counter = 0   for i in range ( len ( a_copy ) ) : if ( a_copy [ i ] != b_copy [ i ] ) : replace_counter += 1   for i in range ( len ( a ) ) : if ( a [ i ] != b [ i ] ) : swap_counter += 1   swap_counter = ( swap_counter - replace_counter ) // 2 print ( replace_counter + swap_counter ) NEW_LINE


a , b = input ( ) , input ( ) ; l = [ a [ i ] + b [ i ] for i in range ( len ( a ) ) ] ; print ( max ( l . count ( '47' ) , l . count ( '74' ) ) ) NEW_LINE


a = list ( map ( int , input ( ) ) ) b = list ( map ( int , input ( ) ) ) c = 0 ; z = 0 for i in range ( len ( a ) ) : if a [ i ] != b [ i ] : if a [ i ] == 4 : c += 1 else : z += 1 print ( max ( c , z ) )   NEW_LINE


from collections import Counter   string1 = input ( ) string2 = input ( )   x1 = Counter ( string1 ) x2 = Counter ( string2 )   string1 = list ( string1 ) string2 = list ( string2 ) q = Counter ( ) q [ '4' ] = abs ( x1 [ '4' ] - x2 [ '4' ] ) q [ '7' ] = abs ( x1 [ '7' ] - x2 [ '7' ] ) if q [ '4' ] < q [ '7' ] : w = '4' else : w = '7' ans = 0 dp = 0 for i in range ( len ( string1 ) ) : if string1 [ i ] != string2 [ i ] : if q [ w ] > 0 : ans += 1 q [ w ] -= 1 else : dp += 1 dp //= 2 print ( ans + dp ) NEW_LINE


from collections import Counter   string1 = input ( ) string2 = input ( )   x1 = Counter ( string1 ) x2 = Counter ( string2 )   string1 = list ( string1 ) string2 = list ( string2 ) mn = min ( abs ( x1 [ '4' ] - x2 [ '4' ] ) , abs ( x1 [ '7' ] - x2 [ '7' ] ) )   ans = 0 dp = 0 for i in range ( len ( string1 ) ) : if string1 [ i ] != string2 [ i ] : if mn > 0 : ans += 1 mn -= 1 else : dp += 1 dp //= 2 print ( ans + dp ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) , b = sc . next ( ) ; int dif = 0 , dif2 = 0 , q = 0 , w = 0 , temp = 0 ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { q = Integer . parseInt ( String . valueOf ( a . charAt ( i ) ) ) ; w = Integer . parseInt ( String . valueOf ( b . charAt ( i ) ) ) ; temp = q - w ; if ( temp > 0 ) { dif ++ ; } else if ( temp < 0 ) { dif2 ++ ; } } if ( dif >= dif2 ) { System . out . println ( dif ) ; } else { System . out . println ( dif2 ) ; } } }


import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner leer = new Scanner ( System . in ) ; String C1 ; String C2 ; int pos = 0 ; int neg = 0 ; C1 = leer . nextLine ( ) ; C2 = leer . nextLine ( ) ; char A [ ] = C1 . toCharArray ( ) ; char B [ ] = C2 . toCharArray ( ) ; if ( ! C1 . equals ( C2 ) ) for ( int i = 0 ; i < ( C1 . length ( ) ) ; i ++ ) { if ( ( ( ( int ) A [ i ] ) - ( ( int ) B [ i ] ) ) < 0 ) neg ++ ; else if ( ( ( ( int ) A [ i ] ) - ( ( int ) B [ i ] ) ) > 0 ) pos ++ ; } if ( pos == neg ) System . out . print ( pos ) ; else if ( pos < neg ) System . out . print ( pos + ( neg - pos ) ) ; else System . out . print ( neg + ( pos - neg ) ) ;   } }


import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;

import mathfor _ in range ( 1 ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) g = 0 for i in range ( 0 , len ( a ) ) : g = math . gcd ( a [ i ] , g ) maxi = max ( a ) // g if ( n - maxi ) % 2 == 0 : print ( " Bob " ) else : print ( " Alice " ) NEW_LINE


from math import * n = int ( input ( ) ) ls = [ int ( x ) for x in input ( ) . split ( ) ] g = 0 for i in ls : g = gcd ( g , i ) x = max ( ls ) // gif ( x - n ) & 1 : print ( ' Alice ' ) else : print ( ' Bob ' ) NEW_LINE


import math as mtimport sys , stringinput = sys . stdin . readlinefrom collections import defaultdictL = lambda : list ( map ( int , input ( ) . split ( ) ) ) Ls = lambda : list ( input ( ) . split ( ) ) M = lambda : map ( int , input ( ) . split ( ) ) I = lambda : int ( input ( ) )   n = I ( ) l = L ( ) m = 0 g = l [ 0 ] for i in l : g = mt . gcd ( g , i ) m = max ( m , i ) ans = ( m // g - n ) if ( ans % 2 ) : print ( " Alice " ) else : print ( " Bob " ) NEW_LINE


n , listo2 , c = int ( input ( ) ) , [ ] , 0 import mathlisto = list ( map ( int , input ( ) . split ( ) ) ) listo . sort ( ) obaa = listo [ 0 ]   def gcd ( x , y ) : while ( y ) : x , y = y , x % y return x     for i in range ( 1 , n ) : GCD = gcd ( listo [ i ] , obaa ) obaa = GCDbomba = int ( listo [ n - 1 ] / GCD ) - n if bomba % 2 == 0 : print ( " Bob " ) else : print ( " Alice " ) NEW_LINE


from fractions import gcdn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = max ( a ) c = 0 for i in range ( len ( a ) ) : c = gcd ( c , a [ i ] ) result = d // c - nif result % 2 == 0 : print ( " Bob " ) else : print ( " Alice " ) NEW_LINE


import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { 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 ; } } public static void main ( String [ ] args ) throws java . lang . Exception { int test = 1 ; FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;


import java . io . * ; import java . util . * ; public class Solution { static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ;


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { FastReader sc = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int d = max ; for ( int i = 1 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; max = Math . max ( max , temp ) ; d = gcd ( d , temp ) ; } System . out . println ( ( ( max / d ) - n ) % 2 == 1 ? " Alice " : " Bob " ) ; } static int gcd ( int a , int b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } } class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }


import java . util . * ; public class Solution {   static int gcd ( int a , int b ) { if ( a % b == 0 ) return b ; return gcd ( b , a % b ) ; } public static String gameWinner ( int [ ] ar , int n ) {


import java . awt . Point ; import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public 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 ; } }   public static FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static final int MOD = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) { solve ( ) ;   out . close ( ) ; }   public static void solve ( ) { long n = in . nextInt ( ) , k = in . nextInt ( ) ;   if ( ( n * ( n - 1 ) ) / 2 <= k ) { out . println ( " no ▁ solution " ) ; return ; }   for ( int i = 0 ; i < n ; i ++ ) { out . println ( 0 + " ▁ " + i ) ; }   }   }

n , k = map ( int , input ( ) . split ( ) )   fac = n * ( n - 1 ) / 2 ; if ( fac > k ) : i = 0 while ( i < n ) : print ( 1 , " ▁ " , i ) i = i + 1 else : print ( " no ▁ solution " ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) if k * 2 >= ( n - 1 ) * n : print ( ' no ▁ solution ' ) else : [ print ( 0 , i ) for i in range ( n ) ] NEW_LINE


r = lambda x : ( x * ( x + 1 ) ) // 2 a , b = map ( int , input ( ) . split ( ) ) if r ( a - 1 ) <= b : exit ( print ( " no ▁ solution " ) ) for i in range ( a ) : print ( 0 , 0 + i ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) tot = ( ( n * ( n - 1 ) ) / 2 )   if tot <= k : print ( " no ▁ solution " ) else : for i in range ( 1 , n + 1 ) : print ( 0 , i ) NEW_LINE


import java . io . BufferedReader ; import java . util . Collections ; 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 hh { public static void hanoitower ( int n , char from , char to , char aux ) { if ( n == 1 ) { System . out . println ( n + " ▁ " + from + " to " + to ) ; return ; } hanoitower ( n - 1 , from , aux , to ) ; System . out . println ( n + " ▁ " + from + " to " + to ) ; hanoitower ( n - 1 , aux , to , from ) ; } public static double factorial ( int n ) { if ( n == 0 ) { return 1 ; } else { return n * factorial ( n - 1 ) ; } } public static void main ( String [ ] args ) throws IOException , InterruptedException { PrintWriter pw = new PrintWriter ( System . out ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; long fac = 0 ; fac = ( n ) * ( n - 1 ) ; fac /= 2 ;


import java . util . * ; public class A_Multiples_of_Length { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; int ar [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } System . out . println ( 1 + " ▁ " + n ) ; for ( i = 0 ; i < n ; i ++ ) { System . out . print ( ( ( long ) - 1 * ( long ) ar [ i ] * ( long ) n ) + " ▁ " ) ; } System . out . println ( ) ; System . out . println ( 1 + " ▁ " + 1 ) ; System . out . println ( ( long ) ( n - 1 ) * ( long ) ar [ 0 ] ) ; if ( n == 1 ) { System . out . println ( 1 + " ▁ " + 1 ) ; System . out . println ( 0 ) ; return ; } System . out . println ( 2 + " ▁ " + n ) ; for ( i = 1 ; i < n ; i ++ ) { System . out . print ( ( long ) ( n - 1 ) * ( long ) ar [ i ] + " ▁ " ) ; } } }

from sys import stdin , stdout NEW_LINE input = stdin . readline NEW_LINE def main ( ) : NEW_LINE INDENT t = 1 NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ai = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( int ( - ai [ 0 ] ) ) NEW_LINE return NEW_LINE DEDENT print ( 1 , n ) NEW_LINE n2 = n * ( n - 1 ) NEW_LINE ai2 = [ n * ( n - 1 - i % ( n - 1 ) ) for i in ai ] NEW_LINE print ( * ai2 ) NEW_LINE ai = [ ai [ i ] + ai2 [ i ] for i in range ( n ) ] NEW_LINE print ( 1 , 1 ) NEW_LINE print ( int ( - ai [ 0 ] ) ) NEW_LINE print ( 2 , n ) NEW_LINE print ( * [ int ( - ai [ i ] ) for i in range ( 1 , n ) ] ) NEW_LINE DEDENT DEDENT main ( ) NEW_LINE


from bisect import bisect_left NEW_LINE n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - 1 * l [ 0 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , n ) NEW_LINE x = n - 1 NEW_LINE for i in range ( n ) : NEW_LINE INDENT t = l [ i ] NEW_LINE if l [ i ] % x : NEW_LINE INDENT l [ i ] += ( x + 1 ) * ( x - t % x ) NEW_LINE DEDENT print ( l [ i ] - t , end = " ▁ " ) NEW_LINE DEDENT x = x - 1 NEW_LINE print ( ) NEW_LINE print ( 2 , n ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT print ( - 1 * l [ i ] , end = " ▁ " ) NEW_LINE DEDENT print ( ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( - 1 * l [ 0 ] ) NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT elif n == 2 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE print ( 2 , 2 ) NEW_LINE print ( - a [ 1 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE a [ 0 ] = 0 NEW_LINE b = [ ] NEW_LINE for i in range ( 1 , len ( a ) ) : NEW_LINE INDENT moda = a [ i ] % n NEW_LINE c = moda * ( n - 1 ) NEW_LINE b . append ( c ) NEW_LINE a [ i ] += c NEW_LINE DEDENT print ( 2 , n ) NEW_LINE print ( ' ▁ ' . join ( list ( map ( str , b ) ) ) ) NEW_LINE print ( 1 , n ) NEW_LINE b = [ ] NEW_LINE for i in a : NEW_LINE INDENT b . append ( - i ) NEW_LINE DEDENT print ( ' ▁ ' . join ( list ( map ( str , b ) ) ) ) NEW_LINE DEDENT


import java . math . BigInteger ; import java . text . DecimalFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; @ SuppressWarnings ( " unused " ) public class B { public static Scanner scan = new Scanner ( System . in ) ; public static void solve ( ) { int n = scan . nextInt ( ) ; int [ ] [ ] a = new int [ 1005 ] [ 1005 ] ; int cnt = 0 ; for ( int i = 0 ; i < 1000 ; i ++ ) { for ( int j = 0 ; j < 1000 ; j ++ ) { a [ i ] [ j ] = 0 ; } } for ( int k = 0 ; k < n ; k ++ ) { int x1 = scan . nextInt ( ) ; int y1 = scan . nextInt ( ) ; int x2 = scan . nextInt ( ) ; int y2 = scan . nextInt ( ) ; for ( int i = x1 ; i <= x2 ; i ++ ) { for ( int j = y1 ; j <= y2 ; j ++ ) { a [ i ] [ j ] ++ ; } } } for ( int i = 0 ; i <= 100 ; i ++ ) { for ( int j = 0 ; j <= 100 ; j ++ ) { cnt += a [ i ] [ j ] ; } } System . out . println ( cnt ) ; } public static void main ( String [ ] args ) { solve ( ) ; scan . close ( ) ; }   }

n = int ( input ( ) ) ans = 0 for _ in range ( n ) : x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) ans += ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) print ( ans ) NEW_LINE


n = int ( input ( ) ) r = 0 for i in range ( n ) : x1 , y1 , x2 , y2 = list ( map ( int , input ( ) . split ( ) ) ) r += ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) print ( r ) NEW_LINE


r = 0 for i in range ( int ( input ( ) ) ) : x1 , y1 , x2 , y2 = list ( map ( int , input ( ) . split ( ) ) ) r = r + ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) print ( r ) NEW_LINE


n = int ( input ( ) ) s = 0 for _ in range ( n ) : x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) s = s + abs ( x2 - x1 + 1 ) * abs ( y2 - y1 + 1 ) print ( s ) NEW_LINE


def build ( ) : arr = [ ] for i in range ( 100 ) : arr . append ( [ 0 ] * 100 ) return arr       def solve ( arr ) : res = build ( ) for i , v in enumerate ( arr ) : for row in range ( v [ 2 ] - ( v [ 0 ] - 1 ) ) : for col in range ( v [ 3 ] - ( v [ 1 ] - 1 ) ) : res [ row ] [ col ] += 1 tot = 0 for i in res : tot += sum ( i ) return tot                   def main ( ) : n = int ( input ( ) ) arr = [ ] for _ in range ( n ) : i = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) arr . append ( i ) print ( solve ( arr ) ) main ( ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; ans = ans + ( Math . abs ( a - c ) + 1 ) * ( Math . abs ( d - b ) + 1 ) ; } System . out . println ( ans ) ; } }


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