import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ;   public class EqualRectangles { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String testCase = scanner . nextLine ( ) ; int t = Integer . parseInt ( testCase ) ; String [ ] n = new String [ t ] ; String [ ] sticks = new String [ t ] ;    for ( int i = 0 ; i < t ; i ++ ) { n [ i ] = scanner . nextLine ( ) ; sticks [ i ] = scanner . nextLine ( ) ; } for ( int i = 0 ; i < t ; i ++ ) { solve ( n [ i ] , sticks [ i ] ) ; } }    public static void solve ( String n , String sticks ) { int r = Integer . parseInt ( n ) ; int [ ] s = Arrays . stream ( sticks . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; boolean helper = false ; boolean helper1 = false ;   int area = s [ 0 ] * s [ 4 * r - 1 ] ;    for ( int i = 0 ; i < 4 * r - 1 ; i = i + 2 ) { if ( s [ i ] == s [ i + 1 ] ) helper = true ; else { helper = false ; break ; } }   if ( ! helper ) System . out . println ( " NO " ) ; else { for ( int i = 1 ; i < 2 * r ; i = i + 2 ) { if ( s [ i ] * s [ 4 * r - i ] == area ) helper1 = true ; else { helper1 = false ; break ; } }   if ( helper1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ;   } } }

import java . util . Arrays ; import java . util . Scanner ;   public class EqualRectangles { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int q = scanner . nextInt ( ) ;   while ( q -- != 0 ) { int n = scanner . nextInt ( ) ; int [ ] sides = new int [ ( 4 * n ) ] ;   for ( int i = 0 ; i < sides . length ; i ++ ) { sides [ i ] = scanner . nextInt ( ) ; } System . out . println ( solve ( sides , n ) ) ; } }   public static String solve ( int [ ] sides , int n ) { Arrays . sort ( sides ) ;   boolean ans = true ; int y = sides [ 0 ] * sides [ sides . length - 1 ] ; int j = sides . length - 1 ; for ( int i = 0 ; i < sides . length / 2 ; i += 2 , j -= 2 ) { if ( sides [ i ] == sides [ i + 1 ] && ( sides [ j ] == sides [ ( j - 1 ) ] ) && sides [ i ] * sides [ j ] == y ) { } else { ans = false ; break ; } }   if ( ans ) { return " YES " ; } else { return " NO " ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . math . * ; public class code { static int dp [ ] [ ] ; static boolean visited [ ] ; static int ans = 0 ; public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ 4 * n ] ; for ( int i = 0 ; i < 4 * n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; boolean flg = true ; n = 4 * n ; for ( int i = 0 ; i < n - 1 ; i += 2 ) { if ( arr [ i ] == arr [ i + 1 ] ) list . add ( arr [ i ] ) ; else { flg = false ; break ; } }

import java . util . * ;   public class EqualRectangles { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int cases = scanner . nextInt ( ) ; while ( ( cases -- ) != 0 ) { int n = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int temp = n * 4 ; while ( ( temp -- ) != 0 ) { list . add ( scanner . nextInt ( ) ) ; } list . sort ( Comparator . comparingInt ( o -> o ) ) ; boolean state = true ; for ( int i = 0 ; i < list . size ( ) - 1 ; i += 2 ) { if ( ! list . get ( i ) . equals ( list . get ( i + 1 ) ) ) { state = false ; System . out . println ( " NO " ) ; break ; } } if ( state ) { int lastIndex = list . size ( ) - 1 ; TreeSet < Integer > couple = new TreeSet < > ( ) ; for ( int j = 0 ; j < list . size ( ) / 2 ; j ++ ) { couple . add ( list . get ( j ) * list . get ( lastIndex -- ) ) ; } if ( couple . size ( ) == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } }

import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapifymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return list ( tmp [ : x ] ) def err ( x ) : print ( x ) ; exit ( )   for _ in range ( inp ( ) ) : n = inp ( ) a = inpl ( ) c = Counter ( a ) res = 1 b = [ ] for key , va in c . items ( ) : if va % 2 : res = 0 for i in range ( va // 2 ) : b . append ( key ) if res == 0 : print ( ' NO ' ) ; continue b . sort ( ) se = set ( ) for i in range ( n * 2 ) : se . add ( b [ i ] * b [ - 1 - i ] ) print ( ' YES ' if len ( se ) == 1 else ' NO ' ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) count = 0 a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) f = 0 p = a [ 0 ] * a [ 4 * n - 1 ] for i in range ( 0 , 4 * n , 2 ) : if a [ i ] * a [ 4 * n - 1 - i ] != p or a [ i ] != a [ i + 1 ] : f = 1   if f == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

from math import *   a = int ( input ( ) ) for x in range ( a ) : b = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) c . sort ( ) t = 0 m = 0 for y in range ( 0 , ( 4 * b ) // 2 , 2 ) : if y == 0 : if ( c [ y ] == c [ y + 1 ] ) and ( c [ ( 4 * b ) - y - 1 ] == c [ ( 4 * b ) - y - 2 ] ) : t = c [ y ] * c [ ( 4 * b ) - y - 1 ] else : m = - 1 break   else : if ( c [ y ] * c [ ( 4 * b ) - y - 1 ] != t ) or ( c [ y ] != c [ y + 1 ] ) or ( c [ ( 4 * b ) - y - 1 ] != c [ ( 4 * b ) - y - 2 ] ) : m = - 1 break   if m == - 1 : print ( " NO " ) else : print ( " YES " ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) :   n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   li . sort ( )   i = 0 j = len ( li ) - 1 area = li [ i ] * li [ j ] res = " YES " while i < j : if li [ i ] != li [ i + 1 ] or li [ j ] != li [ j - 1 ] or li [ i ] * li [ j ] != area : res = " NO " break   i += 2 j -= 2 print ( res )     NEW_LINE


import java . util . Scanner ;   public class BadUglyNumbers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; int [ ] array = new int [ t ] ;   for ( int i = 0 ; i < t ; i ++ ) { array [ i ] = scanner . nextInt ( ) ; }   for ( int i = 0 ; i < array . length ; i ++ ) solve ( array [ i ] ) ;    }   public static void solve ( int n ) { if ( n == 1 ) System . out . println ( - 1 ) ; else { System . out . print ( 2 ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . print ( 3 ) ; } System . out . println ( " ▁ " ) ; } } }

import java . util . Arrays ; import java . util . Scanner ;   public class BadUglyNumbers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCases = scanner . nextInt ( ) ;   while ( testCases -- != 0 ) { int n = scanner . nextInt ( ) ; System . out . println ( solve ( n ) ) ; } }   public static String solve ( int n ) { if ( n == 1 ) { return " - 1" ; } String str = "2" ;   char [ ] chars = new char [ n - 1 ] ; Arrays . fill ( chars , '3' ) ; str = str + new String ( chars ) ; return str ; } }

import java . util . Scanner ;   public class task2 { static Scanner scanner = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { long a = scanner . nextInt ( ) ; for ( int i = 0 ; i < a ; i ++ ) { long num = scanner . nextInt ( ) ; for ( long j = 0 ; j < num ; j ++ ) { if ( num > 1 ) { if ( j == 0 ) System . out . print ( 2 ) ; else System . out . print ( 3 ) ; } else System . out . print ( - 1 ) ; } System . out . println ( ) ; }   } }

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

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) if n == 1 : print ( - 1 ) else : res = [ 3 ] * ( n - 1 ) res . insert ( 0 , 2 ) print ( * res , sep = ' ' ) NEW_LINE

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) if n == 1 : print ( - 1 ) else : ans = "2" + ( "3" * ( n - 1 ) ) print ( ans ) NEW_LINE

def bad_ugly ( ) : for i in range ( int ( input ( ) ) ) : x = int ( input ( ) ) if ( x < 2 ) : print ( " - 1" ) else : print ( "5" + "7" * ( x - 1 ) )           bad_ugly ( )       NEW_LINE

def func ( s ) : for i in range ( s ) : n = int ( input ( ) ) if n == 1 : print ( ' - 1' ) else : ans = '2' + ( '3' * ( n - 1 ) ) print ( ans )   s = int ( input ( ) ) func ( s ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) if n == 1 : print ( - 1 ) else : print ( '5' + '7' * ( n - 1 ) ) NEW_LINE


import java . io . * ; import java . util . * ;   public class A { static ArrayList < Integer > g [ ] ; static int [ ] vis , cc ; public static void main ( String [ ] args ) throws IOException { FastReader f = new FastReader ( ) ; StringBuffer sb = new StringBuffer ( ) ; int n = f . nextInt ( ) ; int m = f . nextInt ( ) ; int k = f . nextInt ( ) ; Set < Integer > cap = new HashSet < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) cap . add ( f . nextInt ( ) ) ; g = new ArrayList [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) g [ i ] = new ArrayList < > ( ) ; vis = new int [ n + 1 ] ; cc = new int [ n + 1 ] ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int x = f . nextInt ( ) ; int y = f . nextInt ( ) ; g [ x ] . add ( y ) ; g [ y ] . add ( x ) ; list . add ( x + " ▁ " + y ) ; } int c = 1 ; for ( int x : cap ) { dfs ( x , c ) ; c ++ ; }

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

import sysinput = sys . stdin . readline   class Unionfind : def __init__ ( self , n ) : self . par = [ - 1 ] * n self . rank = [ 1 ] * n def root ( self , x ) : r = x while not self . par [ r ] < 0 : r = self . par [ r ] t = x while t != r : tmp = t t = self . par [ t ] self . par [ tmp ] = r return r def unite ( self , x , y ) : rx = self . root ( x ) ry = self . root ( y ) if rx == ry : return if self . rank [ rx ] <= self . rank [ ry ] : self . par [ ry ] += self . par [ rx ] self . par [ rx ] = ry if self . rank [ rx ] == self . rank [ ry ] : self . rank [ ry ] += 1 else : self . par [ rx ] += self . par [ ry ] self . par [ ry ] = rx def is_same ( self , x , y ) : return self . root ( x ) == self . root ( y ) def count ( self , x ) : return - self . par [ self . root ( x ) ]   n , m , k = map ( int , input ( ) . split ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) uf = Unionfind ( n )   for _ in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) uf . unite ( u - 1 , v - 1 )   sizes = [ uf . count ( ci - 1 ) for ci in c ] sizes . sort ( ) sizes [ - 1 ] += n - sum ( sizes ) ans = 0   for size in sizes : ans += size * ( size - 1 ) // 2   ans -= m   print ( ans ) NEW_LINE

import osimport sysfrom io import BytesIO , IOBaseBUFSIZE = 8192 class FastIO ( IOBase ) : newlines = 0 def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = " x " in file . mode or " r " not in file . mode self . write = self . buffer . write if self . writable else None def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( ) def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b " \n " ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( " ascii " ) ) self . read = lambda : self . buffer . read ( ) . decode ( " ascii " ) self . readline = lambda : self . buffer . readline ( ) . decode ( " ascii " )     sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( " \n " ) NEW_LINE

from queue import Queue   n , m , k = [ int ( i ) for i in input ( ) . split ( ) ] govt = [ 0 for i in range ( n ) ] l = [ int ( i ) for i in input ( ) . split ( ) ] for i in l : govt [ i - 1 ] = 1 edges = [ ] adj = [ [ ] for i in range ( n ) ] for i in range ( m ) : x = [ int ( i ) for i in input ( ) . split ( ) ] adj [ x [ 0 ] - 1 ] . append ( x [ 1 ] - 1 ) adj [ x [ 1 ] - 1 ] . append ( x [ 0 ] - 1 ) parent = [ - 1 for i in range ( n ) ] mx = 0 ans = 0 visited = [ 0 for i in range ( n ) ] total_no_gov_nodes = 0 extra = 0 for i in range ( n ) : num_edges = 0 back = 0 num_nodes = 0 gov_exist = 0 if ( visited [ i ] == 0 ) : q = Queue ( ) q . put ( i ) visited [ i ] = 1 while ( q . empty ( ) != True ) : num_nodes += 1 tmp = q . get ( ) if ( govt [ tmp ] == 1 ) : gov_exist = 1 for child in adj [ tmp ] : if ( visited [ child ] == 0 ) : num_edges += 1 q . put ( child ) visited [ child ] = 1 parent [ child ] = tmp elif ( parent [ tmp ] != child ) : back += 1 num_edges += ( back / 2 ) num_edges = int ( num_edges ) if ( gov_exist == 1 ) : mx = max ( mx , num_nodes ) add = int ( ( num_nodes * ( num_nodes - 1 ) ) / 2 ) ans += ( add - num_edges ) if ( gov_exist == 0 ) : if ( total_no_gov_nodes == 0 ) : total_no_gov_nodes = num_nodes else : extra += ( total_no_gov_nodes * num_nodes ) total_no_gov_nodes += num_nodesans += extraans += ( mx * total_no_gov_nodes ) print ( ans ) NEW_LINE

from sys import stdin , stdout   def find ( node ) : x = [ ] while dsu [ node ] > 0 : x . append ( node ) node = dsu [ node ] for i in x : dsu [ i ] = node return node   def union ( node1 , node2 ) : if node1 != node2 : if dsu [ node1 ] > dsu [ node2 ] : node1 , node2 = node2 , node1 dsu [ node1 ] += dsu [ node2 ] dsu [ node2 ] = node1 edges [ node1 ] += edges [ node2 ] + 1 else : edges [ node1 ] += 1   n , m , k = map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) arr = [ int ( num ) for num in stdin . readline ( ) . strip ( ) . split ( ) ] edges = [ 0 ] * ( n + 1 ) dsu = [ - 1 ] * ( n + 1 ) maxm = 1 maxm_e = 0 maxm_p = Nonefor __ in range ( m ) : a , b = map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) union ( find ( a ) , find ( b ) ) req = set ( ) for i in arr : p_i = find ( i ) r_e = ( dsu [ p_i ] * ( dsu [ p_i ] + 1 ) ) // 2 maxm_e += r_e - edges [ p_i ] if abs ( dsu [ p_i ] ) >= maxm : maxm = max ( maxm , abs ( dsu [ p_i ] ) ) maxm_p = p_i req . add ( p_i )   for i in range ( 1 , n + 1 ) : if dsu [ i ] < 0 : p_i = find ( i ) if p_i not in req : r_e = ( dsu [ p_i ] * ( dsu [ p_i ] + 1 ) ) // 2 maxm_e += r_e - edges [ p_i ] maxm_e += dsu [ maxm_p ] * dsu [ p_i ] dsu [ maxm_p ] += dsu [ p_i ] stdout . write ( f ' { maxm _ e } ' ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) )   a = set ( map ( int , input ( ) . split ( ) ) )   A = [ [ 0 for i in range ( n + 1 ) ] for i in range ( n + 1 ) ] visited = [ 0 for i in range ( n + 1 ) ]   for i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) A [ u ] [ v ] = 1 A [ v ] [ u ] = 1   e = 0   def dfs ( u ) : global e global v visited [ u ] = 1 e += 1 for i in range ( 1 , n + 1 ) : if A [ u ] [ i ] == 1 and visited [ i ] == 0 : dfs ( i )   return   max_e = 0 ans = 0   for u in a : e = 0 dfs ( u ) ans += e * ( e - 1 ) // 2 max_e = max ( max_e , e ) k = 0 for i in range ( 1 , n + 1 ) : if visited [ i ] == 0 : e = 0 dfs ( i ) k += e ans += ( max_e * k + k * ( k - 1 ) // 2 ) ans -= m   print ( max ( ans , 0 ) ) NEW_LINE


import java . util . * ; import java . io . * ; public class Main { static PrintWriter w = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; if ( n > 36 ) w . println ( - 1 ) ; else { for ( int i = 1 ; i <= n / 2 ; i ++ ) w . print ( "8" ) ; if ( n % 2 == 1 ) w . print ( "4" ) ; } w . close ( ) ; } }

import java . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = scn . nextInt ( ) ; StringBuilder ans = new StringBuilder ( ) ; int lenCheck = 18 ; while ( k > 1 && ans . length ( ) < 20 ) { ans . append ( 8 ) ; k -= 2 ; } if ( k == 1 ) { ans . append ( 4 ) ; } if ( ans . length ( ) > 18 ) System . out . println ( " - 1" ) ; else System . out . println ( ans ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; if ( k > 36 ) { System . out . print ( " - 1" ) ; return ; } while ( k >= 2 ) { k -= 2 ; System . out . print ( "8" ) ; } if ( k == 1 ) { System . out . print ( "6" ) ; } } }

k = int ( input ( ) ) s = " " if k > 36 : print ( - 1 ) else : while k > 0 : if k >= 2 : s = s + "8" k = k - 2 else : s = s + "4" k = k - 1 print ( s ) NEW_LINE

import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) . split ( ) ) ) n = iinput ( ) if n > 36 : print ( - 1 ) else : print ( "8" * ( n // 2 ) + "4" * ( n % 2 ) ) NEW_LINE

n = int ( input ( ) ) if ( n > 36 ) : print ( - 1 ) exit ( ) if ( n % 2 == 0 ) : for i in range ( n // 2 ) : print ( 8 , end = " " ) else : for i in range ( n // 2 ) : print ( 8 , end = " " ) print ( 4 , end = " " ) NEW_LINE

k = int ( input ( ) )   if k > 36 : print ( - 1 ) exit ( )   res = " "   res = res + "8" * ( k // 2 )   res = res + "9" * ( k % 2 )   print ( res )   NEW_LINE


import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int next ; int aSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { next = scan . nextInt ( ) ; aSum |= next ; } int bSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { next = scan . nextInt ( ) ; bSum |= next ; } System . out . println ( aSum + bSum ) ; } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; int b [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = in . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) b [ i ] = in . nextInt ( ) ; long a1 = 0 , b1 = 0 , ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a1 = a1 | a [ i ] ; b1 = b1 | b [ i ] ; if ( a1 + b1 > ans ) ans = a1 + b1 ; } System . out . println ( ans ) ; } }

import java . util . Scanner ;   public class _0591Interview { static long XOR ( int i , int j , int [ ] a , int [ ] b ) { long XorA = 0 ; long XorB = 0 ; for ( int x = i ; x <= j ; x ++ ) { XorA = XorA | a [ x ] ; XorB = XorB | b [ x ] ; } return XorA + XorB ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } long max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { max = Math . max ( max , XOR ( i , j , a , b ) ) ; } } System . out . println ( max ) ; }   }

from functools import reducedef solve ( n , a , b ) : return reduce ( lambda x , y : x | y , a ) + reduce ( lambda x , y : x | y , b )                         def main ( ) : NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   def f ( x , l , r ) : t = 0 for i in x [ l : r ] : t |= i   return t   ms = 0 for s in range ( n , 0 , - 1 ) : for l in range ( 0 , s ) : r = l + s if r > n : break else : if ( f ( a , l , r ) + f ( b , l , r ) ) > ms : ms = f ( a , l , r ) + f ( b , l , r )   print ( ms ) 	 	 	   NEW_LINE

n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] mxa = 0 for i in range ( n ) : cur = a [ i ] for j in range ( i , n ) : cur |= a [ j ] mxa = max ( mxa , cur ) mxb = 0 for i in range ( n ) : cur = b [ i ] for j in range ( i , n ) : cur |= b [ j ] mxb = max ( mxb , cur ) print ( mxa + mxb ) NEW_LINE

a = int ( input ( ) ) x1 = list ( map ( int , input ( ) . split ( ) ) ) x2 = list ( map ( int , input ( ) . split ( ) ) ) y1 = 0 y2 = 0 for i in range ( a ) : y1 |= x1 [ i ] y2 |= x2 [ i ] print ( y1 + y2 ) NEW_LINE

import sys     n = int ( sys . stdin . readline ( ) ) a = [ int ( x ) for x in sys . stdin . readline ( ) . strip ( ) . split ( ) ] b = [ int ( x ) for x in sys . stdin . readline ( ) . strip ( ) . split ( ) ] A = a [ 0 ] for x in a : A |= xB = b [ 0 ] for x in b : B |= x   print ( A + B ) NEW_LINE


import java . util . * ; import java . util . stream . Collectors ; import java . lang . * ; import java . io . * ; public class Problem { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; System . out . println ( find ( s ) ) ; } public static String find ( String s ) { char [ ] ch = s . toCharArray ( ) ; char [ ] ar = new char [ 26 ] ; int i = 0 , j = 0 , ques = 0 ; Set < Character > set = new HashSet < Character > ( ) ; while ( j < s . length ( ) ) { if ( j >= 26 ) { if ( ch [ i ] == ' ? ' ) ques -- ; else { ar [ ch [ i ] - ' A ' ] -- ; if ( ar [ ch [ i ] - ' A ' ] == 0 ) set . remove ( ch [ i ] ) ; } i ++ ; } if ( ch [ j ] == ' ? ' ) ques ++ ; else { ar [ ch [ j ] - ' A ' ] ++ ; set . add ( ch [ j ] ) ; } if ( set . size ( ) + ques == 26 ) { String ans = process ( ch , i , j , set ) ; if ( ans . equals ( " - 1" ) ) return ans ; else { for ( int x = 0 ; x < ch . length ; x ++ ) { if ( ch [ x ] == ' ? ' ) ch [ x ] = ' A ' ; } return new String ( ch ) ; } } j ++ ; } return " - 1" ; } public static String process ( char [ ] ch , int i , int j , Set < Character > set ) { for ( char p = ' A ' ; p <= ' Z ' ; p ++ ) { if ( set . contains ( p ) ) set . remove ( p ) ; else set . add ( p ) ; }

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ;   public class CompleteTheWord { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; if ( s . length ( ) < 26 ) { System . out . println ( - 1 ) ; } else { boolean possible = true ; int left = 0 ; int right = 25 ; int [ ] count = new int [ 26 ] ; int counter = 0 ; for ( int i = 0 ; i <= 25 ; i ++ ) {

import java . util . * ; import java . io . * ; import java . math . * ; public class B372 {   public static void main ( String args [ ] ) { FastReader sc = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int t , i , n ; t = 1 ; while ( t -- > 0 ) { char s [ ] = sc . next ( ) . toCharArray ( ) ; n = s . length ; if ( n < 26 ) { sb . append ( - 1 ) . append ( ' \n ' ) ; continue ; } int j ; HashSet < Character > set = new HashSet < > ( ) ; boolean flag = false ; for ( i = 0 ; i < n ; i ++ ) { int count = 0 ; set . clear ( ) ; for ( j = i ; j <= i + 25 && i + 25 < n ; j ++ ) { if ( s [ j ] != ' ? ' ) set . add ( s [ j ] ) ; else count ++ ;

import java . util . ArrayList ; import java . util . HashSet ; import java . util . Scanner ;   public class CF716_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; HashSet < Character > set = new HashSet < > ( ) ; int q = 0 ; char [ ] alphabet = " abcdefghijklmnopqrstuvwxyz " . toUpperCase ( ) . toCharArray ( ) ; int start = - 1 ; for ( int i = 0 ; i <= s . length ( ) - 26 ; i ++ ) {   for ( int j = 0 ; j < 26 ; j ++ ) { if ( Character . isAlphabetic ( s . charAt ( i + j ) ) ) { set . add ( s . charAt ( i + j ) ) ; } else if ( s . charAt ( i + j ) == ' ? ' ) { q ++ ; } } if ( set . size ( ) + q == 26 ) { start = i ; break ; } else { set = new HashSet < > ( ) ; q = 0 ; } } if ( start == - 1 ) { System . out . println ( - 1 ) ; } else { ArrayList < Character > missing = new ArrayList < > ( ) ; for ( char c : alphabet ) { if ( ! set . contains ( c ) ) { missing . add ( c ) ; } } StringBuilder builder = new StringBuilder ( ) ; builder . append ( s . substring ( 0 , start ) . replace ( ' ? ' , ' A ' ) ) ; int j = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( s . charAt ( start + i ) == ' ? ' ) { builder . append ( missing . get ( j ++ ) ) ; } else { builder . append ( s . charAt ( start + i ) ) ; } } builder . append ( s . substring ( start + 26 ) . replace ( ' ? ' , ' A ' ) ) ; System . out . println ( builder . toString ( ) ) ;   }   } }

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 . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . InputMismatchException ; import java . util . List ; import java . util . Set ;   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 ;

word = input ( ) . lower ( )   if len ( word ) < 26 : print ( - 1 ) exit ( )   alpha = [ ' q ' , ' w ' , ' e ' , ' r ' , ' t ' , ' y ' , ' u ' , ' i ' , ' o ' , ' p ' , ' a ' , ' s ' , ' d ' , ' f ' , ' g ' , ' h ' , ' j ' , ' k ' , ' l ' , ' z ' , ' x ' , ' c ' , ' v ' , ' b ' , ' n ' , ' m ' ]   for i in range ( len ( word ) - 26 + 1 ) : cnt = 0 used = [ ] for char in alpha :   if word [ i : i + 26 ] . count ( char ) == 1 : used . append ( char )   if word [ i : i + 26 ] . count ( char ) < 2 : cnt += 1   if word [ i : i + 26 ] . count ( char ) >= 2 : cnt -= 500000 break   cnt -= 1   if cnt == 0 :   NEW_LINE

import collections   s = input ( ) n = len ( s ) if n < 26 : print ( - 1 ) exit ( ) d = [ 0 ] * 26 for i in range ( 25 ) : if s [ i ] != ' ? ' : d [ ord ( s [ i ] ) - ord ( ' A ' ) ] += 1   def check ( ) : return all ( d [ i ] <= 1 for i in range ( 26 ) )   b = Falsefor i in range ( 25 , n ) : if s [ i ] != ' ? ' : d [ ord ( s [ i ] ) - ord ( ' A ' ) ] += 1 if i >= 26 : if s [ i - 26 ] != ' ? ' : d [ ord ( s [ i - 26 ] ) - ord ( ' A ' ) ] -= 1 if check ( ) : for j in range ( n ) : if s [ j ] != ' ? ' : print ( s [ j ] , end = " " ) else : if j < i - 25 or j > i : print ( ' A ' , end = " " ) else : for k in range ( 26 ) : if d [ k ] == 0 : print ( chr ( ord ( ' A ' ) + k ) , end = " " ) d [ k ] = 1 break exit ( ) print ( - 1 ) NEW_LINE

import sysfrom math import * from string import ascii_uppercase   def ints_input ( ) : return [ int ( i ) for i in sys . stdin . readline ( ) . strip ( " \n " ) . split ( " ▁ " ) ]             def print_list ( arr ) : sys . stdout . writelines ( str ( x ) + " ▁ " for x in arr ) sys . stdout . write ( " \n " )     def fast_input ( type = str ) : return type ( sys . stdin . readline ( ) . strip ( " \n " ) )     s = fast_input ( ) if len ( s ) < 26 : print ( - 1 ) exit ( )   r , j = 0 , 25 found = Falsewhile not found and j < len ( s ) : sl = s [ r : j + 1 ] q = sl . count ( ' ? ' ) if len ( set ( sl ) ) + q - 1 == 26 or len ( set ( sl ) ) == 26 : found = True else : r += 1 j += 1 if not found : print ( - 1 ) exit ( ) d = { } for i in ascii_uppercase + ' ? ' : d [ i ] = 0   for i in sl : d [ i ] += 1 d . pop ( ' ? ' ) zz = list ( filter ( lambda x : not x [ 1 ] , d . items ( ) ) ) k = 0 s = list ( s ) for i in range ( len ( s ) ) : if s [ i ] == ' ? ' : if r <= i <= j : s [ i ] = zz [ k ] [ 0 ] k += 1 else : s [ i ] = ' A ' print ( " " . join ( s ) ) NEW_LINE

s = [ i for i in input ( ) ] ; n = len ( s ) NEW_LINE


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

import java . util . * ; public class A0773_SuccessRate { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; long p = sc . nextInt ( ) ; long q = sc . nextInt ( ) ; if ( ! works ( x , y , p , q , 1000000000 ) ) { System . out . println ( - 1 ) ; continue ; } long l = 0 ; long r = 1000000000 ; while ( r > l ) { long mid = ( r + l ) / 2 ; if ( works ( x , y , p , q , mid ) ) r = mid ; else l = mid + 1 ; } System . out . println ( r * q - y ) ; } sc . close ( ) ; } public static boolean works ( long x , long y , long p , long q , long mid ) { if ( p * mid >= x && q * mid - p * mid >= y - x ) return true ; return false ; } }

import java . lang . * ; import java . util . * ;   public final class Solution { public static void main ( String [ ] args ) { Solution p = new Solution ( ) ; p . run ( ) ; } private void run ( ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; System . out . println ( solve ( x , y , p , q ) ) ; } } private long solve ( int x , int y , int p , int q ) { if ( p == 0 ) { if ( x != 0 ) { return - 1 ; } else { return 0 ; } } if ( p == q ) { if ( x != y ) { return - 1 ; } else { return 0 ; } } long k = ( long ) Math . ceil ( Math . max ( x * 1.0 / p , ( ( y - x ) * 1.0 / ( q - p ) ) ) ) ;   return ( ( k * q ) - y ) ; } }

# include < bits / stdc ++ . h > using namespace std ; # define int long long # define FAST ios_base :: sync_with_stdio ( false ) ; cin . tie ( 0 ) ; cout . tie ( 0 ) ;

from math import ceilfor _ in range ( int ( input ( ) ) ) : x , y , p , q = map ( int , input ( ) . split ( ) ) if p == q and x != y : print ( - 1 ) elif p == q : print ( 0 ) elif p == 0 and x == 0 : print ( 0 ) elif p == 0 : print ( - 1 ) else : a = y // q r = y % q g1 = ( x - p * a + p - 1 ) // p g2 = ceil ( ( x - r - p * a ) / ( p - q ) ) print ( max ( g1 , g2 ) * q - r ) NEW_LINE


import java . util . Scanner ;   public class B242 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int [ ] firsts = new int [ n ] ; int [ ] seconds = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int first = s . nextInt ( ) ; int second = s . nextInt ( ) ; if ( first < min ) { min = first ; } if ( second > max ) { max = second ; } firsts [ i ] = first ; seconds [ i ] = second ; } boolean found = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( firsts [ i ] == min && seconds [ i ] == max ) { System . out . println ( i + 1 ) ; found = true ; break ; } } if ( ! found ) { System . out . println ( - 1 ) ; } } }

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

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int ar [ ] [ ] = new int [ 2 ] [ T ] ; int result = - 1 ; for ( int i = 0 ; i < T ; i ++ ) { int first = sc . nextInt ( ) ; int second = sc . nextInt ( ) ; min = Math . min ( min , first ) ; max = Math . max ( max , second ) ; ar [ 0 ] [ i ] = first ; ar [ 1 ] [ i ] = second ; } for ( int i = 0 ; i < T ; i ++ ) { if ( ar [ 0 ] [ i ] == min && ar [ 1 ] [ i ] == max ) { result = i + 1 ; break ; } } System . out . println ( result ) ; } }

import java . util . * ;    public class dummycodes {   public static class Pair { int l ; int r ; int index ; public Pair ( int x , int y , int i ) { l = x ; r = y ; index = i ; } } public static class sortByL implements Comparator < Pair > { @ Override public int compare ( Pair o1 , Pair o2 ) { return ( o1 . l == o2 . l ) ? o2 . r - o1 . r : o1 . l - o2 . l ; }   }   public static void solve ( ArrayList < Pair > arr , int sze , int maxR ) { Collections . sort ( arr , new sortByL ( ) ) ; Pair P = arr . get ( 0 ) ; int a = P . l ; int b = P . r ;   if ( a <= b && b >= maxR ) System . out . println ( P . index + 1 ) ; else System . out . println ( " - 1" ) ; }   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Pair > arr = new ArrayList < > ( ) ; int max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { Pair p = new Pair ( sc . nextInt ( ) , sc . nextInt ( ) , i ) ; arr . add ( p ) ; if ( p . r > max ) max = p . r ; } solve ( arr , n , max ) ; } }

def solution ( ) : n = int ( input ( ) ) k = [ ] mn = float ( ' Inf ' )   mx = float ( ' - Inf ' ) for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) k . append ( ( l , r ) ) mn = min ( l , mn ) mx = max ( r , mx )   for i in range ( n ) : if k [ i ] [ 0 ] == mn and k [ i ] [ 1 ] == mx : print ( i + 1 ) return print ( - 1 ) return     solution ( ) NEW_LINE

def find_cover_all_seg ( n , l , r ) : min = l [ 0 ] index_min = [ ] max = r [ 0 ] index_max = [ ] for i in range ( n ) : if min >= l [ i ] : min = l [ i ] index_min . append ( i ) if max <= r [ i ] : max = r [ i ] index_max . append ( i ) common_index_list = list ( set ( index_min ) . intersection ( index_max ) ) NEW_LINE

l = list ( list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( int ( input ( ) ) ) ) x = min ( i [ 0 ] for i in l ) y = max ( i [ 1 ] for i in l ) if [ x , y ] in l : print ( l . index ( [ x , y ] ) + 1 ) else : print ( " - 1" ) NEW_LINE

n = int ( input ( ) ) l = [ ] r = [ ] for i in range ( n ) : s , e = map ( int , input ( ) . split ( ) ) l . append ( s ) r . append ( e ) mn = l [ 0 ] mx = r [ 0 ]   for i in range ( n ) : if ( l [ i ] < mn ) : mn = l [ i ] if r [ i ] > mx : mx = r [ i ] flag = 1 p = 0 for i in range ( n ) : if l [ i ] <= mn and r [ i ] >= mx : p = i + 1 flag = 0 if flag == 0 : print ( p ) else : print ( - 1 ) NEW_LINE

n = int ( input ( ) ) p = [ ] al = [ ] bl = [ ] while n > 0 : n -= 1 a , b = map ( int , input ( ) . split ( ) ) p . append ( [ a , b ] ) al . append ( a ) bl . append ( b ) t1 = min ( al ) t2 = max ( bl ) if [ t1 , t2 ] in p : print ( p . index ( [ t1 , t2 ] ) + 1 ) else : print ( - 1 ) NEW_LINE


import java . io . * ; import java . util . * ; public class B { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; Long [ ] arr = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextLong ( ) ; pw . println ( solve ( arr , n ) ) ; pw . close ( ) ; } static long solve ( Long [ ] arr , int n ) { Arrays . sort ( arr ) ; long reng = ( long ) 1e15 ; long ans = ( long ) 1e15 ; boolean finished = false ; for ( long C = 1 ; ; C ++ ) { long res = 0 ; for ( long i = 0 , pw = 1 ; i < n ; i ++ , pw *= C ) { if ( pw >= reng ) { finished = true ; break ; } res += Math . abs ( ( arr [ ( int ) i ] - pw ) ) ; } if ( finished ) break ; ans = Math . min ( ans , res ) ; } return ans ; } static void debug ( Object ... obj ) { System . err . println ( Arrays . deepToString ( obj ) ) ; } }

import sys NEW_LINE input = sys . stdin . readline NEW_LINE import math NEW_LINE n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . sort ( ) NEW_LINE j = a [ 0 ] NEW_LINE c = 1 NEW_LINE mn = 10 ** 18 NEW_LINE inf = 10 ** 18 NEW_LINE if n <= 2 : NEW_LINE INDENT print ( a [ 0 ] - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT while c <= 10 ** 9 : NEW_LINE INDENT cnt = 0 NEW_LINE ok = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT k = c ** i - a [ i ] NEW_LINE cnt += abs ( k ) NEW_LINE if c ** i > inf : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if cnt < mn : NEW_LINE INDENT mn = cnt NEW_LINE DEDENT if c ** ( n - 1 ) > mn + a [ - 1 ] : NEW_LINE INDENT break NEW_LINE DEDENT c += 1 NEW_LINE DEDENT print ( mn ) NEW_LINE DEDENT

n , s = open ( 0 ) ; NEW_LINE print ( min ( sum ( abs ( x - c ** i ) for i , x in enumerate ( sorted ( map ( int , s . split ( ) ) ) ) ) for c in range ( 2 + 9 ** 6 // int ( n ) ** 2 ) ) ) NEW_LINE

from sys import stdin , stdout NEW_LINE def main ( ) : NEW_LINE INDENT n = stdin . readline ( ) NEW_LINE arr = [ int ( i ) for i in stdin . readline ( ) . split ( ) ] NEW_LINE arr . sort ( ) NEW_LINE t = int ( n ) - 1 NEW_LINE p = float ( 1 / t ) NEW_LINE temp = int ( ( int ( arr [ t ] ) ** p ) // 1 ) NEW_LINE ans = int ( 0 ) NEW_LINE ans1 = int ( 0 ) NEW_LINE for i in range ( int ( n ) ) : NEW_LINE INDENT ans = int ( int ( ans ) + int ( abs ( int ( int ( temp ** i ) - arr [ i ] ) ) ) ) NEW_LINE DEDENT temp = int ( int ( temp ) + 1 ) NEW_LINE for i in range ( int ( n ) ) : NEW_LINE INDENT ans1 = int ( int ( ans1 ) + int ( abs ( int ( int ( temp ** i ) - arr [ i ] ) ) ) ) NEW_LINE DEDENT ans = min ( int ( ans ) , int ( ans1 ) ) NEW_LINE stdout . write ( str ( ans ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

from sys import stdin , stdout NEW_LINE input = stdin . readline NEW_LINE def main ( ) : NEW_LINE INDENT t = 1 NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ai = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = sum ( ai ) - n NEW_LINE if n > 33 : NEW_LINE INDENT print ( ans ) NEW_LINE return NEW_LINE DEDENT base = 2 NEW_LINE num = 10 ** 10 * 5 NEW_LINE ai . sort ( ) NEW_LINE while base ** ( n - 1 ) < num : NEW_LINE INDENT ans = min ( ans , sum ( [ abs ( ai [ i ] - base ** i ) for i in range ( n ) ] ) ) NEW_LINE base += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT DEDENT main ( ) NEW_LINE

n = int ( input ( ) ) NEW_LINE s = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = 1 NEW_LINE mx = 100 * ( 10 ** 9 ) NEW_LINE ans = float ( ' inf ' ) NEW_LINE while c ** ( n - 1 ) < mx : NEW_LINE INDENT cur = 0 NEW_LINE for i in range ( n ) : cur += abs ( s [ i ] - c ** i ) NEW_LINE c += 1 NEW_LINE ans = min ( ans , cur ) NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . math . * ; import java . util . * ; import java . io . * ; public class gr13b {

import java . util . Scanner ;   public class _0664FakeNP {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( r - l == 0 ) { System . out . println ( l ) ; } else { System . out . println ( 2 ) ;   } }   }

import java . util . * ; import java . math . * ; public class FakeNP { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( l == r ) { System . out . println ( l ) ; return ; } System . out . println ( 2 ) ; } }

import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( l == r ) { System . out . println ( l ) ; } else { System . out . println ( "2" ) ; } } }

import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static long solve ( long l , long r ) { if ( l == r ) { return l ; } return 2 ; }    public static void main ( String [ ] args ) {   long l = scan . nextLong ( ) ; long r = scan . nextLong ( ) ; System . out . println ( solve ( l , r ) ) ; } }

n , m = map ( int , input ( ) . split ( ) ) print ( ( n , 2 ) [ n != m ] ) NEW_LINE

a , b = input ( ) . split ( ) print ( a if a == b else 2 ) NEW_LINE

l , r = map ( int , input ( ) . split ( ) ) if l != r : print ( 2 ) else : print ( l ) NEW_LINE

def main ( ) : l , r = tuple ( map ( int , input ( ) . split ( ) ) ) if l == r : print ( l ) else : print ( 2 )   if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

m , n = map ( int , input ( ) . split ( ) ) if ( m == n ) : print ( m ) else : print ( 2 ) NEW_LINE


import java . util . * ; public class Array { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; List < Integer > list1 = new ArrayList < > ( ) ; List < Integer > list2 = new ArrayList < > ( ) ; List < Integer > list3 = new ArrayList < > ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp < 0 ) list1 . add ( temp ) ; else if ( temp > 0 ) list2 . add ( temp ) ; else list3 . add ( temp ) ; } if ( list2 . size ( ) == 0 ) { int num1 = list1 . remove ( list1 . size ( ) - 1 ) ; int num2 = list1 . remove ( list1 . size ( ) - 1 ) ; list2 . add ( num1 ) ; list2 . add ( num2 ) ; }   if ( list1 . size ( ) % 2 == 0 ) { list3 . add ( list1 . remove ( list1 . size ( ) - 1 ) ) ;   } sc . close ( ) ;   System . out . print ( list1 . size ( ) ) ; for ( int i = 0 ; i < list1 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list1 . get ( i ) ) ;   System . out . println ( ) ; System . out . print ( list2 . size ( ) ) ; for ( int i = 0 ; i < list2 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list2 . get ( i ) + " ▁ " ) ;   System . out . println ( ) ; System . out . print ( list3 . size ( ) ) ; for ( int i = 0 ; i < list3 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list3 . get ( i ) + " ▁ " ) ; }    }

import java . util . ArrayList ; import java . util . Scanner ;   public class array { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int [ ] arr = new int [ x ] ; ArrayList < Integer > n = new ArrayList < > ( ) ; ArrayList < Integer > p = new ArrayList < > ( ) ; ArrayList < Integer > z = new ArrayList < > ( ) ;   for ( int i = 0 ; i < x ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] < 0 ) n . add ( arr [ i ] ) ; if ( arr [ i ] > 0 ) p . add ( arr [ i ] ) ; if ( arr [ i ] == 0 ) z . add ( arr [ i ] ) ;    }

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

n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) neg = [ i for i in arr if i < 0 ] pos = [ i for i in arr if i > 0 ] zero = [ 0 ]   if len ( neg ) % 2 == 0 : pos . extend ( neg [ 1 : - 1 ] ) zero . append ( neg [ - 1 ] ) neg = neg [ : 1 ] else : if len ( pos ) == 0 : pos . extend ( neg [ - 2 : ] ) neg = neg [ : - 2 ]     print ( len ( neg ) , * neg ) print ( len ( pos ) , * pos ) print ( len ( zero ) , * zero )         NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) i = 0 while ( arr [ i ] < 0 and i < n ) : i += 1 neg = i - 1 zero = ii += 1 pos = 0 while ( i < n and arr [ i ] > 0 ) : i += 1 pos = iif pos > zero : print ( 1 , arr [ 0 ] ) print ( 1 , arr [ zero + 1 ] ) print ( n - 2 , end = ' ▁ ' ) for j in range ( 1 , n ) : if j != zero + 1 : print ( arr [ j ] , end = ' ▁ ' ) else : print ( 1 , arr [ 0 ] ) print ( 2 , arr [ 1 ] , arr [ 2 ] ) print ( n - 3 , end = ' ▁ ' ) for j in range ( 3 , n ) : print ( arr [ j ] , end = ' ▁ ' ) NEW_LINE

n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) a , b , c = [ ] , [ ] , [ ] for i in array : if i < 0 : a . append ( i ) elif i > 0 : b . append ( i ) else : c . append ( i ) if not b : b . append ( a . pop ( ) ) b . append ( a . pop ( ) ) if len ( a ) % 2 == 0 : c . append ( a . pop ( ) ) print ( len ( a ) , * a ) print ( len ( b ) , * b ) print ( len ( c ) , * c ) NEW_LINE

n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] b = [ ] c = [ ] for i in li : if i < 0 : a . append ( i ) elif i > 0 : b . append ( i ) else : c . append ( i )   if len ( a ) % 2 != 0 and len ( b ) == 0 : b . append ( a [ 0 ] ) b . append ( a [ 1 ] ) a = a [ 2 : ] elif len ( b ) == 0 and len ( a ) >= 3 : b . append ( a [ 0 ] ) b . append ( a [ 1 ] ) a = a [ 2 : ] c . extend ( a [ 1 : ] ) a = a [ : 1 ] if len ( a ) % 2 == 0 : c . extend ( a [ 1 : ] ) a = a [ : 1 ]     print ( len ( a ) , * a ) print ( len ( b ) , * b ) print ( len ( c ) , * c ) NEW_LINE

t = int ( input ( ) ) n = [ ] p = [ ] z = [ ] l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( t ) : if l [ i ] > 0 : p . append ( l [ i ] ) elif l [ i ] < 0 : n . append ( l [ i ] ) else : z . append ( l [ i ] ) if len ( n ) % 2 != 0 : if len ( p ) == 0 : x = n [ 0 ] y = n [ 1 ] p . append ( x ) p . append ( y ) n . remove ( x ) n . remove ( y ) else : if len ( p ) == 0 : a = n [ 0 ] b = n [ 1 ] c = n [ 2 ] p . append ( a ) p . append ( b ) z . append ( c ) n . remove ( a ) n . remove ( b ) n . remove ( c ) else : a = n [ 0 ] z . append ( a ) n . remove ( a )   r = ' ' s = ' ' q = ' ' for i in n : r += str ( i ) + ' ▁ ' for i in p : s += str ( i ) + ' ▁ ' for i in z : q += str ( i ) + ' ▁ ' print ( len ( n ) , r ) print ( len ( p ) , s ) print ( len ( z ) , q ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( System . in ) ;   int q = in . nextInt ( ) ;   ArrayList < Interval > intervals = new ArrayList < > ( ) ; int numIntervals = 0 ;   for ( int counter = 0 ; counter < q ; counter ++ ) { if ( in . nextInt ( ) == 1 ) { Interval newInterval = new Interval ( in . nextInt ( ) , in . nextInt ( ) , ++ numIntervals ) ; for ( Interval i : intervals ) { i . addInterval ( newInterval ) ; newInterval . addInterval ( i ) ; } intervals . add ( newInterval ) ; } else { int first = in . nextInt ( ) - 1 ; int goal = in . nextInt ( ) - 1 ;   System . out . println ( intervals . get ( first ) . contains ( intervals . get ( goal ) ) ? " YES " : " NO " ) ; } } }   private static class Interval { int a , b , id ; ArrayList < Interval > paths ;   public Interval ( int a , int b , int id ) { this . a = a ; this . b = b ; this . id = id ;   paths = new ArrayList < > ( ) ; }   public void addInterval ( Interval i ) { if ( i . a < this . a && this . a < i . b || i . a < this . b && this . b < i . b ) { paths . add ( i ) ;

def addEdges ( adj , nodes ) : startNewInterval , endNewInterval = nodes [ - 1 ] for i in range ( 1 , len ( nodes ) - 1 ) : startOther , endOther = nodes [ i ] if startOther < startNewInterval < endOther or startOther < endNewInterval < endOther : adj [ len ( nodes ) - 1 ] . add ( i ) if startNewInterval < startOther < endNewInterval or startNewInterval < endOther < endNewInterval : adj [ i ] . add ( len ( nodes ) - 1 )   def dfs ( adj , start , dest ) : visited = [ False ] * len ( adj ) dfsStack = [ start ] while dfsStack : cur = dfsStack . pop ( ) if visited [ cur ] : continue if cur == dest : return True visited [ cur ] = True dfsStack . extend ( list ( adj [ cur ] ) ) return False inputs = int ( input ( ) ) nodes = [ None ] adj = [ None ] for _ in range ( inputs ) : queryType , start , end = map ( int , input ( ) . split ( ) ) if queryType == 1 : NEW_LINE

import sysfrom math import sqrtfrom collections import dequeinput = sys . stdin . readline   NEW_LINE

n = int ( input ( ) )     class Graph :   def __init__ ( self , V ) : self . V = V self . adj = [ [ ] for i in range ( V ) ]   def DFSUtil ( self , temp , v , y , visited ) :   visited [ v ] = True if v == y : return True   NEW_LINE


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

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

import java . util . * ; public class test { public static void main ( String [ ] args ) throws java . lang . Exception {

n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) if ax in range ( min ( bx , cx ) , max ( bx , cx ) ) or ay in range ( min ( by , cy ) , max ( by , cy ) ) : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE

N = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) board = [ [ - 1 ] * N for i in range ( N ) ] for i in range ( N ) : board [ i ] [ ax - 1 ] = 1 board [ ay - 1 ] [ i ] = 1 for i in range ( - N , N ) : if 0 <= ay - 1 + i < N and 0 <= ax - 1 + i < N : board [ ay - 1 + i ] [ ax - 1 + i ] = 1 if 0 <= ay - 1 - i < N and 0 <= ax - 1 + i < N : board [ ay - 1 - i ] [ ax - 1 + i ] = 1 q = [ ( by - 1 , bx - 1 ) ] while q : yy , xx = q . pop ( ) if yy == cy - 1 and xx == cx - 1 : print ( " YES " ) exit ( ) for dx in [ - 1 , 0 , 1 ] : for dy in [ - 1 , 0 , 1 ] : if 0 <= yy + dy < N and 0 <= xx + dx < N and board [ yy + dy ] [ xx + dx ] == - 1 : board [ yy + dy ] [ xx + dx ] = 0 q . append ( ( yy + dy , xx + dx ) ) print ( " NO " ) NEW_LINE

n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) NEW_LINE

n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) if ( ( bx > ax and cx > ax ) or ( bx < ax and cx < ax ) ) and ( ( by > ay and cy > ay ) or ( by < ay and cy < ay ) ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

dimensions = int ( input ( ) ) ax , ay = tuple ( map ( int , input ( ) . split ( ) ) ) bx , by = tuple ( map ( int , input ( ) . split ( ) ) ) cx , cy = tuple ( map ( int , input ( ) . split ( ) ) )   if bx < ax and by < ay : if cx < ax and cy < ay : diff_x = ax - cx diff_y = ay - cy   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx < ax and by > ay : if cx < ax and cy > ay : diff_x = ax - cx diff_y = cy - ay   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx > ax and by < ay : if cx > ax and cy < ay : diff_x = cx - ax diff_y = ay - cy   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx > ax and by > ay : if cx > ax and cy > ay : diff_x = cx - ax diff_y = cy - ay   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   else : print ( ' NO ' ) NEW_LINE


import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] home = new int [ n ] ; int [ ] away = new int [ n ] ; int matches = 0 ; for ( int i = 0 ; i < n ; i ++ ) { home [ i ] = in . nextInt ( ) ; away [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; if ( home [ i ] == away [ j ] ) ++ matches ; } } System . out . println ( matches ) ; } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { int n , i ; int a1 , a2 ; int [ ] jerh = new int [ 51 ] ; int [ ] jera = new int [ 51 ] ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) { a1 = sc . nextInt ( ) ; a2 = sc . nextInt ( ) ; jerh [ i ] = a1 ; jera [ i ] = a2 ; } int j , sig = 0 ; for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < n ; j ++ ) { if ( jerh [ i ] == jera [ j ] ) sig ++ ; } } System . out . println ( sig ) ; } }

import java . util . * ; public class Game { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] arr1 = new int [ n ] ; int [ ] arr2 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr1 [ i ] = s . nextInt ( ) ; arr2 [ i ] = s . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i != j && arr1 [ i ] == arr2 [ j ] ) { count ++ ; } } } System . out . println ( count ) ; } }

import java . util . * ; public class Game { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] h = new int [ t ] ; int [ ] a = new int [ t ] ; int count = 0 ; for ( int i = 0 ; i < t ; i ++ ) { h [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < t ; i ++ ) { for ( int j = 0 ; j < t ; j ++ ) { if ( i != j && h [ i ] == a [ j ] ) ++ count ; } } System . out . println ( count ) ; } }

import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] home = new int [ n ] ; int [ ] away = new int [ n ] ; int matches = 0 ; for ( int i = 0 ; i < n ; i ++ ) { home [ i ] = in . nextInt ( ) ; away [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( home [ i ] == away [ j ] ) ++ matches ; System . out . println ( matches ) ; } }

n = int ( input ( ) ) l1 = [ ] l2 = [ ] result = 0 for i in range ( n ) : t = input ( ) . split ( ) l1 . append ( t [ 0 ] ) l2 . append ( t [ 1 ] )   for i in range ( len ( l1 ) ) : for j in range ( len ( l2 ) ) : if l1 [ i ] == l2 [ j ] : result += 1     print ( result ) NEW_LINE

s = 0 a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( int ( input ( ) ) ) ] for i in range ( len ( a ) ) : for j in range ( len ( a ) ) : if a [ i ] [ 0 ] == a [ j ] [ 1 ] : s += 1 print ( s ) NEW_LINE

n = int ( input ( " " ) ) l = [ ] for i in range ( n ) : a , b = input ( " " ) . split ( " ▁ " ) a , b = int ( a ) , int ( b ) l . append ( a ) l . append ( b ) c = 0 for i in range ( 0 , len ( l ) , 2 ) : for j in range ( 1 , len ( l ) , 2 ) : if l [ i ] == l [ j ] : c = c + 1 print ( c ) NEW_LINE

n = int ( input ( ) ) s1 = [ ] s2 = [ ] ans = 0 for i in range ( n ) : a , b = input ( ) . split ( ) s1 . append ( a ) s2 . append ( b )   for x in s2 : ans = ans + s1 . count ( x ) NEW_LINE

n = int ( input ( ) ) l1 = [ ] l2 = [ ] r = 0 for i in range ( n ) : t = input ( ) . split ( ) l1 . append ( t [ 0 ] ) l2 . append ( t [ 1 ] )   for i in range ( len ( l1 ) ) : for j in range ( len ( l2 ) ) : if l1 [ i ] == l2 [ j ] : r += 1     print ( r ) NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { private static int findAnswer ( int n , int [ ] a ) { int res = 0 ; for ( int bit = 0 ; bit <= 25 ; bit ++ ) { if ( findBit ( n , a , bit ) > 0 ) { res += ( 1 << bit ) ; } } return res ; }   private static int findBit ( int n , int [ ] a , int bit ) { int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = ( a [ i ] % ( 1 << ( bit + 1 ) ) ) ; } Arrays . sort ( A ) ;

import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class PresentRedo { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; Arrays . setAll ( a , i -> sc . nextInt ( ) ) ; int MAXBIT = 24 ; int ans = 0 ; for ( int i = 0 , bit = 1 ; i <= MAXBIT ; i ++ , bit <<= 1 ) { int [ ] fraction = new int [ N ] ; long ones = 0 ; for ( int j = 0 ; j < N ; j ++ ) { fraction [ j ] = a [ j ] & ( bit - 1 ) ; if ( ( a [ j ] & bit ) > 0 ) { ones ++ ; } } Arrays . sort ( fraction ) ; int r = N ; long carried = 0 ; for ( int l = 0 ; l < N ; l ++ ) { while ( r >= max ( 1 , l + 2 ) && fraction [ l ] + fraction [ r - 1 ] >= bit ) { r -- ; } r = max ( r , l + 1 ) ; carried += max ( 0 , N - r ) ; }

for z in range ( 1 ) : co = 0 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for e in range ( 1 , 25 ) : po = 2 ** e re = sorted ( [ k % po for k in l ] ) b = n r = 0 for a in range ( n ) : b -= 1 while re [ a ] + re [ b ] >= po and b >= 0 : b -= 1 b += 1 r += n - b - ( a >= b ) r //= 2 if r % 2 : co += 2 ** e if n % 2 == 0 : for k in l : co = co ^ k print ( co ) NEW_LINE

import sysinput = sys . stdin . readline   n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   ANS = 0 for i in range ( 26 ) : B = [ ]   for a in A : B . append ( a & ( ( 1 << ( i + 1 ) ) - 1 ) )   B . sort ( )   j0 = n - 1 j1 = n - 1 j2 = n - 1 count = 0   for j in range ( n ) : while j0 >= 0 and B [ j0 ] + B [ j ] >= ( 1 << i ) : j0 -= 1 while j1 >= 0 and B [ j1 ] + B [ j ] > ( 1 << ( i + 1 ) ) - 1 : j1 -= 1   while j2 >= 0 and B [ j2 ] + B [ j ] >= ( 1 << i ) + ( 1 << ( i + 1 ) ) : j2 -= 1   NEW_LINE

from collections import defaultdictfrom queue import deque     def arrinp ( ) : return [ * map ( int , input ( ) . split ( ' ▁ ' ) ) ]     def mulinp ( ) : return map ( int , input ( ) . split ( ' ▁ ' ) )     def intinp ( ) : return int ( input ( ) )     def solution ( ) : co = 0 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for e in range ( 1 , 25 ) : po = 2 ** e re = sorted ( [ k % po for k in l ] ) b = n r = 0 for a in range ( n ) : b -= 1 while re [ a ] + re [ b ] >= po and b >= 0 : b -= 1 b += 1 r += n - b - ( a >= b ) r //= 2 if r % 2 : co += 2 ** e if n % 2 == 0 : for k in l : co = co ^ k print ( co )     testcases = 1 NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Random ; import java . util . * ; import java . util . StringTokenizer ; import java . util . Scanner ; public class Comptetive { static class Pair { int f ; int s ; Pair ( int f , int s ) { this . f = f ; this . s = s ; } } public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ;

import java . util . * ; import java . io . * ; import java . math . * ; import java . text . * ;   public class Main { static PrintWriter out ; static Reader in ; public static void main ( String [ ] args ) throws IOException { input_output ( ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class A { 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 ) { FastScanner in = new FastScanner ( ) ; FastWriter out = new FastWriter ( ) ; int n = in . nextInt ( ) ; String [ ] str1 = in . next ( ) . split ( " " ) ; String [ ] str2 = in . next ( ) . split ( " " ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int diff = Math . abs ( Integer . parseInt ( str1 [ i ] ) - Integer . parseInt ( str2 [ i ] ) ) ; if ( diff <= 5 ) { cnt += diff ; } else { cnt += 10 - diff ; } } out . println ( cnt ) ; out . close ( ) ; } }

import java . util . Scanner ;   public class A540 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , t = 0 ; String word1 = scanner . next ( ) , word2 = scanner . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int diff = Math . abs ( word1 . charAt ( i ) - word2 . charAt ( i ) ) ; if ( diff > 5 ) { t += 10 - diff ; } else { t += diff ; } } System . out . println ( t ) ; } }

def fun ( ls , ms ) : ans = 0 for i , j in zip ( ls , ms ) : NEW_LINE

n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) s = 0 for i in range ( n ) : m = min ( abs ( int ( s1 [ i ] ) - int ( s2 [ i ] ) ) , min ( int ( s1 [ i ] ) , 10 - int ( s1 [ i ] ) ) + min ( int ( s2 [ i ] ) , 10 - int ( s2 [ i ] ) ) ) s = s + mprint ( s ) NEW_LINE

from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBaseimport math   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip       def main ( ) : n = int ( input ( ) ) NEW_LINE

n = int ( input ( ) ) lock = str ( input ( ) ) unlock = str ( input ( ) )   total_comb = 0   for i in range ( 0 , n ) : a = int ( lock [ i ] ) b = int ( unlock [ i ] )   d1 = abs ( a - b ) d2 = 10 - max ( a , b ) + min ( a , b )   total_comb += min ( d1 , d2 )   print ( total_comb ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Olympiad { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( ! set . contains ( a ) && a != 0 ) { set . add ( a ) ; } } System . out . println ( set . size ( ) ) ; } }

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

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

import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ 601 ] ; Arrays . fill ( a , - 1 ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x > 0 && a [ x ] == - 1 ) { a [ x ] = 1 ; res ++ ; } } System . out . println ( res ) ; } }

def main_function ( ) : n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] hash = [ 0 for i in range ( 605 ) ] for i in p : if not i == 0 : hash [ i ] += 1 count = 0 for i in hash : if i != 0 : count += 1 return count       print ( main_function ( ) ) NEW_LINE

n = int ( input ( ) ) a = set ( map ( int , input ( ) . split ( ) ) ) a -= { 0 } print ( len ( a ) ) NEW_LINE

import sysinput = sys . stdin . readline   n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] res = [ int ( i ) for i in a if i > 0 ] print ( len ( set ( res ) ) ) NEW_LINE

import sys   def main ( ) : _ , s = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) return len ( set ( s . split ( ) ) - { '0' } ) print ( main ( ) ) NEW_LINE


import java . io . * ; import java . util . * ; import java . util . stream . * ;   public class a implements Runnable { public static void main ( String [ ] args ) { new Thread ( null , new a ( ) , " process " , 1 << 26 ) . start ( ) ; } public void run ( ) { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; String s = sc . next ( ) ; int i = 0 ; int count0 , count1 ; count1 = 0 ; count0 = 0 ; char st = s . charAt ( 0 ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; for ( i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == st ) continue ; { st = s . charAt ( i ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; } } if ( y > x ) { if ( count0 > 1 ) {

n , x , y = map ( int , input ( ) . split ( ) ) s = input ( ) c = 0 ans1 , ans2 = 0 , 0 for i in range ( n - 1 ) : if s [ i ] == '0' and s [ i + 1 ] == '1' : c += 1 if s [ n - 1 ] == '0' : c += 1 if c == 0 : print ( 0 ) else : ans1 = x * ( c - 1 ) + y ans2 = ( c - 1 ) * y + y print ( min ( ans1 , ans2 ) )               NEW_LINE

def so ( l ) : l = l . replace ( "11" , "1" ) return ln , x , y = map ( int , input ( ) . split ( ) ) l = input ( ) if ( "0" not in l ) : print ( 0 ) else : while ( "11" in l ) : l = so ( l ) l = l . split ( "1" ) if ( l [ 0 ] == " " ) : l . remove ( " " ) if ( l [ - 1 ] == " " ) : l . pop ( )   a = len ( l ) - 1 ans1 = ( a + 1 ) * y   ans2 = a * x + y print ( min ( ans1 , ans2 ) ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : n , x , y = map ( int , input ( ) . split ( ) ) s = list ( input ( ) )   arr = [ s [ 0 ] ]   for i in range ( 1 , n ) : if s [ i ] != s [ i - 1 ] : arr . append ( s [ i ] )   if len ( arr ) == 1 and arr [ 0 ] == '1' : print ( 0 ) exit ( 0 )   c = arr . count ( '0' )   xarr = [ 0 ] yarr = [ y ]   for i in range ( 1 , c ) : xarr . append ( xarr [ - 1 ] + x ) yarr . append ( yarr [ - 1 ] + y )   yarr . reverse ( )   print ( min ( map ( lambda o : o [ 0 ] + o [ 1 ] , zip ( xarr , yarr ) ) ) ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = 0 ; int [ ] x = new int [ n + 1 ] ; x [ 1 ] = sc . nextInt ( ) ; for ( int i = 2 ; i <= n ; i ++ ) { x [ i ] = sc . nextInt ( ) ^ x [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { t = Math . max ( t , x [ i ] ^ x [ j ] ) ; } } System . out . println ( t ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] x = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { x [ i ] = sc . nextLong ( ) ^ x [ i - 1 ] ; } long max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { max = Math . max ( x [ i ] , max ) ; for ( int j = 0 ; j < i ; j ++ ) { max = Math . max ( x [ i ] ^ x [ j ] , max ) ; } } System . out . println ( max ) ; } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner read = new Scanner ( System . in ) ; long ans = 0 ; int n = read . nextInt ( ) ; long [ ] arr = new long [ n + 1 ] ; long [ ] pref = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = read . nextLong ( ) ; pref [ i ] = pref [ i - 1 ] ^ arr [ i ] ; } for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i ; j <= n ; j ++ ) { ans = Math . max ( ans , pref [ j ] ^ pref [ i - 1 ] ) ; } } System . out . println ( ans ) ; } }

import mathn = int ( input ( ) ) ; ans = 0 a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : x = 0 for j in range ( i , n ) : x = x ^ a [ j ] ans = max ( ans , x ) print ( ans )   NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] for i in range ( n ) : x = a [ i ] b . append ( x ) for j in range ( i + 1 , n ) : x ^= a [ j ] b . append ( x ) print ( max ( b ) ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = max ( a ) for i in range ( n - 1 ) : p = a [ i ] for j in range ( i + 1 , n ) : p = p ^ a [ j ] ans = max ( ans , p ) print ( ans ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) max_xor = - 19999 for i in range ( 1 , n + 1 ) : for j in range ( n - i + 1 ) : cur_xor = arr [ j ] for h in range ( j , j + i - 1 ) : cur_xor = cur_xor ^ arr [ h + 1 ] max_xor = max ( cur_xor , max_xor ) print ( max_xor ) NEW_LINE

import math , sysfrom collections import defaultdict , dequeimport bisect as bidef yes ( ) : print ( ' YES ' ) def no ( ) : print ( ' NO ' ) def I ( ) : return ( int ( sys . stdin . readline ( ) ) ) def In ( ) : return ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def Sn ( ) : return sys . stdin . readline ( ) . strip ( ) def Pr ( x ) : sys . stdout . write ( str ( x ) + ' \n ' ) NEW_LINE


import java . io . * ; import java . util . * ;   public class P396A { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( in , out ) ; out . close ( ) ; }   static class Task { private static List < Integer > primes = new ArrayList < > ( ) ; final long M = 1000000007 ;   public static void sievePrimes ( int maxValue ) {

import java . io . * ; import java . math . BigInteger ; import java . util . * ; import java . util . Stack ; import java . util . regex . Pattern ;        public class ROUGH {   public static class FastReader { BufferedReader br ; StringTokenizer st ;

import java . io . * ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . StringTokenizer ;   public class multipliers { static public HashMap < Integer , Integer > factor ( int in ) { HashMap < Integer , Integer > result = new HashMap < > ( ) ; for ( int i = 2 ; i * i <= in ; i ++ ) { if ( in % i == 0 ) { int count = 0 ; while ( in % i == 0 ) { count ++ ; in /= i ; } result . put ( i , count ) ; } } if ( in != 1 ) { result . put ( in , 1 ) ; } return result ; }   static public void factor ( int in , HashMap < Integer , Integer > a ) { HashMap < Integer , Integer > result = new HashMap < > ( ) ; for ( int i = 2 ; i * i <= in ; i ++ ) { if ( in % i == 0 ) { int count = 0 ; while ( in % i == 0 ) { count ++ ; in /= i ; } if ( a . containsKey ( i ) ) a . put ( i , a . remove ( i ) + count ) ; else a . put ( i , count ) ; } } if ( in != 1 ) { if ( a . containsKey ( in ) ) a . put ( in , a . remove ( in ) + 1 ) ; else a . put ( in , 1 ) ;   }   } static int base = 0 ; static int MOD = ( int ) ( 1e9 + 7 ) ;

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . Set ; import java . util . HashMap ; import java . io . IOException ; import java . util . Random ; import java . io . UncheckedIOException ; import java . util . HashSet ; import java . util . Map ; import java . io . Closeable ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . math . BigInteger ; import java . util . Collections ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) throws Exception { Thread thread = new Thread ( null , new TaskAdapter ( ) , " " , 1 << 29 ) ; thread . start ( ) ; thread . join ( ) ; }   static class TaskAdapter implements Runnable { @ Override public void run ( ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastInput in = new FastInput ( inputStream ) ; FastOutput out = new FastOutput ( outputStream ) ; AOnNumberOfDecompositionsIntoMultipliers solver = new AOnNumberOfDecompositionsIntoMultipliers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } }   static class AOnNumberOfDecompositionsIntoMultipliers { int mod = ( int ) 1e9 + 7 ; Combination comb = new Combination ( ( int ) 1e5 , mod ) ;   public void solve ( int testNumber , FastInput in , FastOutput out ) { int n = in . ri ( ) ; int [ ] a = in . ri ( n ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int x : a ) { Set < Integer > set = PollardRho . findAllFactors ( x ) ; for ( int y : set ) { int p = 0 ; while ( x % y == 0 ) { x /= y ; p ++ ; } map . put ( y , map . getOrDefault ( y , 0 ) + p ) ; } }   long ans = 1 ; for ( int v : map . values ( ) ) {

from math import factorial as fdef primes ( n ) : sieve = [ True ] * n for i in range ( 3 , int ( n ** 0.5 ) + 1 , 2 ) : if sieve [ i ] : sieve [ i * i : : 2 * i ] = [ False ] * ( ( n - i * i - 1 ) // ( 2 * i ) + 1 ) return [ 2 ] + [ i for i in range ( 3 , n , 2 ) if sieve [ i ] ] p = primes ( 31627 ) s = [ 0 ] * ( 31623 ) s1 = { } def factorize ( n ) : for i in p : if n <= 1 : return 56 while n % i == 0 : s [ p . index ( i ) ] += 1 n //= i if n > 1 : if n in s1 : s1 [ n ] += 1 else : s1 [ n ] = 1 n = int ( input ( ) ) for i in map ( int , input ( ) . split ( ) ) : factorize ( i ) s = list ( filter ( lambda a : a != 0 , s ) ) for i in s1 . values ( ) : s . append ( i ) ans = 1 for i in s : ans *= f ( i + n - 1 ) // ( f ( n - 1 ) * f ( i ) ) print ( int ( ans ) % 1000000007 ) NEW_LINE

Mod = 1000000007 MAX = 33000 n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) B = [ 0 ] * MAX bePrime = [ 0 ] * MAX ; primNum = [ ] C = [ ] fac = [ 1 ] for j in range ( 1 , MAX ) : fac . append ( fac [ - 1 ] * j % Mod ) def calc ( M , N ) : return fac [ M ] * pow ( fac [ N ] * fac [ M - N ] % Mod , Mod - 2 , Mod ) % Mod for j in range ( 2 , MAX ) : if bePrime [ j ] == 0 : primNum . append ( j ) i = j while i < MAX : bePrime [ i ] = 1 i = i + j for x in A : tmp = x for j in primNum : while tmp % j == 0 : tmp /= j B [ j ] += 1 if tmp > 1 : C . append ( tmp ) ans = 1 for j in range ( 2 , MAX ) : if B [ j ] > 0 : ans = ans * calc ( n + B [ j ] - 1 , n - 1 ) % Mod l = len ( C ) for j in range ( 0 , l ) : num = 0 ; for k in range ( 0 , l ) : if C [ k ] == C [ j ] : num = num + 1 if k > j : num = 0 break if num > 0 : ans = ans * calc ( n + num - 1 , n - 1 ) % Mod print ( str ( ans % Mod ) ) NEW_LINE


import java . util . * ; import java . io . * ; public class Solution { public static PrintWriter out ; public static void main ( String args [ ] ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) , true ) ; int n = sc . nextInt ( ) ; for ( int z = 1 ; z <= n ; z ++ ) { long p = sc . nextLong ( ) ; long q = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; q = q / gcd ( p , q ) ; b = gcd ( b , q ) ; while ( b != 1 ) { while ( q % b == 0 ) q = q / b ; b = gcd ( q , b ) ; } if ( q == 1 ) out . println ( " Finite " ) ; else out . println ( " Infinite " ) ; } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) return b ; else if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . io . BufferedInputStream ; import java . io . IOException ; import java . io . PrintWriter ;   public class CF_483_A {   static final BufferedInputStream input = new BufferedInputStream ( System . in ) ; static final PrintWriter output = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws Exception { int n = readInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long p = readLong ( ) ; long q = readLong ( ) ; long b = readLong ( ) ; q = q / gcd ( q , p ) ; long d = gcd ( q , b ) ; while ( d > 1 ) { q /= d ; while ( ( q % d ) == 0 ) { q /= d ; } d = gcd ( q , d ) ; } output . println ( ( q == 1 ) ? " Finite " : " Infinite " ) ; } output . flush ( ) ; output . close ( ) ; }   static long gcd ( long a , long b ) {

import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T -- > 0 ) { long p = input . nextLong ( ) ; long q = input . nextLong ( ) ; long b = input . nextLong ( ) ; q = q / gcd ( p , q ) ; long g = gcd ( q , b ) ; while ( g > 1 ) { while ( q % g == 0 ) { q = q / g ; } g = gcd ( q , b ) ; } if ( q == 1 ) { out . println ( " Finite " ) ; } else { out . println ( " Infinite " ) ; } } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) {   return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T - -> 0 ) { long p = input . nextLong ( ) ; long q = input . nextLong ( ) ; long b = input . nextLong ( ) ; q = q / gcd ( p , q ) ; long g = gcd ( q , b ) ; while ( g > 1 ) { while ( q % g == 0 ) { q = q / g ; } g = gcd ( q , b ) ; } if ( q == 1 ) { out . println ( " Finite " ) ; } else { out . println ( " Infinite " ) ; } } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } 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 ; } } } NEW_LINE

import sys   def main ( ) : n = int ( input ( ) ) ans = [ ] for i in range ( n ) : p , q , b = map ( int , input ( ) . split ( " ▁ " ) ) t = pow ( b , 111 , q ) if p * t % q == 0 : ans . append ( " Finite " ) else : ans . append ( " Infinite " )   print ( " \n " . join ( ans ) )   main ( ) NEW_LINE

import sysinput = sys . stdin . readline   t = int ( input ( ) ) res = [ ] for _ in range ( t ) : p , q , b = map ( int , input ( ) . split ( ) ) if p * pow ( b , 64 , q ) % q != 0 : res . append ( " Infinite " ) else : res . append ( " Finite " ) print ( ' \n ' . join ( res ) ) NEW_LINE


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

import java . util . * ; public class BadTriangle { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int c = 0 , n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; if ( a [ 0 ] + a [ 1 ] <= a [ n - 1 ] ) System . out . println ( 1 + " ▁ " + 2 + " ▁ " + n ) ; else System . out . println ( - 1 ) ; } } }

import java . util . * ; public class op { 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 a [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } if ( a [ 0 ] + a [ 1 ] <= a [ n - 1 ] ) System . out . println ( 1 + " ▁ " + 2 + " ▁ " + n ) ; else System . out . println ( - 1 ) ; } } }

import java . util . * ; import java . io . * ; public class _practise { public static void main ( String args [ ] ) { FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextLong ( ) ; if ( a [ 0 ] + a [ 1 ] > a [ n - 1 ] ) so . println ( " - 1" ) ; else so . println ( "1 ▁ 2 ▁ " + ( n ) ) ; } so . flush ( ) ; } 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 ( ) ) ; } int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

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

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE q = ali [ 1 ] + ali [ 0 ] NEW_LINE if ( ali [ - 1 ] >= q ) : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT

def removeSmallest ( ) : NEW_LINE INDENT s = arr [ 0 ] + arr [ 1 ] NEW_LINE k = 0 NEW_LINE if len ( arr ) < 3 : NEW_LINE INDENT k = - 1 NEW_LINE DEDENT for i in range ( 2 , n ) : NEW_LINE INDENT if s <= arr [ i ] : NEW_LINE INDENT k = 0 NEW_LINE x = i + 1 NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT k = - 1 NEW_LINE DEDENT DEDENT if k == 0 : NEW_LINE INDENT return ( " " + str ( 1 ) + " ▁ " + str ( 2 ) + " ▁ " + str ( i + 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT return - 1 NEW_LINE DEDENT DEDENT t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( removeSmallest ( ) ) NEW_LINE DEDENT

import sys NEW_LINE input = sys . stdin . readline NEW_LINE for test in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE if a [ 0 ] + a [ 1 ] > a [ - 1 ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT DEDENT

for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( * ( [ 1 , 2 , n ] , [ - 1 ] ) [ a [ 0 ] + a [ 1 ] > a [ n - 1 ] ] ) NEW_LINE DEDENT

import sys NEW_LINE input = sys . stdin . readline NEW_LINE def non_deg ( vals ) : NEW_LINE INDENT a , b , c = vals NEW_LINE return a + b > c and a + c > b and b + c > a NEW_LINE DEDENT t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if not non_deg ( [ a [ 0 ] , a [ 1 ] , a [ - 1 ] ] ) : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class B {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) , m = fs . nextInt ( ) ; Node [ ] nodes = new Node [ n ] ; for ( int i = 0 ; i < n ; i ++ ) nodes [ i ] = new Node ( i ) ; for ( int i = 0 ; i < n ; i ++ ) { nodes [ i ] . outDegree = fs . nextInt ( ) ; for ( int j = 0 ; j < nodes [ i ] . outDegree ; j ++ ) { int next = fs . nextInt ( ) - 1 ; nodes [ i ] . canReach . add ( nodes [ next ] ) ; nodes [ next ] . canReachMe . add ( nodes [ i ] ) ; } }

import java . util . * ; import java . io . * ; public class EdA { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; static Map < State , ArrayList < State > > graph ; static Map < Integer , ArrayList < Integer > > outgraph ; static int [ ] [ ] dp ; static Set < Integer > currDFS ; public static void main ( String [ ] omkar ) throws Exception {

n , m = list ( map ( int , input ( ) . split ( ) ) )   from collections import defaultdict   graph = defaultdict ( list )   for i in range ( 1 , n + 1 ) : neighbours = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] graph [ ( i , 0 ) ] = [ ( x , 1 ) for x in neighbours ] graph [ ( i , 1 ) ] = [ ( x , 0 ) for x in neighbours ]   start = int ( input ( ) )   NEW_LINE

n , m = [ int ( x ) for x in input ( ) . split ( ) ]   edges = [ set ( ) ]   drain = set ( )   for i in range ( n ) :   nums = [ int ( x ) for x in input ( ) . split ( ) ]   if nums [ 0 ] == 0 :   drain . add ( i + 1 )   edges . append ( set ( nums [ 1 : ] ) )   start = int ( input ( ) )       nodes = { start }   visited = { }   while len ( nodes ) > 0 :   curr = nodes . pop ( )   for v in edges [ abs ( curr ) ] :   if curr > 0 :   v = - v   if visited . get ( v ) is None :   nodes . add ( v )   visited [ v ] = curr       ok = False   for d in drain :   if - d in visited :   print ( ' Win ' )   v = - d   l = [ ]   while v != start :   l . append ( abs ( v ) )   v = visited [ v ]   l . append ( start )   print ( ' ▁ ' . join ( str ( x ) for x in l [ : : - 1 ] ) )   ok = True   break       if not ok :   stack = [ start ]   in_stack = { start }   visited = { start }   while len ( stack ) > 0 :   curr = stack [ - 1 ]   if len ( edges [ curr ] ) == 0 :   stack . pop ( )   in_stack . remove ( curr )   continue   v = edges [ curr ] . pop ( )   if v not in visited :   visited . add ( v )   stack . append ( v )   in_stack . add ( v )   elif v in in_stack :   print ( ' Draw ' )   ok = True   break   if not ok :   print ( ' Lose ' )                         NEW_LINE


import java . util . * ; import java . io . * ; import java . math . BigInteger ;   public class b { public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long ql = sc . nextLong ( ) ; long qr = sc . nextLong ( ) ; long [ ] w = sc . nextLongArray ( n ) ;   long [ ] lsum = new long [ n + 1 ] ; long [ ] rsum = new long [ n + 1 ] ; lsum [ 1 ] = w [ 0 ] ; for ( int i = 2 ; i <= n ; i ++ ) lsum [ i ] = lsum [ i - 1 ] + w [ i - 1 ] ; rsum [ n - 1 ] = w [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) rsum [ i ] = rsum [ i + 1 ] + w [ i ] ;   long min = Integer . MAX_VALUE ;   for ( int i = 0 ; i <= n ; i ++ ) { int lop = i ; int rop = n - i ; long cost = lsum [ lop ] * l + rsum [ n - rop ] * r ;   if ( lop > rop ) { cost += ( lop - rop - 1 ) * ql ; } else if ( rop > lop ) { cost += ( rop - lop - 1 ) * qr ; } min = Math . min ( min , cost ) ; } System . out . println ( min ) ;   } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { static class InputReader { protected BufferedReader br = null ; StringTokenizer tokenizer = null ;   public InputReader ( InputStream is ) { super ( ) ; br = new BufferedReader ( new InputStreamReader ( is ) ) ; }   public String next ( ) { for ( ; tokenizer == null || ! tokenizer . hasMoreTokens ( ) ; ) { try { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) {

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; long [ ] w ; long L , R , QL , QR ; void run ( FastScanner in , PrintWriter out ) {

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) ) : sys . stdin = open ( " input . txt " , " r " ) sys . stdout = open ( " output . txt " , " w " ) N = 10 ** 5 + 5 n , l , r , q1 , q2 = map ( int , input ( ) . split ( ) ) w = [ int ( x ) for x in input ( ) . split ( ) ] pre = [ 0 ] * Nfor i in range ( n ) : pre [ i + 1 ] = pre [ i ] + w [ i ]   ans = 10 ** 18   for i in range ( n + 1 ) : curr = pre [ i ] * l + ( pre [ n ] - pre [ i ] ) * r x , y = i , n - i if ( x < y ) : curr += q2 * ( y - x - 1 ) elif ( x > y ) : curr += q1 * ( x - y - 1 ) ans = min ( ans , curr ) print ( ans ) NEW_LINE

import time , math as mt , bisect as bs , sysfrom sys import stdin , stdoutfrom collections import dequefrom fractions import Fractionfrom collections import Counterfrom collections import OrderedDictpi = 3.14159265358979323846264338327950 def II ( ) : NEW_LINE

if __name__ == ' _ _ main _ _ ' : n , l , r , ql , qr = map ( int , input ( ) . split ( ) ) weights = [ int ( x ) for x in input ( ) . split ( ) ]   curr_sum = 0 cum_sum = list ( )   for i in weights : curr_sum += i cum_sum . append ( curr_sum ) NEW_LINE