import java . util . Arrays ; import java . util . Scanner ;   public class StrangeBirthdayParty {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } Arrays . sort ( a ) ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = a [ n - i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = c [ i ] ; } int q = 0 ; long res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int k = b [ a [ i ] - 1 ] ; if ( k != q && q < m && b [ q ] < k ) { res += b [ q ] ; ++ q ; } else { res += k ; } } System . out . println ( res ) ; } }   }

import java . util . * ; import java . math . * ; public class StrangeBirthday { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] friends = new int [ n ] ; int [ ] presents = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) friends [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) presents [ i ] = sc . nextInt ( ) ; Arrays . sort ( friends ) ; int dex = 0 ; long out = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { int pCost = presents [ dex ] ; int cash = presents [ friends [ i ] - 1 ] ; if ( pCost < cash ) { out += pCost ; dex ++ ; } else { out += cash ; } } System . out . println ( out ) ; } } }

import java . util . * ; public class Ques { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; int i , j ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } int [ ] b = new int [ m ] ; int [ ] c = new int [ m ] ; for ( i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ;

import java . util . Arrays ; import java . util . Scanner ;   public class A1470 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; Integer [ ] K = new Integer [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { K [ n ] = in . nextInt ( ) ; } int [ ] C = new int [ M ] ; for ( int m = 0 ; m < M ; m ++ ) { C [ m ] = in . nextInt ( ) ; } Arrays . sort ( K ) ; long [ ] money = new long [ N + 1 ] ; for ( int n = 0 ; n < N ; n ++ ) { money [ n + 1 ] = money [ n ] + C [ K [ n ] - 1 ] ; } long [ ] giftCost = new long [ M + 1 ] ; for ( int m = 0 ; m < M ; m ++ ) { giftCost [ m + 1 ] = giftCost [ m ] + C [ m ] ; } long minCost = Long . MAX_VALUE ; for ( int gifts = 0 ; gifts <= Math . min ( N , M ) ; gifts ++ ) { long cost = giftCost [ gifts ] + money [ N - gifts ] ; minCost = Math . min ( minCost , cost ) ; } System . out . println ( minCost ) ; } }   }

import java . util . Arrays ; NEW_LINE import java . util . Scanner ;   public NEW_LINE class A1470 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t + + ) { int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; Integer [ ] K = new Integer [ N ] ; for ( int n = 0 ; n < N ; n + + ) { K [ n ] = in . nextInt ( ) ; } int [ ] C = new int [ M ] ; for ( int m = 0 ; m < M ; m + + ) { C [ m ] = in . nextInt ( ) ; } Arrays . sort ( K ) ; long [ ] money = new long [ N + 1 ] ; for ( int n = 0 ; n < N ; n + + ) { money [ n + 1 ] = money [ n ] + C [ K [ n ] - 1 ] ; } long [ ] giftCost = new long [ M + 1 ] ; for ( int m = 0 ; m < M ; m + + ) { giftCost [ m + 1 ] = giftCost [ m ] + C [ m ] ; } long minCost = Long . MAX_VALUE ; for ( int gifts = 0 ; gifts <= Math . min ( N , M ) ; gifts + + ) { long cost = giftCost [ gifts ] + money [ N - gifts ] ; minCost = Math . min ( minCost , cost ) ; } System . out . println ( minCost ) ; } }   } NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE s = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = True ) NEW_LINE p = list ( map ( int , input ( ) . split ( ) ) )   ans = 0 NEW_LINE for i in range ( n ) : if NEW_LINE i + 1 < s [ i ] : ans += p [ i ] else : ans += p [ s [ i ] - 1 ] NEW_LINE print ( ans ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE k . sort ( reverse = True ) NEW_LINE c . sort ( ) NEW_LINE s = set ( ) NEW_LINE j = 0 NEW_LINE sum = 0 NEW_LINE for i in range ( n ) : if NEW_LINE c [ k [ i ] - 1 ] > c [ j ] : sum += c [ j ] NEW_LINE s . add ( c [ j ] ) NEW_LINE j = j + 1 elif c [ k [ i ] - 1 ] <= c [ j ] : sum += c [ k [ i ] - 1 ] NEW_LINE print ( sum ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE k . sort ( reverse = True ) NEW_LINE c = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE idx = 0 NEW_LINE ans = 0 NEW_LINE for i in range ( n ) : if NEW_LINE idx < k [ i ] - 1 : ans += c [ idx ] NEW_LINE idx += 1 else : ans += c [ k [ i ] - 1 ] NEW_LINE print ( ans ) NEW_LINE

import sysimport NEW_LINE inspectimport NEW_LINE reimport NEW_LINE math   if __name__ == " CP " : sys . stdin = open ( ' ip . txt ' , ' r ' ) NEW_LINE sys . stdout = open ( ' op . txt ' , ' w ' ) NEW_LINE sys . stderr = open ( ' error . txt ' , ' w ' )   NEW_LINE def debug ( arg ) : frame = inspect . currentframe ( ) NEW_LINE try : context = inspect . getframeinfo ( frame . f_back ) . code_context NEW_LINE caller_lines = ' ' . join ( [ line . strip ( ) for line in context ] ) NEW_LINE m = re . search ( r ' debug\s * \ ( ( . + ? ) \ ) $ ' , caller_lines ) NEW_LINE if m : caller_lines = m . group ( 1 ) NEW_LINE sys . stderr . write ( caller_lines + " ▁ = ▁ " + str ( arg ) + " \n " ) finally : del frame   try : M = 1000000007 NEW_LINE def solve ( ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) )   a . sort ( reverse = True ) NEW_LINE


import java . lang . reflect . Array ; import java . text . DecimalFormat ; import java . util . * ; import java . io . * ;   public class Equal {    static class pair implements Comparable < pair > { int x ; int y ;   public pair ( int u , int v ) { this . x = u ; this . y = v ; }   @ Override public int compareTo ( pair o ) { if ( y == o . y ) return 0 ; if ( y < o . y ) return 1 ; return - 1 ; } }   static double dis ( pair a , pair b ) { return Math . sqrt ( ( ( a . x - b . x ) * ( a . x - b . x ) ) + ( ( a . y - b . y ) * ( a . y - b . y ) ) ) ; }   static int c ; static int d ; static int e ;   static void extendedEuclid ( int a , int b ) { if ( b == 0 ) { c = 1 ; d = 0 ; e = a ; return ; } extendedEuclid ( b , a % b ) ; int x1 = d ; int y1 = c - ( a / b ) * d ; c = x1 ; d = y1 ; } static int [ ] rank ; static int [ ] p ; static int sets ; static int findSet ( int i ) { return ( p [ i ] == i ) ? i : ( p [ i ] = findSet ( p [ i ] ) ) ; } static boolean isSameSet ( int i , int j ) { return findSet ( i ) == findSet ( j ) ; } static void unionSet ( int i , int j ) { if ( ! isSameSet ( i , j ) ) { sets -- ; int x = findSet ( i ) ; int y = findSet ( j ) ; if ( rank [ x ] > rank [ y ] ) p [ y ] = x ; else { p [ x ] = y ; if ( rank [ x ] == rank [ y ] ) rank [ y ] ++ ; } } } static class SegmentTree {

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

import java . util . Scanner ;   public class CF141_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; if ( x >= a || x <= - a ) { System . out . println ( - 1 ) ; return ; } if ( y % a == 0 ) { System . out . println ( - 1 ) ; return ; } int h = ( int ) Math . ceil ( y * 1.0 / a ) ; if ( h % 2 == 1 && h != 1 ) { if ( x == 0 ) { System . out . println ( - 1 ) ; } else {   int cell = h + ( h / 2 ) - 1 ; if ( x > 0 ) { cell ++ ; } System . out . println ( cell ) ; } } else { if ( x >= a / 2.0 || x <= - a / 2.0 ) { System . out . println ( - 1 ) ; } else { int cell = h + Math . max ( h / 2 - 1 , 0 ) ; System . out . println ( cell ) ; } }    } }

import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = " " ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = false ;

a , x , y = map ( int , input ( ) . split ( ) ) ans = 0 if x >= a or x <= - a : ans = - 1 if ( ( y // a ) % 2 == 1 or y // a == 0 ) and ( x >= a / 2 or x <= - a / 2 ) : ans = - 1 if y // a == y / a : ans = - 1 if ( y // a ) % 2 == 0 and y // a > 0 and x == 0 : ans = - 1 if ans == 0 : ans = y // a + 1 + ( y // a ) // 2 if ( y // a ) % 2 == 0 and y // a > 0 and x < 0 : ans -= 1 print ( ans ) else : print ( - 1 ) NEW_LINE

pxy = input ( ) . split ( ) p = int ( pxy [ 0 ] ) x = int ( pxy [ 1 ] ) y = int ( pxy [ 2 ] ) if y % p == 0 : print ( " - 1" ) else : k = int ( y / p ) if y < p : if x < p / 2 and x > - p / 2 : print ( "1" ) else : print ( " - 1" ) elif k % 2 == 1 : if x < p / 2 and x > - p / 2 : print ( int ( ( k + 1 ) / 2 * 3 - 1 ) ) else : print ( " - 1" ) else : if x < p and x > - p and x != 0 : if x > 0 : print ( int ( k / 2 * 3 + 1 ) ) else : print ( int ( k / 2 * 3 ) ) else : print ( " - 1" ) NEW_LINE

import sysimport mathimport collectionsimport bisectdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) for t in range ( 1 ) : a , x , y = get_ints ( ) seq = [ ] start_x_right = a / 2 start_x_left = - a / 2 start_y_up = a start_y_bottom = 0 seq . append ( [ start_x_left , start_x_right , start_y_bottom , start_y_up ] ) count = 2 limit = math . ceil ( y // a ) for i in range ( limit ) : start_y_up += a start_y_bottom += a if count % 2 == 0 : seq . append ( [ start_x_left , start_x_right , start_y_bottom , start_y_up ] ) else : seq . append ( [ - a , 0 , start_y_bottom , start_y_up ] ) seq . append ( [ 0 , a , start_y_bottom , start_y_up ] ) count += 1 poss = 0 for i in range ( len ( seq ) ) : row = seq [ i ] left , right , down , up = row if x > left and x < right and y > down and y < up : print ( i + 1 ) poss += 1 break if poss == 0 : print ( - 1 ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : a , x , y = map ( int , input ( ) . rstrip ( ) . split ( ) ) num = - 1   if x < a / 2 and x > ( - 0.5 * a ) : if y < a and y > 0 : num = 1 if y < 2 * a and y > a and y > 0 : num = 2 if y < 4 * a and y > 3 * a and y > 0 : num = 5 if x < a and x > ( - 1 ) * a : if y < 3 * a and y > 2 * a and y > 0 : if x < 0 : num = 3 else : num = 4 if x == 0 : num = - 1 if y > 3 * a : ny = y // a if ny % 2 == 0 : t = ny // 2 - 1 if x < a and x > ( - 1 ) * a : if x < 0 : num = ( 2 * ny ) - t - 1 else : num = ( 2 * ny ) - t if x == 0 : num = - 1 else : if x < a / 2 and x > ( - 0.5 * a ) : t = ny // 2 num = ( 2 * ny ) - t if y % a == 0 : num = - 1 print ( num ) NEW_LINE

a , x , y = map ( int , input ( ) . split ( ) ) if y <= 0 or abs ( x ) >= a : print ( - 1 ) else : v = y // a v1 = y / a if v == v1 : print ( - 1 ) elif v == 0 : print ( 1 if abs ( x ) < a / 2 else - 1 ) elif v % 2 : u = v // 2 * 3 + 1 print ( u + 1 if abs ( x ) < a / 2 else - 1 ) else : u = ( v - 1 ) // 2 * 3 if x < 0 : print ( u + 3 ) elif x > 0 : print ( u + 4 ) else : print ( - 1 ) NEW_LINE


import java . util . * ;   public class OracAndModels {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ;   for ( int i = 0 ; i < t ; i ++ ) { solve ( sc ) ; }   }   public static void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; int s [ ] = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . nextInt ( ) ; }   int dp [ ] = new int [ n ] ; int max = 1 ; dp [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { int r = 1 ; for ( Integer c : getDiv ( i + 1 ) ) { if ( s [ c - 1 ] < s [ i ] && dp [ c - 1 ] + 1 > r ) r = dp [ c - 1 ] + 1 ; } dp [ i ] = r ; if ( dp [ i ] > max ) max = dp [ i ] ; } System . out . println ( max ) ; }   public static List < Integer > getDiv ( int n ) { List < Integer > l = new LinkedList < > ( ) ; l . add ( 1 ) ; for ( int i = 2 ; i <= ( int ) Math . ceil ( Math . sqrt ( n ) ) ; i ++ ) { if ( n % i == 0 ) { l . add ( i ) ; if ( i != n / i ) l . add ( n / i ) ; } } return l ; } }

for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] dp = [ 1 for i in range ( n ) ] for i in range ( 1 , n ) : for j in range ( i - 1 , n , i ) : if a [ j ] > a [ i - 1 ] : dp [ j ] = max ( dp [ j ] , 1 + dp [ i - 1 ] ) ans = 1 for i in dp : ans = max ( ans , i ) print ( ans ) NEW_LINE

import sysimport math   t = int ( sys . stdin . readline ( ) ) for _ in range ( t ) : n = int ( sys . stdin . readline ( ) ) l = [ 0 ] + list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) ans = [ 1 for i in range ( n + 1 ) ] for i in range ( 1 , n + 1 ) : for j in range ( 1 , round ( math . sqrt ( i ) ) + 1 ) : if i % j == 0 : if j != i and l [ i ] > l [ j ] : ans [ i ] = max ( ans [ j ] + 1 , ans [ i ] ) if i // j != i and l [ i ] > l [ i // j ] : ans [ i ] = max ( ans [ i // j ] + 1 , ans [ i ] ) best = 0 for i in range ( 1 , n + 1 ) : best = max ( best , ans [ i ] ) print ( best ) NEW_LINE

from os import path ; import sys , time NEW_LINE

from sys import stdint = int ( input ( ) ) l = [ [ 1 ] for i in range ( 10 ** 5 + 1 ) ] for i in range ( 2 , 10 ** 5 + 1 ) : for j in range ( i , 10 ** 5 + 1 , i ) : l [ j ] . append ( i ) for _ in range ( t ) : n = int ( stdin . readline ( ) ) s = [ 0 ] + list ( map ( int , stdin . readline ( ) . split ( ) ) ) dp = [ 0 ] * ( n + 1 ) for i in range ( 1 , n + 1 ) : for x in l [ i ] : if s [ x ] < s [ i ] : dp [ i ] = max ( dp [ i ] , dp [ x ] ) dp [ i ] += 1 print ( max ( dp ) ) NEW_LINE


import java . util . Arrays ; import java . util . Random ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int cost [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { cost [ i ] = sc . nextInt ( ) ; } int days = sc . nextInt ( ) ; int cash [ ] = new int [ days ] ; for ( int i = 0 ; i < days ; i ++ ) { cash [ i ] = sc . nextInt ( ) ; }   Arrays . sort ( cost ) ; for ( int i = 0 ; i < days ; i ++ ) { int start = 0 ; int end = n + 1 ; int x = cash [ i ] ; while ( start + 1 < end ) { int mid = ( start + end ) / 2 ; if ( cost [ mid ] > x ) { end = mid ; } else { start = mid ; } } pw . println ( start ) ; } pw . close ( ) ;   } }

import java . util . Arrays ; import java . util . Scanner ;   public class n706B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] price = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) price [ i ] = scanner . nextInt ( ) ; Arrays . sort ( price ) ; int q = scanner . nextInt ( ) ; long m ; for ( int i = 0 ; i < q ; i ++ ) { m = scanner . nextLong ( ) ; if ( m < price [ 0 ] ) System . out . println ( 0 ) ; else if ( m >= price [ n - 1 ] ) System . out . println ( n ) ; else System . out . println ( binarysearch ( price , m , 0 ) ) ; } }   public static int binarysearch ( int [ ] price , long m , int start ) { int left = start ; int right = price . length - 1 ; while ( left <= right ) { int mid = ( left + right ) / 2 ; if ( price [ mid ] == m ) { while ( mid + 1 < price . length - 1 && price [ mid ] == price [ mid + 1 ] ) return binarysearch ( price , m , mid + 1 ) ; return mid + 1 ; } else if ( price [ mid ] < m ) left = mid + 1 ; else right = mid - 1 ; } while ( left < price . length - 1 && price [ left - 1 ] == price [ left ] ) return binarysearch ( price , m , left ) ; return left ; } }

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 t = 0 ; t < n ; t ++ ) { ar [ t ] = sc . nextInt ( ) ; } Arrays . sort ( ar ) ; int zz = ar [ ar . length - 1 ] ; int y [ ] = new int [ zz + 1 ] ; for ( int u : ar ) { y [ u ] ++ ; } for ( int o = 1 ; o < zz ; o ++ ) { y [ o ] = y [ o ] + y [ o - 1 ] ; } int q = sc . nextInt ( ) ; for ( int r = 0 ; r < q ; r ++ ) { int high = sc . nextInt ( ) ; if ( high > zz - 1 ) { System . out . println ( n ) ; } else { System . out . println ( y [ high ] ) ; } } } }

import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main {    public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int [ ] [ ] b = new int [ k ] [ 2 ] ; for ( int i = 0 ; i < k ; i ++ ) { b [ i ] [ 0 ] = sc . nextInt ( ) ; b [ i ] [ 1 ] = i ; } Arrays . sort ( a ) ; Arrays . sort ( b , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] o1 , int [ ] o2 ) { if ( o1 [ 0 ] == o2 [ 0 ] ) return Integer . compare ( o1 [ 1 ] , o2 [ 1 ] ) ; return Integer . compare ( o1 [ 0 ] , o2 [ 0 ] ) ; } } ) ; int [ ] ans = new int [ k ] ; int id = 0 ; for ( int i = 0 ; i < k ; i ++ ) { while ( id < a . length && b [ i ] [ 0 ] >= a [ id ] ) { id ++ ; } ans [ b [ i ] [ 1 ] ] = id ; } for ( int i = 0 ; i < ans . length ; i ++ ) { System . out . println ( ans [ i ] ) ; } pw . close ( ) ; } }

n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) q = int ( input ( ) ) presum = [ 0 ] * ( max ( x ) + 1 ) sum = 0 x . sort ( ) for i in range ( n ) : presum [ x [ i ] ] = ( i + 1 ) for i in range ( len ( presum ) ) : if presum [ i ] != 0 : sum = presum [ i ] presum [ i ] = sum NEW_LINE

import bisect   input ( ) x = sorted ( map ( int , input ( ) . split ( ) ) )   for i in range ( int ( input ( ) ) ) : print ( bisect . bisect ( x , int ( input ( ) ) ) )                         NEW_LINE

num = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) ) cases = int ( input ( ) ) while cases : cases -= 1 n = int ( input ( ) ) ans = - 1 l , r = 0 , num - 1 found = False while l <= r : mid = ( l + r ) // 2 if arr [ mid ] <= n : ans = mid l = mid + 1 else : r = mid - 1   print ( ans + 1 )       NEW_LINE

import bisect_ = input ( ) a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) for _ in range ( int ( input ( ) ) ) : print ( bisect . bisect ( a , int ( input ( ) ) ) ) NEW_LINE

import math   def binarySearch ( itemArr : list , item : int ) : low = 0 mid = 0 high = len ( itemArr ) - 1 if item >= itemArr [ high ] : return high + 1 if item < itemArr [ 0 ] : return 0 index = 0   while low <= high : mid = math . floor ( ( low + high ) / 2 ) if item == itemArr [ mid ] : index = mid low = mid + 1 elif item > itemArr [ mid ] : if item < itemArr [ mid + 1 ] : return mid + 1 else : low = mid + 1 elif item < itemArr [ mid ] : if item > itemArr [ mid - 1 ] : return mid else : high = mid - 1 return index + 1       if __name__ == ' _ _ main _ _ ' : import math shop = int ( input ( ) ) BottlePricePerShop = [ int ( x ) for x in input ( ) . split ( ) ] days = int ( input ( ) ) coinPerDays = [ ] for i in range ( days ) : coinPerDays . append ( int ( input ( ) ) ) BottlePricePerShop . sort ( )   for i in coinPerDays : print ( binarySearch ( BottlePricePerShop , i ) , end = ' \n ' ) NEW_LINE


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Solution { static char [ ] [ ] board = new char [ 8 ] [ 8 ] ; static boolean [ ] [ ] visited = new boolean [ 8 ] [ 8 ] ; public static void main ( String [ ] args ) { try ( BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { for ( int i = 0 ; i < 8 ; i ++ ) { board [ i ] = in . readLine ( ) . toCharArray ( ) ; Arrays . fill ( visited [ i ] , false ) ; } dfs ( 7 , 0 , 0 ) ; System . out . println ( " LOSE " ) ; } catch ( IOException e ) {   } } static void dfs ( int row , int col , int step ) { if ( row < 0 || row >= 8 || col < 0 || col >= 8 ) return ; if ( board [ row ] [ col ] == ' A ' || step >= 7 ) { System . out . println ( " WIN " ) ; System . exit ( 0 ) ; } for ( int i = - 1 ; i <= 1 ; i ++ ) for ( int j = - 1 ; j <= 1 ; j ++ ) { int x = row + i ; int y = col + j ; if ( x < 0 || x >= 8 || y < 0 || y >= 8 ) continue ; if ( x - step >= 0 && board [ x - step ] [ y ] == ' S ' ) continue ; if ( x - step - 1 >= 0 && board [ x - step - 1 ] [ y ] == ' S ' ) continue ; dfs ( x , y , step + 1 ) ; } } }

r , s = [ 63 ] , ' ' . join ( input ( ) + ' T ' for i in range ( 8 ) ) + ' T ' * 9 for i in range ( 0 , 72 , 9 ) : t = set ( ) for x in r : for y in ( x , x - 1 , x + 1 , x - 9 , x + 9 , x - 10 , x - 8 , x + 10 , x + 8 ) : if s [ y ] == ' T ' : continue if ( y < i or s [ y - i ] != ' S ' ) and ( y < i + 9 or s [ y - i - 9 ] != ' S ' ) : t . add ( y ) r = tprint ( ' WIN ' if r else ' LOSE ' ) NEW_LINE


import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ;   public class cc2 {     public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int l [ ] = new int [ t ] ; int r [ ] = new int [ t ] ; int left = 0 , right = 0 ; for ( int i = 0 ; i < t ; i ++ ) { l [ i ] = sc . nextInt ( ) ; r [ i ] = sc . nextInt ( ) ; left += l [ i ] ; right += r [ i ] ; } int max = ( int ) Math . abs ( left - right ) ; int idx = 0 ; for ( int i = 0 ; i < t ; i ++ ) { int c = left - l [ i ] + r [ i ] ; int d = right - r [ i ] + l [ i ] ; int abs1 = ( int ) Math . abs ( c - d ) ; if ( abs1 > max ) { max = abs1 ; idx = i + 1 ;   } } System . out . println ( idx ) ;                                } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] left = new int [ n ] ; int [ ] right = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { left [ i ] = in . nextInt ( ) ; right [ i ] = in . nextInt ( ) ; } int L = 0 , R = 0 ; for ( int i = 0 ; i < n ; i ++ ) { L += left [ i ] ; R += right [ i ] ; } int min = Math . abs ( L - R ) ; int minIndex = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int Lnum = L - left [ i ] + right [ i ] ; int Rnum = R - right [ i ] + left [ i ] ; if ( Math . abs ( Lnum - Rnum ) > min ) { min = Math . abs ( Lnum - Rnum ) ; minIndex = i ; } } System . out . println ( minIndex + 1 ) ; } }

n = int ( input ( ) ) L = 0 R = 0 a = [ ] pas = 0 for _ in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) L += l R += r a . append ( l - r ) b = abs ( L - R ) k = bfor i in range ( n ) : if abs ( ( L - a [ i ] ) - ( R + a [ i ] ) ) > k : k = abs ( ( L - a [ i ] ) - ( R + a [ i ] ) ) pas = i + 1 if k == b : print ( 0 ) else : print ( pas ) NEW_LINE

sl = 0 sr = 0 d = [ ] n = int ( input ( ) ) for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) sl += l sr += r d . append ( [ l - r , i + 1 ] ) d . sort ( )   md = sl - srans = 0 ad = abs ( md )   if abs ( md - d [ 0 ] [ 0 ] * 2 ) > ad : ans = d [ 0 ] [ 1 ] ad = abs ( md - d [ 0 ] [ 0 ] * 2 )   if abs ( md - d [ - 1 ] [ 0 ] * 2 ) > ad : ans = d [ - 1 ] [ 1 ] ad = abs ( md - d [ - 1 ] [ 0 ] ) print ( ans ) NEW_LINE

z = [ ] l = 0 r = 0 for _ in range ( int ( input ( ) ) ) : a = list ( map ( int , input ( ) . split ( ) ) ) z . append ( a ) l += a [ 0 ] r += a [ 1 ] s = abs ( l - r ) idx = - 1 for i in range ( len ( z ) ) : ll = l - z [ i ] [ 0 ] + z [ i ] [ 1 ] rr = r - z [ i ] [ 1 ] + z [ i ] [ 0 ] ss = abs ( ll - rr ) if ( ss > s ) : s = ss idx = iprint ( idx + 1 ) NEW_LINE

n = int ( input ( ) ) a = [ ] sum = 0 while n : n -= 1 l , r = [ int ( x ) for x in input ( ) . split ( ) ] a . append ( l - r ) sum += l - rmax = summaxi = - 1 for i in range ( len ( a ) ) : if abs ( sum - a [ i ] * 2 ) > abs ( max ) : max = sum - a [ i ] * 2 maxi = iprint ( maxi + 1 ) NEW_LINE

n = int ( input ( ) ) l , r = 0 , 0 index = - 1 a = [ ] for i in range ( n ) : x = [ int ( i ) for i in input ( ) . split ( ) ] l += x [ 0 ] r += x [ 1 ] a . append ( x ) ml , mr = l , rres = abs ( l - r ) for i in range ( n ) : temp = abs ( ( l - a [ i ] [ 0 ] + a [ i ] [ 1 ] ) - ( r - a [ i ] [ 1 ] + a [ i ] [ 0 ] ) ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   int n , d ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; d = sc . nextInt ( ) ;   String input ; int maxWin = 0 ; int counter = 0 ; boolean allOpponents ; boolean prevWin = true ;   for ( int i = 0 ; i < d ; i ++ ) { sc . reset ( ) ; input = sc . next ( ) ; allOpponents = true ;   for ( int j = 0 ; j < n ; j ++ ) { if ( input . charAt ( j ) == '0' ) { allOpponents = false ; counter ++ ; break ; } }    if ( counter > maxWin ) { maxWin = counter ; } if ( allOpponents ) { counter = 0 ; }   }   System . out . println ( maxWin ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner puttingvaluesinside = new Scanner ( System . in ) ; puttingvaluesinside . nextInt ( ) ; int i = puttingvaluesinside . nextInt ( ) ; puttingvaluesinside . nextLine ( ) ; int max = 0 , wins = 0 ; for ( ; i > 0 ; i -- ) { char [ ] c = puttingvaluesinside . nextLine ( ) . toCharArray ( ) ; boolean flag = false ;

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int d = in . nextInt ( ) ; String s ; int max = - 1 , m = 0 ; for ( int i = 0 ; i < d ; i ++ ) { s = in . next ( ) ; if ( s . indexOf ( "0" ) >= 0 ) m ++ ; else { if ( m > max ) max = m ; m = 0 ; } } if ( m > max ) max = m ; System . out . println ( max ) ; } }

import java . util . Scanner ; import java . util . StringTokenizer ;   public class Opponents { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ;   StringTokenizer tokenizer = new StringTokenizer ( line ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int m = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   int maxConsecutiveCount = 0 ; int consecutiveCount = 0 ; for ( int i = 0 ; i < m ; i ++ ) { String row = scanner . nextLine ( ) ; boolean aryaWins = row . contains ( "0" ) ; if ( aryaWins ) { consecutiveCount ++ ; if ( consecutiveCount > maxConsecutiveCount ) { maxConsecutiveCount = consecutiveCount ; } } else { consecutiveCount = 0 ; } }   System . out . println ( maxConsecutiveCount ) ; } }

def does_arya_beat ( s ) : for i in s : if i != "1" : return True return False     def main_function ( ) : n , d = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] counts = [ ] count = 0 for i in range ( d ) : s = input ( ) if does_arya_beat ( s ) : count += 1 if i == d - 1 : counts . append ( count ) else : counts . append ( count ) count = 0 return max ( counts )               print ( main_function ( ) ) NEW_LINE

from collections import Counterdef func ( ) : l = [ ] x , y = map ( int , input ( ) . split ( ) ) for i in range ( y ) : l . append ( input ( ) ) ma = 0 ans = - 1 for i in l : if i . count ( '1' ) != len ( i ) : ma += 1 else : if ma > ans : ans = ma ma = 0 if ma > ans : ans = ma print ( ans ) t = 1 NEW_LINE

m , n = map ( int , input ( ) . split ( ) ) k = 0 x = 0 while n > 0 : l = input ( ) if l . count ( '1' ) != len ( l ) : x = x + 1 else : k = max ( k , x ) x = 0 n = n - 1 k = max ( k , x ) print ( k ) NEW_LINE

_ , d = input ( ) . split ( ' ▁ ' ) d = int ( d )   current = 0 previous = 0   for i in range ( d ) : s = input ( ) if '0' in s : current += 1 elif ( current > previous ) : previous = current current = 0 else : current = 0   print ( max ( previous , current ) ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : n , d = map ( int , input ( ) . split ( ) ) mx , current = 0 , 0 for _ in range ( d ) : if '0' in input ( ) : current += 1 else : mx = max ( mx , current ) current = 0 print ( max ( mx , current ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; import java . util . StringTokenizer ;   public class F { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   } public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; String s = fs . next ( ) ; Map < Character , Boolean > mp = new HashMap < > ( ) ; int change = 0 ; if ( n > 26 ) { System . out . println ( - 1 ) ; } else { for ( int i = 0 ; i < n ; i ++ ) { if ( mp . containsKey ( s . charAt ( i ) ) ) { change ++ ; } else { mp . put ( s . charAt ( i ) , true ) ; } } System . out . println ( change ) ; } } }

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

import java . util . Scanner ;   public class _0666DifferentisGood {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String input = sc . nextLine ( ) ; int count = 0 ; if ( input . length ( ) > 26 ) { System . out . println ( - 1 ) ; return ; } else { int [ ] arr = new int [ 27 ] ; for ( int i = 0 ; i < n ; i ++ ) { char temp = input . charAt ( i ) ; arr [ temp - 97 ] ++ ; } for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] != 0 ) { count += arr [ i ] - 1 ; } } } System . out . println ( count ) ; }   }

import java . util . * ; import java . math . * ; public class DifferentIsGood { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int size = sc . nextInt ( ) ; char [ ] arr = sc . next ( ) . toCharArray ( ) ; int out = 0 ; boolean [ ] letters = new boolean [ 26 ] ; if ( size > 26 ) { System . out . println ( - 1 ) ; return ; } for ( int i = 0 ; i < size ; i ++ ) { if ( letters [ arr [ i ] - ' a ' ] == true ) out ++ ; else { letters [ arr [ i ] - ' a ' ] = true ; } } System . out . println ( out ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . List ;     public class CF672BDifferentIsGood { static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) throws IOException { in . readLine ( ) ; String s = in . readLine ( ) ; if ( s . length ( ) > 26 ) { out . print ( - 1 ) ; } else { int repetitions = 0 ; List < Character > abc = new ArrayList < > ( ) ; char [ ] letters = s . toCharArray ( ) ; for ( char letter : letters ) { if ( abc . contains ( letter ) ) { repetitions ++ ; } else { abc . add ( letter ) ; } } out . print ( repetitions ) ; } out . close ( ) ; } }

n = int ( input ( ) ) s = input ( ) l = list ( s ) p = set ( l ) if ( len ( s ) > 26 ) : print ( - 1 ) elif ( len ( p ) < len ( l ) ) : print ( len ( l ) - len ( p ) ) else : print ( 0 ) NEW_LINE

n = int ( input ( ) ) s = input ( ) if n > 26 : print ( - 1 ) exit ( ) m = [ ] for i in s : if i not in m : m . append ( i ) print ( n - len ( m ) ) NEW_LINE

n = int ( input ( ) ) if n <= 26 : print ( n - len ( set ( input ( ) ) ) ) else : print ( " - 1" ) NEW_LINE

n = int ( input ( ) ) st = input ( ) st1 = set ( st ) if n < 27 : print ( n - len ( st1 ) ) else : print ( - 1 ) NEW_LINE


import java . io . * ; import java . util . * ;   public class BatchSort { static int n = 0 , m = 0 ;   public static boolean check ( int arr [ ] [ ] ) {   for ( int i = 0 ; i < n ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < m ; j ++ ) { if ( arr [ i ] [ j ] != ( j + 1 ) ) ++ count ; if ( count > 2 ) return false ; } } return true ; }   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; int arr [ ] [ ] = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) arr [ i ] [ j ] = sc . nextInt ( ) ; } if ( check ( arr ) ) { System . out . println ( " YES " ) ; return ; } for ( int i = 0 ; i < m - 1 ; i ++ ) { for ( int j = i + 1 ; j < m ; j ++ ) { for ( int k = 0 ; k < n ; k ++ ) { int temp = arr [ k ] [ i ] ; arr [ k ] [ i ] = arr [ k ] [ j ] ; arr [ k ] [ j ] = temp ; } if ( check ( arr ) ) { System . out . println ( " YES " ) ; return ; } for ( int k = 0 ; k < n ; k ++ ) { int temp = arr [ k ] [ i ] ; arr [ k ] [ i ] = arr [ k ] [ j ] ; arr [ k ] [ j ] = temp ; } } } System . out . println ( " NO " ) ; }   }

import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   sys . setrecursionlimit ( 10 ** 5 ) ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) slmii = lambda : sorted ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def gcd ( a , b ) : if b == 0 : return a return gcd ( b , a % b )     def lcm ( a , b ) : return ( a * b ) // gcd ( a , b )     def ncr ( n , r ) : return math . factorial ( n ) // ( math . factorial ( n - r ) * math . factorial ( r ) )     def npr ( n , r ) : return math . factorial ( n ) // math . factorial ( n - r )     def main ( ) : NEW_LINE

def check ( matrix , getindex = False , isfirst = False ) : indices = set ( ) canbe = True for row in matrix : count = 0 for i , value in enumerate ( row ) : if value != i + 1 : indices . update ( [ i ] ) count += 1 if count > 2 : canbe = False if count > 4 and isfirst : print ( " NO " ) exit ( ) if getindex : return list ( indices ) return canbe     n , m = map ( int , input ( ) . split ( ) ) matrix = [ ] for i in range ( n ) : row = [ int ( x ) for x in input ( ) . split ( ) ] matrix . append ( row )   indices = check ( matrix , True , True ) canbesort = check ( matrix )   for i in indices : if canbesort : break for j in indices [ 1 : ] : for k in range ( n ) : matrix [ k ] [ i ] , matrix [ k ] [ j ] = matrix [ k ] [ j ] , matrix [ k ] [ i ] canbesort = check ( matrix )   if canbesort : break for k in range ( n ) : matrix [ k ] [ i ] , matrix [ k ] [ j ] = matrix [ k ] [ j ] , matrix [ k ] [ i ]   print ( canbesort and ' YES ' or ' NO ' ) NEW_LINE

import random     def gcd ( a , b ) : if a == 0 : return b return gcd ( b % a , a )     def lcm ( a , b ) : return ( a * b ) / gcd ( a , b )     n , m = map ( int , input ( ) . split ( ) ) a = [ ] ans = 0 for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( m ) : for j in range ( i + 1 , m ) : for k in range ( n ) : t = a [ k ] [ i ] a [ k ] [ i ] = a [ k ] [ j ] a [ k ] [ j ] = t NEW_LINE

def cntmisp ( a ) : return ( sum ( [ int ( a [ i ] != ( i + 1 ) ) for i in range ( len ( a ) ) ] ) )   n , m = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] a = [ ] for i in range ( n ) : a . append ( [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] )   cnts = [ cntmisp ( x ) for x in a ]   fl = 0 if ( max ( cnts ) <= 2 ) : print ( " YES " ) else : for p1 in range ( m - 1 ) : for p2 in range ( p1 + 1 , m ) : A = [ ] for i in range ( n ) : subA = [ ] for p in range ( m ) : if ( p == p1 ) : subA . append ( a [ i ] [ p2 ] ) elif ( p == p2 ) : subA . append ( a [ i ] [ p1 ] ) else : subA . append ( a [ i ] [ p ] ) A . append ( list ( subA ) ) newcnts = [ cntmisp ( x ) for x in A ] if ( max ( newcnts ) <= 2 ) : fl = 1 print ( " YES " if ( fl ) else " NO " )   NEW_LINE


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

from collections import namedtuple   Dancer = namedtuple ( ' Dancer ' , [ ' category ' , ' x ' , ' y ' , ' idx ' , ' group ' ] )   def read_dancer ( idx ) : group , pos , time = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] x , y = None , None if group == 1 : x , y = pos , 0 else : x , y = 0 , pos return Dancer ( time - pos , x , y , idx , group )   n , w , h = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ]   dancers = [ read_dancer ( idx ) for idx in range ( n ) ]   dancers_in = sorted ( dancers , key = lambda d : ( d . category , - d . group , d . x , - d . y ) ) dancers_out = sorted ( dancers , key = lambda d : ( d . category , d . group , d . x , - d . y ) )     end_pos = [ None for _ in range ( n ) ]   def get_end_pos ( dancer ) : x , y = None , None if dancer . x == 0 : x , y = w , dancer . y else : x , y = dancer . x , h return ( x , y )   for i in range ( n ) : end_pos [ dancers_in [ i ] . idx ] = get_end_pos ( dancers_out [ i ] )   for i in range ( n ) : print ( * end_pos [ i ] ) NEW_LINE

n , w , h = map ( int , input ( ) . split ( ) )       D = [ ]       original = [ ]       for i in range ( n ) :   g , p , t = map ( int , input ( ) . split ( ) )       a = p - t       p = p if g == 1 else - p       original . append ( ( ) )   D . append ( ( a , p , i ) )       D . sort ( )       from bisect import bisect       res = [ None ] * n       i = 0   while i < len ( D ) :   a = D [ i ] [ 0 ]   j = bisect ( D , ( a + 1 , - n , 0 ) , lo = i )   m = bisect ( D , ( a , 0 , 0 ) , lo = i , hi = j )       L = D [ i : j ]   R = D [ m : j ] + D [ i : m ]       for t in range ( len ( L ) ) :   _ , _ , d = L [ t ]   _ , p , _ = R [ t ]   if p > 0 :   res [ d ] = ( p , h )   else :   res [ d ] = ( w , - p )       i = j       print ( ' \n ' . join ( str ( x ) + ' ▁ ' + str ( y ) for x , y in res ) )           NEW_LINE


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

import java . io . * ; import java . math . BigInteger ; import java . text . DecimalFormat ; import java . util . * ;         public class Main { public static InputReader in ; public static PrintWriter pw ; public static void main ( String args [ ] ) { new Thread ( null , new Runnable ( ) { public void run ( ) { try { solve ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } , "1" , 1 << 26 ) . start ( ) ; } static ArrayList < Integer > g [ ] ; static ArrayList < Integer > h [ ] ; static boolean visited [ ] ; static int [ ] parent ; static int par [ ] ; static int degree [ ] ; static int edjes = 0 ; static int start = - 1 ; static int end = - 1 ; static int Total = 0 ; static int time1 [ ] ; static int time2 [ ] ; static int glob = 0 ; static long ans [ ] = new long [ 1000000 ] ; static boolean vis2 [ ] [ ] ;

def g ( t ) : return [ ( t [ i ] + t [ i - 1 ] ) // 2 for i in range ( 1 , len ( t ) ) ] + [ 1000000 ] NEW_LINE def h ( a , b , c ) : j = s = 0 NEW_LINE for i in b : while NEW_LINE i > c [ j ] : j += 1 NEW_LINE s += abs ( i - a [ j ] ) NEW_LINE return s   n , k = map ( int , input ( ) . split ( ) ) NEW_LINE q = ' abcdefghijklmnopqrstuvwxyz ' NEW_LINE s , a = 0 , { i : [ ] for i in q } NEW_LINE for i , j in enumerate ( input ( ) ) : a [ j ] . append ( i ) NEW_LINE c = { i : g ( a [ i ] ) for i in q }   NEW_LINE def f ( ) : s , b = 0 , { i : [ ] for i in q } NEW_LINE t = input ( ) NEW_LINE for i , j in enumerate ( t ) : b [ j ] . append ( i ) NEW_LINE for i in q : if NEW_LINE b [ i ] : NEW_LINE if a [ i ] : NEW_LINE INDENT s += h ( a [ i ] , b [ i ] , c [ i ] ) else : NEW_LINE s += len ( t ) * len ( b [ i ] ) NEW_LINE DEDENT return str ( s )   print ( ' \n ' . join ( f ( ) for i in range ( n ) ) ) NEW_LINE

from bisect import bisect_leftn , k = map ( int , input ( ) . split ( ) ) NEW_LINE q = " abcdefghijklmnopqrstuvwxyz " NEW_LINE a = { i : [ ] for i in q }   for key , value in enumerate ( input ( ) ) : a [ value ] . append ( key ) NEW_LINE


import javax . annotation . processing . SupportedSourceVersion ; import java . io . * ; import java . util . * ; import java . util . regex . Matcher ;   public class Main {   public static void main ( String [ ] args ) throws IOException { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( in , out ) ; out . close ( ) ; }   private static class TaskB {   static final long max = 1000000000000000000L ; static final double eps = 0.0000001 ; static final long mod = 1000000007 ; static long X , Y ; static char line [ ] ;   void solve ( InputReader in , PrintWriter out ) throws IOException {   int a = in . nextInt ( ) ; line = in . nextLine ( ) . toCharArray ( ) ; List < Oper > list = new ArrayList < > ( ) ;   int last = - 1 ; for ( int i = 0 ; i < line . length ; i ++ ) {   if ( line [ i ] == ' a ' ) {   int C ;   if ( i == 0 ) { list . add ( new Oper ( 1 , 1 ) ) ; last = 2 ; } else if ( i - 2 >= 0 && i - 2 > last && line [ i - 1 ] == ' + ' && line [ i - 2 ] == ' + ' ) { if ( i - 3 >= 0 && line [ i - 3 ] == ' * ' ) C = getC ( i - 4 ) ; else if ( i - 3 >= 0 && line [ i - 3 ] == ' - ' ) C = - 1 ; else C = 1 ; list . add ( new Oper ( C , 0 ) ) ; last = i - 2 ; } else { if ( line [ i - 1 ] == ' * ' ) C = getC ( i - 2 ) ; else if ( line [ i - 1 ] == ' - ' ) C = - 1 ; else C = 1 ; list . add ( new Oper ( C , 1 ) ) ; last = i + 2 ; } } }

import re   class Term : def __init__ ( self , factor , type ) : self . factor = factor self . type = type def __str__ ( self ) : return ' ( % d ▁ * ▁ % s ) ' % ( self . factor , self . type )   a = int ( input ( ) ) s = ' + ' + input ( ) . strip ( ) terms = [ ] pos = 0 while pos != len ( s ) : sign = 1 if s [ pos ] == ' - ' : sign = - 1 factor = 1 if re . match ( ' \d ' , s [ pos + 1 ] ) : start = pos + 1 pos = start + 1 while s [ pos ] != ' * ' : pos += 1 factor = int ( s [ start : pos ] ) pos += 4 term_type = ' pre ' if s [ pos - 3 : pos ] == ' a + + ' : term_type = ' post ' terms . append ( Term ( sign * factor , term_type ) )   terms . sort ( key = lambda term : term . factor ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class B { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] nextArray ( 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 ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } } public static void main ( String [ ] args ) {

import java . util . Scanner ;   public class A1400 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; String S = in . next ( ) ; for ( int n = 0 ; n < N ; n ++ ) { output . append ( S . charAt ( 2 * n ) ) ; } output . append ( ' \n ' ) ; } System . out . print ( output ) ; }   }

import java . util . * ; public class Practice { void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; String bin = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < bin . length ( ) ; i += 2 ) ans += " " + bin . charAt ( i ) ; System . out . println ( ans ) ; } } public static void main ( String [ ] args ) { Practice p = new Practice ( ) ; p . solve ( ) ; } }

import java . util . * ; public class sol { public static void main ( String ar [ ] ) { Scanner scan = new Scanner ( System . in ) ; int test = scan . nextInt ( ) ; while ( test -- > 0 ) { int n = Integer . parseInt ( scan . next ( ) ) ; String s = scan . next ( ) . trim ( ) ; String ch = "1" ; if ( s . charAt ( n - 1 ) == '0' ) ch = "0" ; while ( n -- > 0 ) System . out . print ( ch ) ; System . out . println ( ) ; } } }

t = int ( input ( ) )   while t : size , string = int ( input ( ) ) , input ( )   for i in range ( 0 , len ( string ) , 2 ) : print ( string [ i ] , end = ' ' ) print ( )           t -= 1 NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) s = input ( ) q = s [ n - 1 ] * n print ( q ) NEW_LINE

import matht = int ( input ( ) ) while t : n = int ( input ( ) ) s = input ( ) li = [ ] for i in range ( 0 , n ) : x = s [ i : i + n + 1 ] li . append ( x ) a = ' ' index = - 1 for i in range ( 0 , n ) : c = 0 d = 0 for j in li : if j [ i ] == '0' : c += 1 else : d += 1 if c == n : a = '0' index = i break elif d == n : a = '1' index = i break w = " " for i in range ( 0 , n ) : if i != index : w += "0" else : if d == n : w += "1" elif c == n : w += "0" print ( w ) t -= 1 NEW_LINE

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = input ( ) print ( n * s [ n - 1 ] ) NEW_LINE


import java . util . * ;   public class eDictonary { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String s = scan . next ( ) ; StringBuilder sb = new StringBuilder ( s ) ; int index = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i == s . length ( ) - 1 ) { sb . deleteCharAt ( index ) ; break ; } else if ( sb . charAt ( index ) <= sb . charAt ( index + 1 ) ) { index ++ ; } else { sb . deleteCharAt ( index ) ; break ; } } System . out . println ( sb ) ; } }

import java . util . * ; public class _1076A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; char c = ' \u0000' ; int f = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { char ch = s . charAt ( i ) ; char ch2 = s . charAt ( i + 1 ) ; if ( ch > ch2 ) { c = ch ; f = 1 ; break ; } } if ( f == 0 ) c = s . charAt ( n - 1 ) ; f = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( f == 0 && s . charAt ( i ) == c ) { f = 1 ; continue ; } System . out . print ( s . charAt ( i ) ) ; } } }

import javax . swing . plaf . IconUIResource ; import java . util . * ;

import java . lang . * ; import java . util . * ;   public class Abhishek { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; StringBuilder s = new StringBuilder ( sc . nextLine ( ) ) ; char max = s . charAt ( 0 ) ; boolean fl = false ; for ( int i = 1 ; i < n ; i ++ ) { max = ( char ) Math . max ( s . charAt ( i ) , s . charAt ( i - 1 ) ) ; if ( s . charAt ( i - 1 ) > s . charAt ( i ) ) { s . deleteCharAt ( i - 1 ) ; fl = true ; break ; }   } if ( ! fl ) { s . deleteCharAt ( s . indexOf ( String . valueOf ( max ) ) ) ; }   System . out . println ( s ) ; } }

n = int ( input ( ) ) s = input ( ) i = 1 while i < n and s [ i - 1 ] <= s [ i ] : i += 1 print ( s [ : i - 1 ] + s [ i : ] ) NEW_LINE

from sys import maxsize , stdout , stdin , stderrmod = int ( 1e9 + 7 ) def I ( ) : return int ( stdin . readline ( ) ) def lint ( ) : return [ int ( x ) for x in stdin . readline ( ) . split ( ) ] def S ( ) : return input ( ) . strip ( ) def grid ( r , c ) : return [ lint ( ) for i in range ( r ) ] from collections import defaultdictimport mathn = I ( ) s = input ( ) for i in range ( n - 1 ) : if ord ( s [ i ] ) > ord ( s [ i + 1 ] ) : s = s [ : i ] + s [ i + 1 : ] breakif len ( s ) == n : s = s [ : - 1 ] print ( s )   NEW_LINE

n = int ( input ( ) ) st = input ( ) for i in range ( n - 1 ) : if st [ i ] > st [ i + 1 ] : st = st [ : i ] + st [ i + 1 : ] breakif len ( st ) != n : print ( st ) else : print ( st [ : - 1 ] ) NEW_LINE

n = int ( input ( ) ) s = str ( input ( ) ) for i in range ( n - 1 ) : j = ord ( s [ i ] ) - ord ( ' a ' ) k = ord ( s [ i + 1 ] ) - ord ( ' a ' ) if j > k : p = i breakelse : print ( s [ 0 : n - 1 ] ) exit ( ) ans = s [ 0 : p ] + s [ p + 1 : n ] print ( ans ) NEW_LINE

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   def main ( ) : n = int ( input ( ) ) s = input ( ) removed = False for i in range ( n - 1 ) : if s [ i ] > s [ i + 1 ] and not removed : removed = True continue print ( s [ i ] , end = ' ' ) if removed : print ( s [ n - 1 ] , end = ' ' ) main ( ) NEW_LINE


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

import java . util . Scanner ;   public class Main {   static int n , sol , auxs ; static int pizza [ ] ;   public static void main ( String args [ ] ) { Scanner l = new Scanner ( System . in ) ; n = l . nextInt ( ) ; pizza = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { pizza [ i ] = l . nextInt ( ) ; } sol = 360 ; for ( int i = 0 ; i < n ; i ++ ) { auxs = 0 ; for ( int k = 0 ; i + k <= n ; k ++ ) { sol = Math . min ( sol , Math . abs ( 360 - auxs * 2 ) ) ; if ( i + k < n ) { auxs += pizza [ i + k ] ; } } } System . out . println ( sol ) ; } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { int n ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; n = Integer . parseInt ( br . readLine ( ) ) ; String s [ ] = br . readLine ( ) . split ( " ▁ " ) ; int arr [ ] = new int [ n ] ; arr [ 0 ] = Integer . parseInt ( s [ 0 ] ) ; int ans = Math . abs ( 180 - arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { arr [ i ] += arr [ i - 1 ] + Integer . parseInt ( s [ i ] ) ; ans = Math . min ( ans , Math . abs ( arr [ i ] - 180 ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { int angle = arr [ j ] - arr [ i ] ; ans = Math . min ( Math . abs ( angle - 180 ) , ans ) ; } } System . out . println ( ans * 2 ) ;

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

import java . io . * ; import java . util . * ;   public class pizzaseparate { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int n = Integer . parseInt ( ( st . nextToken ( ) ) ) ; int ans = 360 ; int [ ] slices = new int [ 360 ] ; st = new StringTokenizer ( f . readLine ( ) ) ; int total = 360 ; for ( int i = 0 ; i < n ; i ++ ) { slices [ i ] = Integer . parseInt ( ( st . nextToken ( ) ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { int currentDiff = 0 ; for ( int j = i ; j < n ; j ++ ) { currentDiff += slices [ j ] ; ans = Math . min ( ans , Math . abs ( ( total - currentDiff ) - currentDiff ) ) ; } } out . println ( ans ) ; out . close ( ) ; } }

N = int ( input ( ) ) raw = input ( ) numbers = [ int ( token ) for token in raw . split ( ' ▁ ' ) ]   total = sum ( numbers )   smallest = 1000 for i in range ( N ) : for j in range ( i , N ) : sum1 = sum ( numbers [ i : j ] ) sum2 = total - sum1 smallest = min ( smallest , abs ( sum1 - sum2 ) )   print ( smallest )   NEW_LINE

import osimport sysfrom math import * from collections import *   NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) res = 360 for qq in range ( n ) : sm = 0 for i in range ( n - 1 ) : sm += a [ i ] q = 360 - sm res = min ( res , abs ( sm - q ) ) a = [ a [ - 1 ] ] + a [ : - 1 ] print ( res ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )     res = float ( " inf " )     for i in range ( len ( a ) ) :   l , r = 0 , 360 for i in a [ i : ] + a [ : i ] : res = min ( res , abs ( l - r ) ) l += i r -= i   res = min ( res , abs ( l - r ) )   print ( res ) NEW_LINE

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) r = [ 0 ] * nmn = 360 for i in range ( n ) : q = [ ] q . extend ( p [ i : ] ) if i > 0 : q . extend ( p [ 0 : i ] ) NEW_LINE


import java . io . * ; import java . util . HashMap ; public class sol { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String s = br . readLine ( ) ; String str [ ] = s . trim ( ) . split ( " \\ s + " ) ; int a [ ] = new int [ str . length ] ; for ( int i = 0 ; i < str . length ; i ++ ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; } HashMap < Integer , Integer > data = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { data . put ( a [ i ] , i + 1 ) ; } for ( int i = 1 ; i <= a . length ; i ++ ) { System . out . print ( data . get ( i ) + " ▁ " ) ; } } }

import java . io . * ; import java . util . HashMap ; public class sol { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String s = br . readLine ( ) ; String str [ ] = s . trim ( ) . split ( " \\ s + " ) ; int a [ ] = new int [ str . length ] ; for ( int i = 0 ; i < str . length ; i ++ ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; } HashMap < Integer , Integer > data = new HashMap < Integer , Integer > ( ) ; int t = 1 ; for ( int i = 0 ; i < a . length ; i ++ ) { data . put ( a [ i ] , t ) ; t ++ ; } t = 1 ; for ( int i = 0 ; i < a . length ; i ++ ) { System . out . print ( data . get ( t ) + " ▁ " ) ; t ++ ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class A_Presents { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) , p ; int [ ] ans = new int [ n + 1 ] ;   for ( int i = 1 ; i <= n ; i ++ ) { p = fs . nextInt ( ) ; ans [ p ] = i ; }   for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( ans [ i ] + " ▁ " ) ; } }   static int min ( int a , int b ) { return Math . min ( a , b ) ; }   static int max ( int a , int b ) { return Math . max ( a , b ) ; }   static long min ( long a , long b ) { return Math . min ( a , b ) ; }   static long max ( long a , long b ) { return Math . max ( a , b ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ; import java . io . * ; public class Presents { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String str = br . readLine ( ) ; String split [ ] = str . split ( " ▁ " ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( split [ i ] ) ; calculatePresents ( a ) ; } private static void calculatePresents ( int a [ ] ) { int b [ ] = new int [ a . length ] ; for ( int i = 0 ; i < a . length ; i ++ ) { int no = a [ i ] ; b [ no - 1 ] = i ; } for ( int i = 0 ; i < b . length ; i ++ ) System . out . print ( b [ i ] + 1 + " ▁ " ) ; } }

import java . util . * ; import java . lang . * ; import java . io . * ; public class pyta   { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { arr [ j ] = sc . nextInt ( ) ; } int ans [ ] = new int [ n ] ; int t = 0 ; int p = 1 ; for ( int b = 0 ; b < n ; b ++ ) { for ( int a = 0 ; a < n ; a ++ ) { if ( arr [ a ] == p ) { ans [ t ] = a + 1 ; t ++ ; p ++ ; } } } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( ans [ i ] + " ▁ " ) ; } } }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( len ( l ) ) : for j in range ( len ( l ) ) : if ( ( i + 1 ) == l [ j ] ) : print ( j + 1 , end = ' ▁ ' ) NEW_LINE

x = int ( input ( ) ) ; a = input ( ) . split ( ) ; print ( * [ a . index ( str ( i + 1 ) ) + 1 for i in range ( x ) ] ) NEW_LINE


import java . util . Scanner ;   public class A134 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] A = new int [ N ] ; long sum = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int a = in . nextInt ( ) ; sum += a ; A [ n ] = a ; } int count = 0 ; StringBuilder sb = new StringBuilder ( ) ; for ( int n = 0 ; n < N ; n ++ ) { if ( sum == N * A [ n ] ) { count ++ ; sb . append ( n + 1 ) . append ( ' ▁ ' ) ; } } System . out . println ( count ) ; System . out . println ( sb ) ; }   }

import java . io . * ; import java . util . * ; public class S { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; long a [ ] = new long [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextLong ( ) ; sum = sum + a [ i ] ; } ArrayList < Long > al = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { sum -= a [ i ] ; if ( sum % ( n - 1 ) == 0 && sum / ( n - 1 ) == a [ i ] ) { al . add ( ( long ) i + 1 ) ; } sum += a [ i ] ; } System . out . println ( al . size ( ) ) ; for ( int i = 0 ; i < al . size ( ) ; i ++ ) { System . out . print ( al . get ( i ) + " ▁ " ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class averageNumbers { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int c = 0 ; double sum = 0 ; int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; sum = sum + a [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == ( sum - a [ i ] ) / ( n - 1 ) ) { b [ c ] = i ; c ++ ; } } System . out . println ( c ) ; for ( int i = 0 ; i < c ; i ++ ) { System . out . print ( b [ i ] + 1 + " ▁ " ) ; } } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int c = 0 ; double sum = 0 ; int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; sum = sum + a [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == ( sum - a [ i ] ) / ( n - 1 ) ) { b [ c ] = i ; c ++ ; } } System . out . println ( c ) ; for ( int i = 0 ; i < c ; i ++ ) { System . out . print ( b [ i ] + 1 + " ▁ " ) ; } } }

import java . util . Scanner ;   public class AverageNumbers {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long arr [ ] = new long [ n ] ; long arr2 [ ] = new long [ n ] ; long sum = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = input . nextInt ( ) ; sum += arr [ i ] ; } for ( int j = 0 ; j < n ; j ++ ) { if ( ( sum - arr [ j ] ) == ( arr [ j ] * ( n - 1 ) ) ) { arr2 [ count ] = j ; count ++ ; } } System . out . println ( count ) ; if ( count != 0 ) { for ( int k = 0 ; k < count ; k ++ ) { System . out . print ( arr2 [ k ] + 1 + " ▁ " ) ; } } input . close ( ) ; }   }

n = int ( input ( ) ) a = [ int ( c ) for c in input ( ) . split ( ) ] k = sum ( a ) / len ( a ) b = [ ] for i in range ( len ( a ) ) : if a [ i ] == k : b . append ( i + 1 ) print ( len ( b ) ) print ( * b ) NEW_LINE

import sysimport mathn = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] l1 = [ ] s = sum ( l ) c = 0 for i in range ( n ) : if ( l [ i ] == ( s - l [ i ] ) / ( n - 1 ) ) : c += 1 l1 . append ( i + 1 ) print ( c ) print ( * l1 ) NEW_LINE

n = int ( input ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) sm = sum ( ar ) if ( sm // n * n != sm ) : print ( 0 ) else : vl = sm // n print ( ar . count ( vl ) ) print ( * [ x + 1 for x in range ( n ) if ar [ x ] == vl ] ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : cin = input n = int ( cin ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] s = sum ( a ) b = [ str ( i + 1 ) for i in range ( n ) if a [ i ] * ( n - 1 ) == s - a [ i ] ] print ( len ( b ) ) print ( " ▁ " . join ( b ) ) NEW_LINE

n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) B = [ ] srar = 0     for i in range ( n ) : srar += A [ i ] srar = srar / n       for i in range ( n ) : if ( ( srar * n ) - A [ i ] ) / ( n - 1 ) == A [ i ] : B . append ( i + 1 ) print ( len ( B ) ) for i in range ( len ( B ) ) : print ( B [ i ] , end = ' ▁ ' ) NEW_LINE


import java . util . * ; import java . io . * ; public class Main {   public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int s [ ] = new int [ n ] ; int d [ ] = new int [ m ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; ; } for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . nextInt ( ) ; if ( p [ i ] > d [ s [ i ] - 1 ] ) { d [ s [ i ] - 1 ] = p [ i ] ; } } for ( int i = 0 ; i < k ; i ++ ) { int c = sc . nextInt ( ) ; if ( p [ c - 1 ] < d [ s [ c - 1 ] - 1 ] ) count ++ ; } System . out . println ( count ) ; }   }    class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int t , n , m , i , j , k , count , min , sch , pow ; t = 1 ; while ( t > 0 ) { t -- ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; k = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int s [ ] = new int [ n ] ; int c [ ] = new int [ k ] ; for ( i = 0 ; i < n ; i ++ ) p [ i ] = sc . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) s [ i ] = sc . nextInt ( ) ; for ( i = 0 ; i < k ; i ++ ) c [ i ] = sc . nextInt ( ) ; count = 0 ; for ( i = 0 ; i < k ; i ++ ) { min = c [ i ] - 1 ; sch = s [ min ] ; pow = p [ min ] ; for ( j = 0 ; j < n ; j ++ ) { if ( s [ j ] == sch && p [ j ] > pow ) { count ++ ; break ; } } } System . out . println ( count ) ; } } catch ( Exception e ) { } } }

import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . RoundingMode ; import java . util . * ; import java . util . concurrent . LinkedBlockingDeque ;    public class scratch_25 {

n , m , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in range ( n ) : if d . get ( b [ i ] ) : if d [ b [ i ] ] < a [ i ] : d [ b [ i ] ] = a [ i ] else : d [ b [ i ] ] = a [ i ] ans = 0 for i in c : if a [ i - 1 ] < d [ b [ i - 1 ] ] : ans += 1 print ( ans ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( map ( int , input ( ) . split ( ) ) ) c = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) dic = { } for i in range ( n ) : if s [ i ] not in dic : dic [ s [ i ] ] = p [ i ] else : if p [ i ] > dic [ s [ i ] ] : dic [ s [ i ] ] = p [ i ] ans = 0j = 0 for i in range ( n ) : if j < k : if c [ j ] == i + 1 : if p [ i ] < dic [ s [ i ] ] : ans += 1 j += 1 else : break print ( ans ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( map ( int , input ( ) . split ( ) ) ) k = list ( map ( int , input ( ) . split ( ) ) ) count = 0 for i in k : l = s [ i - 1 ] t = p [ i - 1 ] for i in range ( n ) : if s [ i ] == l and p [ i ] > t : count += 1 breakprint ( count ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) p = [ int ( i ) for i in input ( ) . split ( ) ] s = [ int ( i ) for i in input ( ) . split ( ) ] c = [ int ( i ) for i in input ( ) . split ( ) ] count = 0 for i in c : x = i - 1 school = s [ x ] for j in range ( n ) : if s [ j ] == school and p [ j ] > p [ x ] : count += 1 breakprint ( count ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) P = list ( map ( int , input ( ) . split ( ) ) ) S = list ( map ( int , input ( ) . split ( ) ) ) C = list ( map ( int , input ( ) . split ( ) ) )   M = [ - 1 ] * md = { } for i , s in enumerate ( S ) : d [ i ] = s - 1 M [ s - 1 ] = max ( P [ i ] , M [ s - 1 ] )   ans = 0 for c in C : if M [ d [ c - 1 ] ] != P [ c - 1 ] : ans += 1 print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ; import java . math . BigInteger ; import java . lang . Object ;    public class Main { static class sort implements Comparator < int [ ] > { public int compare ( int [ ] a , int [ ] b ) {

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

def Work ( ) : global n , arr , f , last , ans NEW_LINE n = int ( input ( ) ) NEW_LINE arr = [ 0 ] * ( n + 1 ) NEW_LINE arr [ 1 : ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE f = [ 0 ] * ( n + 1 ) NEW_LINE ans = [ - 1 ] * ( n + 1 ) NEW_LINE last = [ 0 ] * ( n + 1 )   for i in range ( 1 , n + 1 ) : f [ arr [ i ] ] = max ( f [ arr [ i ] ] , i - last [ arr [ i ] ] ) NEW_LINE last [ arr [ i ] ] = i   for x in range ( 1 , n + 1 ) : f [ x ] = max ( f [ x ] , n - last [ x ] + 1 )   i = f [ x ] NEW_LINE while i <= n and ans [ i ] == - 1 : ans [ i ] = x NEW_LINE i += 1 NEW_LINE for e in range ( 1 , n + 1 ) : print ( ans [ e ] , end = " ▁ " ) NEW_LINE print ( )           if __name__ == " _ _ main _ _ " : t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : Work ( )     ''' TC ▁ = ▁ O ( n )   / / ▁ array ▁ consists ▁ of ▁ number ▁ from ▁ 1 ▁ to ▁ n ▁ only / / ▁ Task ▁ - > ▁ for ▁ each ▁ i ▁ from ▁ 1 ▁ to ▁ k ▁ find ▁ number ▁ that ▁ occurs ▁ in ▁ all / / ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ subarrays ▁ of ▁ size ▁ i / / / / ▁ for ▁ every ▁ i ▁ from ▁ 1 ▁ to ▁ n ▁ we ▁ calculate ▁ value ▁ of ▁ min ▁ value ▁ of ▁ such ▁ k / / ▁ and ▁ say ▁ for ▁ a ▁ number ▁ i ▁ it ▁ value ▁ of ▁ k ▁ is ▁ f [ k ] / / ▁ / / ▁ for ▁ each ▁ i ▁ from ▁ 1 ▁ to ▁ n ▁ : / / ▁ ▁ ▁ ▁ ▁ ▁ x ▁ = ▁ arr [ i ] / / ▁ ▁ ▁ ▁ ▁ ▁ f [ x ] ▁ = ▁ max ( f [ x ] , i - last [ x ] ) ▁ / / ▁ in ▁ each ▁ iteration ▁ we ▁ are ▁ calciulating / / ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ / / ▁ value ▁ of ▁ f [ arr [ i ] ] ▁ and ▁ updating ▁ if ▁ i - last [ arr [ i ] ] / / ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ / / ▁ is ▁ greater ▁ than ▁ f [ arr [ i ] ] / / / / / / ▁ now ▁ for ▁ each ▁ x ▁ from ▁ 1 ▁ to ▁ n : / / ▁ ▁ ▁ ▁ ▁ ▁ f [ x ] ▁ = ▁ max ( f [ x ] , n - last [ x ] + 1 ) ▁ / / boundary ▁ condition / / ▁ ▁ ▁ ▁ ▁ ▁ update ▁ ans [ i ] ▁ such ▁ that ▁ i > = f [ x ] ▁ and ▁ ans [ i ] ! = - 1 / / / / print ▁ ans ''' NEW_LINE

from sys import stdin , stdout   outputs = [ ] NEW_LINE t = int ( stdin . readline ( ) . strip ( ) ) NEW_LINE for __ in range ( t ) : n = int ( stdin . readline ( ) . strip ( ) ) NEW_LINE res = [ n + 2 ] * n NEW_LINE arr = [ int ( num ) for num in stdin . readline ( ) . strip ( ) . split ( ) ] NEW_LINE req = [ [ - 1 , - 1 , - 1 ] for i in range ( n + 1 ) ] NEW_LINE

from collections import defaultdictdef NEW_LINE function ( A ) : n = len ( A ) NEW_LINE hash = defaultdict ( lambda : [ 0 , - 1 ] ) NEW_LINE for i in range ( n ) : prev = hash [ A [ i ] ] [ 1 ] NEW_LINE dist = i - prev NEW_LINE hash [ A [ i ] ] = [ max ( hash [ A [ i ] ] [ 0 ] , dist ) , i ] NEW_LINE visited = set ( ) NEW_LINE for i in range ( n - 1 , - 1 , - 1 ) : if NEW_LINE A [ i ] not in visited : visited . add ( A [ i ] ) NEW_LINE hash [ A [ i ] ] [ 0 ] = max ( hash [ A [ i ] ] [ 0 ] , n - hash [ A [ i ] ] [ 1 ] ) NEW_LINE z = dict ( ) NEW_LINE for u in hash . keys ( ) : z [ u ] = hash [ u ] [ 0 ] NEW_LINE length_to_x = defaultdict ( lambda : 2 ** 36 ) NEW_LINE for key in z : length_to_x [ z [ key ] ] = min ( length_to_x [ z [ key ] ] , key ) NEW_LINE res = [ 2 ** 36 for i in range ( n ) ] NEW_LINE if len ( set ( A ) ) != 1 : NEW_LINE INDENT res [ 0 ] = 2 ** 36 else : NEW_LINE res [ 0 ] = A [ 0 ] NEW_LINE DEDENT for i in range ( 1 , n ) : length = i + 1 NEW_LINE res [ i ] = res [ i - 1 ] NEW_LINE if length in length_to_x : res [ i ] = min ( res [ i ] , length_to_x [ length ] ) NEW_LINE for i in range ( n ) : if NEW_LINE res [ i ] == 2 ** 36 : res [ i ] = - 1 NEW_LINE return rest = int ( input ( ) ) NEW_LINE for u in range ( t ) : n = int ( input ( ) ) NEW_LINE A = [ int ( k ) for k in input ( ) . split ( ) ] [ : n ] NEW_LINE B = function ( A ) NEW_LINE for x in B : print ( x , " " , end = ' ' ) NEW_LINE print ( ) NEW_LINE


import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int res = 1 ; for ( int i = 1 ; i < n ; i ++ ) { res += 4 * i ; } System . out . println ( res ) ; } }

import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int arr [ ] = new int [ 101 ] ; int n = sc . nextInt ( ) ; arr [ 0 ] = 1 ; arr [ 1 ] = 5 ; for ( int i = 2 ; i < 101 ; i ++ ) { arr [ i ] = arr [ i - 1 ] + 2 * ( arr [ i - 1 ] - arr [ i - 2 ] ) ; } System . out . println ( 2 * n * ( n - 1 ) + 1 ) ; } }

import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; System . out . println ( n * n + ( n - 1 ) * ( n - 1 ) ) ; } }

import java . util . * ; import java . io . * ; import java . lang . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n + ( n - 1 ) * ( n - 1 ) ) ; sc . close ( ) ; } }

import java . util . Scanner ;   public class A1180 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , s ; s = n * n + ( n - 1 ) * ( n - 1 ) ; System . out . print ( s ) ; } }

n = int ( input ( ) ) print ( 2 * n * ( n - 1 ) + 1 ) NEW_LINE

def dp ( n ) : if n == 1 : return 1 return 4 * ( n - 1 ) + dp ( n - 1 ) print ( dp ( int ( input ( ) ) ) ) NEW_LINE

n = int ( input ( ) ) print ( 1 + ( n - 1 ) * n * 2 ) NEW_LINE

n = int ( input ( ) ) if ( n == 1 ) : print ( 1 ) else : ans = 2 * n - 1 while ( n >= 2 ) : ans += 4 * n - 6 n -= 1 print ( ans ) NEW_LINE

n = int ( input ( ) ) count = 2 * ( n - 1 ) ** 2 + 2 * n - 1 print ( count ) NEW_LINE


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

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

import java . util . * ;   public class Solve { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int positive = 0 , negative = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < 0 ) { negative ++ ; } if ( a [ i ] > 0 ) { positive ++ ; } } if ( n % 2 != 0 ) { n ++ ; } if ( positive >= n / 2 ) { System . out . println ( 1 ) ; } else if ( negative >= n / 2 ) { System . out . println ( - 1 ) ; } else { System . out . println ( 0 ) ; } } }

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 count = 0 , less = 0 , zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( a > 0 ) { count ++ ; } else if ( a < 0 ) { less ++ ; } else { zero ++ ; } } int c = 0 ; if ( n % 2 == 0 ) { c = n / 2 ; } else { c = ( n / 2 ) + 1 ; } if ( count >= c ) { System . out . println ( "1" ) ; } else if ( less > count && less >= c ) { System . out . println ( " - 1" ) ; } else { System . out . println ( "0" ) ; } } }

from math import ceilnum = ( - ( - int ( input ( ) ) ) ) / 2 p , n , o = [ ] , [ ] , [ ] for v in map ( int , input ( ) . split ( ) ) : if v > 0 : p . append ( v ) if v < 0 : n . append ( v ) if len ( p ) >= num or len ( n ) >= num : ans = { 1 : len ( p ) , - 1 : len ( n ) } print ( max ( ans , key = lambda x : ans [ x ] ) ) else : print ( 0 ) NEW_LINE

import mathn = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) )   least = math . ceil ( n / 2 )   newlist = [ i for i in l if i != 0 ] p = 0 n = 0   if len ( newlist ) >= least : for i in newlist : if i / 1 > 0 : p += 1 else : n += 1 if p >= n : if p >= least : print ( 1 ) else : print ( 0 ) else : if n >= least : print ( - 1 ) else : print ( 0 ) else : print ( 0 ) NEW_LINE

import math   n = int ( input ( ) ) L = list ( map ( int , input ( ) . split ( ) ) ) need = int ( math . ceil ( n / 2 ) ) neg = 0 pos = 0 for i in L : if i < 0 : neg += 1 elif i > 0 : pos += 1 if pos >= need : print ( 1 ) elif neg >= need : print ( - 1 ) else : print ( 0 ) NEW_LINE

import mathn = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = 0 d = 0 for i in l : if i / 1 > 0 : c += 1 for i in l : if i / ( - 1 ) > 0 : d += 1 if c >= math . ceil ( n / 2 ) : print ( 1 ) elif d >= math . ceil ( n / 2 ) : print ( - 1 ) else : print ( 0 ) NEW_LINE

n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) count = 0 d = 0 for i in li : if i / 1 > 0 : count += 1 for j in li : if j / ( - 1 ) > 0 : d += 1 if count >= n / 2 : print ( 1 ) elif d >= n / 2 : print ( - 1 ) else : print ( 0 ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ;     public class Main {   static int [ ] dx = { 0 , 1 , 0 , - 1 } ; static int [ ] dy = { - 1 , 0 , 1 , 0 } ;   static int [ ] ddx = { 0 , 1 , 0 , - 1 , - 1 , 1 , 1 , - 1 } ; static int [ ] ddy = { - 1 , 0 , 1 , 0 , - 1 , - 1 , 1 , 1 } ;   static int [ ] kx = { 2 , 1 , - 1 , - 2 , - 2 , - 1 , 1 , 2 } ; static int [ ] ky = { 1 , 2 , 2 , 1 , - 1 , - 2 , - 2 , - 1 } ;   static long MOD = Long . MAX_VALUE ;   static final int MAX = 50000 ; static long INF = Long . MAX_VALUE ;   static double PI = 3.1415926535 ;   public static void main ( String [ ] args ) {   InputReader in = new InputReader ( System . in ) ;   int n = in . nextInt ( ) ; long p = in . nextLong ( ) ; long k = in . nextLong ( ) ; Map < Long , Long > map = new HashMap < Long , Long > ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long a = in . nextLong ( ) ; long b = bigMod ( a , 4 , p ) - ( ( k * a ) % p ) ; if ( b < 0 ) { b += p ; } if ( map . containsKey ( b ) ) { long val = map . get ( b ) ; ans += val ; val ++ ; map . put ( b , val ) ; } else { map . put ( b , ( long ) 1 ) ; } } System . out . println ( ans ) ; System . exit ( 0 ) ; }

from collections import defaultdict   n , p , k = map ( int , input ( ) . split ( ) ) keys = list ( map ( int , input ( ) . split ( ) ) ) dictionary = defaultdict ( lambda : 0 ) answer = 0   for key in keys : answer += dictionary [ ( pow ( key , 4 , p ) - k * key ) % p ] dictionary [ ( key ** 4 - k * key ) % p ] += 1   print ( answer ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { static final boolean _DEBUG = false ;   private static class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( BufferedReader _br ) { br = _br ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return " " ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   }   static MyScanner scan ; static PrintWriter out ;   static int debugCount = 0 ; static void debug ( String msg ) { if ( _DEBUG && debugCount < 200 ) { out . println ( msg ) ; out . flush ( ) ; debugCount ++ ; } } public static void main ( String args [ ] ) throws IOException {

class Racer : def NEW_LINE __init__ ( self , name , points ) : self . name = name NEW_LINE self . points = points NEW_LINE def __str__ ( self ) : return ' % s ▁ % d ' % ( self . name , self . points ) NEW_LINE   n = int ( input ( ) ) NEW_LINE best = n * [ None ] NEW_LINE worst = n * [ None ] NEW_LINE for i in range ( n ) : name , points = input ( ) . split ( ) NEW_LINE points = int ( points ) NEW_LINE best [ i ] = Racer ( name , points ) NEW_LINE worst [ i ] = Racer ( name , points ) NEW_LINE m = int ( input ( ) ) NEW_LINE place_bonus = list ( reversed ( sorted ( map ( int , input ( ) . split ( ) ) ) ) ) NEW_LINE your_name = input ( ) . strip ( )   debugging = Falsedef NEW_LINE debug_print ( s ) : NEW_LINE if debugging : print ( s )   NEW_LINE def find ( racers , name ) : for NEW_LINE i in range ( n ) : NEW_LINE if racers [ i ] . name == name : return i   NEW_LINE def sort_racers ( racers ) : racers . sort ( key = lambda racer : ( - racer . points , racer . name ) ) NEW_LINE     NEW_LINE


import java . util . Scanner ;   public class I { public static void main ( String [ ] args ) {   int arr [ ] = new int [ 6 ] ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 6 ; i ++ ) arr [ i ] = scan . nextInt ( ) ;   boolean thereis = false ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = i + 1 ; j < 5 ; j ++ ) { for ( int k = j + 1 ; k < 6 ; k ++ ) { int op [ ] = new int [ 3 ] ; int t = 0 ; for ( int q = 0 ; q <= 5 ; q ++ ) { if ( q != i && q != j && q != k ) { op [ t ] = q ; t ++ ; } } if ( arr [ i ] + arr [ k ] + arr [ j ] == arr [ op [ 0 ] ] + arr [ op [ 1 ] ] + arr [ op [ 2 ] ] ) { thereis = true ; } } } } if ( thereis ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . util . Scanner ;   public class Eieve {   public static void main ( String args [ ] ) {   Scanner input = new Scanner ( System . in ) ; int [ ] a = new int [ 6 ] ; int s = 0 , c = 0 ; for ( int i = 0 ; i < 6 ; i ++ ) { a [ i ] = input . nextInt ( ) ; s = s + a [ i ] ; } int s1 = s / 2 ; if ( s % 2 == 0 ) { for ( int i = 0 ; i < 6 ; i ++ ) { for ( int j = i + 1 ; j < 6 ; j ++ ) { for ( int k = j + 1 ; k < 6 ; k ++ ) { if ( a [ i ] + a [ j ] + a [ k ] == s1 ) { System . out . println ( " yes " ) ; c ++ ; break ; } } if ( c == 1 ) { break ; } } if ( c == 1 ) { break ; }   } if ( c == 0 ) { System . out . println ( " no " ) ; } } else { System . out . println ( " no " ) ; }   }   }

r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) arr . sort ( )     f = Falsefor i in range ( 0 , len ( arr ) ) : for j in range ( 0 , len ( arr ) ) : for k in range ( 0 , len ( arr ) ) : if i != j != k != i : if arr [ i ] + arr [ j ] + arr [ k ] == sum ( arr ) / 2 : NEW_LINE

from itertools import combinationsl = list ( map ( int , input ( ) . split ( ) ) ) s = sum ( l ) ; f = 0 if s % 2 != 0 : print ( " NO " ) f = 1 else : for i in combinations ( l , 3 ) : if sum ( i ) == s // 2 : print ( " YES " ) f = 1 breakif f == 0 : print ( " NO " ) NEW_LINE

from itertools import * a = [ int ( x ) for x in input ( ) . split ( ) ] s1 = 0 s2 = 0 flag = 0 for o in permutations ( a ) : s1 = o [ 0 ] + o [ 1 ] + o [ 2 ] s2 = o [ 3 ] + o [ 4 ] + o [ 5 ] if ( s1 == s2 ) : flag = 1 break if ( flag == 1 ) : print ( " YES " ) else : print ( " NO " ) NEW_LINE

numbers = [ ] numbers = [ int ( item ) for item in input ( ) . split ( ) ] numbers . sort ( ) if ( ( numbers [ 0 ] + numbers [ 5 ] + numbers [ 1 ] ) == ( numbers [ 2 ] + numbers [ 3 ] + numbers [ 4 ] ) ) : print ( " Yes " ) elif ( ( numbers [ 2 ] + numbers [ 5 ] + numbers [ 1 ] ) == ( numbers [ 0 ] + numbers [ 3 ] + numbers [ 4 ] ) ) : print ( " Yes " ) elif ( ( numbers [ 0 ] + numbers [ 5 ] + numbers [ 2 ] ) == ( numbers [ 1 ] + numbers [ 3 ] + numbers [ 4 ] ) ) : print ( " Yes " ) elif ( ( numbers [ 0 ] + numbers [ 5 ] + numbers [ 3 ] ) == ( numbers [ 2 ] + numbers [ 1 ] + numbers [ 4 ] ) ) : print ( " Yes " ) elif ( ( numbers [ 0 ] + numbers [ 5 ] + numbers [ 4 ] ) == ( numbers [ 2 ] + numbers [ 1 ] + numbers [ 3 ] ) ) : print ( " Yes " ) else : print ( " No " ) NEW_LINE

lst = [ int ( i ) for i in input ( ) . split ( ) ] if ( sum ( lst ) % 2 == 1 ) : print ( " NO " ) else : avr = sum ( lst ) / 2 hasPrint = False for a in range ( 6 ) : for b in range ( a + 1 , 6 ) : for c in range ( b + 1 , 6 ) : if lst [ a ] + lst [ b ] + lst [ c ] == avr and not hasPrint : print ( " YES " ) hasPrint = True if not hasPrint : print ( " No " ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { String [ ] name = { " Washington " , " Adams " , " Jefferson " , " Madison " , " Monroe " , " Adams " , " Jackson " , " Van ▁ Buren " , " Harrison " , " Tyler " , " Polk " , " Taylor " , " Fillmore " , " Pierce " , " Buchanan " , " Lincoln " , " Johnson " , " Grant " , " Hayes " , " Garfield " , " Arthur " , " Cleveland " , " Harrison " , " Cleveland " , " McKinley " , " Roosevelt " , " Taft " , " Wilson " , " Harding " , " Coolidge " , " Hoover " , " Roosevelt " , " Truman " , " Eisenhower " , " Kennedy " , " Johnson " , " Nixon " , " Ford " , " Carter " , " Reagan " , " Bush " , " Clinton " , " Bush " , " Obama " , " Trump " } ; Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; System . out . print ( name [ n - 1 ] ) ; } }

import java . util . Scanner ;   public class A_MysteriousStrings {   public static void main ( String [ ] args ) { String [ ] s = { " Washington " , " Adams " , " Jefferson " , " Madison " , " Monroe " , " Adams " , " Jackson " , " Van ▁ Buren " , " Harrison " , " Tyler " , " Polk " , " Taylor " , " Fillmore " , " Pierce " , " Buchanan " , " Lincoln " , " Johnson " , " Grant " , " Hayes " , " Garfield " , " Arthur " , " Cleveland " , " Harrison " , " Cleveland " , " McKinley " , " Roosevelt " , " Taft " , " Wilson " , " Harding " , " Coolidge " , " Hoover " , " Roosevelt " , " Truman " , " Eisenhower " , " Kennedy " , " Johnson " , " Nixon " , " Ford " , " Carter " , " Reagan " } ; Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; System . out . println ( s [ n - 1 ] ) ;   }   }

pres = [ " Washington " , " Adams " , " Jefferson " , " Madison " , " Monroe " , " Adams " , " Jackson " , " Van ▁ Buren " , " Harrison " , " Tyler " , " Polk " , " Taylor " , " Fillmore " , " Pierce " , " Buchanan " , " Lincoln " , " Johnson " , " Grant " , " Hayes " , " Garfield " , " Arthur " , " Cleveland " , " Harrison " , " Cleveland " , " McKinley " , " Roosevelt " , " Taft " , " Wilson " , " Harding " , " Coolidge " , " Hoover " , " Roosevelt " , " Truman " , " Eisenhower " , " Kennedy " , " Johnson " , " Nixon " , " Ford " , " Carter " , " Reagan " , " Bush " , " Clinton " , " Bush " , " Obama " , " Trump " , " Biden " ]   print ( pres [ int ( input ( ) ) - 1 ] ) NEW_LINE

a = ' Washington , Adams , Jefferson , Madison , Monroe , Adams , Jackson , Van ▁ Buren , Harrison , Tyler , Polk , Taylor , Fillmore , Pierce , Buchanan , Lincoln , Johnson , Grant , Hayes , Garfield , Arthur , Cleveland , Harrison , Cleveland , McKinley , Roosevelt , Taft , Wilson , Harding , Coolidge , Hoover , Roosevelt , Truman , Eisenhower , Kennedy , Johnson , Nixon , Ford , Carter , Reagan , Bush , Clinton ' . split ( ' , ' ) print ( a [ int ( input ( ) ) - 1 ] ) NEW_LINE

x = int ( input ( ) )   presidents = [ ' Washington ' , ' Adams ' , ' Jefferson ' , ' Madison ' , ' Monroe ' , ' Adams ' , ' Jackson ' , ' Van ▁ Buren ' , ' Harrison ' , ' Tyler ' , ' Polk ' , ' Taylor ' , ' Fillmore ' , ' Pierce ' , ' Buchanan ' , ' Lincoln ' , ' Johnson ' , ' Grant ' , ' Hayes ' , ' Garfield ' , ' Arthur ' , ' Cleveland ' , ' Harrison ' , ' Cleveland ' , ' McKinley ' , ' Roosevelt ' , ' Taft ' , ' Wilson ' , ' Harding ' , ' Coolidge ' , ' Hoover ' , ' Roosevelt ' , ' Truman ' , ' Eisenhower ' , ' Kennedy ' , ' Johnson ' , ' Nixon ' , ' Ford ' , ' Carter ' , ' Reagan ' ]   print ( presidents [ x - 1 ] ) NEW_LINE

a = int ( input ( ) ) l = [ ' Washington ' , ' Adams ' , ' Jefferson ' , ' Madison ' , ' Monroe ' , ' Adams ' , ' Jackson ' , ' Van ▁ Buren ' , ' Harrison ' , ' Tyler ' , ' Polk ' , ' Taylor ' , ' Fillmore ' , ' Pierce ' , ' Buchanan ' , ' Lincoln ' , ' Johnson ' , ' Grant ' , ' Hayes ' , ' Garfield ' , ' Arthur ' , ' Cleveland ' , ' Harrison ' , ' Cleveland ' , ' McKinley ' , ' Roosevelt ' , ' Taft ' , ' Wilson ' , ' Harding ' , ' Coolidge ' , ' Hoover ' , ' Roosevelt ' , ' Truman ' , ' Eisenhower ' , ' Kennedy ' , ' Johnson ' , ' Nixon ' , ' Ford ' , ' Carter ' , ' Reagan ' , ' Bush ' ] print ( l [ a - 1 ] ) NEW_LINE

a = [ " " , " Washington " , " Adams " , " Jefferson " , " Madison " , " Monroe " , " Adams " , " Jackson " , " Van ▁ Buren " , " Harrison " , " Tyler " , " Polk " , " Taylor " , " Fillmore " , " Pierce " , " Buchanan " , " Lincoln " , " Johnson " , " Grant " , " Hayes " , " Garfield " , " Arthur " , " Cleveland " , " Harrison " , " Cleveland " , " McKinley " , " Roosevelt " , " Taft " , " Wilson " , " Harding " , " Coolidge " , " Hoover " , " Roosevelt " , " Truman " , " Eisenhower " , " Kennedy " , " Johnson " , " Nixon " , " Ford " , " Carter " , " Reagan " ] print ( a [ int ( input ( ) ) ] ) NEW_LINE


import java . util . Scanner ;   public class _0842ShovelsandSwords {   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 ( ) ;

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner read = new Scanner ( System . in ) ; int t = read . nextInt ( ) ; for ( int x = 1 ; x <= t ; x ++ ) { int a = read . nextInt ( ) ; int b = read . nextInt ( ) ; System . out . println ( Math . min ( ( a + b ) / 3 , Math . min ( a , b ) ) ) ; } } }

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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = ( a + b ) / 3 ; int nas = Math . min ( a , Math . min ( b , sum ) ) ; System . out . println ( nas ) ; } } }

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

for i in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) print ( min ( a , b , ( a + b ) // 3 ) ) NEW_LINE

t = int ( input ( ) ) while t > 0 : t -= 1 s , d = [ int ( x ) for x in input ( ) . split ( ) ] print ( min ( s , d , ( s + d ) // 3 ) ) NEW_LINE

import matht = int ( input ( ) ) for i in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) print ( min ( a , b , ( a + b ) // 3 ) )                                                                 NEW_LINE

for _ in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) r = 0 if a == b : t = a // 3 l = a % 3 if l == 2 : print ( 2 * t + 1 ) else : print ( 2 * t ) elif a > b : fark = a - b r += fark a -= 2 * fark b -= fark if a == 0 : print ( r ) elif a > 0 : t = a // 3 l = a % 3 if l == 2 : print ( 2 * t + 1 + r ) else : print ( 2 * t + r ) else : u = - b print ( r - u )             else : fark = b - a r += fark a -= fark b -= 2 * fark if a == 0 : print ( r ) elif a > 0 : t = a // 3 l = a % 3 if l == 2 : print ( 2 * t + 1 + r ) else : print ( 2 * t + r ) else : u = - a print ( r - u ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : l , r = map ( int , input ( ) . split ( ) ) print ( min ( l , r , ( l + r ) // 3 ) ) NEW_LINE


import java . util . Scanner ; public class Switchs { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a ; int b ; a = input . nextInt ( ) ; b = input . nextInt ( ) ; int max = Math . max ( a , b ) ; if ( max == 1 ) { System . out . println ( "1/1" ) ; } else if ( max == 2 ) { System . out . println ( "5/6" ) ; } else if ( max == 3 ) { System . out . println ( "2/3" ) ; } else if ( max == 4 ) { System . out . println ( "1/2" ) ; } else if ( max == 5 ) { System . out . println ( "1/3" ) ; } else if ( max == 6 ) { System . out . println ( "1/6" ) ; } else { System . out . println ( "0/1" ) ; } } }

import java . util . Scanner ;   public class Test { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int y = in . nextInt ( ) ; int w = in . nextInt ( ) ; y = 7 - Math . max ( y , w ) ; if ( y == 1 ) System . out . println ( "1/6" ) ; else if ( y == 2 ) System . out . println ( "1/3" ) ; else if ( y == 3 ) System . out . println ( "1/2" ) ; else if ( y == 4 ) System . out . println ( "2/3" ) ; else if ( y == 5 ) System . out . println ( "5/6" ) ; else if ( y == 6 ) System . out . println ( "1/1" ) ; } }

import java . util . Scanner ;   public class Test { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int y = in . nextInt ( ) ; int w = in . nextInt ( ) ; int favOutcomes = 7 - Math . max ( y , w ) ; if ( favOutcomes == 1 ) System . out . println ( "1/6" ) ; else if ( favOutcomes == 2 ) System . out . println ( "1/3" ) ; else if ( favOutcomes == 3 ) System . out . println ( "1/2" ) ; else if ( favOutcomes == 4 ) System . out . println ( "2/3" ) ; else if ( favOutcomes == 5 ) System . out . println ( "5/6" ) ; else if ( favOutcomes == 6 ) System . out . println ( "1/1" ) ; } }

import java . util . Scanner ;   public class Test { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int y = in . nextInt ( ) ; int w = in . nextInt ( ) ; int favOutcomes = 0 ; for ( int i = Math . max ( y , w ) ; i <= 6 ; i ++ ) ++ favOutcomes ; int gcd = 0 ; for ( int i = 1 ; i <= favOutcomes && i <= 6 ; i ++ ) { if ( favOutcomes % i == 0 && 6 % i == 0 ) gcd = i ; } System . out . println ( favOutcomes / gcd + " / " + 6 / gcd ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Die_Roll { 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 a , b ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; int max = Math . max ( a , b ) ; max = ( 6 - max ) + 1 ; if ( max % 2 == 1 ) { if ( max == 3 ) { System . out . println ( "1/2" ) ; } else { System . out . println ( max + " / " + 6 ) ; } } else { if ( max == 4 ) { System . out . println ( "2/3" ) ; } else { System . out . println ( 1 + " / " + 6 / max ) ; } }   } }

def main ( y , w ) : greater = max ( y , w ) rem = ( 6 - greater ) + 1 if rem % 6 == 0 : print ( f " { ( rem ▁ / / ▁ 6 ) } / { (6 ▁ / / ▁ 6 ) } " ) elif rem % 2 == 0 : print ( f " { ( rem ▁ / / ▁ 2 ) } / { (6 ▁ / / ▁ 2 ) } " ) elif rem % 3 == 0 : print ( f " { ( rem ▁ / / ▁ 3 ) } / { (6 ▁ / / ▁ 3 ) } " ) else : print ( f " { rem } / { 6 } " )     if __name__ == ' _ _ main _ _ ' : y , w = map ( int , input ( ) . split ( ) ) main ( y , w ) NEW_LINE

from math import * a , b = map ( int , input ( ) . split ( ) ) print ( ( 7 - max ( a , b ) ) // gcd ( 7 - max ( a , b ) , 6 ) , 6 // gcd ( 7 - max ( a , b ) , 6 ) , sep = ' / ' ) NEW_LINE

Y , W = map ( int , input ( ) . split ( ) ) m = max ( Y , W ) if m == 1 : print ( '1/1' ) elif m == 2 : print ( '5/6' ) elif m == 3 : print ( '2/3' ) elif m == 4 : print ( '1/2' ) elif m == 5 : print ( '1/3' ) else : print ( '1/6' )       NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) lar = a if a > b else bif lar == 6 : print ( "1/6" ) elif lar == 5 : print ( "1/3" ) elif lar == 4 : print ( "1/2" ) elif lar == 3 : print ( "2/3" ) elif lar == 2 : print ( "5/6" ) else : print ( "1/1" ) NEW_LINE