import java . util . Scanner ; import java . util . Arrays ; public class Ishu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , b , i , sum = 0 , index = 0 ; String str ; double temp ; boolean flag = true ; int [ ] a = new int [ 100 ] ; n = scan . nextInt ( ) ; b = scan . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) { a [ i ] = scan . nextInt ( ) ; sum += a [ i ] ; } sum += b ; temp = ( double ) sum / n ; for ( i = 0 ; i < n ; ++ i ) if ( ( double ) a [ i ] > temp ) { System . out . println ( - 1 ) ; return ; } for ( i = 0 ; i < n ; ++ i ) { str = String . valueOf ( temp - a [ i ] ) ; index = str . indexOf ( ' . ' ) ; if ( str . length ( ) - index < 7 ) { while ( str . length ( ) - index < 7 ) str += "0" ; } else if ( str . length ( ) - index > 7 ) str = String . valueOf ( Math . round ( ( temp - a [ i ] ) * 1000000.0 ) / 1000000.0 ) ; System . out . println ( str ) ; } } }


n , b = map ( int , input ( ) . split ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) sb = sum ( s ) + bsb /= nif sb - max ( s ) >= 0 : for x in s : print ( sb - x ) else : print ( ' - 1' )     NEW_LINE


n , k = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) lst = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) m = max ( lst ) lst2 = [ ] s = 0 for i in range ( n ) : lst2 . append ( m - lst [ i ] ) s += m - lst [ i ] if s > k : print ( - 1 ) else : k -= s k = k / n for i in range ( n ) : print ( " { 0 : . 6f } " . format ( k + lst2 [ i ] ) ) NEW_LINE


n , b = map ( int , input ( ) . split ( ) ) a = list ( float ( x ) for x in input ( ) . split ( ) ) s = max ( a ) c = [ 0 ] * nfor i in range ( n ) : m = s - a [ i ] b = b - m c [ i ] = c [ i ] + mif b >= 0 : for i in range ( n ) : c [ i ] = c [ i ] + b / n for i in range ( n ) : print ( " % .6f " % c [ i ] ) else : print ( " - 1" ) NEW_LINE


def f ( l1 , al ) : n , b = l1 c = ( sum ( al ) + b ) / n if max ( al ) > c : return [ - 1 ] return [ c - a for a in al ] l1 = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) [ print ( r ) for r in f ( l1 , l2 ) ] NEW_LINE


import sysfrom collections import defaultdict , dequeinput = lambda : sys . stdin . readline ( ) . rstrip ( ) x , y , ax , ay , bx , by = map ( int , input ( ) . split ( ) ) xs , ys , t = map ( int , input ( ) . split ( ) ) a = [ ] ; a . append ( ( x , y ) ) ; px = x ; py = y ; LIMIT = 2 * * 62 - 1 while ( 1 ) : dx = ax * px + bx ; dy = ay * py + by ; if ( dx >= LIMIT or dy >= LIMIT ) : break ; a . append ( ( dx , dy ) ) ; px = dx ; py = dy ; px = xs ; py = ys ; ans = 0 ; a = list ( a ) n = len ( a ) for i in range ( n ) : for j in range ( i , n ) : # start to i to j l = abs ( a [ j ] [ 0 ] - a [ i ] [ 0 ] ) + abs ( a [ j ] [ 1 ] - a [ i ] [ 1 ] ) l1 = abs ( a [ i ] [ 0 ] - xs ) + abs ( a [ i ] [ 1 ] - ys ) + l # start to j to i l2 = abs ( a [ j ] [ 0 ] - xs ) + abs ( a [ j ] [ 1 ] - ys ) + l if l1 <= t or l2 <= t : ans = max ( ans , j - i + 1 ) print ( ans ) ;

x0 , y0 , ax , ay , bx , by = map ( int , input ( ) . split ( ' ▁ ' ) ) ps = [ ( x0 , y0 ) ] NEW_LINE


import timestartTimeProblem = time . time ( )   import fileinput , sys , itertools , functools , mathfrom bisect import * from heapq import * from collections import *     MOD = 10 ** 9 + 7 NEW_LINE


import sysfrom collections import defaultdict , dequeinput = lambda : sys . stdin . readline ( ) . rstrip ( ) x , y , ax , ay , bx , by = map ( int , input ( ) . split ( ) ) xs , ys , t = map ( int , input ( ) . split ( ) ) a = [ ] ; a . append ( ( x , y ) ) ; px = x ; py = y ; LIMIT = 2 ** 62 - 1 while ( 1 ) : dx = ax * px + bx ; dy = ay * py + by ; if ( dx >= LIMIT or dy >= LIMIT ) : break ; a . append ( ( dx , dy ) ) ; px = dx ; py = dy ; px = xs ; py = ys ; ans = 0 ; a = list ( a ) n = len ( a ) for i in range ( n ) : for j in range ( i , n ) : NEW_LINE


x0 , y0 , ax , ay , bx , by = map ( int , input ( ) . split ( ) ) xs , ys , t = map ( int , input ( ) . split ( ) )   V = [ [ x0 , y0 ] ]   while V [ - 1 ] [ 0 ] < 10 ** 25 : x , y = V [ - 1 ] V . append ( [ ax * x + bx , ay * y + by ] )   ans = 0   for i in range ( len ( V ) ) :   if abs ( xs - V [ i ] [ 0 ] ) + abs ( ys - V [ i ] [ 1 ] ) <= t : curt = t - ( abs ( xs - V [ i ] [ 0 ] ) + abs ( ys - V [ i ] [ 1 ] ) ) curans = 1   for j in range ( i - 1 , - 1 , - 1 ) : if abs ( V [ j ] [ 0 ] - V [ j + 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j + 1 ] [ 1 ] ) <= curt : curt -= abs ( V [ j ] [ 0 ] - V [ j + 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j + 1 ] [ 1 ] ) curans += 1 else : break   ans = max ( ans , curans )   curt = t - ( abs ( xs - V [ i ] [ 0 ] ) + abs ( ys - V [ i ] [ 1 ] ) ) curans = 1   for j in range ( i + 1 , len ( V ) ) : if abs ( V [ j ] [ 0 ] - V [ j - 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j - 1 ] [ 1 ] ) <= curt : curt -= abs ( V [ j ] [ 0 ] - V [ j - 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j - 1 ] [ 1 ] ) curans += 1 else : break   ans = max ( ans , curans )   print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ;   public class round568B { public static void main ( String s [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { char [ ] s1 = br . readLine ( ) . toCharArray ( ) , s2 = br . readLine ( ) . toCharArray ( ) ; int p1 = 0 , p2 = 0 , n1 = s1 . length , n2 = s2 . length ; while ( p1 < n1 ) { int c1 = count ( s1 , p1 , s1 [ p1 ] ) , c2 = count ( s2 , p2 , s1 [ p1 ] ) ; if ( c1 > c2 ) {

t = int ( input ( ) ) for zzz in range ( t ) : s1 = input ( ) s2 = input ( ) pos1 = 0 pos2 = 0 prev1 = 0 prev2 = 0 while ( pos1 < len ( s1 ) ) : let1 = s1 [ pos1 ] while pos1 < len ( s1 ) and s1 [ pos1 ] == let1 : pos1 += 1 while pos2 < len ( s2 ) and s2 [ pos2 ] == let1 : pos2 += 1 if ( pos1 - prev1 > pos2 - prev2 ) : print ( ' NO ' ) break prev1 = pos1 prev2 = pos2 else : if ( pos1 == len ( s1 ) and pos2 == len ( s2 ) ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


def do ( a , b ) -> bool : if a [ 0 ] != b [ 0 ] : return False i = 0 for j in range ( 1 , len ( b ) ) : if i < len ( a ) - 1 and a [ i + 1 ] == b [ j ] : i += 1 elif b [ j ] != a [ i ] : return False return i == len ( a ) - 1 for _ in range ( int ( input ( ) ) ) : a = input ( ) b = input ( ) print ( " YES " ) if do ( a , b ) else print ( " NO " )                   NEW_LINE


for u in range ( int ( input ( ) ) ) : s = input ( ) r = input ( ) n , m = len ( s ) , len ( r ) s += '3' c = 0 for i in range ( m ) : if ( s [ c ] == r [ i ] and c < n ) : c += 1 elif ( r [ i ] != r [ i - 1 ] or i == 0 ) : c = c - 1 break if ( c == n ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { FastScanner sc = new FastScanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int T = sc . nextInt ( ) ; for ( int ti = 0 ; ti < T ; ti ++ ) { char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; int nowS = 0 ; int nowT = 0 ; boolean flg = true ; while ( nowS < s . length ) { char cs = s [ nowS ] ; int cnt = 0 ; while ( nowS < s . length && cs == s [ nowS ] ) { nowS ++ ; cnt ++ ; } while ( nowT < t . length && cs == t [ nowT ] ) { nowT ++ ; cnt -- ; }


import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int t = in . nextInt ( ) ; L : while ( -- t >= 0 ) { char s [ ] = ( in . next ( ) + " _ " ) . toCharArray ( ) ; char p [ ] = ( in . next ( ) + " _ " ) . toCharArray ( ) ; int n1 = s . length ; int n2 = p . length ; int i = 0 , j = 0 ; boolean chk = false ; while ( i < n1 && j < n2 ) { if ( s [ i ] == p [ j ] ) { i ++ ; int ctr1 = 1 ; while ( i < n1 && s [ i ] == s [ i - 1 ] ) { i ++ ; ctr1 ++ ; } j ++ ; int ctr2 = 1 ; while ( j < n2 && p [ j ] == p [ j - 1 ] ) { j ++ ; ctr2 ++ ; } if ( ctr1 > ctr2 ) { chk = true ; break ; } } else { chk = true ; break ; } } if ( ! chk ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = true ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; for ( int i = 0 ; i < 8 ; i ++ ) { int a1 = i & 1 ; int b1 = i & 2 ; int c1 = i & 4 ; int ta , tb , tc ; if ( a1 != 0 ) { ta = b ; } else { ta = a ; } if ( b1 != 0 ) { tb = c ; } else { tb = b ; } if ( c1 != 0 ) { tc = d ; } else { tc = c ; } if ( isOk ( ta , tb , tc ) ) { out . printf ( " % d ▁ % d ▁ % d \n " , ta , tb , tc ) ; return ; } } }   boolean isOk ( int a , int b , int c ) { return a + b > c && a + c > b && c + b > a ; }

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


from typing import Iterator     def get_num_input ( ) -> Iterator [ int ] : return map ( int , input ( ) . split ( ) )     def main ( ) -> None : first : int second : int _ , first , second , _ = get_num_input ( )   print ( first , second , second )     if __name__ == " _ _ main _ _ " : ONLY_ONCE : bool = False for _ in range ( 1 if ONLY_ONCE else int ( input ( ) ) ) : main ( ) NEW_LINE


from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport sysfrom io import BytesIO , IOBase   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip   ''' Notes : x ▁ + ▁ y ▁ > = ▁ zx ▁ + ▁ z ▁ > = ▁ yy ▁ + ▁ z ▁ > = ▁ x '''   def main ( ) : a , b , c , d = map ( int , input ( ) . split ( ) ) x = b y = c z = c print ( f ' { x } ▁ { y } ▁ { z } ' )     NEW_LINE


for s in [ * open ( 0 ) ] [ 1 : ] : a , b , c , d = s . split ( ) ; print ( a , c , c ) NEW_LINE


import java . io . * ; import java . math . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; Task solver = new Task ( ) ; int T = scan . nextInt ( ) ; for ( int tt = 0 ; tt < T ; tt ++ ) solver . solve ( tt , scan , out ) ; out . close ( ) ; }   static class Task { public void solve ( int testNumber , FastReader scan , PrintWriter out ) { int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; out . println ( b + " ▁ " + c + " ▁ " + c ) ; } }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public FastReader ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( new File ( s ) ) ) ; }   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 Main {   public static void main ( String [ ] args ) {


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( b + " ▁ " + c + " ▁ " + c ) ; } } }


import java . awt . * ; 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 t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) ; sb . append ( a + " ▁ " + c + " ▁ " + c + " \n " ) ; } System . out . println ( sb ) ; } } class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }


import java . util . * ; import java . io . * ;   public class Solution {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ( ) ; String [ ] info = a . split ( " ▁ " ) ; int numCats = Integer . parseInt ( info [ 0 ] ) ; int numDone = Integer . parseInt ( info [ 1 ] ) ; if ( numDone == 0 ) System . out . println ( 1 ) ; else if ( numDone <= numCats / 2 ) System . out . println ( numDone ) ; else System . out . println ( numCats - numDone ) ; } }

from math import ceiln , m = list ( map ( int , input ( ) . split ( ) ) ) if m == 0 : print ( 1 ) elif m <= ( n // 2 ) : print ( m ) else : if n % 2 != 0 and m == ceil ( n / 2 ) : print ( n // 2 ) else : print ( n - m ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) if n == m : print ( 0 ) elif m == 0 : print ( 1 ) elif n / m < 2 : print ( n - m ) else : print ( m ) NEW_LINE


no_of_cats , no_of_cats_left = map ( int , input ( ) . split ( ) )     l = [ ]     if ( no_of_cats_left == 0 ) : print ( 1 ) elif ( no_of_cats % 2 == 0 ) : if ( no_of_cats // 2 == no_of_cats_left ) : print ( no_of_cats_left ) elif ( no_of_cats_left < no_of_cats // 2 ) : print ( no_of_cats_left ) else : print ( no_of_cats - no_of_cats_left ) else : if ( no_of_cats_left <= no_of_cats // 2 ) : print ( no_of_cats_left ) else : print ( no_of_cats - no_of_cats_left )         NEW_LINE


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


n , m = map ( int , input ( ) . split ( ) ) if m != 0 : print ( min ( m , n - m ) ) else : print ( 1 ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( m == 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( Math . min ( m , n - m ) ) ; } } }


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( m == 0 ) { System . out . println ( "1" ) ; } else if ( n - m == 0 ) { System . out . println ( "0" ) ; } else { int k = Math . min ( m , n - m ) ; System . out . println ( k ) ; } } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int count = 0 ; if ( m == 0 ) count = 1 ; else { count = Math . min ( m , n - m ) ; } System . out . println ( count ) ; } }


import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int res = 0 ; if ( m == 0 || m == 1 ) res = 1 ; else if ( m <= n / 2 ) res = m ; else res = n - m ; System . out . println ( res ) ; } }


import java . util . * ; public class cl { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int top_sum = 0 ; int bottom_sum = 0 ; boolean diff = false ; for ( int i = 0 ; i < n ; i ++ ) { int top = in . nextInt ( ) ; int bottom = in . nextInt ( ) ; if ( ( bottom + top ) % 2 != 0 ) diff = true ; top_sum += top ; bottom_sum += bottom ; } if ( top_sum % 2 == 0 && bottom_sum % 2 == 0 ) System . out . println ( 0 ) ; else if ( top_sum % 2 != 0 && bottom_sum % 2 != 0 && n != 1 && diff ) System . out . println ( 1 ) ; else System . out . println ( - 1 ) ; } }

l1 = [ ] ; l2 = [ ] n = int ( input ( ) ) for __ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) l1 . append ( x ) ; l2 . append ( y ) if sum ( l1 ) % 2 == 0 and sum ( l2 ) % 2 == 0 : print ( 0 ) elif sum ( l1 ) % 2 != 0 and sum ( l2 ) % 2 != 0 and n != 1 : c = - 1 for i , j in zip ( l1 , l2 ) : if abs ( i - j ) % 2 != 0 : c += 2 break print ( c ) else : print ( - 1 ) NEW_LINE


n = int ( input ( ) ) odd = 0 x = y = 0 for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) x += l y += r if ( l + r ) % 2 != 0 : odd += 1 if x % 2 == 0 and y % 2 == 0 : print ( 0 ) else : if odd % 2 == 0 and n != 1 and odd > 0 : print ( 1 ) else : print ( - 1 ) NEW_LINE


n = int ( input ( ) ) l = 0 r = 0 flag = Falsefor i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) l += x r += y if ( x + y ) % 2 != 0 : flag = Trueif l % 2 == 0 and r % 2 == 0 : print ( '0' ) elif ( l + r ) % 2 == 0 and flag : print ( '1' ) else : print ( ' - 1' ) NEW_LINE


n = int ( input ( ) )   ls = 0 rs = 0   has = False   for _ in range ( n ) : l , r = map ( int , input ( ) . split ( ) )   ls += l rs += r   if not has : if l % 2 == 1 and r % 2 == 0 : has = True elif r % 2 == 1 and l % 2 == 0 : has = True   if ls % 2 == 0 and rs % 2 == 0 : ans = 0 elif ( ls % 2 == 0 ) ^ ( rs % 2 == 0 ) : ans = - 1 elif has : ans = 1 else : ans = - 1   print ( ans ) NEW_LINE


n = int ( input ( ) ) if n == 1 : x , y = [ int ( x ) for x in input ( ) . split ( ) ] if x % 2 + y % 2 >= 1 : print ( " - 1" ) else : print ( "0" ) else : s = ' False ' l = 0 r = 0 for i in range ( n ) : x , y = [ int ( x ) for x in input ( ) . split ( ) ] if y % 2 + x % 2 == 1 : s = ' True ' l += x r += y if l % 2 == 0 and r % 2 == 0 : print ( "0" ) elif l % 2 == 1 and r % 2 == 1 and s == ' True ' : print ( "1" ) else : print ( " - 1" ) NEW_LINE


import java . util . * ; public class cl { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int top_sum = 0 ; int bottom_sum = 0 ; boolean diff = false ; for ( int i = 0 ; i < n ; i ++ ) { int top = in . nextInt ( ) ; int bottom = in . nextInt ( ) ; if ( ( bottom + top ) % 2 != 0 ) diff = true ; top_sum += top ; bottom_sum += bottom ; } if ( top_sum % 2 == 0 && bottom_sum % 2 == 0 ) System . out . println ( 0 ) ; else if ( top_sum % 2 != 0 && bottom_sum % 2 != 0 && n != 1 && diff ) System . out . println ( 1 ) ;


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( 0 , Math . abs ( a - b ) + Math . abs ( a - c ) + Math . abs ( b - c ) - 4 ) ) ; } } } }

n = int ( input ( ) ) for i in range ( n ) : a , b , c = [ int ( x ) for x in input ( ) . split ( ) ] l , r = min ( a , b , c ) , max ( a , b , c ) if l < r : l += 1 if l < r : r -= 1 print ( 2 * ( r - l ) ) NEW_LINE


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


import sysinput = sys . stdin . readline   for test in range ( int ( input ( ) ) ) : a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) if a [ 0 ] == a [ 1 ] and a [ 1 ] == a [ 2 ] : res = 0 else : res = 4 ans = abs ( a [ 0 ] - a [ 1 ] ) + abs ( a [ 0 ] - a [ 2 ] ) + abs ( a [ 1 ] - a [ 2 ] ) print ( max ( 0 , ans - res ) ) NEW_LINE


""" s ▁ = ▁ input ( ) l = [ ] i = 0lens ▁ = ▁ len ( s ) while ( i < len ( s ) ) : ▁ ▁ ▁ ▁ l . append ( s [ i : i + 2 ] ) ▁ ▁ ▁ ▁ i + = 2len1 ▁ = ▁ len ( l ) if ▁ len1 = = 1 : ▁ ▁ ▁ ▁ print ( " NO " ) else : ▁ ▁ ▁ ▁ if ▁ lens % 2 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ " AB " ▁ in ▁ l ▁ and ▁ " BA " ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " YES " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) ▁ ▁ ▁ ▁ else :   ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ " AB " ▁ in ▁ l ▁ and ▁ " BA " ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " YES " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # ▁ print ( l ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ " AB " ▁ in ▁ l ▁ and ▁ " BA " ▁ not ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s . find ( " AB " ) ! = lens - 3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s = " " ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s + = l [ len1-2 ] [ 1 ] + l [ len1-1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s = = " BA " : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " YES " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ elif ▁ " BA " ▁ in ▁ l ▁ and ▁ " AB " ▁ not ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s . find ( " BA " ) ! = lens - 3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s = " " ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s + = l [ len1-2 ] [ 1 ] + l [ len1-1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s = = " AB " : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " YES " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) """ """ s ▁ = ▁ input ( ) ab = s . find ( " AB " ) ba ▁ = ▁ s . find ( " BA " ) if ▁ s . find ( " BA " , ab + 2 ) ! = - 1 ▁ and ▁ ab ! = - 1 : ▁ ▁ ▁ ▁ print ( " YES " ) elif ▁ s . find ( " AB " , ba + 2 ) ! = - 1 ▁ and ▁ ba ! = - 1 : ▁ ▁ ▁ ▁ print ( " YES " ) else : ▁ ▁ ▁ ▁ print ( " NO " ) """   """ n , m ▁ = ▁ map ( int , input ( ) . split ( ) ) if ▁ m % 2 ! = 0 : ▁ ▁ ▁ ▁ l = [ ( m + 1 ) / /2 ] ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 1 , ( m + 1 ) / /2 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( ( m + 1 ) / /2 ▁ - ▁ i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( ( m + 1 ) / /2 ▁ + ▁ i ) else : ▁ ▁ ▁ ▁ if ▁ m = = 2 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l = [ 1,2 ] ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l = [ m / /2 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 1 , m / /2 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( m / /2 + i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( m / /2 - i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( m ) ans ▁ = ▁ l * ( n / / len ( l ) ) ans + = l [ 0 : n % len ( l ) ] for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ print ( ans [ i ] ) """ """ def ▁ main ( ) : ▁ ▁ ▁ ▁ t ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n ▁ = ▁ str ( n ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n = ▁ list ( n ) [ : : - 1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ i = 0 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ while ( i < len ( n ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ n [ i ] = = " 0 " : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n . remove ( n [ i ] ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " " . join ( n ) ) if ▁ _ _ name _ _ ▁ = = ▁ ' _ _ main _ _ ' : ▁ ▁ ▁ ▁ main ( ) """ """ t ▁ = ▁ int ( input ( ) ) for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ s ▁ = ▁ input ( ) ▁ ▁ ▁ ▁ if ▁ len ( s ) %2 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ s [ : len ( s ) / / 2 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ s [ len ( s ) / / 2 : ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ sorted ( list ( q ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ sorted ( ( list ( t ) ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ q = = t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " YES " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ s [ 0 : len ( s ) ▁ / / ▁ 2 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ s [ len ( s ) ▁ / / ▁ 2 ▁ + 1 : ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ sorted ( list ( q ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ sorted ( ( list ( t ) ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ q ▁ = = ▁ t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " YES " ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( " NO " ) """ import sysinput = sys . stdin . readline """ n = ▁ int ( input ( ) ) l = [ ] for ▁ _ ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ p ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ l . append ( p ) l . sort ( ) s = [ ] for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ s . append ( l [ i ] * ( n - i ) ) # print ( s ) print ( max ( s ) ) """ """ t ▁ = ▁ int ( input ( ) ) for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ n ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ s ▁ = ▁ list ( map ( int , input ( ) . split ( ) ) ) ▁ ▁ ▁ ▁ cnt = 1 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( s ) -1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # print ( s [ i ] ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s [ i ] > = s [ i + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ cnt + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s [ i + 1 ] = s [ i ] ▁ ▁ ▁ ▁ print ( cnt ) """     NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = sc . nextInt ( ) ; while ( n -- > 0 ) { long a = sc . nextLong ( ) , b = sc . nextLong ( ) , c = sc . nextLong ( ) ; System . out . println ( Math . max ( ( Math . abs ( a - b ) + Math . abs ( a - c ) + Math . abs ( b - c ) - 4 ) , 0 ) ) ; } } } }


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


import java . util . Scanner ;   public class JavaApplication1 {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int rounds = input . nextInt ( ) ; int [ ] befor = new int [ rounds ] ; int [ ] after = new int [ rounds ] ; boolean check = true ; for ( int i = 0 ; i < rounds ; i ++ ) { befor [ i ] = input . nextInt ( ) ; after [ i ] = input . nextInt ( ) ; if ( befor [ i ] != after [ i ] ) { System . out . println ( " rated " ) ; check = false ; break ; } } if ( check ) { for ( int i = 1 ; i < rounds ; i ++ ) { if ( befor [ i - 1 ] < befor [ i ] ) { System . out . println ( " unrated " ) ; check = false ; break ; } } } if ( check ) System . out . println ( " maybe " ) ; input . close ( ) ; } }

li = list ( ) for _ in range ( int ( input ( ) ) ) : b , a = map ( int , input ( ) . split ( ) ) li . append ( a ) if b != a : print ( " rated " ) breakelse : li2 = sorted ( li ) li . reverse ( ) if li == li2 : print ( " maybe " ) else : print ( " unrated " ) NEW_LINE


n = int ( input ( ) ) a = [ ] fl = 1 for i in range ( n ) : a . append ( [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] ) if ( a [ - 1 ] [ 0 ] != a [ - 1 ] [ 1 ] ) : fl = 0 if ( not fl ) : print ( " rated " ) else : fl = 1 for i in range ( 1 , n ) : if ( a [ i - 1 ] [ 0 ] < a [ i ] [ 0 ] ) : fl = 0 if ( fl ) : print ( " maybe " ) else : print ( " unrated " ) NEW_LINE


num = int ( input ( ) ) participants = [ ] for i in range ( num ) : participant = input ( ) . split ( ) participants . append ( participant ) i = 0 for j in range ( num ) : if int ( participants [ j ] [ 0 ] ) != int ( participants [ j ] [ 1 ] ) : print ( ' rated ' ) break elif j == num - 1 : while i < num - 1 :   if int ( participants [ i ] [ 1 ] ) < int ( participants [ i + 1 ] [ 1 ] ) : print ( ' unrated ' ) break i += 1 else : print ( ' maybe ' ) NEW_LINE


n = int ( input ( ) ) prev = 0 count = - 1 f = 0 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) NEW_LINE


cases = int ( input ( ) )   arr = [ ] while cases : cases -= 1 a , b = map ( int , input ( ) . split ( ) ) if a != b : print ( " rated " ) exit ( ) arr . append ( a )   sor = sorted ( arr , reverse = True )   if arr == sor : print ( " maybe " ) else : print ( " unrated " ) NEW_LINE


import java . util . Scanner ;   public class IsRated { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; short a = sc . nextShort ( ) ; short d = 0 , aux = Short . MAX_VALUE ; boolean e = false , f = false ; for ( int i = 0 ; i < a ; i ++ ) { short b = sc . nextShort ( ) ; short c = sc . nextShort ( ) ; if ( b != c ) { e = true ; } if ( b == c ) { d ++ ; } if ( aux < b ) { f = true ; } aux = b ; } if ( e ) { System . out . println ( " rated " ) ; } else if ( f ) { System . out . println ( " unrated " ) ; } else if ( d == a ) { System . out . println ( " maybe " ) ; } } }


import java . util . * ; public class IsItRated { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int in = sc . nextInt ( ) ; boolean diff = false ; Integer [ ] arr = new Integer [ in ] ; Integer [ ] hold = new Integer [ in ] ; for ( int i = 0 ; i < in ; i ++ ) { int temp = sc . nextInt ( ) ; arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] != temp ) diff = true ; hold [ i ] = arr [ i ] ; } if ( diff ) System . out . println ( " rated " ) ; else { Arrays . sort ( arr , Collections . reverseOrder ( ) ) ; boolean out = false ; for ( int i = 0 ; i < in ; i ++ ) { if ( arr [ i ] != hold [ i ] ) { System . out . println ( " unrated " ) ; out = true ; break ; } } if ( ! out ) System . out . println ( " maybe " ) ; } } }


import java . util . * ;   public class NewClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , lp = 4126 ; boolean changed = false , ni = true ; for ( int i = 0 ; i < n ; i ++ ) { int b = sc . nextInt ( ) , a = sc . nextInt ( ) ; if ( b != a ) { changed = true ; break ; } if ( lp < b ) { ni = false ; } lp = b ; } if ( changed ) System . out . println ( " rated " ) ; else if ( ni ) System . out . println ( " maybe " ) ; else System . out . println ( " unrated " ) ; } }


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

n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] ans = 1e10 for i in range ( n ) : ans = min ( ans , l [ i ] // max ( n - i - 1 , i ) ) print ( ans ) NEW_LINE


n , a , k = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) , 10 ** 9 for i in range ( n ) : k = min ( k , a [ i ] // ( max ( n - i - 1 , i ) ) ) print ( k ) NEW_LINE


n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] ans = 1e10 for i in range ( n ) : ans = min ( ans , l [ i ] // max ( n - i - 1 , i ) ) print ( ans )   NEW_LINE


n = int ( input ( ) )   s = list ( map ( int , input ( ) . split ( ) ) ) ex = 10 ** 9   for i in range ( n ) : ex = min ( ex , s [ i ] // max ( i , n - i - 1 ) ) print ( ex ) NEW_LINE


import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; 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 ( final 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 ( final IOException e ) { e . printStackTrace ( ) ; } return str ; }   int [ ] nextIntArray ( final int n ) { final int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( next ( ) ) ; } return a ; }   }   private static long startTime = System . currentTimeMillis ( ) ;   public static void main ( final String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int a [ ] = sc . nextIntArray ( n ) ; int min = Integer . MAX_VALUE ; for ( int i = 1 ; i <= n ; i ++ ) {


import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . List ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException { InputReader in = new InputReader ( new BufferedInputStream ( System . in ) ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; TaskB solver = new TaskB ( ) ;


import java . util . * ;   public class CodeForces1159B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { min = Math . min ( min , input . nextInt ( ) / Math . max ( i , n - i - 1 ) ) ; } System . out . println ( min ) ; } }


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

cases = int ( input ( ) )   arr1 = ( map ( int , input ( ) . split ( ) ) ) arr2 = ( map ( int , input ( ) . split ( ) ) )   lost = 0 win = 0   for i , j in zip ( arr1 , arr2 ) : if i == 1 and j == 0 : win += 1 elif i == 0 and j == 1 : lost += 1   if win == 0 : print ( - 1 ) else : ans = ( lost + win - 1 ) // win if ans * win == lost : ans += 1 print ( ans )     NEW_LINE


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


def solve ( ) : n = int ( input ( ) ) r = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) s1 = { n + 1 } s2 = { n + 1 } for i in range ( n ) : if r [ i ] == 1 : s1 . add ( i ) for i in range ( n ) : if b [ i ] == 1 : s2 . add ( i ) s1 . remove ( n + 1 ) s2 . remove ( n + 1 ) if s1 . issubset ( s2 ) or len ( s2 ) == n or len ( s1 ) == 0 : print ( - 1 ) return else : if len ( s1 ) > len ( s2 ) : print ( 1 ) return else : z = 0 for i in s1 : if not s2 . __contains__ ( i ) : NEW_LINE


import mathimport operator   def lcm ( a , b ) : return ( a / math . gcd ( a , b ) ) * b def nCr ( n , r ) : return ( ( math . factorial ( n ) ) / ( ( math . factorial ( r ) ) * ( math . factorial ( n - r ) ) ) )       def isKthBitSet ( n , k ) : if ( n & ( 1 << ( k - 1 ) ) ) : return True else : return Falsedef maximalRectangle ( matrix ) : if not matrix or not matrix [ 0 ] : return 0 n = len ( matrix [ 0 ] ) height = [ 0 ] * ( n + 1 ) ans = 0 for row in matrix : for i in range ( n ) : height [ i ] = height [ i ] + 1 if row [ i ] == '0' else 0 stack = [ - 1 ] for i in range ( n + 1 ) : while height [ i ] < height [ stack [ - 1 ] ] : h = height [ stack . pop ( ) ] w = i - 1 - stack [ - 1 ] ans = max ( ans , h * w ) stack . append ( i ) return ans     def matched ( str ) : count = 0 for i in str : if i == " ( " : count += 1 elif i == " ) " : count -= 1 if count < 0 : return False return count == 0   def isValid ( h , m , nh , nm ) : l = [ 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 ] if ( l [ h // 10 ] == - 1 or l [ h % 10 ] == - 1 or l [ m // 10 ] == - 1 or l [ m % 10 ] == - 1 ) : return False resh = l [ m % 10 ] * 10 + l [ m // 10 ] resm = l [ h % 10 ] * 10 + l [ h // 10 ]   return ( resh < nh and resm < nm )       def solve ( ) :   NEW_LINE


def main ( ) : n = int ( input ( ) ) r = readIntArr ( ) b = readIntArr ( ) rwin = 0 bwin = 0 for i in range ( n ) : if r [ i ] == 0 and b [ i ] == 1 : bwin += 1 elif r [ i ] == 1 and b [ i ] == 0 : rwin += 1 if rwin == 0 : print ( - 1 ) else : NEW_LINE


import java . math . BigInteger ; import java . util . * ;   public class Example { public static void main ( String [ ] args ) {    Scanner sc = new Scanner ( System . in ) ;   int t = sc . nextInt ( ) ;   int [ ] r = new int [ t ] ; int [ ] a = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { r [ i ] = sc . nextInt ( ) ;   } for ( int i = 0 ; i < t ; i ++ ) { a [ i ] = sc . nextInt ( ) ;   } int aa = 0 ; int b = 0 ;   for ( int i = 0 ; i < t ; i ++ ) { if ( a [ i ] != r [ i ] ) { if ( r [ i ] == 1 ) { aa ++ ; } else { b ++ ; } } } if ( aa != 0 ) { int x = 1 + b / aa ;   System . out . println ( x ) ;   } else { System . out . println ( - 1 ) ; }    } }


import java . io . * ; import java . util . * ;   public class Main {    public static void main ( String [ ] args ) throws IOException { int n = sc . nextInt ( ) ; int [ ] r = sc . nextIntArr ( n ) ; int [ ] b = sc . nextIntArr ( n ) ; int R = 0 , B = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( r [ i ] != b [ i ] ) { if ( r [ i ] == 1 ) R ++ ; else B ++ ; } }


import java . util . * ; import java . io . * ; import java . math . * ;     public class A {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   int n = sc . nextInt ( ) ; int arr [ ] = sc . readArray ( n ) ; int b [ ] = sc . readArray ( n ) ; int ff = 0 , ss = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == b [ i ] ) continue ; if ( arr [ i ] == 1 ) ff ++ ; else ss ++ ; } if ( ff == 0 ) { System . out . println ( - 1 ) ; return ; } ss ++ ; int ans = ceil ( ss , ff ) ; System . out . println ( ans ) ;   }


import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; while ( t -- > 0 ) { int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int r = input . nextInt ( ) ; int c = input . nextInt ( ) ;   System . out . println ( Math . max ( ( r - 1 ) , ( n - r ) ) + Math . max ( ( c - 1 ) , ( m - c ) ) ) ; } } }

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m , r , c = map ( int , input ( ) . split ( ) ) NEW_LINE q = max ( r - 1 , n - r ) NEW_LINE w = max ( c - 1 , m - c ) NEW_LINE print ( q + w ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n , m , r , c = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( r - 1 , n - r ) + max ( c - 1 , m - c ) ) NEW_LINE


import sys   NEW_LINE def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) NEW_LINE out = [ ] NEW_LINE for s in inp [ 1 : ] : n , m , r , c = map ( int , s . split ( ) ) NEW_LINE out . append ( max ( n - r , r - 1 ) + max ( m - c , c - 1 ) ) NEW_LINE return out NEW_LINE print ( * main ( ) , sep = ' \n ' ) NEW_LINE


import java . awt . List ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . TreeSet ;    public final class CF_TechCup2021_R2_A {   static boolean verb = true ; static void log ( Object X ) { if ( verb ) System . err . println ( X ) ; } static void log ( Object [ ] X ) { if ( verb ) { for ( Object U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( int [ ] X ) { if ( verb ) { for ( int U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( int [ ] X , int L ) { if ( verb ) { for ( int i = 0 ; i < L ; i ++ ) System . err . print ( X [ i ] + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( long [ ] X ) { if ( verb ) { for ( long U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } }   static void logWln ( Object X ) { if ( verb ) System . err . print ( X ) ; } static void info ( Object o ) { System . out . println ( o ) ; } static void output ( Object o ) { outputWln ( " " + o + " \n " ) ; } static void outputWln ( Object o ) { try { out . write ( " " + o ) ; } catch ( Exception e ) { } }


import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tc = sc . nextInt ( ) ; for ( int i = 0 ; i < tc ; i ++ ) { int n = sc . nextInt ( ) - 1 ; int m = sc . nextInt ( ) - 1 ; int r = sc . nextInt ( ) - 1 ; int c = sc . nextInt ( ) - 1 ; int max = 0 ;   max = Math . max ( r + c , n - r + m - c ) ; max = Math . max ( max , n - r + c ) ; max = Math . max ( max , r + m - c ) ; System . out . println ( max ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int max = Math . abs ( 1 - r ) + Math . abs ( 1 - c ) ; max = Math . max ( max , ( Math . abs ( n - r ) + Math . abs ( 1 - c ) ) ) ; max = Math . max ( max , ( Math . abs ( n - r ) + Math . abs ( m - c ) ) ) ; max = Math . max ( max , ( Math . abs ( 1 - r ) + Math . abs ( m - c ) ) ) ; System . out . println ( max ) ; } } }


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

class UnionFind : def __init__ ( self , n ) : self . parent = list ( range ( n ) ) def find ( self , a ) : NEW_LINE


import java . io . BufferedReader ; import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;     public class Codeforces {   public static void main ( String args [ ] ) throws IOException {


import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . * ;   public class B_Monopole_Magnets { static int N ; static int M ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ;


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; int M ; char [ ] [ ] g ;   int [ ] dx = { 0 , 0 , - 1 , 1 } ; int [ ] dy = { 1 , - 1 , 0 , 0 } ;   void run ( FastScanner in , PrintWriter out ) {    N = in . nextInt ( ) ; M = in . nextInt ( ) ; g = new char [ N ] [ ] ;   for ( int i = 0 ; i < N ; i ++ ) { g [ i ] = in . next ( ) . toCharArray ( ) ; }   int [ ] rowSegs = new int [ N ] ; int [ ] colSegs = new int [ M ] ;


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = 0 ; if ( c < a && c < b ) { if ( n == 1 ) { System . out . println ( "0" ) ; } else { d = Math . min ( ( a + ( c * ( n - 2 ) ) ) , ( b + ( c * ( n - 2 ) ) ) ) ; System . out . println ( d ) ; } } else { d = Math . min ( ( a * ( n - 1 ) ) , ( b * ( n - 1 ) ) ) ; System . out . println ( d ) ; } } }

no_of_meals = int ( input ( ) ) ro = int ( input ( ) ) re = int ( input ( ) ) oe = int ( input ( ) ) distance = 0 home = " r "   for each in range ( 0 , no_of_meals - 1 ) : if ( home == " r " ) : if ( ro > re ) : home = " e " distance += re else : home = " o " distance += ro elif ( home == " o " ) : if ( ro > oe ) : home = " e " distance += oe else : home = " r " distance += ro else : if ( re > oe ) : home = " o " distance += oe else : home = " r " distance += re print ( distance )     NEW_LINE


n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) n -= 1 if n == 0 : print ( 0 ) else : print ( min ( a , b , c ) * ( n - 1 ) + min ( a , b ) ) NEW_LINE


n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) if min ( a , b , c ) == a or min ( a , b , c ) == b or n == 1 : print ( min ( a , b ) * ( n - 1 ) ) else : print ( min ( a , b ) + ( c * ( n - 2 ) ) ) NEW_LINE


n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) x = min ( a , b ) y = min ( a , b , c ) print ( 0 if n == 1 else x + y * ( n - 2 ) ) NEW_LINE


n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) i = 0 k = 0 m = 0 d = 0 while k != min ( a , b , c ) and d != ( n - 1 ) : if i == 0 : k = min ( a , b ) i = 1 if k == a else 2 m += k d += 1 elif i == 1 : k = min ( a , c ) i = 0 if k == a else 2 m += k d += 1 else : k = min ( b , c ) i = 0 if k == b else 1 m += k d += 1 print ( m if d == n else ( m + ( ( n - d - 1 ) * ( min ( a , b , c ) ) ) ) ) NEW_LINE


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; String [ ] d = { " R " , " O " , " E " } ; int [ ] d1 = { a , b , c } ; int count = 1 , dist = 0 ; String curr = d [ 0 ] ; int e = a , f = b ; while ( count != n ) { count ++ ; int min = Math . min ( e , f ) ; dist = dist + min ; if ( min == e ) { curr = d [ 1 ] ; f = c ; e = a ; } else { curr = d [ 2 ] ; e = c ; f = b ; } } System . out . println ( dist ) ; } }


import java . util . * ;   public class Absolutezero { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int possible1 = a ; int possible2 = b ; n = n - 1 ; int sum = 0 ; for ( int j = n ; j >= 1 ; j -- ) { int min = Math . min ( possible1 , possible2 ) ; sum = sum + min ; if ( min == a ) { possible1 = a ; possible2 = c ; } else if ( min == b ) { possible1 = b ; possible2 = c ; } else { if ( possible1 == a ) { possible1 = b ; possible2 = c ; } else { possible1 = a ; possible2 = c ; } }   } System . out . println ( sum ) ;    }   static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; }   public List < Integer > getDivisors ( int n ) { List < Integer > list = new ArrayList < > ( ) ; for ( int d = 2 ; d * d <= n ; d ++ ) { while ( n % d == 0 ) { list . add ( d ) ; n /= d ; } } if ( n > 1 ) { list . add ( n ) ; } return list ; }   public int lcm ( int n1 , int n2 ) { int gcd = 1 ; for ( int i = 1 ; i <= n1 && i <= n2 ; ++ i ) {


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


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

import matht = int ( input ( ) ) NEW_LINE for _ in range ( t ) : x , y , k = map ( int , input ( ) . split ( ) ) NEW_LINE coal = ( ( k * y + k - 1 ) + x - 2 ) NEW_LINE totalstcks = k + coal - 1 NEW_LINE trade = coal // ( x - 1 ) NEW_LINE ans = trade + k NEW_LINE print ( ans ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for i in range ( t ) : x , y , k = map ( int , input ( ) . split ( ) ) NEW_LINE need = int ( k * y ) NEW_LINE if x == 2 : NEW_LINE INDENT print ( need + k - 1 + k ) else : NEW_LINE rem = ( need + k - 1 ) % ( x - 1 ) NEW_LINE DEDENT count = ( need + k - 1 ) // ( x - 1 ) NEW_LINE if rem != 0 : NEW_LINE INDENT print ( count + k + 1 ) else : NEW_LINE print ( int ( count ) + k ) NEW_LINE DEDENT


import sysinput = sys . stdin . readline   for test in range ( int ( input ( ) ) ) : x , y , k = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE need = y * k + k - 1 NEW_LINE


import sysinput = sys . stdin . readlinefor NEW_LINE _ in range ( int ( input ( ) ) ) : a , b , c = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE print ( c + ( b * c + c - 1 + a + - 2 ) // ( a - 1 ) ) NEW_LINE


import mathtestcases = int ( input ( ) ) NEW_LINE for i in range ( 0 , testcases ) : xyk = input ( ) NEW_LINE m = xyk . split ( ) NEW_LINE x = int ( m [ 0 ] ) NEW_LINE y = int ( m [ 1 ] ) NEW_LINE k = int ( m [ 2 ] ) NEW_LINE s = 0 NEW_LINE r = ( k * y + k - 1 ) % ( x - 1 ) NEW_LINE if ( r == 0 ) : NEW_LINE INDENT s = ( k * y + k - 1 ) // ( x - 1 ) else : NEW_LINE s = 1 + ( k * y + k - 1 ) // ( x - 1 ) NEW_LINE DEDENT t = k + s NEW_LINE print ( t ) NEW_LINE


import java . util . Scanner ;   public class A1418 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { long X = in . nextLong ( ) ; long Y = in . nextLong ( ) ; long K = in . nextLong ( ) ; long sticksNeeded = K * ( Y + 1 ) ; long answer = K + ( sticksNeeded - 1 + X - 2 ) / ( X - 1 ) ; System . out . println ( answer ) ; } }   }


import java . util . Scanner ;   public class BuyingTorches { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCases = scanner . nextInt ( ) ;   while ( testCases -- != 0 ) {   long x = scanner . nextInt ( ) ; long y = scanner . nextInt ( ) ; long k = scanner . nextInt ( ) ;   System . out . println ( solve ( x , y , k ) ) ; } }   public static long solve ( long x , long y , long k ) { x -- ; long a = y * k + ( k - 1 ) + ( x - 1 ) ; return a / x + k ; } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) {   Scanner scanner = new Scanner ( System . in ) ; int cases = scanner . nextInt ( ) ;   for ( int i = 0 ; i < cases ; i ++ ) { long x = scanner . nextInt ( ) ; long y = scanner . nextInt ( ) ; long k = scanner . nextInt ( ) ;   long total = k + y * k - 1 ;   long x2 = x - 1 ; long trade = ( total + x2 - 1 ) / x2 ; trade += k ;   System . out . println ( trade ) ; } } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; min = Math . min ( min , x ) ; max = Math . max ( max , x ) ; arr [ i ] = x ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != min & arr [ i ] != max ) { count ++ ; } } System . out . println ( count ) ; } }

n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) c = n - s . count ( max ( s ) ) - s . count ( min ( s ) ) print ( c if c >= 0 else 0 ) NEW_LINE


n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c1 , c2 = 0 , 0 m = min ( l ) mx = max ( l ) if n == 1 or n == 2 : print ( 0 ) elif mx == m : print ( 0 ) else : for i in range ( n ) : if l [ i ] == mx : c1 += 1 if l [ i ] == m : c2 += 1 print ( n - c1 - c2 ) NEW_LINE


n = input ( ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) mi = min ( arr ) ma = max ( arr ) c = 0   for i in arr : if i != mi and i != ma : c += 1   print ( c )     NEW_LINE


n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) )   x . sort ( )   mini = x [ 0 ] maxi = x [ - 1 ] c1 = 0 c2 = 0 for i in range ( n ) : if x [ i ] == maxi : c1 += 1 if x [ i ] == mini : c2 += 1   if maxi == mini : print ( 0 ) else : print ( n - c1 - c2 )     NEW_LINE


input ( ) ; l = sorted ( map ( int , input ( ) . split ( ) ) ) print ( max ( 0 , len ( l ) - l . count ( l [ 0 ] ) - l . count ( l [ - 1 ] ) ) ) NEW_LINE


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


import java . util . * ;   public class Runner { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int stewards = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] stewardsArr = stringToIntArray ( sc . nextLine ( ) ) ; int min = stewardsArr [ 0 ] ; int max = stewardsArr [ 0 ] ; for ( int i = 1 ; i < stewards ; i ++ ) { min = Math . min ( min , stewardsArr [ i ] ) ; max = Math . max ( max , stewardsArr [ i ] ) ; } int edgesFound = 0 ; for ( int i = 0 ; i < stewards ; i ++ ) { if ( stewardsArr [ i ] == min || stewardsArr [ i ] == max ) edgesFound ++ ; } if ( min == max ) System . out . println ( 0 ) ; else System . out . println ( stewards - edgesFound ) ; }    private static int [ ] stringToIntArray ( String str ) { String [ ] strs = str . trim ( ) . split ( " ▁ " ) ; int [ ] intArr = new int [ strs . length ] ; for ( int i = 0 ; i < strs . length ; i ++ ) { intArr [ i ] = Integer . parseInt ( strs [ i ] ) ; } return intArr ; }   }


import java . util . Arrays ; import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int [ ] arr = new int [ x ] ; int a ; for ( int i = 0 ; i < x ; i ++ ) { arr [ i ] = in . nextInt ( ) ; } Arrays . sort ( arr ) ; int ans = 0 ; for ( int i = 1 ; i < x - 1 ; i ++ ) { if ( arr [ 0 ] < arr [ i ] && arr [ x - 1 ] > arr [ i ] ) ans ++ ; } System . out . println ( ans ) ; } }


import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader inputReader = new InputReader ( inputStream ) ; PrintWriter printWriter = new PrintWriter ( outputStream ) ; Task task = new Task ( ) ; task . run ( inputReader , printWriter ) ; printWriter . close ( ) ; }   static class Task {   int n ; int [ ] r ;   private void read ( InputReader in ) { n = in . nextInt ( ) ; r = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { r [ i ] = in . nextInt ( ) ; } }   private void solve ( PrintWriter out ) { int result = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int sum = 0 ; for ( int j = i ; j < n ; ++ j ) { sum += r [ j ] ; if ( sum > ( j - i + 1 ) * 100 && result < j - i + 1 ) { result = j - i + 1 ; } } } out . print ( result ) ; }   void run ( InputReader in , PrintWriter out ) { read ( in ) ; solve ( out ) ; } }    static class InputReader { private BufferedReader reader ; private StringTokenizer tokenizer ;   InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 1 << 15 ) ; tokenizer = null ; }   String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

from itertools import accumulate as acfrom collections import Counter as ccfrom bisect import bisect_left as bslfrom bisect import bisect as bsfrom math import factorial as ffrom collections import * from itertools import * from string import * from bisect import * from queue import * from heapq import * from math import * from sys import * from re import * def fast ( ) : return stdin . readline ( ) . strip ( ) def zzz ( ) : return [ int ( i ) for i in fast ( ) . split ( ) ]     z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) )     def lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def output ( answer ) : stdout . write ( str ( answer ) )     NEW_LINE


from sys import stdin , stdoutfrom math import gcd , sqrtfrom collections import dequeinput = stdin . readlineR = lambda : map ( int , input ( ) . split ( ) ) I = lambda : int ( input ( ) ) S = lambda : input ( ) . rstrip ( ' \n ' ) L = lambda : list ( R ( ) ) P = lambda x : stdout . write ( x ) hg = lambda x , y : ( ( y + x - 1 ) // x ) * xpw = lambda x : 1 if x == 1 else 1 + pw ( x // 2 ) chk = lambda x : chk ( x // 2 ) if not x % 2 else True if x == 1 else FalseN = 10 ** 6 + 7 v = [ ( i + 1 ) * 100 for i in range ( 5000 ) ] ans = 0 n = I ( ) a = L ( ) for i in range ( n ) : s = 0 for j in range ( i , n ) : s += a [ j ] if s > v [ j - i ] : ans = max ( ans , j - i + 1 ) print ( ans ) NEW_LINE


n = int ( input ( ) )   l = [ * map ( int , input ( ) . split ( ) ) ] mx = 0 mxs = 0 ''' for ▁ i ▁ in ▁ range ( n - 1 ) : ▁ ▁ ▁ ▁ t = 100 ▁ ▁ ▁ ▁ total = l [ i ] ▁ ▁ ▁ ▁ if ▁ total > = t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ mxs + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( l [ i ] ) ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( i + 1 , n ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t + = 100 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ total + = l [ j ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ total > = t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ mxs + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( l [ j ] ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ mx = max ( mx , mxs ) print ( mx ) ▁ ▁ ▁ ▁ ▁ ''' m = 0 for i in range ( n ) : s = 0 for j in range ( i , n ) : s = s + l [ j ] if ( s > ( j - i + 1 ) * 100 ) : m = max ( m , j - i + 1 ) print ( m ) NEW_LINE


import sysinput = sys . stdin . readline   '''   '''   n = int ( input ( ) ) r = list ( map ( int , input ( ) . split ( ) ) ) prefix_sum = [ r [ 0 ] ] for i in range ( 1 , n ) : prefix_sum . append ( prefix_sum [ - 1 ] + r [ i ] )   best = 0 done = Falsefor length in reversed ( range ( 1 , n + 1 ) ) : treshold = 100 * length for i in range ( n - length + 1 ) : pre = 0 if i == 0 else prefix_sum [ i - 1 ] total = prefix_sum [ i + length - 1 ] - pre if total > treshold : done = True best = length break if done : break   print ( best ) NEW_LINE


import sysinput = sys . stdin . buffer . readline   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) lst = [ a [ 0 ] ] for i in range ( 1 , n ) : lst . append ( lst [ - 1 ] + a [ i ] )   mx = 0 for i in range ( n ) : for j in range ( i , n ) : if lst [ j ] - lst [ i ] + a [ i ] > 100 * ( j - i + 1 ) and j - i + 1 > mx : mx = j - i + 1 print ( mx ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class DDoS { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int ar [ ] = new int [ n ] ; int pre [ ] = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; ++ i ) { ar [ i ] = in . nextInt ( ) ; } for ( int i = 1 ; i <= n ; ++ i ) { pre [ i ] = pre [ i - 1 ] + ar [ i - 1 ] ; } int resp = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = i ; j <= n ; ++ j ) { if ( pre [ j ] - pre [ i - 1 ] > 100 * ( j - i + 1 ) ) { resp = max ( resp , j - i + 1 ) ; } } } out . println ( resp ) ; }   private int max ( int resp , int i ) { return resp > i ? resp : i ; } }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


import java . util . * ; public class water { public static void main ( String args [ ] ) { Scanner ob = new Scanner ( System . in ) ; int n = ob . nextInt ( ) ; long a [ ] = new long [ n + 1 ] ; long sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { sum = sum + ob . nextInt ( ) ; a [ i ] = sum ; } long max = 0 ; for ( int i = 0 ; i <= n ; i ++ ) for ( int j = i ; j <= n ; j ++ ) if ( a [ j ] - a [ i ] > 100 * ( j - i ) ) max = Math . max ( max , j - i ) ; System . out . println ( max ) ; } }


import java . util . * ; import java . io . * ;   public class CF1057B { static FastReader in = new FastReader ( ) ;   public static void main ( String [ ] args ) { solve ( ) ; }   static void solve ( ) { int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } int [ ] psums = new int [ n + 1 ] ; for ( int i = 1 ; i < n + 1 ; i ++ ) { psums [ i ] = psums [ i - 1 ] + a [ i - 1 ] ; }   int longest = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { for ( int j = i ; j < n + 1 ; j ++ ) { if ( psums [ j ] - psums [ i - 1 ] > 100 * ( j - ( i - 1 ) ) ) longest = Math . max ( longest , ( j - ( i - 1 ) ) ) ; } } System . out . println ( longest ) ; }   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 . * ; import java . util . * ;   public class Main { static PrintWriter out = new PrintWriter ( System . out ) ; static Scanner sc = new Scanner ( System . in ) ; static BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long mod = 998244353 ; long inv2 = 1 ; int step = 1 ; long [ ] ans ;   List < int [ ] > [ ] graph ;    public static void main ( String [ ] args ) throws IOException { Main main = new Main ( ) ;   main . solve ( ) ;

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


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


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


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


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

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


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


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


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


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


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

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


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


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


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


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


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

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


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


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


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


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


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


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


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


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

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


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

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


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


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


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


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


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

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


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


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


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


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


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


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


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


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

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


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


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


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


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


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


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


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


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


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

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


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


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


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Mishka_and_Game { static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }   public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n = sc . nextInt ( ) ; int countM = 0 , countC = 0 , countS = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a , b ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a < b ) { countC ++ ; } if ( a > b ) { countM ++ ; } if ( a == b ) { countS ++ ; } } if ( countM > countC ) { System . out . println ( " Mishka " ) ; } else if ( countM < countC ) { System . out . println ( " Chris " ) ; } else { System . out . println ( " Friendship ▁ is ▁ magic ! ^ ^ " ) ; }   } }


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


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