import java . util . * ; import java . io . * ;   public class HarryPotterAndHistoryOfMagic65B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] dates = new String [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { dates [ i ] = sc . next ( ) ; }   String correctedDates = correctDates ( dates ) ; System . out . println ( correctedDates ) ; }   public static String correctDates ( String [ ] dates ) { if ( dates . length == 0 ) { return " " ; } StringBuilder sb = new StringBuilder ( " " ) ; String res = makeDateCorrect ( dates [ dates . length - 1 ] , "2011" ) ; if ( res == null ) { return " No ▁ solution " ; } sb . append ( res ) ; dates [ dates . length - 1 ] = res ;

import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class Main { private static int fixDigit ( int num , int index , int digit ) { switch ( index ) { case - 1 : return num ; case 0 : return 1000 * digit + ( num % 1000 ) ; case 1 : return 100 * digit + ( num / 1000 ) * 1000 + ( num % 100 ) ; case 2 : return 10 * digit + ( num / 100 ) * 100 + ( num % 10 ) ; case 3 : return digit + ( num / 10 ) * 10 ; default : return 0 ; } }   private static int changeMinimunValue ( int oldVlaue , int minValue , int maxValue ) { int newValue = 9999 ; for ( int index = 0 ; index <= 3 ; ++ index ) { for ( int digit = 0 ; digit <= 9 ; ++ digit ) { int temp = fixDigit ( oldVlaue , index , digit ) ; if ( minValue <= temp && temp <= maxValue && temp < newValue ) { newValue = temp ; } } } return newValue ; }   public static void main ( String arg [ ] ) {

import java . util . * ;   public class HarryPotterAndTheHistoryOfMagic { static boolean valid ( int [ ] dates ) { for ( int i = 0 ; i < dates . length ; i ++ ) { if ( dates [ i ] < 1000 || dates [ i ] > 2011 ) return false ; if ( i > 0 && dates [ i - 1 ] > dates [ i ] ) return false ; } return true ; } static int changeDate ( int currentDate , int previousDate ) { char [ ] dateChars = String . valueOf ( currentDate ) . toCharArray ( ) ; int min = 9999 ; for ( int i = 0 ; i < dateChars . length ; i ++ ) { char tmp = dateChars [ i ] ; for ( char c = '0' ; c <= '9' ; c ++ ) { dateChars [ i ] = c ; int year = Integer . parseInt ( String . valueOf ( dateChars ) ) ; if ( year <= 2011 && year >= previousDate && year < min ) { min = year ; } } dateChars [ i ] = tmp ; } return min ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] dates = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { dates [ i ] = in . nextInt ( ) ; } int [ ] newDates = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { newDates [ i ] = changeDate ( dates [ i ] , i == 0 ? 1000 : newDates [ i - 1 ] ) ; } if ( ! valid ( newDates ) ) { System . out . println ( " No ▁ solution " ) ; } else { for ( int date : newDates ) { System . out . println ( date ) ; } } in . close ( ) ; System . exit ( 0 ) ; } }

n = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE for _ in range ( n ) : a . append ( input ( ) )   prev = "1000" NEW_LINE z = 1 NEW_LINE for i in range ( n ) : l = ' ' NEW_LINE for j in range ( 4 ) : x = list ( a [ i ] [ : ] ) NEW_LINE for k in range ( 10 ) : x [ j ] = chr ( k + ord ( '0' ) ) NEW_LINE check = ' ' . join ( r for r in x ) NEW_LINE if int ( check ) >= int ( prev ) : if NEW_LINE len ( l ) == 0 : l = check else : if int ( check ) < int ( l ) : l = check   a [ i ] = ' ' . join ( r for r in l ) NEW_LINE if int ( a [ i ] ) > 2011 or int ( a [ i ] ) < int ( prev ) : z = 0 NEW_LINE break ; NEW_LINE prev = a [ i ] NEW_LINE if z == 1 : for NEW_LINE i in a : print ( i ) NEW_LINE

import sys   n = int ( input ( ) ) NEW_LINE d = [ ] NEW_LINE for i in range ( n ) : d . append ( input ( ) ) NEW_LINE ans = [ ]   bad = ' No ▁ solution ' NEW_LINE low = 1000 NEW_LINE for date in d : lowest = 100500 NEW_LINE for i in range ( 10 ) : for NEW_LINE j in range ( i == 0 , 5 ) : changed = date [ : j ] + str ( i ) + date [ j + 1 : ] NEW_LINE if lowest > int ( changed ) >= low : lowest = int ( changed ) NEW_LINE if lowest > 2011 : print ( bad ) NEW_LINE sys . exit ( 0 ) NEW_LINE ans . append ( str ( lowest ) ) NEW_LINE low = lowest   print ( ' \n ' . join ( ans ) ) NEW_LINE

n = int ( input ( ) )   l = [ ] NEW_LINE for i in range ( n ) : l . append ( int ( input ( ) ) )   NEW_LINE def repair ( x , y , r ) : if NEW_LINE INDENT ( r == 0 ) : NEW_LINE DEDENT return x NEW_LINE z = ( x % ( 10 * r ) ) // r - ( y % ( 10 * r ) ) // r NEW_LINE if ( z == 0 ) : return repair ( x , y , r // 10 ) NEW_LINE if ( x % r >= y % r ) : NEW_LINE INDENT return x - z * r else : NEW_LINE if NEW_LINE ( z != 1 ) : NEW_LINE DEDENT return x - z * r + r NEW_LINE return x - x % r + ( x % r ) % ( 10 ** ( len ( str ( x % r ) ) - 1 ) )   y = 1000 NEW_LINE try : for NEW_LINE i in range ( n ) : l [ i ] = repair ( l [ i ] , y , 1000 ) NEW_LINE if ( l [ i ] > 2011 ) : raise Exception ( ) NEW_LINE y = l [ i ] NEW_LINE for i in l : print ( i ) except : print ( " No ▁ solution " ) NEW_LINE

n , a , ans , last = int ( input ( ) ) , [ ] , [ ] , 1000 NEW_LINE for i in range ( n ) : a . append ( input ( ) ) NEW_LINE for d in a : minoverd = 10000000 NEW_LINE for i in range ( 10 ) : for NEW_LINE j in range ( i == 0 , 5 ) : t = int ( d [ : j ] + str ( i ) + d [ j + 1 : ] ) NEW_LINE if minoverd > t >= last : minoverd = t NEW_LINE ans . append ( str ( minoverd ) ) NEW_LINE if minoverd > 2011 : break NEW_LINE last = minoverdif NEW_LINE minoverd > 2011 : print ( " No ▁ solution " ) else : print ( * ans ) NEW_LINE


import java . io . * ; import java . util . * ;    public class Solution { public static void main ( String [ ] args ) throws Exception { int n = in . readInt ( ) ; int [ ] [ ] cube = new int [ 3 ] [ 6 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { Arrays . fill ( cube [ i ] , - 1 ) ; } for ( int i = 0 ; i < n ; i ++ ) { cube [ i ] = in . readA ( ) ; Arrays . sort ( cube [ i ] ) ; } int [ ] digit = new int [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 6 ; j ++ ) { digit [ cube [ i ] [ j ] ] ++ ; } } for ( int i = 1 ; i < 100 ; i ++ ) { if ( ! check ( i , digit , cube ) ) { System . out . println ( i - 1 ) ; return ; } } } public static boolean check ( int x , int [ ] digit , int [ ] [ ] cube ) { int t = x , c = 0 ; while ( x > 0 ) { c ++ ; x /= 10 ; } x = t ; if ( c == 1 ) return digit [ x ] > 0 ; else { int d10 = x / 10 , d1 = x % 10 ; for ( int i = 1 ; i <= 3 ; i ++ ) { for ( int j = i + 1 ; j <= 3 ; j ++ ) { if ( ( Arrays . binarySearch ( cube [ i - 1 ] , d10 ) > - 1 && Arrays . binarySearch ( cube [ j - 1 ] , d1 ) > - 1 ) || ( Arrays . binarySearch ( cube [ i - 1 ] , d1 ) > - 1 && Arrays . binarySearch ( cube [ j - 1 ] , d10 ) > - 1 ) ) {

import java . io . * ; import java . util . * ; import java . util . regex . * ; public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ;

import java . util . Collections ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class B887 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] [ ] cubes = new int [ N ] [ 6 ] ; for ( int cubeNo = 0 ; cubeNo < N ; cubeNo ++ ) { for ( int i = 0 ; i < 6 ; i ++ ) { cubes [ cubeNo ] [ i ] = in . nextInt ( ) ; } } Set < Integer > set = new HashSet < > ( ) ; for ( int cubeIdx1 = 0 ; cubeIdx1 < N ; cubeIdx1 ++ ) { for ( int sideIdx1 = 0 ; sideIdx1 < 6 ; sideIdx1 ++ ) { int side1 = cubes [ cubeIdx1 ] [ sideIdx1 ] ; set . add ( side1 ) ; for ( int cubeIdx2 = 0 ; cubeIdx2 < N ; cubeIdx2 ++ ) { if ( cubeIdx1 == cubeIdx2 ) { continue ; } for ( int sideIdx2 = 0 ; sideIdx2 < 6 ; sideIdx2 ++ ) { int side2 = cubes [ cubeIdx2 ] [ sideIdx2 ] ; set . add ( 10 * side1 + side2 ) ; set . add ( 10 * side2 + side1 ) ; for ( int cubeIdx3 = 0 ; cubeIdx3 < N ; cubeIdx3 ++ ) { if ( cubeIdx3 == cubeIdx1 || cubeIdx3 == cubeIdx2 ) { continue ; } for ( int sideIdx3 = 0 ; sideIdx3 < 6 ; sideIdx3 ++ ) { int side3 = cubes [ cubeIdx3 ] [ sideIdx3 ] ; set . add ( 100 * side1 + 10 * side2 + side3 ) ; set . add ( 100 * side1 + 10 * side3 + side2 ) ; set . add ( 100 * side2 + 10 * side1 + side3 ) ; set . add ( 100 * side2 + 10 * side3 + side1 ) ; set . add ( 100 * side3 + 10 * side1 + side2 ) ; set . add ( 100 * side3 + 10 * side2 + side1 ) ; } } } } } } int max = 1 ; while ( set . contains ( max ) ) { max ++ ; } System . out . println ( max - 1 ) ; }   }

def check ( cubes , n ) : if len ( str ( n ) ) == 1 : for cube in cubes : if n in cube : return True return False elif len ( str ( n ) ) == 2 : for c1 in range ( len ( cubes ) ) : for c2 in range ( len ( cubes ) ) : if c1 == c2 : pass elif int ( str ( n ) [ 0 ] ) in cubes [ c1 ] and int ( str ( n ) [ 1 ] ) in cubes [ c2 ] : return True return False         n = int ( input ( ) ) cubes = [ [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] for i in range ( n ) ] i = 1 while check ( cubes , i ) : i += 1 print ( i - 1 ) NEW_LINE

n = int ( input ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ] for ai in a : ai . insert ( 0 , ' ' ) dic = { } for k in range ( 1 , 7 ** n ) : tmp = k i = 0 arr = [ ] while 0 < tmp : arr . append ( str ( a [ i ] [ tmp % 7 ] ) ) tmp //= 7 i += 1 arr . sort ( ) dic [ ' ' . join ( arr ) ] = True ans = 0 while ' ' . join ( sorted ( list ( str ( ans + 1 ) ) ) ) in dic : ans += 1 print ( ans ) NEW_LINE


import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; scan . nextLine ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; int minJ = m , maxJ = - 1 , minI = n , maxI = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { String line = scan . nextLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { grid [ i ] [ j ] = line . charAt ( j ) == ' * ' ; if ( grid [ i ] [ j ] ) { minJ = Math . min ( j , minJ ) ; maxJ = Math . max ( j , maxJ ) ; minI = Math . min ( i , minI ) ; maxI = Math . max ( i , maxI ) ; } } } for ( int i = minI ; i <= maxI ; i ++ ) { for ( int j = minJ ; j <= maxJ ; j ++ ) System . out . print ( grid [ i ] [ j ] ? ' * ' : ' . ' ) ; System . out . println ( ) ; } } } }

import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) ; } int sr = 0 ; int sco = 0 ; int lr = 0 ; int lc = 0 ; List < Integer > alr = new ArrayList < > ( ) ; List < Integer > alc = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < s [ i ] . length ( ) ; j ++ ) { if ( s [ i ] . charAt ( j ) == ' * ' ) { lr = i ; lc = j ; alr . add ( i ) ; alc . add ( j ) ;

import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int y = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; char arr [ ] [ ] = new char [ y ] [ x ] ; for ( int i = 0 ; i < y ; i ++ ) { arr [ i ] = sc . next ( ) . toCharArray ( ) ; } int top = Integer . MAX_VALUE ; int bottom = - 1 ; int left = Integer . MAX_VALUE ; int right = - 1 ; for ( int i = 0 ; i < y ; i ++ ) { for ( int j = 0 ; j < x ; j ++ ) { if ( arr [ i ] [ j ] == ' * ' ) { top = Math . min ( i , top ) ; bottom = Math . max ( bottom , i ) ; left = Math . min ( left , j ) ; right = Math . max ( right , j ) ; } } } for ( int i = top ; i <= bottom ; i ++ ) { for ( int j = left ; j <= right ; j ++ ) { System . out . print ( arr [ i ] [ j ] ) ; } System . out . println ( ) ; } } }

n , m = map ( int , input ( ) . split ( ) ) s = [ None ] * nfor i in range ( n ) : s [ i ] = input ( ) while True : if s [ 0 ] . count ( ' * ' ) != 0 : break s . pop ( 0 ) while True : if s [ len ( s ) - 1 ] . count ( ' * ' ) != 0 : break s . pop ( ) x = m - 1 d = m - 1 n = len ( s ) for i in range ( n ) : if s [ i ] . count ( ' * ' ) == 0 : continue s [ i ] = s [ i ] [ : : - 1 ] c = s [ i ] . index ( ' * ' ) if c < d : d = c s [ i ] = s [ i ] [ : : - 1 ] c = s [ i ] . index ( ' * ' ) if c < x : x = cfor i in range ( n ) : print ( s [ i ] [ x : m - d ] ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = [ ] xmin , xmax = m , 0 for i in range ( n ) : a . append ( input ( ) ) for i in range ( n ) : x1 , x2 = a [ i ] . find ( " * " ) , a [ i ] . rfind ( " * " ) if x1 >= 0 : xmin = min ( xmin , x1 ) if x2 >= 0 : xmax = max ( xmax , x2 ) for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if a [ i ] == " . " * m : a . pop ( i ) else : breaka = a [ : : - 1 ] for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if a [ i ] == " . " * m : a . pop ( i ) else : breaka = a [ : : - 1 ] for i in range ( len ( a ) ) : print ( a [ i ] [ xmin : xmax + 1 ] ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) )   cases = a   matrix = [ ] while cases : cases -= 1 matrix . append ( list ( input ( ) ) ) an = matrix [ : ] for row in matrix : if row . count ( " * " ) == 0 : an . pop ( 0 ) else : breakfor row in matrix [ : : - 1 ] : if row . count ( " * " ) == 0 : an . pop ( ) else : breakx = an [ : ]   matrix2 = [ [ x [ j ] [ i ] for j in range ( len ( x ) ) ] for i in range ( len ( x [ 0 ] ) ) ]   ans = matrix2 [ : ] for row in matrix2 : if row . count ( " * " ) == 0 : ans . pop ( 0 ) else : breakfor row in matrix2 [ : : - 1 ] : if row . count ( " * " ) == 0 : ans . pop ( ) else : break   x = ans [ : ]   matrix3 = [ [ x [ j ] [ i ] for j in range ( len ( x ) ) ] for i in range ( len ( x [ 0 ] ) ) ]   for i in matrix3 : print ( " " . join ( i ) )   NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   min_i = 51 max_i = 0 min_j = 51 max_j = 0   pattern = list ( )   for i in range ( n ) : s = input ( ) pattern . append ( s )   temp = s . find ( " * " ) if temp != - 1 : min_j = min ( temp , min_j ) max_j = max ( max_j , s . rfind ( " * " ) ) min_i = min ( i , min_i ) max_i = max ( i , max_i )   for i in range ( n ) : if min_i <= i <= max_i : print ( pattern [ i ] [ min_j : max_j + 1 ] ) NEW_LINE


import java . util . Scanner ; public class ChainReaction {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] [ ] beacons = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < beacons . length ; i ++ ) { beacons [ i ] [ 0 ] = scanner . nextInt ( ) ; beacons [ i ] [ 1 ] = scanner . nextInt ( ) ; } scanner . close ( ) ; sortBeacons ( beacons ) ; int [ ] savedNum = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) {

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 1_000_005 ; int [ ] present = new int [ max ] ; for ( int i = 0 ; i < n ; i ++ ) { present [ sc . nextInt ( ) ] = sc . nextInt ( ) ; } int [ ] dp = new int [ max ] ; if ( present [ 0 ] > 0 ) { dp [ 0 ] = 1 ; } int mx = 0 ; for ( int i = 1 ; i < max ; i ++ ) { if ( present [ i ] == 0 ) { dp [ i ] = dp [ i - 1 ] ; } else { if ( present [ i ] >= i ) { dp [ i ] = 1 ; } else { dp [ i ] = dp [ i - present [ i ] - 1 ] + 1 ; } } mx = Math . max ( mx , dp [ i ] ) ; } System . out . println ( n - mx ) ; sc . close ( ) ; } }

import sys , os , iofrom sys import stdinfrom bisect import bisect_left , bisect_rightdef ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( " input . txt " , " r " ) ; sys . stdout = open ( " output . txt " , " w " ) else : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   n = ii ( ) ; l = [ ] for i in range ( n ) : l . append ( tuple ( li ( ) ) ) l . sort ( ) ; DP = [ 0 ] * ( n ) for i in range ( n ) : x = bisect_left ( l , ( l [ i ] [ 0 ] - l [ i ] [ 1 ] , 0 ) ) if x == 0 : DP [ i ] = 1 else : DP [ i ] = DP [ x - 1 ] + 1 print ( n - max ( DP ) ) NEW_LINE

import bisectn = int ( input ( ) ) b = [ ] p = [ ] a = [ ] for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) a . sort ( ) for i in range ( n ) : b . append ( a [ i ] [ 0 ] ) p . append ( a [ i ] [ 1 ] ) dp = [ 0 ] * nfor i in range ( n ) : j = bisect . bisect_left ( b , b [ i ] - p [ i ] ) dp [ i ] = i - j + dp [ j - 1 ] ans = 10 ** 9 c = 1 for j in range ( n - 1 , - 1 , - 1 ) : ans = min ( ans , dp [ j - 1 ] + c , dp [ j ] + c - 1 ) c = c + 1 print ( ans ) NEW_LINE

import bisectfrom math import infa = [ ] b = [ ] maxi = 10 ** 6 ind = [ - 1 ] * ( maxi + 1 ) n = int ( input ( ) ) for _ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) a . append ( [ x , y ] ) b . append ( x ) a . sort ( ) b . sort ( ) for i in range ( len ( b ) ) : ind [ b [ i ] ] = idp = [ 0 ] * ( n ) dp [ 0 ] = 0 NEW_LINE

import sys , os , iofrom sys import stdinfrom math import log , gcd , ceilfrom collections import defaultdict , deque , Counterfrom heapq import heappush , heappop , heapifyfrom bisect import bisect_left , bisect_rightimport math def ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( " input . txt " , " r " ) ; sys . stdout = open ( " output . txt " , " w " ) else : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   no = " NO " yes = " YES "   def solve ( ) : n = ii ( ) NEW_LINE


import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintStream ; import java . io . PrintWriter ; import java . security . AccessControlException ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Objects ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . LongStream ; import java . util . stream . Stream ; public class _p001132B { static public void main ( final String [ ] args ) throws IOException { p001132B . _main ( args ) ; }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( " " ) ; String next ( ) throws IOException { if ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } long mod = 1000000007 ; void solve ( ) throws IOException { int n = ni ( ) ; Integer [ ] A = new Integer [ n ] ; long s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = ni ( ) ; s += A [ i ] ; } Arrays . sort ( A , ( a , b ) -> Integer . compare ( b , a ) ) ; int m = ni ( ) ; for ( int i = 0 ; i < m ; i ++ ) out . println ( s - A [ ni ( ) - 1 ] ) ; out . flush ( ) ; } int gcd ( int a , int b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long gcd ( long a , long b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long mp ( long a , long p ) { long r = 1 ; while ( p > 0 ) { if ( ( p & 1 ) == 1 ) r = ( r * a ) % mod ; p >>= 1 ; a = ( a * a ) % mod ; } return r ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } }

import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . security . acl . LastOwnerException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Queue ; import java . util . Set ; import java . util . SortedSet ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import javax . sound . midi . Soundbank ; import org . omg . PortableInterceptor . LOCATION_FORWARD ;    public class Main {   public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   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 [ ] nextSArray ( ) { String sr [ ] = null ; try { sr = br . readLine ( ) . trim ( ) . split ( " ▁ " ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return sr ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }   return str ; } }

n = int ( input ( ) ) arr = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) summa = sum ( arr ) m = int ( input ( ) ) marr = list ( map ( int , input ( ) . split ( ) ) ) for x in marr : print ( summa - arr [ len ( arr ) - x ] ) NEW_LINE

a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) b . sort ( reverse = True ) res = sum ( b ) n = int ( input ( ) ) mas = list ( map ( int , input ( ) . split ( ) ) ) for k in mas : print ( res - b [ k - 1 ] ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) )   a . sort ( ) s = sum ( a )   for i in q : print ( s - a [ - i ] )   NEW_LINE

n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] m = int ( input ( ) ) a . sort ( reverse = True ) s = sum ( a ) q = [ s - a [ int ( i ) - 1 ] for i in input ( ) . split ( ) ] print ( * q , sep = ' \n ' ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) add = sum ( l ) l . sort ( reverse = True ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( m ) : sum1 = add sum1 = sum1 - l [ q [ i ] - 1 ] print ( sum1 ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { class E implements Comparable < E > { int v ; int id ; E ( int v , int id ) { this . v = v ; this . id = id ; }   @ Override public int compareTo ( E o ) { return Integer . compare ( v , o . v ) ; } } void solve ( ) { int n = in . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = in . nextInt ( ) ;

import java . util . * ;   public class CF529B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] w = new int [ n ] ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { w [ i ] = scan . nextInt ( ) ; h [ i ] = scan . nextInt ( ) ; } int ans = - 1 ; for ( int H = 1 ; H <= 1000 ; ++ H ) { int W = 0 , rem = ( int ) n / 2 , ok = 1 ; List < Integer > delta = new ArrayList < > ( ) ; ; for ( int i = 0 ; i < n ; ++ i ) { if ( h [ i ] > H && w [ i ] > H ) {

from operator import negn = int ( input ( ) ) a = [ tuple ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]   def check ( max_h ) : k = n // 2 b = [ ] for w , h in a : if h > max_h : if k <= 0 or w > max_h : return 1 << 60 b . append ( ( h , w ) ) k -= 1 else : b . append ( ( w , h ) ) b . sort ( key = lambda t : t [ 1 ] - t [ 0 ] ) r = 0 for w , h in b : if k > 0 and w <= max_h and h < w : r += h k -= 1 else : r += w return r * max_h   print ( min ( check ( h ) for h in range ( 1 , 1001 ) ) ) NEW_LINE


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

import javax . print . attribute . HashAttributeSet ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . TreeMap ;   public class Template { private static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static String readln ( ) throws IOException { String line = input . readLine ( ) ; return line ; }   public static void main ( String [ ] args ) throws IOException { solution ( ) ; }    public static void solution ( ) throws IOException { int n = Integer . parseInt ( readln ( ) ) ; String aa [ ] = readln ( ) . split ( " ▁ " ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( aa [ i ] ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i + 1 == a [ i ] ) { } else { System . out . println ( i + 1 ) ; return ; } } System . out . println ( n + 1 ) ; } }

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

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF27_D2_A { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ 3009 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ scanner . nextInt ( ) ] ++ ; } for ( int i = 1 ; i < arr . length ; i ++ ) { if ( arr [ i ] == 0 ) { System . out . println ( i ) ; return ; } } }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; }   Integer [ ] nextArray ( int n , boolean object ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) i = 1 while i in l : i += 1   print ( i ) NEW_LINE

n = int ( input ( ) ) indices_str = input ( ) . split ( ) indices = [ ]   for i in range ( n ) : indices . append ( int ( indices_str [ i ] ) )   mayor = indices [ 0 ] menor = indices [ 0 ]   for i in range ( n - 1 ) : if indices [ i + 1 ] > mayor : mayor = indices [ i + 1 ] if indices [ i + 1 ] < menor : menor = indices [ i + 1 ] if menor != 1 : print ( 1 ) elif mayor == n : print ( n + 1 ) else : for i in range ( mayor - 1 ) : if not ( i + 1 ) in indices : print ( i + 1 ) break ; NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr = sorted ( arr ) for i in range ( 1 , n + 1 ) : if i != arr [ i - 1 ] : print ( i ) breakelse : print ( n + 1 ) NEW_LINE

def func ( n , a ) : i = 1 while 1 : if i not in a : return i break i += 1   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( func ( n , a ) ) NEW_LINE

n = int ( input ( ) ) a = [ int ( y ) for y in input ( ) . split ( ) ] a . sort ( ) ans = - 1 for i in range ( 1 , n + 1 ) : if a [ i - 1 ] != i : ans = i breakif ans == - 1 : print ( n + 1 ) else : print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int [ ] nm = in . readA ( ) ; int n = nm [ 0 ] , m = nm [ 1 ] ;

import java . util . Scanner ;   public class Main { static int m ; static int n ; static int sx [ ] = { 1 , - 1 , 0 , 0 , - 1 , - 1 , 1 , 1 } ; static int sy [ ] = { 0 , 0 , 1 , - 1 , - 1 , 1 , 1 , - 1 } ; static char map [ ] [ ] ; static char now [ ] [ ] ; public static void main ( String [ ] args ) {

def check ( a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if i == 1 and j == 1 : continue elif l [ a + i ] [ b + j ] == " . " : return False return Truedef make ( a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if i == 1 and j == 1 : continue else : l1 [ a + i ] [ b + j ] = " # " l = [ ] l1 = [ ] for _ in range ( 1 ) : n , m = map ( int , input ( ) . split ( ) ) for i in range ( n ) : l . append ( list ( input ( ) ) ) l1 . append ( [ " . " ] * m ) for i in range ( n - 2 ) : for j in range ( m - 2 ) : if check ( i , j ) : make ( i , j ) if l == l1 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) tab = [ ] mat = [ ]   for _ in range ( n ) : tab . append ( list ( input ( ) ) )   for i in range ( n ) : mat . append ( list ( [ ' . ' ] * m ) )   n -= 2 m -= 2   for i in range ( n ) : for ii in range ( m ) : if ( tab [ i ] [ ii ] == ' # ' and tab [ i + 1 ] [ ii ] == ' # ' and tab [ i + 2 ] [ ii ] == ' # ' and tab [ i + 2 ] [ ii + 1 ] == ' # ' and tab [ i + 2 ] [ ii + 2 ] == ' # ' and tab [ i + 1 ] [ ii + 2 ] == ' # ' and tab [ i ] [ ii + 2 ] == ' # ' and tab [ i ] [ ii + 1 ] == ' # ' ) : mat [ i ] [ ii ] = ' # ' mat [ i + 1 ] [ ii ] = ' # ' mat [ i + 2 ] [ ii ] = ' # ' mat [ i + 2 ] [ ii + 1 ] = ' # ' mat [ i + 2 ] [ ii + 2 ] = ' # ' mat [ i + 1 ] [ ii + 2 ] = ' # ' mat [ i ] [ ii + 1 ] = ' # ' mat [ i ] [ ii + 2 ] = ' # '   print ( ' YES ' if ( tab == mat ) else ' NO ' ) NEW_LINE

def bidui ( ) : for i in range ( n ) : for j in range ( m ) : if mp [ i ] [ j ] != v [ i ] [ j ] : return 0 return 1   if __name__ == ' _ _ main _ _ ' : n , m = map ( int , input ( ) . strip ( ) . split ( ) ) mp = [ ] for i in range ( n ) : tmp = input ( ) . strip ( ) . split ( ) [ 0 ] mp . append ( list ( tmp ) ) v = [ [ ' . ' ] * m for i in range ( n ) ] dx = [ 0 , 0 , - 1 , - 1 , - 1 , 1 , 1 , 1 ] dy = [ - 1 , 1 , - 1 , 0 , 1 , - 1 , 0 , 1 ] for i in range ( n ) : for j in range ( m ) : tag = 1 for k in range ( 8 ) : nx = i + dx [ k ] ny = j + dy [ k ] if nx < 0 : tag = 0 break if nx >= n : tag = 0 break if ny < 0 : tag = 0 break if ny >= m : tag = 0 break NEW_LINE

import sysinput = sys . stdin . readlinen , m = map ( int , input ( ) . split ( ) ) grid = [ ] ansgrid = [ ] for i in range ( n ) : grid . append ( input ( ) ) ansgrid . append ( [ 0 ] * m ) for i in range ( n - 2 ) : for j in range ( m - 2 ) : if grid [ i ] [ j ] == ' # ' and grid [ i + 1 ] [ j ] == ' # ' and grid [ i + 2 ] [ j ] == ' # ' and grid [ i ] [ j + 1 ] == ' # ' and grid [ i ] [ j + 2 ] == ' # ' and grid [ i + 2 ] [ j + 1 ] == ' # ' and grid [ i + 2 ] [ j + 2 ] == ' # ' and grid [ i + 1 ] [ j + 2 ] == ' # ' : ansgrid [ i ] [ j ] = 1 ansgrid [ i + 1 ] [ j ] = 1 ansgrid [ i + 2 ] [ j ] = 1 ansgrid [ i + 1 ] [ j + 2 ] = 1 ansgrid [ i + 2 ] [ j + 2 ] = 1 ansgrid [ i + 2 ] [ j + 1 ] = 1 ansgrid [ i ] [ j + 2 ] = 1 ansgrid [ i ] [ j + 1 ] = 1 flag = 0 for i in range ( n ) : for j in range ( m ) : if grid [ i ] [ j ] == ' # ' and ansgrid [ i ] [ j ] == 0 or grid [ i ] [ j ] == ' . ' and ansgrid [ i ] [ j ] == 1 : flag = 1 if flag : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; long k1 = Long . parseLong ( st . nextToken ( ) ) ; long k2 = Long . parseLong ( st . nextToken ( ) ) ; long k3 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; long t1 = Long . parseLong ( st . nextToken ( ) ) ; long t2 = Long . parseLong ( st . nextToken ( ) ) ; long t3 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Long . parseLong ( st . nextToken ( ) ) ; b [ i ] = a [ i ] ; }

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) {   long [ ] K = new long [ 3 ] ; long [ ] T = new long [ 3 ] ; K [ 0 ] = in . nextLong ( ) ; K [ 1 ] = in . nextLong ( ) ; K [ 2 ] = in . nextLong ( ) ;   T [ 0 ] = in . nextLong ( ) ; T [ 1 ] = in . nextLong ( ) ; T [ 2 ] = in . nextLong ( ) ;   int N = in . nextInt ( ) ; long [ ] c = new long [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) c [ i ] = in . nextLong ( ) ;   long [ ] timeWaited = new long [ N ] ; long [ ] timePutInQueue = new long [ N ] ; PriorityQueue < Integer > [ ] pq = new PriorityQueue [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { pq [ i ] = new PriorityQueue < > ( 10 , ( a , b ) -> { long ta = timeWaited [ a ] ; long tb = timeWaited [ b ] ;

from heapq import heappush , heappopk = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE t = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE n = int ( input ( ) ) NEW_LINE l = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE X = list ( l ) NEW_LINE for i in range ( 3 ) : for NEW_LINE j in range ( n ) : NEW_LINE if j >= k [ i ] and X [ j - k [ i ] ] > X [ j ] : X [ j ] += X [ j - k [ i ] ] - X [ j ] NEW_LINE X [ j ] += t [ i ] NEW_LINE for i in range ( n ) : ans = max ( ans , X [ i ] - l [ i ] ) NEW_LINE print ( ans ) NEW_LINE


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int sum = 0 ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = 100 ; } for ( int i = 0 ; i < m ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; for ( int j = l - 1 ; j < r ; j ++ ) { a [ j ] = Math . min ( a [ j ] , x ) ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 100 ) { sum += h * h ; } else { sum += a [ i ] * a [ i ] ; } } System . out . println ( sum ) ; } }

n , h , m = map ( int , input ( ) . split ( ) ) X = [ h ] * nfor i in range ( m ) : l , r , x = map ( int , input ( ) . split ( ) ) l , r = l - 1 , r - 1 for j in range ( l , r + 1 ) : X [ j ] = min ( X [ j ] , x ) ans = 0 for i in range ( n ) : ans += X [ i ] ** 2 print ( ans ) NEW_LINE

n , h , m = list ( map ( int , input ( ) . split ( ) ) ) doma = [ h ] * n   for _ in range ( m ) : l , r , x = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( l , r + 1 ) : if doma [ i - 1 ] > x : doma [ i - 1 ] = x   summ = 0 for i in doma : summ += i ** 2   print ( summ ) NEW_LINE

n , h , m = map ( int , input ( ) . split ( ) ) l = [ h ] * nfor i in range ( 0 , m ) : p , r , x = map ( int , input ( ) . split ( ) ) for j in range ( p - 1 , r ) : if ( l [ j ] > x ) : l [ j ] = x else : passc = 0 for i in range ( n ) : c = c + l [ i ] * l [ i ] print ( c ) NEW_LINE

from collections import defaultdict as diccn , h , cases = map ( int , input ( ) . split ( ) )   dic = dicc ( )   while cases : cases -= 1 l , r , x = map ( int , input ( ) . split ( ) )   for i in range ( l , r + 1 ) : if i not in dic or dic [ i ] > x : dic [ i ] = x   profit = 0   for spot in range ( 1 , n + 1 ) : if spot not in dic : profit += h ** 2 else : profit += ( min ( h , dic [ spot ] ) ) ** 2   print ( profit ) NEW_LINE


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

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

import java . util . Scanner ;   public class LineToCashier { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , j , a [ ] = new int [ n ] , b [ ] = new int [ n ] , m = Integer . MAX_VALUE ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; b [ i ] = a [ i ] * 15 ; } for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < a [ i ] ; j ++ ) { b [ i ] += in . nextInt ( ) * 5 ; } } in . close ( ) ; for ( i = 0 ; i < n ; i ++ ) m = Math . min ( m , b [ i ] ) ; System . out . println ( m ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( newInputStreamReader ( 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 fs = new FastReader ( ) ; int n = fs . nextInt ( ) ;   int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = fs . nextInt ( ) ; }   int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int cur = 0 ; for ( int j = 0 ; j < a [ i ] ; j ++ ) { cur += fs . nextInt ( ) * 5 ; } cur += a [ i ] * 15 ; min = Math . min ( cur , min ) ; }   System . out . println ( min ) ;    } }

import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int casher = sc . nextInt ( ) ; int peopleNumber [ ] = new int [ casher + 1 ] ;   for ( int i = 1 ; i <= casher ; i ++ ) { peopleNumber [ i ] = sc . nextInt ( ) ; }   int min = Integer . MAX_VALUE ; for ( int i = 1 ; i <= casher ; i ++ ) { int queueTime = 0 ; for ( int j = 1 ; j <= peopleNumber [ i ] ; j ++ ) { int temp = sc . nextInt ( ) ; queueTime += ( temp * 5 ) ; } queueTime += ( peopleNumber [ i ] * 15 ) ;

n = int ( input ( ) ) ks = [ int ( i ) for i in input ( ) . split ( ) ]   mi = 10 ** 9 for k in range ( n ) : mi = min ( mi , sum ( [ 5 * int ( i ) + 15 for i in input ( ) . split ( ) ] ) ) print ( mi ) NEW_LINE

import sysn = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) min1 = sys . maxsizefor i in range ( n ) : temp = list ( map ( int , input ( ) . split ( ) ) ) temp2 = 0 temp2 += sum ( temp ) * 5 + arr [ i ] * 15 if min1 > temp2 : min1 = temp2print ( min1 ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) ans = 10000000000000 for i in range ( n ) : l1 = list ( map ( int , input ( ) . split ( ) ) ) t = 0 for j in range ( len ( l1 ) ) : t = l1 [ j ] * 5 + t t = t + ( len ( l1 ) * 15 ) NEW_LINE

n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) ans = float ( ' inf ' ) for i in range ( n ) : x = r ( ) c = sum ( x ) * 5 + 15 * len ( x ) ans = min ( ans , c )     print ( ans )   NEW_LINE

n = int ( input ( ) ) fodac = input ( ) val = 100000 for i in range ( n ) : val = min ( val , sum ( int ( x ) * 5 + 15 for x in input ( ) . split ( ) ) ) print ( val ) NEW_LINE


import java . util . Scanner ; public class Ishu { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m , i , j , k , l , a , b ; int sum = 0 , min = 0 , x = 0 ; int [ ] [ ] g = new int [ 50 ] [ 50 ] ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) for ( j = 0 ; j < m ; ++ j ) g [ i ] [ j ] = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; for ( i = 0 ; i + a - 1 < n ; ++ i ) for ( j = 0 ; j + b - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + a - 1 ; ++ l ) for ( k = j ; k <= j + b - 1 ; ++ k ) if ( g [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } for ( i = 0 ; i + b - 1 < n ; ++ i ) for ( j = 0 ; j + a - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + b - 1 ; ++ l ) for ( k = j ; k <= j + a - 1 ; ++ k ) if ( g [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } System . out . println ( min ) ; } }

import java . nio . file . Paths ; import java . util . * ; import java . io . * ; public class Main {

import java . util . Scanner ; public class Ishu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , m , i , j , k , l , a , b , sum = 0 , min = 0 , x = 0 ; int [ ] [ ] garden = new int [ 50 ] [ 50 ] ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) for ( j = 0 ; j < m ; ++ j ) garden [ i ] [ j ] = scan . nextInt ( ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; for ( i = 0 ; i + a - 1 < n ; ++ i ) for ( j = 0 ; j + b - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + a - 1 ; ++ l ) for ( k = j ; k <= j + b - 1 ; ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } for ( i = 0 ; i + b - 1 < n ; ++ i ) for ( j = 0 ; j + a - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + b - 1 ; ++ l ) for ( k = j ; k <= j + a - 1 ; ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } System . out . println ( min ) ; } }

import java . lang . * ; import java . util . * ; import java . io . * ;   public class Codeforces {   public void solve ( ) throws IOException { FastScanner fs = new FastScanner ( ) ; StringBuilder print = new StringBuilder ( ) ; int n = fs . nextInt ( ) , m = fs . nextInt ( ) ; int [ ] [ ] mat = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) mat [ i ] [ j ] = fs . nextInt ( ) ;   int a = fs . nextInt ( ) , b = fs . nextInt ( ) ; int cnt = a * b ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int tmp = 0 , area = 0 ; for ( int k = i ; k < Math . min ( i + a , n ) ; k ++ ) { for ( int l = j ; l < Math . min ( j + b , m ) ; l ++ ) { area ++ ; if ( mat [ k ] [ l ] == 1 ) tmp ++ ; } } if ( area == a * b ) { cnt = Math . min ( tmp , cnt ) ; } area = 0 ; tmp = 0 ; for ( int k = i ; k < Math . min ( i + b , n ) ; k ++ ) { for ( int l = j ; l < Math . min ( j + a , m ) ; l ++ ) { area ++ ; if ( mat [ k ] [ l ] == 1 ) tmp ++ ; } } if ( area == a * b ) { cnt = Math . min ( tmp , cnt ) ; } } } System . out . println ( cnt ) ; }   public static void main ( String [ ] args ) throws IOException { try { new Codeforces ( ) . solve ( ) ; } catch ( Exception e ) {

def calc_trees ( cont , start_row , start_col , a , b ) : counter = 0 for i in range ( start_row , start_row + a ) : for j in range ( start_col , start_col + b ) : counter += cont [ i ] [ j ] return counter     n , m = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   cont = [ ] for i in range ( n ) : cont . append ( list ( map ( int , input ( ) . split ( " ▁ " ) ) ) )   a , b = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) ans , helper = n * m , 0 for i in range ( n ) : for j in range ( m ) : if i + a <= n and j + b <= m : helper = calc_trees ( cont , i , j , a , b ) if helper < ans : ans = helper if i + b <= n and j + a <= m : helper = calc_trees ( cont , i , j , b , a ) if helper < ans : ans = helperprint ( ans ) NEW_LINE

I = lambda : map ( int , input ( ) . split ( ) )   n , m = I ( ) A = [ [ * I ( ) ] for _ in range ( n ) ] a , b = I ( )   print ( min ( sum ( A [ i ] [ j ] for i in range ( x , x + dx ) for j in range ( y , y + dy ) ) for dx , dy in ( ( a , b ) , ( b , a ) ) for x in range ( n - dx + 1 ) for y in range ( m - dy + 1 ) ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) c = [ ] for i in range ( n ) : c . append ( [ ] ) for j in input ( ) . split ( ) : c [ i ] . append ( int ( j ) ) a , b = map ( int , input ( ) . split ( ) ) ans = n * mfor i in range ( n - a + 1 ) : for j in range ( m - b + 1 ) : s = 0 for k in range ( i , i + a ) : s += sum ( c [ k ] [ j : j + b ] ) ans = min ( s , ans ) for i in range ( n - b + 1 ) : for j in range ( m - a + 1 ) : s = 0 for k in range ( i , i + b ) : s += sum ( c [ k ] [ j : j + a ] ) ans = min ( s , ans ) print ( ans ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) x = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] a , b = map ( int , input ( ) . split ( ) ) def solve ( n , m , x ) : y = [ [ 0 ] * ( m + 1 ) for i in range ( n + 1 ) ] for i in range ( n ) : for j in range ( m ) : y [ i + 1 ] [ j + 1 ] = y [ i + 1 ] [ j ] + x [ i ] [ j ] for j in range ( m ) : y [ i + 1 ] [ j + 1 ] += y [ i ] [ j + 1 ] ans = n * m for i in range ( a , n + 1 ) : for j in range ( b , m + 1 ) : ans = min ( ans , y [ i ] [ j ] - y [ i - a ] [ j ] - y [ i ] [ j - b ] + y [ i - a ] [ j - b ] ) return ansprint ( min ( solve ( n , m , x ) , solve ( m , n , list ( map ( list , zip ( * x ) ) ) ) ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )     t = [ ]   for j in range ( n ) : t . append ( list ( map ( int , input ( ) . split ( ) ) ) )       a , b = map ( int , input ( ) . split ( ) ) ans = 99999999   for i in range ( n - a + 1 ) : for j in range ( m - b + 1 ) : u = 0 for x in range ( i , i + a ) : for y in range ( j , j + b ) : u += t [ x ] [ y ]   ans = min ( ans , u )   f = [ ]   for j in range ( m ) : y = [ ] for k in range ( n ) : y . append ( t [ k ] [ j ] ) f . append ( y )   for i in range ( m - a + 1 ) : for j in range ( n - b + 1 ) : u = 0 for x in range ( i , i + a ) : for y in range ( j , j + b ) : u += f [ x ] [ y ]   ans = min ( ans , u )   print ( ans ) NEW_LINE


import java . util . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class ChatInGame {   public static void main ( String [ ] args ) {   List < String > inputs = new ArrayList ( ) ; int nroCharactersToEnd = 0 ; int nroRemainingCharacters = 0 ; StringBuilder result = new StringBuilder ( ) ; Scanner keyboard = new Scanner ( System . in ) ; while ( true ) { try { String text = keyboard . nextLine ( ) ; if ( text . isEmpty ( ) ) break ; else { inputs . add ( text ) ; } } catch ( Exception e ) { break ; } }   for ( String text : inputs ) { for ( int i = text . length ( ) - 1 ; i >= 0 ; i -- ) { if ( text . charAt ( i ) == ' ) ' ) { nroCharactersToEnd ++ ; } else { break ; } }   boolean containNumbers = text . contains ( "0" ) || text . contains ( "1" ) || text . contains ( "2" ) || text . contains ( "3" ) || text . contains ( "4" ) || text . contains ( "5" ) || text . contains ( "6" ) || text . contains ( "7" ) || text . contains ( "8" ) || text . contains ( "9" ) ;   if ( ! text . matches ( " [ + - ] ? \\ d * ( \\ . \\ d + ) ? " ) || ! containNumbers ) { if ( text . length ( ) / 2 >= nroCharactersToEnd ) { result . append ( " No \n " ) ; } else result . append ( " Yes \n " ) ; }   nroCharactersToEnd = 0 ;   }    System . out . println ( result ) ;   }   }

import java . util . Scanner ;   public class chat {   public static void main ( String [ ] args ) { Scanner userInput = new Scanner ( System . in ) ; int t = userInput . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = userInput . nextInt ( ) ; String S = userInput . next ( ) ; int count = 0 ; for ( int j = n - 1 ; j >= 0 ; j -- , count ++ ) { if ( S . charAt ( j ) != ' ) ' ) break ; } if ( 2 * count > n ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }   }

import java . util . Scanner ;   public class A1411 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { in . nextInt ( ) ; String S = in . next ( ) ; int count = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == ' ) ' ) { count ++ ; } else { count = 0 ; } } boolean bad = count > ( S . length ( ) - count ) ; System . out . println ( bad ? " Yes " : " No " ) ; } }   }

import java . util . Scanner ;   public class Nk { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int t = input . nextInt ( ) ;   while ( t -- > 0 ) {   int a = input . nextInt ( ) ; String s = input . next ( ) ; int n = 0 ;   for ( int i = s . length ( ) - 1 ; i > - 1 ; i -- ) {   char c = s . charAt ( i ) ;   if ( c == ' ) ' ) { n ++ ;   if ( n == s . length ( ) ) { System . out . println ( " Yes " ) ; } }   else {   if ( n > s . length ( ) - n ) { System . out . println ( " Yes " ) ; break ; }   else { System . out . println ( " No " ) ; break ; } } } } } }

import java . io . * ; import java . math . BigInteger ; import java . util . * ; import static java . lang . Math . PI ; import static java . lang . System . in ; import static java . lang . System . out ; import static java . lang . System . err ;   public class A { public static void main ( String [ ] args ) throws Exception { Foster sc = new Foster ( ) ; PrintWriter p = new PrintWriter ( out ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int n = sc . nextInt ( ) ; char a [ ] = sc . next ( ) . toCharArray ( ) ; int count = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( a [ i ] == ' ) ' ) count ++ ; else break ; } p . println ( count > n - count ? " Yes " : " No " ) ; } p . close ( ) ; } static long [ ] sort ( long a [ ] ) { ArrayList < Long > arr = new ArrayList < > ( ) ; for ( long i : a ) { arr . add ( i ) ; } Collections . sort ( arr ) ; for ( int i = 0 ; i < arr . size ( ) ; i ++ ) { a [ i ] = arr . get ( i ) ; } return a ; } static int [ ] sort ( int a [ ] ) { ArrayList < Integer > arr = new ArrayList < > ( ) ; for ( int i : a ) { arr . add ( i ) ; } Collections . sort ( arr ) ;

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE b = - 1 NEW_LINE c = 0 NEW_LINE while b >= - n and s [ b ] == ' ) ' : c += 1 NEW_LINE b -= 1 NEW_LINE print ( " YES " if c > n - c else " NO " ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for ti in range ( t ) : n = int ( input ( ) ) NEW_LINE str = input ( ) NEW_LINE i = n - 1 NEW_LINE c = 0 NEW_LINE while i >= 0 and str [ i ] == ' ) ' : i -= 1 NEW_LINE c += 1 NEW_LINE if c > n - c : NEW_LINE INDENT print ( ' Yes ' ) else : NEW_LINE print ( ' No ' ) NEW_LINE DEDENT


import java . util . * ; public class laptop {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a [ ] [ ] = new int [ n ] [ 4 ] ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < 4 ; j ++ ) a [ i ] [ j ] = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( a [ i ] [ 0 ] < a [ j ] [ 0 ] && a [ i ] [ 1 ] < a [ j ] [ 1 ] && a [ i ] [ 2 ] < a [ j ] [ 2 ] ) a [ i ] [ 3 ] = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int ctr = 0 ; for ( int j = 0 ; j < n ; j ++ ) if ( i != j && a [ i ] [ 3 ] < a [ j ] [ 3 ] ) ctr ++ ;   if ( ctr == n - 1 ) { System . out . println ( i + 1 ) ; break ; } }   }   }

import java . util . Arrays ; import java . util . Scanner ;   public class problemB { private static final Scanner in = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; int a [ ] [ ] = new int [ n ] [ 4 ] , b [ ] = new int [ n ] , c [ ] = new int [ n ] ; Arrays . fill ( c , 0 ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < 3 ; ++ j ) { a [ i ] [ j ] = in . nextInt ( ) ; } b [ i ] = in . nextInt ( ) ; }

import java . util . * ; import java . lang . * ; import java . io . * ; public class Vasya_and_choose_laptop {   public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) , a [ ] [ ] = new int [ n ] [ 4 ] ; for ( int i = 0 ; i < n ; i ++ ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int j = 0 ; j < 4 ; j ++ ) { a [ i ] [ j ] = Integer . parseInt ( st . nextToken ( ) ) ; } } int no = Integer . MAX_VALUE , po = 0 ; boolean b [ ] = new boolean [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int s = a [ i ] [ 0 ] , r = a [ i ] [ 1 ] , hdd = a [ i ] [ 2 ] ; for ( int j = 0 ; j < n ; j ++ ) { if ( s < a [ j ] [ 0 ] && r < a [ j ] [ 1 ] && hdd < a [ j ] [ 2 ] && ! b [ i ] ) { b [ i ] = true ;

from sys import * input = stdin . readlinet = int ( input ( ) ) l = [ ] cost = [ ] for i in range ( t ) : a , b , c , d = map ( int , input ( ) . split ( ) ) l . append ( [ a , b , c ] ) cost . append ( d ) for i in range ( t ) : for j in range ( t ) : if ( i != j ) : if ( l [ i ] [ 0 ] < l [ j ] [ 0 ] and l [ i ] [ 1 ] < l [ j ] [ 1 ] and l [ i ] [ 2 ] < l [ j ] [ 2 ] ) : cost [ i ] = 10000 breakprint ( cost . index ( min ( cost ) ) + 1 )   NEW_LINE

from itertools import compressarr = [ ] yo = lenfor i in range ( int ( input ( ) ) ) : NEW_LINE

a = int ( input ( ) ) l = [ ] for x in range ( a ) : b = list ( map ( int , input ( ) . split ( ) ) ) l . append ( b )   ma = 9999999999999 s = 0 t = - 1 for x in range ( a ) : for y in range ( a ) : if x == y : s += 1 continue   else : if l [ x ] [ 0 ] >= l [ y ] [ 0 ] or l [ x ] [ 1 ] >= l [ y ] [ 1 ] or l [ x ] [ 2 ] >= l [ y ] [ 2 ] : s += 1   if s == a : if ma > l [ x ] [ 3 ] : ma = l [ x ] [ 3 ] t = x + 1   s = 0 else : s = 0 continue   print ( t ) NEW_LINE

n = int ( input ( ) ) li = [ ] f = [ ] p = [ ] for i in range ( n ) : l1 = list ( map ( int , input ( ) . split ( ) ) ) li . append ( l1 )   pr = [ li [ i ] [ 3 ] for i in range ( n ) ]   for i in range ( n ) : for j in range ( n ) : if li [ i ] [ 0 ] < li [ j ] [ 0 ] and li [ i ] [ 1 ] < li [ j ] [ 1 ] and li [ i ] [ 2 ] < li [ j ] [ 2 ] : pr [ i ] = 0 break   for i in range ( n ) : if pr [ i ] > 0 : f . append ( i ) p . append ( pr [ i ] )   print ( f [ p . index ( min ( p ) ) ] + 1 ) NEW_LINE

n = int ( input ( ) ) a = 0 b = 0 c = 0 g = [ ] v = [ 0 ] * nfor _ in range ( n ) : l = list ( map ( int , input ( ) . split ( ) ) ) g . append ( l ) l = [ ] for i in range ( n ) : f = 0 for j in range ( n ) : if ( g [ i ] [ 1 ] < g [ j ] [ 1 ] and g [ i ] [ 2 ] < g [ j ] [ 2 ] and g [ i ] [ 0 ] < g [ j ] [ 0 ] ) : f = 1 break if ( f == 0 ) : l . append ( ( g [ i ] [ 3 ] , i + 1 ) ) l . sort ( key = lambda x : ( x [ 0 ] , x [ 1 ] ) )   print ( l [ 0 ] [ 1 ] ) NEW_LINE


import java . util . * ;   public class Codeforces { static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int t = 1 ;   while ( t -- > 0 ) { solve ( ) ; }   sc . close ( ) ; }   private static void solve ( ) {   int n = sc . nextInt ( ) ; int v = sc . nextInt ( ) ;   int [ ] arr = new int [ 3001 ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ sc . nextInt ( ) ] += sc . nextInt ( ) ;   int op = helper ( arr , v ) ; System . out . println ( op ) ; }   private static int helper ( int [ ] arr , int v ) { int prev = 0 ; int count = 0 ; for ( int i = 1 ; i <= 3000 ; i ++ ) { int curr = v ; if ( prev >= v ) { count += curr ; prev = arr [ i ] ; } else { count += prev ; curr -= prev ; if ( arr [ i ] >= curr ) { count += curr ; prev = arr [ i ] - curr ; } else { count += arr [ i ] ; prev = 0 ; } } } if ( prev >= v ) { count += v ; } else { count += prev ; } return count ; }    public static void sort2dArray ( long [ ] [ ] arr ) { Arrays . sort ( arr , ( a , b ) -> { if ( a [ 1 ] == b [ 1 ] ) return ( int ) ( a [ 0 ] - b [ 0 ] ) ; return ( int ) ( a [ 1 ] - b [ 1 ] ) ; } ) ; }   }

import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ;    public class B441M2 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {

n , v = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] a_dict = { } m = 0 p = 0 for tree in range ( n ) : a , b = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] m = max ( a , m ) if a in a_dict . keys ( ) : a_dict [ a ] += b else : a_dict [ a ] = b   for day in range ( m + 2 ) : if day not in a_dict . keys ( ) : a_dict [ day ] = 0     for day in range ( 1 , m + 2 ) :   y = min ( v , a_dict [ day - 1 ] ) a_dict [ day - 1 ] -= y z = min ( v - y , a_dict [ day ] ) a_dict [ day ] -= z   p += z + y   print ( p ) NEW_LINE

from sys import stdin , stdoutinput = stdin . readline import math , bisect   n , v = map ( int , input ( ) . split ( ) ) l = [ 0 ] * ( 3002 ) for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) l [ a ] += b   ans = 0 rem = 0 for i in range ( 1 , 3002 ) : if l [ i ] + rem <= v : ans += ( l [ i ] + rem ) rem = 0 else : if rem >= v : ans += v rem = l [ i ] else : ans += rem if l [ i ] >= v - rem : ans += v - rem rem = l [ i ] - ( v - rem ) else : ans += l [ i ] rem = 0 print ( ans + min ( v , rem ) )   NEW_LINE

n , v = map ( int , input ( ) . split ( ) ) l = [ ] for j in range ( 3001 ) : l += [ 0 ] for k in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) l [ x - 1 ] += ysum = 0 for kl in range ( 3001 ) : if kl == 0 : if v <= l [ kl ] : sum += v l [ kl ] -= v else : sum += l [ kl ] l [ kl ] = 0 else : v1 = v if v1 <= l [ kl - 1 ] : sum += v1 l [ kl - 1 ] -= v1 else : sum += l [ kl - 1 ] v1 -= l [ kl - 1 ] l [ kl - 1 ] = 0 if v1 > 0 : if v1 <= l [ kl ] : sum += v1 l [ kl ] -= v1 else : sum += l [ kl ] l [ kl ] = 0 print ( sum ) NEW_LINE

n , v = map ( int , input ( ) . split ( ) ) lst = [ 0 ] * 3002 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) lst [ a ] += b   ans = 0 prev = 0 for i in range ( 1 , len ( lst ) ) : available = min ( v , prev + lst [ i ] ) ans += available if prev >= v : prev = lst [ i ] else : prev = max ( 0 , lst [ i ] - ( v - prev ) )   print ( ans ) NEW_LINE


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

import java . io . * ; import java . util . * ;   public class Main { static int n ; static int [ ] arr ; static final int MAXN = ( int ) 1e5 + 7 ;

import java . util . * ; import java . io . * ;    public class C_Div1_A_Boredom { public static void main ( String args [ ] ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sarr = br . readLine ( ) . split ( " ▁ " ) ; long [ ] arr = new long [ 100001 ] ; for ( int i = 0 ; i < n ; i ++ ) { int val = Integer . parseInt ( sarr [ i ] ) ; arr [ val ] ++ ; } long [ ] dp = new long [ 100001 ] ; dp [ 1 ] = arr [ 1 ] ; for ( int i = 2 ; i < arr . length ; i ++ ) { dp [ i ] = Math . max ( dp [ i - 1 ] , dp [ i - 2 ] + i * arr [ i ] ) ; } System . out . println ( dp [ 100000 ] ) ; } }

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

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

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( reverse = True ) b = [ ] idx = 0 cnt = 1 while idx < n : while idx + 1 < n and a [ idx ] == a [ idx + 1 ] : idx += 1 cnt += 1 b . append ( [ a [ idx ] , cnt ] ) cnt = 1 idx += 1 ans = 0 m = len ( b ) dp = [ 0 ] * mdp [ - 1 ] = b [ m - 1 ] [ 0 ] * b [ m - 1 ] [ 1 ] for i in range ( m - 1 ) [ : : - 1 ] : if b [ i ] [ 0 ] == b [ i + 1 ] [ 0 ] + 1 and i + 2 < m : dp [ i ] = max ( dp [ i + 1 ] , dp [ i + 2 ] + b [ i ] [ 0 ] * b [ i ] [ 1 ] ) elif b [ i ] [ 0 ] == b [ i + 1 ] [ 0 ] + 1 : dp [ i ] = max ( dp [ i + 1 ] , b [ i ] [ 0 ] * b [ i ] [ 1 ] ) else : dp [ i ] = dp [ i + 1 ] + b [ i ] [ 0 ] * b [ i ] [ 1 ] print ( max ( dp ) ) NEW_LINE

import sys , mathfrom itertools import permutations , combinationsfrom collections import defaultdict , dequeinput = sys . stdin . readline   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = defaultdict ( int ) maxi = 0 for i in l : maxi = max ( maxi , i ) d [ i ] += 1 dp = [ 0 for i in range ( maxi + 1 ) ] dp [ 1 ] = d [ 1 ] for i in range ( 2 , maxi + 1 ) : dp [ i ] = max ( d [ i ] * i + dp [ i - 2 ] , dp [ i - 1 ] ) print ( dp [ - 1 ] ) NEW_LINE

import osimport sysfrom io import BytesIO , IOBaseimport mathimport itertoolsimport bisectimport heapq NEW_LINE


import java . io . File ; import java . util . Arrays ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p023 { public static void main ( String args [ ] ) throws Exception { StringTokenizer stok = new StringTokenizer ( new Scanner ( System . in ) . useDelimiter ( " \\ A " ) . next ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( stok . nextToken ( ) ) ; long [ ] a = new long [ n + 2 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = Long . parseLong ( stok . nextToken ( ) ) ; long [ ] l = new long [ n + 2 ] ; long [ ] r = new long [ n + 2 ] ; for ( int i = 1 ; i <= n ; i ++ ) l [ i ] = Math . min ( l [ i - 1 ] + 1 , a [ i ] ) ; for ( int i = n ; i >= 1 ; i -- ) r [ i ] = Math . min ( r [ i + 1 ] + 1 , a [ i ] ) ; for ( int i = 1 ; i <= n ; i ++ ) l [ i ] = Math . min ( l [ i ] , r [ i ] ) ; System . out . println ( Arrays . stream ( l ) . max ( ) . getAsLong ( ) ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] array = new int [ n ] ; int [ ] farward = new int [ n ] ; StringTokenizer stoken = new StringTokenizer ( reader . readLine ( ) ) ; array [ 0 ] = Integer . parseInt ( stoken . nextToken ( ) ) ; farward [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { array [ i ] = Integer . parseInt ( stoken . nextToken ( ) ) ; farward [ i ] = Math . min ( farward [ i - 1 ] + 1 , array [ i ] ) ; } int [ ] backward = new int [ n ] ; backward [ n - 1 ] = 1 ; int res = Math . min ( farward [ n - 1 ] , backward [ n - 1 ] ) ; for ( int i = n - 2 ; i > - 1 ; i -- ) { backward [ i ] = Math . min ( backward [ i + 1 ] + 1 , array [ i ] ) ; res = Math . max ( res , Math . min ( farward [ i ] , backward [ i ] ) ) ; } System . out . println ( res ) ; } }

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

from math import infn = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] l . append ( 0 ) l . insert ( 0 , 0 ) minus = [ v - i for i , v in enumerate ( l ) ] plus = [ v + i for i , v in enumerate ( l ) ]   lminus , rplus = [ minus [ 0 ] ] , [ plus [ - 1 ] ] for i in range ( 1 , n + 1 ) : lminus . append ( min ( lminus [ - 1 ] , minus [ i ] ) ) lminus . append ( inf )   for i in range ( n , 0 , - 1 ) : rplus . append ( min ( rplus [ - 1 ] , plus [ i ] ) ) rplus . append ( inf ) rplus . reverse ( ) m = 0   for i in range ( 1 , n + 1 ) : x = min ( lminus [ i ] + i , rplus [ i ] - i ) m = max ( m , x ) print ( m ) NEW_LINE

import sysfrom math import gcd , sqrt , ceil , log2from collections import defaultdict , Counter , dequefrom bisect import bisect_left , bisect_rightimport mathsys . setrecursionlimit ( 2 * 10 ** 5 + 10 ) import heapqfrom itertools import permutations   NEW_LINE


import java . util . * ; import java . io . * ;   public class Yaroslav_and_Sequence {   static int mod = ( int ) ( 1e9 + 7 ) ;   public static void main ( String [ ] args ) throws java . lang . Exception { long start = System . nanoTime ( ) ;

import static java . lang . System . out ;   import java . util . * ;   public class Test {   Test ( ) { Scanner in = new Scanner ( System . in ) ; int initNumber = in . nextInt ( ) ; List < Integer > numbers = new ArrayList < > ( ) ; boolean hasZero = false ; int minuses = 0 ; int sum = 0 ; for ( int index = 0 ; index < 2 * initNumber - 1 ; index ++ ) { int number = in . nextInt ( ) ; if ( number < 0 ) { minuses ++ ; number *= - 1 ; } else if ( number == 0 ) { hasZero = true ; } sum += number ; numbers . add ( number ) ; } if ( hasZero ) { out . println ( sum ) ; return ; } if ( initNumber % 2 == 1 ) { out . println ( sum ) ; return ; } if ( minuses % 2 == 0 ) { out . println ( sum ) ; return ; } Collections . sort ( numbers ) ; out . println ( sum - 2 * numbers . get ( 0 ) ) ; }   public static void main ( String [ ] args ) { new Test ( ) ; } }

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

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) neg = 0   for i in range ( len ( a ) ) : if ( a [ i ] < 0 ) : neg += 1 a [ i ] = - a [ i ] if ( neg % 2 == 0 or n % 2 == 1 ) : print ( sum ( a ) ) else : print ( sum ( a ) - min ( a ) * 2 ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) t = 0 for i in range ( len ( a ) ) : if a [ i ] < 0 : t += 1 a [ i ] = - a [ i ] if t % 2 == 0 or n % 2 == 1 : print ( sum ( a ) ) else : print ( sum ( a ) - min ( a ) * 2 ) NEW_LINE

/ * Author - - Vishwas Agrawal * // * Author - - Vishwas Agrawal * / NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int scene = sc . nextInt ( ) ; for ( int k = 0 ; k < scene ; k ++ ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int list1Cnt = 0 ; int list2Cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp % 2 != 0 ) { list1Cnt ++ ; } else { list2Cnt ++ ; } }   boolean result = false ; if ( list2Cnt >= x - 1 ) { result = list1Cnt >= 1 ; } else { if ( ( x - list2Cnt ) % 2 == 1 ) { result = list1Cnt >= x - list2Cnt ; } else { if ( list2Cnt == 0 ) { result = false ; } else { result = list1Cnt >= x - list2Cnt + 1 ; } } } System . out . println ( result ? " YES " : " NO " ) ; } } }

import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Bit_year { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; while ( T -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > even = new ArrayList < Integer > ( ) ; List < Integer > odd = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int num = sc . nextInt ( ) ; if ( num % 2 == 0 ) even . add ( num ) ; else odd . add ( num ) ; } int sum = 0 ; if ( odd . size ( ) > 0 ) { sum += odd . get ( 0 ) ; odd . remove ( 0 ) ; k -- ; while ( k > 1 && odd . size ( ) > 1 ) { sum += odd . get ( 0 ) ; odd . remove ( 0 ) ; sum += odd . get ( 0 ) ; odd . remove ( 0 ) ; k -= 2 ; } while ( k > 0 && even . size ( ) > 0 ) { sum += even . get ( 0 ) ; even . remove ( 0 ) ; k -- ; } } System . out . println ( ( k > 0 || sum == 0 || sum % 2 == 0 ) ? " NO " : " YES " ) ; } } }

t = int ( input ( ) )   for i in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) odd = 0 even = 0 for j in range ( n ) : if a [ j ] % 2 == 1 : odd += 1 else : even += 1 m = min ( even , x - 1 ) d = x - m   if d % 2 == 0 : d += 1 if odd >= d and d <= x : print ( " YES " ) else : print ( " NO " ) NEW_LINE

t = int ( input ( ) )   def odd_sum ( n , l ) : eve = 0 odd = 0 t = 0 for i in l : if i % 2 == 0 : eve += 1 else : odd += 1   m = min ( eve , n - 1 ) fill = n - m if fill % 2 == 0 : fill += 1 if odd >= fill and fill <= n : return ' Yes ' else : return ' No '     for i in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) print ( odd_sum ( x , l ) )             NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) e = 0 o = 0 for i in l : if i % 2 == 0 : e += 1 else : o += 1 if e + o == x : if o % 2 != 0 : print ( " Yes " ) else : print ( " No " ) else : if o >= x and x % 2 != 0 : print ( " Yes " ) elif o >= 1 and e >= 1 : print ( " YES " ) else : print ( " No " ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   ce = 0 co = 0 summ = 0 for i in a : if i % 2 == 0 : ce += 1 else : co += 1 summ += i if n == x : if summ % 2 == 0 : print ( " No " ) else : print ( " Yes " ) elif x % 2 == 0 : if ce > 0 and co > 0 : print ( " Yes " ) else : print ( " No " ) else : if co > 0 : print ( " Yes " ) else : print ( " No " ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) odd = 0 even = 0 for i in l : if ( i % 2 == 0 ) : even += 1 else : odd += 1 if ( odd == 0 ) : print ( " No " ) else : if ( odd % 2 == 0 ) : if ( x < odd ) : if ( x % 2 == 0 ) : rem = 1 else : rem = 0 else : rem = x - ( odd - 1 ) else : if ( x < odd ) : if ( x % 2 == 0 ) : rem = 1 else : rem = 0 else : rem = x - odd print ( ' Yes ' if even >= rem else ' No ' ) NEW_LINE


import java . util . * ; public class A51 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; boolean [ ] table = new boolean [ 6667 ] ; int num = scan . nextInt ( ) , a , b , number , result = 1 , j = 0 ; a = scan . nextInt ( ) * 100 ; b = scan . nextInt ( ) ; number = b % 10 * 10 + ( b / 10 ) + a ; for ( int i = 0 ; i < 4 ; i ++ ) { number = rotate ( number ) ; table [ number ] = true ; } for ( int i = 1 ; i < num ; i ++ ) { scan . next ( ) ; a = scan . nextInt ( ) * 100 ; b = scan . nextInt ( ) ; number = b % 10 * 10 + ( b / 10 ) + a ; j = 0 ; if ( ! table [ number ] ) for ( j = 0 ; j < 4 ; j ++ ) { number = rotate ( number ) ; table [ number ] = true ; } if ( j != 0 ) result ++ ; } System . out . println ( result ) ; }   public static int rotate ( int number ) { int help = number % 10 * 1000 ; number /= 10 ; return number + help ; } }

import java . util . Arrays ; import java . util . Scanner ;   public class AA {   public static void main ( String [ ] args ) { int n , temp , min , x ; int c [ ] = new int [ 10 ] ; boolean w [ ] = new boolean [ 10010 ] ; Arrays . fill ( w , false ) ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { in . nextLine ( ) ; for ( int j = 0 ; j < 4 ; j += 2 ) { String a = in . nextLine ( ) ; c [ j ] = a . charAt ( 0 ) - '0' ; c [ j + 1 ] = a . charAt ( 1 ) - '0' ; } temp = c [ 2 ] ; c [ 2 ] = c [ 3 ] ; c [ 3 ] = temp ; min = 99999 ; for ( int j = 0 ; j < 4 ; j ++ ) c [ j + 4 ] = c [ j ] ; for ( int j = 0 ; j < 4 ; j ++ ) { x = 0 ; for ( int r = j ; r < j + 4 ; r ++ ) { x = x * 10 + c [ r ] ; } if ( x < min ) { min = x ; } } w [ min ] = true ;   } int ans = 0 ; for ( int i = 0 ; i <= 9999 ; i ++ ) { if ( w [ i ] ) ans ++ ; } System . out . println ( ans ) ;   }   }

import java . util . ArrayList ; import java . util . Scanner ;     public class ASD {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; ArrayList < Domino > dominoes = new ArrayList < Domino > ( ) ;   while ( n > 0 ) { in . nextLine ( ) ; String a = in . nextLine ( ) ; String b = in . nextLine ( ) ; Domino B = new Domino ( ) ; B . a [ 0 ] = ( int ) ( a . charAt ( 0 ) - '0' ) ; B . a [ 1 ] = ( int ) ( a . charAt ( 1 ) - '0' ) ; B . a [ 2 ] = ( int ) ( b . charAt ( 1 ) - '0' ) ; B . a [ 3 ] = ( int ) ( b . charAt ( 0 ) - '0' ) ; dominoes . add ( B ) ;   for ( int i = 0 ; i < dominoes . size ( ) - 1 ; i ++ ) { if ( B . is_equal ( dominoes . get ( i ) ) ) { dominoes . remove ( i ) ; }   }   n -- ; } System . out . println ( dominoes . size ( ) ) ; }   }   class Domino { int [ ] a = new int [ 4 ] ;   boolean is_equal ( Domino A ) { for ( int i = 0 ; i < 4 ; i ++ ) { if ( this . a [ i ] == A . a [ 0 ] && this . a [ ( i + 1 ) % 4 ] == A . a [ 1 ] && this . a [ ( i + 2 ) % 4 ] == A . a [ 2 ] && this . a [ ( i + 3 ) % 4 ] == A . a [ 3 ] ) return true ; } return false ;   }   }

def rotate ( item : str ) -> str : NEW_LINE

n = int ( input ( ) ) a = [ ] for i in range ( n ) : s = input ( ) s += input ( ) [ : : - 1 ] if i != n - 1 : input ( ) add = True for x in a : if s in x : add = False break if add : a . append ( s + s ) print ( len ( a ) ) NEW_LINE

d = dict ( ) ; o = int ( input ( ) ) for t in range ( o ) : x , y = input ( ) . replace ( ' ' , ' ▁ ' ) . split ( ) i , j = input ( ) . replace ( ' ' , ' ▁ ' ) . split ( ) if t != o - 1 : input ( ) if not ( ( x , y , i , j ) in d or ( y , j , x , i ) in d or ( j , i , y , x ) in d or ( i , x , j , y ) in d ) : d [ ( x , y , i , j ) ] = 1 print ( len ( d ) ) NEW_LINE

n = int ( input ( ) ) d = { } for i in range ( n ) : s = ' ' found = False s = input ( ) + input ( ) if i != n - 1 : input ( ) t = s [ 2 ] + s [ 0 ] + s [ 3 ] + s [ 1 ] p = s [ 3 ] + s [ 2 ] + s [ 1 ] + s [ 0 ] q = s [ 1 ] + s [ 3 ] + s [ 0 ] + s [ 2 ] for key in d . keys ( ) : for var in d [ key ] . keys ( ) : if s == var : found = True d [ key ] [ var ] += 1 if not found : d [ s ] = { } d [ s ] [ s ] = 1 d [ s ] [ t ] = 0 d [ s ] [ p ] = 0 d [ s ] [ q ] = 0 print ( len ( d ) ) NEW_LINE

nro_amu = int ( input ( ) )   amu = [ ] for i in range ( nro_amu ) : fila1 = list ( input ( ) ) fila2 = list ( input ( ) ) fila1 . extend ( fila2 ) amu . append ( fila1 ) if i + 1 != nro_amu : _ = input ( ) pilas = [ ] nro_pilas = 0   for a in amu : existe = False for i in range ( nro_pilas ) : for j in range ( 4 ) : if pilas [ i ] [ j ] == a : existe = True if not existe : pilas . append ( [ a , [ a [ 2 ] , a [ 0 ] , a [ 3 ] , a [ 1 ] ] , [ a [ 3 ] , a [ 2 ] , a [ 1 ] , a [ 0 ] ] , [ a [ 1 ] , a [ 3 ] , a [ 0 ] , a [ 2 ] ] ] ) nro_pilas = nro_pilas + 1 print ( nro_pilas ) NEW_LINE


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

import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { char c = s . charAt ( i ) ; if ( c == ' ? ' || c == ' ▁ ' ) continue ; if ( c == ' A ' || c == ' E ' || c == ' I ' || c == ' O ' || c == ' U ' || c == ' Y ' || c == ' a ' || c == ' e ' || c == ' i ' || c == ' o ' || c == ' u ' || c == ' y ' ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } } } }

if input ( ) . lower ( ) . strip ( ' ? ▁ ' ) [ - 1 ] in ' aeiouy ' : print ( " YES " ) else : print ( " NO " ) NEW_LINE

pregunta = input ( ) n = len ( pregunta ) vocales = [ ' A ' , ' E ' , ' I ' , ' O ' , ' U ' , ' Y ' , ' a ' , ' e ' , ' i ' , ' o ' , ' u ' , ' y ' ] rpta = ' '   i = 2 while i <= n and rpta == ' ' : if pregunta [ n - i ] != ' ▁ ' : for j in range ( len ( vocales ) ) : if pregunta [ n - i ] == vocales [ j ] : rpta = ' YES ' break if rpta == ' ' : rpta = ' NO ' i = i + 1 print ( rpta ) NEW_LINE

s = input ( ) v = " AEIOUYaeiouy " l = [ ] for i in s [ : : - 1 ] : if i != " ▁ " and i != " ? " : if i in v : print ( " YES " ) exit ( ) else : print ( " NO " ) exit ( ) NEW_LINE

str1 = list ( map ( str , input ( ) . split ( ) ) ) if ( str1 [ len ( str1 ) - 1 ] == ' ? ' ) : k = str1 [ len ( str1 ) - 2 ] k_len = len ( k ) m = k [ k_len - 1 ] if ( m == ' a ' or m == ' e ' or m == ' i ' or m == ' o ' or m == ' u ' or m == ' y ' or m == ' A ' or m == ' E ' or m == ' I ' or m == ' O ' or m == ' U ' or m == ' Y ' ) : print ( ' YES ' ) else : print ( ' NO ' ) else : k = str1 [ len ( str1 ) - 1 ] k_len = len ( k ) m = k [ k_len - 2 ] if ( m == ' a ' or m == ' e ' or m == ' i ' or m == ' o ' or m == ' u ' or m == ' y ' or m == ' A ' or m == ' E ' or m == ' I ' or m == ' O ' or m == ' U ' or m == ' Y ' ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


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

import java . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scn . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = scn . nextInt ( ) ; String input = " " ; for ( int val : arr ) input += " , " + val ; n = input . length ( ) ;

import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int n = in . readInt ( ) ; int [ ] A = in . readA ( ) ; int [ ] days = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; boolean l = false ;   for ( int i = 0 ; i < 12 ; i ++ ) { int j = 0 , leap = 0 ; for ( ; j < n ; j ++ ) { if ( days [ ( j + i ) % 12 ] != A [ j ] ) { if ( ( j + i ) % 12 == 1 && A [ j ] == 29 ) leap ++ ; else break ; } } if ( j == n && leap < 2 ) l = true ; }   if ( l ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ;

import java . util . Scanner ;   public class App {   public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; int n = inp . nextInt ( ) ; String a = "312831303130313130313031" ; String b = " " ; int t ; boolean lp = false ; for ( int i = 0 ; i < n ; i ++ ) { t = inp . nextInt ( ) ; if ( t == 29 ) { if ( lp ) { System . out . println ( " NO " ) ; inp . close ( ) ; return ; } b += 28 ; lp = true ; } else { b += t ; } } String tmp = a ; if ( tmp . contains ( b ) ) { System . out . println ( " YES " ) ; } else if ( ( tmp += a ) . contains ( b ) ) { System . out . println ( " YES " ) ; } else if ( ( tmp += a ) . contains ( b ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } inp . close ( ) ; }   }

normal = '312831303130313130313031' leap = '312931303130313130313031' years_5 = normal * 2 + leap + normal * 2 n = int ( input ( ) ) A = [ a for a in input ( ) . split ( ) ] A = ' ' . join ( A ) if ( A in years_5 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) throws IOException { int N = in . nextInt ( ) ; char [ ] ca = in . br . readLine ( ) . toCharArray ( ) ;   int max = 0 ; for ( int i = 0 ; i < N ; ) { if ( ! alpha ( ca [ i ] ) ) { i ++ ; continue ; }   int vol = 0 ; while ( i < N && alpha ( ca [ i ] ) ) { if ( ca [ i ] >= ' A ' && ca [ i ] <= ' Z ' ) vol ++ ; i ++ ; } max = Math . max ( vol , max ) ; } out . println ( max ) ;   } boolean alpha ( char c ) { return ( c >= ' A ' && c <= ' Z ' ) || ( c >= ' a ' && c <= ' z ' ) ;   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

import java . util . * ;   public class P3 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ;   int c = 0 ; int max = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) >= ' A ' && s . charAt ( i ) <= ' Z ' ) { c ++ ; max = Math . max ( c , max ) ; } if ( s . charAt ( i ) == ' ▁ ' ) { c = 0 ; } } System . out . println ( max ) ; } }

import java . io . * ; import java . util . * ;   public class A1008 { public static void main ( String [ ] args ) { InputStream inputReader = System . in ; OutputStream outputReader = System . out ; InputReader in = new InputReader ( inputReader ) ;

import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000837A { static public void main ( final String [ ] args ) throws IOException { p000837A . _main ( args ) ; }

import java . util . * ; public class test { public static void main ( String [ ] agrs ) { int n ; String s ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; s = scan . nextLine ( ) ;

n = input ( ) S = list ( map ( str , input ( ) . split ( ) ) ) Max = 0 for i in range ( len ( S ) ) : C = 0 for j in range ( len ( S [ i ] ) ) : if S [ i ] [ j ] . isupper ( ) : C += 1 if C > Max : Max = Cprint ( Max ) NEW_LINE

if __name__ == " _ _ main _ _ " : text_length = int ( input ( ) ) words = list ( input ( ) . split ( ) ) max_volume = 0 for word in words : max_volume = max ( max_volume , sum ( [ 1 for letter in word if str ( letter ) . isupper ( ) ] ) ) print ( max_volume ) NEW_LINE

num = input ( )   arr = input ( ) . split ( )   mx = 0 ct = 0 for word in arr : for char in word : if char . isupper ( ) : ct += 1 mx = max ( mx , ct ) ct = 0   print ( mx )   NEW_LINE

import string   uppercased_letters = string . ascii_uppercase   def find_volume ( word ) : volume = 0 for character in word : if character in uppercased_letters : volume += 1 return volume   _ = int ( input ( ) ) text = input ( )     volumes = [ ] words = text . split ( )     for word in words : volumes . append ( find_volume ( word ) )   volume_of_text = max ( volumes ) print ( volume_of_text ) NEW_LINE

n = int ( input ( ) ) s = input ( ) . split ( ) ans = 0 for i in s : now = 0 for j in i : now += j <= ' Z ' ans = max ( ans , now )   print ( ans ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; int testCount = Integer . parseInt ( in . next ( ) ) ; for ( int i = 1 ; i <= testCount ; i ++ ) solver . solve ( i , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long n = in . nextLong ( ) ; long m = in . nextLong ( ) ; long x = in . nextLong ( ) ; long col = ( x / n ) ; if ( x % n > 0 ) col ++ ; long row = ( x - 1 ) % n ; out . println ( m * row + col ) ; } } }

import java . util . Scanner ; public class StrangeTable { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int testCase = sc . nextInt ( ) ; while ( testCase > 0 ) { String input = sc . next ( ) ; input += sc . nextLine ( ) ; int i = 0 ; String [ ] split = input . split ( " ▁ " ) ; long m = Long . parseLong ( split [ i ++ ] ) ; long n = Long . parseLong ( split [ i ++ ] ) ; long x = Long . parseLong ( split [ i ] ) ; long p = x % m == 0 ? x / m : x / m + 1 ; long q = x % m == 0 ? m : x % m ; long y = ( q - 1 ) * n + p ; System . out . println ( y ) ; testCase -- ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; solve ( n , m , x ) ; } } public static void solve ( long n , long m , long x ) { x -- ; long row = x % n ; long col = x / n ; System . out . println ( row * m + col + 1 ) ; } }

import java . io . IOException ; import java . util . * ; public class Main5 { static int [ ] t ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long col = x / n ; long row = x % n ; if ( row == 0 ) { col -- ; row = n - 1 ; } else { row -- ; } long val = row * m + col + 1 ; System . out . println ( val ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t > 0 ) { long n = scan . nextLong ( ) ; long m = scan . nextLong ( ) ; long x = scan . nextLong ( ) ; long row = ( x - 1 ) % n + 1 ; long col = ( x - 1 ) / n + 1 ; System . out . println ( ( row - 1 ) * m + col ) ; t -- ; } } }

from sys import stdin , setrecursionlimit , stdout NEW_LINE from math import sqrt , floor , ceil , log , log2 , log10 , pi , gcd , sin , cos , asin NEW_LINE def ii ( ) : return int ( stdin . readline ( ) ) NEW_LINE def fi ( ) : return float ( stdin . readline ( ) ) NEW_LINE def mi ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def fmi ( ) : return map ( float , stdin . readline ( ) . split ( ) ) NEW_LINE def li ( ) : return list ( mi ( ) ) NEW_LINE def si ( ) : return stdin . readline ( ) . rstrip ( ) NEW_LINE def lsi ( ) : return list ( si ( ) ) NEW_LINE mod = 1000000007 NEW_LINE res = [ ' NO ' , ' YES ' ] NEW_LINE test , test_case = 0 , 1 NEW_LINE test_case = ii ( ) NEW_LINE while test < test_case : NEW_LINE INDENT test += 1 NEW_LINE n , m , x = mi ( ) NEW_LINE c = ceil ( x / n ) NEW_LINE r = x % n NEW_LINE if not r : NEW_LINE INDENT r = n NEW_LINE DEDENT print ( m * ( r - 1 ) + c ) NEW_LINE DEDENT

import math NEW_LINE cases = int ( input ( ) ) NEW_LINE for c in range ( cases ) : NEW_LINE INDENT n , m , pos = map ( int , input ( ) . split ( ) ) NEW_LINE row = pos % n if pos % n != 0 else n NEW_LINE col = ( pos - 1 ) // n + 1 NEW_LINE answ = ( row - 1 ) * m + col NEW_LINE print ( answ ) NEW_LINE DEDENT

import math NEW_LINE def main ( ) : NEW_LINE INDENT t = int ( input ( ) ) NEW_LINE cases = [ ] NEW_LINE for i in range ( t ) : NEW_LINE INDENT cases . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT for case in cases : NEW_LINE INDENT if case [ 2 ] % case [ 0 ] == 0 : NEW_LINE INDENT row = case [ 0 ] NEW_LINE DEDENT else : NEW_LINE INDENT row = case [ 2 ] % case [ 0 ] NEW_LINE DEDENT col = math . ceil ( case [ 2 ] / case [ 0 ] ) NEW_LINE x = row * case [ 1 ] - ( case [ 1 ] - col ) NEW_LINE print ( x ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

import math as m NEW_LINE def findClosest ( arr , n , target ) : NEW_LINE INDENT if ( target <= arr [ 0 ] ) : NEW_LINE INDENT return arr [ 0 ] , 0 NEW_LINE DEDENT if ( target >= arr [ n - 1 ] ) : NEW_LINE INDENT return arr [ n - 1 ] , n - 1 NEW_LINE DEDENT i = 0 ; NEW_LINE j = n ; NEW_LINE mid = 0 NEW_LINE while ( i < j ) : NEW_LINE INDENT mid = ( i + j ) // 2 NEW_LINE if ( arr [ mid ] == target ) : NEW_LINE INDENT return arr [ mid ] , mid NEW_LINE DEDENT if ( target < arr [ mid ] ) : NEW_LINE INDENT if ( mid > 0 and target > arr [ mid - 1 ] ) : NEW_LINE INDENT return getClosest ( arr [ mid - 1 ] , arr [ mid ] , target ) , 0 NEW_LINE DEDENT j = mid NEW_LINE DEDENT else : NEW_LINE INDENT if ( mid < n - 1 and target < arr [ mid + 1 ] ) : NEW_LINE INDENT return getClosest ( arr [ mid ] , arr [ mid + 1 ] , target ) , 0 NEW_LINE DEDENT i = mid + 1 NEW_LINE DEDENT DEDENT return arr [ mid ] , mid NEW_LINE DEDENT def getClosest ( val1 , val2 , target ) : NEW_LINE INDENT if ( target - val1 <= val2 - target ) : NEW_LINE INDENT return val1 NEW_LINE DEDENT else : NEW_LINE INDENT return val2 NEW_LINE DEDENT DEDENT test_Cases = int ( input ( ) ) NEW_LINE for i in range ( 0 , test_Cases ) : NEW_LINE INDENT row , column , cell_by_column = input ( ) . split ( ) NEW_LINE row = int ( row ) NEW_LINE column = int ( column ) NEW_LINE cell_by_column = int ( cell_by_column ) NEW_LINE cell_by_column_temp = cell_by_column NEW_LINE count = 0 NEW_LINE r = cell_by_column_temp / row NEW_LINE if cell_by_column_temp % row != 0 : NEW_LINE INDENT r = r + 1 NEW_LINE DEDENT r = int ( r ) NEW_LINE count = row - ( r * row - cell_by_column ) NEW_LINE x_coordinate = r NEW_LINE y_coordinates = count NEW_LINE t1 = ( y_coordinates - 1 ) * column NEW_LINE t2 = x_coordinate NEW_LINE print ( t1 + t2 ) NEW_LINE DEDENT

for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n , m , x = map ( int , input ( ) . split ( ) ) NEW_LINE if ( x % n == 0 ) : NEW_LINE INDENT column_x = x // n NEW_LINE DEDENT else : NEW_LINE INDENT column_x = x // n + 1 NEW_LINE DEDENT row_x = x - abs ( ( ( column_x - 1 ) * n ) ) NEW_LINE if ( row_x == 1 ) : NEW_LINE INDENT v = column_x NEW_LINE DEDENT else : NEW_LINE INDENT v = ( row_x - 1 ) * m + column_x NEW_LINE DEDENT print ( v ) NEW_LINE DEDENT


import java . util . Scanner ; public class JavaApplication1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; if ( a == b ) { System . out . println ( " infinity " ) ; return ; } long cont = 0 ; long semresto = a - b ; long meio = ( long ) ( Math . sqrt ( semresto ) + 1 ) ; for ( int i = 1 ; i < meio ; i ++ ) { if ( semresto % i == 0 ) { if ( i > b ) cont ++ ; if ( ( semresto / i ) != i && ( semresto / i ) > b ) cont ++ ; } } System . out . println ( cont ) ; } }

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

import static java . lang . Math . sqrt ; import java . util . Scanner ; public class modularEquations { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int count = 0 ; int end = a - b ; if ( a == b ) { System . out . println ( " infinity " ) ; return ; } for ( int i = 1 ; i <= Math . sqrt ( end ) ; i ++ ) { if ( a % i == b ) count ++ ; if ( ( end % i ) == 0 ) { if ( i > end ) count ++ ;   if ( ( end / i ) != i && ( end / i ) > b ) count ++ ; } } System . out . println ( Integer . toString ( count ) ) ; } }

import java . util . * ; import java . math . * ;   public class Main { private static Scanner s ; public static void main ( String [ ] args ) { s = new Scanner ( System . in ) ; int num = s . nextInt ( ) ; int resp = s . nextInt ( ) ; int mod = 0 ; int count = 0 ; if ( num == resp ) { System . out . println ( " infinity " ) ; return ; } if ( resp > num ) { System . out . println ( "0" ) ; return ; } int diff = num - resp ; for ( int i = 1 ; i * i <= diff ; i ++ ) { if ( diff % i == 0 ) { if ( diff / i == i && i > resp ) { count ++ ; } else { if ( i > resp ) count ++ ; if ( diff / i > resp ) count ++ ; } } } System . out . println ( count ) ; s . close ( ) ; } }

import java . util . * ; import java . lang . * ; import java . math . * ; import java . awt . image . ConvolveOp ; import java . io . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ;

from math import sqrtn_to_mod , remainder = input ( ) . split ( )   n_to_mod = int ( n_to_mod ) remainder = int ( remainder )     def verify_n_divisors ( array_div_population ) : if array_div_population == [ ] : return 0 n_of_divisors = 1 for idx_div in range ( len ( array_div ) ) : n_of_divisors *= ( array_div_population [ idx_div ] + 1 ) return n_of_divisors     def is_at_array_div ( divisor , array_div , array_div_population ) : for div_idx in range ( len ( array_div ) ) : if divisor == array_div [ div_idx ] : array_div_population [ div_idx ] += 1 return array_div_population . append ( 1 ) array_div . append ( divisor )     def get_divisors ( array_div , array_div_population ) : divisors = [ 1 ]   for div_idx in range ( len ( array_div ) ) :   divisors = multiply_fact_n_times ( divisors , array_div [ div_idx ] , array_div_population [ div_idx ] ) return divisors     def multiply_fact_n_times ( divisors , factor , n_times ) : new_divisors = [ ] for div in divisors : result = div * factor new_divisors . append ( result ) divisors = divisors + new_divisors   while n_times - 1 > 0 : final_divisors = [ ] for div in new_divisors : result = div * factor final_divisors . append ( result ) divisors = divisors + final_divisors new_divisors = final_divisors n_times -= 1   return divisors   if n_to_mod == remainder : print ( ' infinity ' ) elif n_to_mod <= remainder : print ( 0 ) else : array_div = [ ] array_div_population = [ ] factor_count = 2 plus_two = False   first_module = n_to_mod - remainder max_size = sqrt ( first_module ) count_modular_times = 0 module_controller = 2 while first_module != 1 : if first_module % factor_count == 0 : first_module //= factor_count is_at_array_div ( factor_count , array_div , array_div_population )   else : if not plus_two : factor_count += 1 plus_two = True else : factor_count += 2   if factor_count > max_size : factor_count = first_module   divisors = list ( sorted ( get_divisors ( array_div , array_div_population ) ) ) for divisor in divisors : if divisor > remainder : count_modular_times += 1 print ( count_modular_times )   NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) if a == b : print ( ' infinity ' ) exit ( 0 ) x = abs ( a - b ) ans = 0 for xx in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % xx == 0 : if a % xx == b : ans += 1 if xx * xx != x : if a % ( x // xx ) == b : ans += 1 print ( ans ) NEW_LINE

arr = [ int ( x ) for x in input ( ) . split ( ) ] a = arr [ 0 ] b = arr [ 1 ] resp = 0 if a == b : resp = ' infinity ' if resp != ' infinity ' : x = a - b i = 1 c = 0 while i ** 2 < x : c += 1 if x % i == 0 : if i > b : resp += 1 if x / i > b : resp += 1 i += 1 if i ** 2 == x and i > b : resp += 1 print ( resp )   NEW_LINE