import java . util . * ; public class Arena { public static void main ( String args [ ] ) { Scanner e = new Scanner ( System . in ) ; int t = e . nextInt ( ) ; while ( t > 0 ) { int n = e . nextInt ( ) ; int a [ ] = new int [ n ] ; int x = 100 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = e . nextInt ( ) ; if ( a [ i ] < x ) x = a [ i ] ; } int b = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > x ) b ++ ; } System . out . println ( b ) ; t -- ; } } }

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

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

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int A [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; int min = Arrays . stream ( A ) . min ( ) . getAsInt ( ) ; int cnt = 0 ; for ( int x : A ) { if ( x > min ) cnt ++ ; } System . out . println ( cnt ) ; } sc . close ( ) ; } }

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = * map ( int , s . split ( ) ) , ; print ( len ( a ) - a . count ( min ( a ) ) ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) ; a = [ int ( i ) for i in input ( ) . split ( ) ] ; print ( n - a . count ( min ( a ) ) ) NEW_LINE


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class absolute { static int [ ] I = new int [ ] { 0 , - 1 , 0 , 1 } ; static int [ ] J = new int [ ] { - 1 , 0 , 1 , 0 } ; static int [ ] [ ] mat ; public static void main ( String [ ] args ) {

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

for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) g = [ ] for _ in range ( n ) : g . append ( list ( map ( int , input ( ) . split ( ) ) ) ) f = 0 for i in range ( n ) : for j in range ( m ) : maxx = 4 if j in ( 0 , m - 1 ) : maxx -= 1 if i in ( 0 , n - 1 ) : maxx -= 1 if g [ i ] [ j ] > maxx : print ( " NO " ) f = 1 break if f : break if not f : print ( " YES " ) for i in range ( n ) : for j in range ( m ) : maxx = 4 if j in ( 0 , m - 1 ) : maxx -= 1 if i in ( 0 , n - 1 ) : maxx -= 1 print ( maxx , end = ' ▁ ' ) print ( ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : m , n = map ( int , input ( ) . split ( ) ) l = [ [ int ( i ) for i in input ( ) . split ( ) ] for k in range ( m ) ] f = 0 for i in range ( m ) : for j in range ( n ) : ct = 0 if i - 1 >= 0 : ct += 1 if i + 1 < m : ct += 1 if j - 1 >= 0 : ct += 1 if j + 1 < n : ct += 1 if l [ i ] [ j ] > ct : f = 1 break else : l [ i ] [ j ] = ct if f == 1 : break if f == 1 : print ( ' NO ' ) else : print ( ' YES ' ) for i in l : print ( * i ) NEW_LINE

from collections import dequeimport sysinf = float ( ' inf ' ) input = sys . stdin . readline """ n ▁ = ▁ int ( input ( ) ) n , k ▁ = ▁ map ( int , input ( ) . split ( ) ) arr ▁ = ▁ list ( map ( int , input ( ) . split ( ) ) ) """   for _ in range ( int ( input ( ) ) ) : Row , Col = map ( int , input ( ) . split ( ) ) matt = [ ] for i in range ( Row ) : matt . append ( list ( map ( int , input ( ) . split ( ) ) ) ) flag = True for row in range ( Row ) : for col in range ( Col ) : if ( row == 0 or row == Row - 1 ) and ( col == 0 or col == Col - 1 ) : if matt [ row ] [ col ] > 2 : flag = False elif ( row == 0 or row == Row - 1 ) or ( col == 0 or col == Col - 1 ) : if matt [ row ] [ col ] > 3 : flag = False else : if matt [ row ] [ col ] > 4 : flag = False   if not flag : print ( ' NO ' ) else : print ( ' YES ' ) for row in range ( Row ) : for col in range ( Col ) : if ( row == 0 or row == Row - 1 ) and ( col == 0 or col == Col - 1 ) : matt [ row ] [ col ] = 2 elif ( row == 0 or row == Row - 1 ) or ( col == 0 or col == Col - 1 ) : matt [ row ] [ col ] = 3 else : matt [ row ] [ col ] = 4 for i in matt : print ( * i ) NEW_LINE

import sysimport mathfrom math import factorial , inf , gcdfrom heapq import * from functools import * from itertools import * from collections import * from typing import * sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE

import sys   def answer ( n , m , a ) : NEW_LINE


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;   public class Main { public static long GCD ( long n1 , long n2 ) { if ( n1 == 0 ) { return n2 ; } return GCD ( n2 % n1 , n1 ) ; }   public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; long sum = 0 ; for ( int i = 2 ; i < n ; i ++ ) { int temp = n ; while ( temp != 0 ) { sum += temp % i ; temp /= i ; } } long gc = GCD ( sum , n - 2 ) ; System . out . println ( ( sum / gc ) + " / " + ( ( n - 2 ) / gc ) ) ;    }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   }

import java . util . * ; import java . lang . Math . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; long sum = 0 ; int d = 0 ; int b = a ; for ( int i = 2 ; i < b ; i ++ ) { int x = 0 ; while ( a != 0 ) { x = x + a % i ; a = a / i ; } sum = sum + x ; a = b ; d ++ ; } for ( int j = 2 ; j < d ; j ++ ) { if ( ( sum % j == 0 ) && ( d % j == 0 ) ) { sum = sum / j ; d = d / j ; j -- ; } } System . out . println ( sum + " / " + d ) ; } }

import java . util . Scanner ;   public class Main {   public static int getGcd ( int num1 , int num2 ) { if ( num2 == 0 ) { return num1 ; } else { return getGcd ( num2 , num1 % num2 ) ; } }   public static int sumsOfDigits ( int num ) { int result = 0 ; for ( int i = 2 ; i < num ; i ++ ) { int tmp = num ; while ( tmp != 0 ) { result += tmp % i ; tmp = tmp / i ; } }   return result ; }   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int num = in . nextInt ( ) ;   int result = sumsOfDigits ( num ) ;   int divisor = num - 2 ;   int gcd = getGcd ( result , divisor ) ;   System . out . println ( ( result / gcd ) + " / " + ( divisor / gcd ) ) ;   in . close ( ) ; } }

from math import gcd   def base ( n , b ) : c = 0 while n : c += n % b n //= b return c       n = int ( input ( ) ) x = 0   for i in range ( 2 , int ( n ) ) : x += base ( int ( n ) , i )     n -= 2 hcf = gcd ( x , n )     x //= hcfn //= hcfprint ( f " { x } / { n } " )   NEW_LINE

from math import gcdn , s = int ( input ( ) ) , 0 for i in range ( 2 , n ) : k = n while k != 0 : s += k % i k //= ip = gcd ( s , n - 2 ) print ( f ' { s / / p } / { ( n - 2 ) / / p } ' ) NEW_LINE

from math import gcd   n = int ( input ( ) ) s = 0 for i in range ( 2 , n ) : copy = n while copy > 0 : s += copy % i copy //= i   a = sb = n - 2 g = gcd ( a , b ) print ( f " { a ▁ / / ▁ g } / { b ▁ / / ▁ g } " ) NEW_LINE

a = int ( input ( ) ) s = 0 for i in range ( 2 , a ) : x = a while x : s += x % i x //= ib = a - 2 for i in range ( 2 , 1001 ) : while s % i == 0 and b % i == 0 : s //= i b //= iprint ( s , ' / ' , b , sep = ' ' ) NEW_LINE


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

import java . util . * ; public class _240_A_Mashmokh_and_numbers { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int pairs = n / 2 ; if ( n == 1 ) { if ( k == 0 ) System . out . println ( 1 ) ; else System . out . println ( - 1 ) ; System . exit ( 0 ) ; } if ( k < pairs ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } HashSet < Integer > hset = new HashSet < > ( ) ; int t = k - pairs + 1 ; System . out . print ( t + " ▁ " + ( 2 * t ) + " ▁ " ) ; hset . add ( t ) ; hset . add ( t * 2 ) ; int j = 1 ; if ( hset . contains ( j ) || hset . contains ( 1 + j ) ) j = j + 2 ; for ( int i = 1 ; i < pairs ; i ++ ) { while ( hset . contains ( j ) || hset . contains ( j + 1 ) ) j ++ ; System . out . print ( j + " ▁ " + ( 1 + j ) + " ▁ " ) ; hset . add ( j ) ; hset . add ( j + 1 ) ; } if ( pairs * 2 != n ) { while ( hset . contains ( j ) ) j ++ ; System . out . print ( j ) ; } } }

arr = [ int ( x ) for x in input ( ) . split ( ) ] n , k = arr [ 0 ] , arr [ 1 ] if ( k < n // 2 ) : print ( - 1 ) elif ( n == 1 ) : if ( k > 0 ) : print ( - 1 ) else : print ( 1 ) else : ans = [ ] if ( n % 2 == 0 ) : temp = n // 2 temp -= 1 k -= temp i = 1 print ( k , 2 * k , end = " ▁ " ) while ( temp > 0 ) : if ( i != k and i != 2 * k and i + 1 != k and i + 1 != 2 * k ) : print ( i , i + 1 , end = " ▁ " ) temp -= 1 i += 2 else : temp = n // 2 temp -= 1 k -= temp i = 1 print ( k , 2 * k , end = " ▁ " ) while ( temp > 0 ) : if ( i != k and i != 2 * k and i + 1 != k and i + 1 != 2 * k ) : print ( i , i + 1 , end = " ▁ " ) temp -= 1 i += 2 print ( i + 17 ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = n // 2 z = k - a + 1 ans = [ 10 ** 9 - i for i in range ( 1 , n + 1 ) ]   if z == 1 : print ( * ans ) elif z < 1 or n == 1 : print ( - 1 ) else : if n == 1 : print ( 99 ) else : ans [ 0 ] , ans [ 1 ] = z , z * 2 print ( * ans ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   if m < n // 2 and n != 1 or ( n == 1 and m >= n ) : print ( - 1 )   else : if m : k = ( n - 2 ) // 2 print ( ( m - k ) , end = " ▁ " ) print ( ( m - k ) * 2 , end = " ▁ " ) n -= 2 c = ( m - k ) * 2 + 1   if n != 1 : for i in range ( c , c + n ) : print ( i , end = " ▁ " ) else : print ( 1 )   NEW_LINE


import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . RoundingMode ; import java . util . * ; import java . util . concurrent . LinkedBlockingDeque ;   import java . util . ArrayList ; import java . util . HashMap ; import java . util . LinkedList ;

import java . io . * ; import java . util . * ;    public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ;   public static int checkreverse ( int [ ] [ ] arr , int n ) { if ( n % 2 == 1 ) return n ; for ( int i = n / 2 - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < arr [ 0 ] . length ; j ++ ) { if ( arr [ i ] [ j ] != arr [ n - i - 1 ] [ j ] ) return n ; } }   return checkreverse ( arr , n / 2 ) ;   }   static boolean flag = false ; static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; }   public static void main ( String [ ] args ) throws IOException {   String [ ] sr = br . readLine ( ) . split ( " ▁ " ) ;   int n = next ( sr , 0 ) ; int m = next ( sr , 1 ) ; int [ ] [ ] arr = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { sr = br . readLine ( ) . split ( " ▁ " ) ; for ( int j = 0 ; j < m ; j ++ ) arr [ i ] [ j ] = next ( sr , j ) ; }   System . out . println ( checkreverse ( arr , n ) ) ;    } }

import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws InterruptedException { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; solve ( in , out ) ; out . close ( ) ; }   static void solve ( MyScanner in , PrintWriter out ) { int n , m ; n = in . nextInt ( ) ; m = in . nextInt ( ) ; int [ ] [ ] mt = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { mt [ i ] [ j ] = in . nextInt ( ) ; } } int ans = n ; while ( ans % 2 == 0 && isSym ( mt , ans ) ) { ans /= 2 ; } out . println ( ans ) ; }   static boolean isSym ( int [ ] [ ] mt , int len ) { int up = len / 2 - 1 ; int down = len / 2 ; int m = mt [ 0 ] . length ; while ( up >= 0 ) { for ( int i = 0 ; i < m ; i ++ ) { if ( mt [ up ] [ i ] != mt [ down ] [ i ] ) { return false ; } } up -- ; down ++ ; } return true ; }   static class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( InputStream io ) { br = new BufferedReader ( new InputStreamReader ( io ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

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

n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( " " . join ( list ( map ( str , input ( ) . split ( ) ) ) ) ) while not n % 2 : if l [ : n // 2 ] != l [ n // 2 : n ] [ : : - 1 ] : break n //= 2 print ( n ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( " " . join ( list ( map ( str , input ( ) . split ( ) ) ) ) ) while not n % 2 and l [ : n // 2 ] == l [ n // 2 : n ] [ : : - 1 ] : n //= 2 print ( n ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( list ( map ( str , input ( ) . split ( ) ) ) ) while not n % 2 and l [ : n // 2 ] == l [ n // 2 : n ] [ : : - 1 ] : n //= 2 print ( n ) NEW_LINE

from math import log row , col = map ( int , input ( ) . split ( " ▁ " ) ) if row % 2 == 1 : print ( row ) else : matrix = [ ] for _ in range ( row ) : matrix . append ( input ( ) . split ( " ▁ " ) ) minimum = row for _ in range ( int ( log ( row , 2 ) ) ) : if matrix [ 0 : minimum // 2 ] == matrix [ minimum - 1 : minimum // 2 - 1 : - 1 ] : minimum //= 2 else : break print ( minimum ) NEW_LINE


import java . util . * ; public class chess { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int c = 0 , d = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char x = s . charAt ( i ) ; if ( x == ' D ' ) d ++ ; else c ++ ; } if ( c > d ) System . out . println ( " Anton " ) ; else if ( c < d ) System . out . println ( " Danik " ) ; else System . out . println ( " Friendship " ) ; } }

import java . util . * ;   public class test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String test = scanner . nextLine ( ) ; String str = scanner . nextLine ( ) ; int test1 = Integer . parseInt ( test ) ; int a = 0 ; int d = 0 ;   for ( int i = 0 ; i < test1 ; i ++ ) { char ch = str . charAt ( i ) ; if ( ch == ' A ' ) { a ++ ; } else d ++ ; } if ( a > d ) { System . out . println ( " Anton " ) ; } else if ( d > a ) { System . out . println ( " Danik " ) ; } else System . out . println ( " Friendship " ) ; }   }

import java . util . Scanner ;   public class AntonAndDanik { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; String b = scanner . next ( ) ;   int anton = 0 ; int danik = 0 ;   for ( int i = 0 ; i < b . length ( ) ; i ++ ) { if ( b . charAt ( i ) == ' A ' ) { anton ++ ; } else { danik ++ ; } } if ( anton > danik ) { System . out . println ( " Anton " ) ; } else if ( danik > anton ) { System . out . println ( " Danik " ) ; } else System . out . println ( " Friendship " ) ;    } }

import java . util . Scanner ;   public class AntonAndDanik { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String num = scanner . nextLine ( ) ; String str = scanner . nextLine ( ) ; System . out . println ( solve ( str ) ) ; }   public static String solve ( String str ) { int anton = 0 ; int danik = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' A ' ) { anton ++ ; } else if ( str . charAt ( i ) == ' D ' ) { danik ++ ; } } if ( anton > danik ) { return " Anton " ; } else if ( danik > anton ) { return " Danik " ; } return " Friendship " ; } }

import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int l = in . nextInt ( ) ; int d = 0 , a = 0 ; String s = in . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == ' A ' ) { a ++ ; } else { d ++ ; } } if ( a > d ) { System . out . println ( " Anton " ) ; } else if ( a < d ) { System . out . println ( " Danik " ) ; } else { System . out . println ( " Friendship " ) ; } }   }

n = input ( ' ' ) x = input ( ' ' ) a = x . count ( ' A ' ) d = x . count ( ' D ' ) if a > d : print ( ' Anton ' ) elif d > a : print ( ' Danik ' ) else : print ( ' Friendship ' ) NEW_LINE

n = int ( input ( ) ) s = input ( ) if s . count ( ' A ' ) > s . count ( ' D ' ) : print ( " Anton " ) elif s . count ( ' D ' ) > s . count ( ' A ' ) : print ( " Danik " ) else : print ( " Friendship " ) NEW_LINE

n = input ( ) l = list ( input ( ) ) an = l . count ( ' A ' ) dn = l . count ( ' D ' ) if ( an > dn ) : print ( " Anton " ) elif ( dn > an ) : print ( " Danik " ) else : print ( " Friendship " ) NEW_LINE

n = int ( input ( ) ) s = input ( ) a = len ( s ) c = 0 d = 0 for i in range ( a ) : if ( s [ i ] == ' A ' ) : c = c + 1 elif ( s [ i ] == ' D ' ) : d = d + 1 if ( c > d ) : print ( " Anton " ) elif ( d > c ) : print ( " Danik " ) elif ( c == d ) : print ( " Friendship " ) NEW_LINE


import java . util . * ;   public class Tell_Your_World { static final double E = 0.0000001 ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) arr [ i ] = sc . nextInt ( ) ;   boolean thereIsAnswer = false ; outer : for ( int i = 1 ; i < 4 ; i ++ ) { for ( int j = i ; j < 4 ; j ++ ) { if ( j == i ) continue ;   line src = new line ( i , arr [ i ] , j , arr [ j ] ) ; for ( int k = 1 ; k <= n ; k ++ ) {   line other = src . getParallel ( k , arr [ k ] ) ;    for ( int l = 1 ; l <= n && ! other . identical ( src ) ; l ++ ) { if ( ( src . passThroughPoint ( l , arr [ l ] ) || other . passThroughPoint ( l , arr [ l ] ) ) ) { thereIsAnswer = true ; } else { thereIsAnswer = false ; break ;   } } if ( thereIsAnswer && ! other . identical ( src ) ) break outer ;   }    } } System . out . println ( thereIsAnswer ? " YES " : " NO " ) ;    }   public static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; }   static class line implements Comparable < line > {   int a ; int b ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) flag = 0 for i in range ( 1 , n ) : k = set ( ) xdif = i ydif = a [ i ] - a [ 0 ] k . add ( a [ 0 ] * xdif ) for j in range ( n ) : k . add ( a [ j ] * xdif - ( ydif * j ) ) if len ( k ) == 2 : flag = 1 breakxdif = 1 ydif = a [ 2 ] - a [ 1 ] k = set ( ) k . add ( a [ 1 ] * xdif - ydif ) for j in range ( n ) : k . add ( a [ j ] * xdif - ( ydif * j ) )   if len ( k ) == 2 : flag = 1 if flag : print ( ' Yes ' ) else : print ( ' No ' ) NEW_LINE

n = int ( input ( ) ) y = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , n ) : a = [ ] for j in range ( n ) : NEW_LINE

from decimal import * getcontext ( ) . prec = 16 from math import sqrt   n = int ( input ( ) )   liste = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   perm = [ ( 0 , 1 , 2 ) , ( 0 , 2 , 1 ) , ( 1 , 2 , 0 ) ]   bool = Falsefor element in perm : i0 , i1 , i2 = element count = 2 slope = ( liste [ i1 ] - liste [ i0 ] ) / ( i1 - i0 ) rest = [ ] for i in range ( 3 , n ) : if slope == ( liste [ i1 ] - liste [ i ] ) / ( i1 - i ) : count += 1 else : rest . append ( i ) if slope == ( liste [ i2 ] - liste [ i1 ] ) / ( i2 - i1 ) : count += 1 else : rest . append ( i2 ) if rest != [ ] : count += 1 for i in range ( 1 , len ( rest ) ) : if slope == ( liste [ rest [ 0 ] ] - liste [ rest [ i ] ] ) / ( rest [ 0 ] - rest [ i ] ) : count += 1 if count == n and rest != [ ] : print ( " YES " ) break   else : print ( " NO " ) NEW_LINE


import java . io . File ; import java . io . IOException ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . * ; import java . io . DataInputStream ; import java . io . InputStream ; import java . util . InputMismatchException ;   import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . StringTokenizer ;    public class Main { public static void main ( String [ ] argv ) { Task t = new Task ( ) ;

def main ( ) : s = input ( ) . split ( ) n , T , c = int ( s [ 0 ] ) , int ( s [ 1 ] ) , float ( s [ 2 ] ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) sumA , approx , mean = [ 0 ] , [ ] , 0. for i in range ( 1 , n + 1 ) : mean = ( mean + a [ i - 1 ] / T ) / c approx . append ( mean ) sumA . append ( a [ i - 1 ] + sumA [ i - 1 ] ) ans = [ ( sumA [ q [ i ] ] - sumA [ q [ i ] - T ] ) / T for i in range ( m ) ] for i in range ( m ) : print ( ' % .6f ' % ans [ i ] , ' % .6f ' % approx [ q [ i ] - 1 ] , ' % .6f ' % ( abs ( approx [ q [ i ] - 1 ] - ans [ i ] ) / ans [ i ] ) ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

a = list ( input ( ) . split ( ) ) n , T , c = int ( a [ 0 ] ) , int ( a [ 1 ] ) , float ( a [ 2 ] ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) )   sum_a = sum ( a [ : T - 1 ] ) mean = 0 for t in range ( T - 1 ) : mean = ( mean + a [ t ] / T ) / c   i = 0 for t in range ( T - 1 , p [ - 1 ] ) : sum_a += a [ t ] mean = ( mean + a [ t ] / T ) / c if t == p [ i ] - 1 : real = sum_a / T print ( ' % 0.6f ▁ % 0.6f ▁ % 0.6f ' % ( real , mean , abs ( real - mean ) / real ) ) i += 1 if i == len ( p ) : break sum_a -= a [ t - T + 1 ] NEW_LINE

__author__ = ' ruckus ' n , T , c = input ( ) . split ( ) n = int ( n ) T = int ( T ) c = float ( c ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) res_a = 0 real = 0 maxi_q = max ( q ) q_n = 0 for i in range ( q [ - 1 ] ) : res_a = ( res_a + a [ i ] / T ) / c real += a [ i ] if i >= T : real -= a [ i - T ] if q [ q_n ] == i + 1 : q_n += 1 r = real / T print ( r , res_a , abs ( r - res_a ) / r ) NEW_LINE


import java . io . * ; import java . util . * ;   public class main { public static void solucion ( String strPalabra ) { List < String > ans = new ArrayList < > ( ) ;

import java . util . Scanner ; import java . util . TreeSet ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; TreeSet < String > suffixes = new TreeSet < > ( ) ;   String word = sc . nextLine ( ) ; sc . close ( ) ;   String tempSubstring ;   boolean doubleStepIsPossible [ ] = new boolean [ word . length ( ) ] ; boolean tripleStepIsPossible [ ] = new boolean [ word . length ( ) ] ;   if ( word . length ( ) <= 6 ) { System . out . println ( "0" ) ; return ; }   int wordLength = word . length ( ) ;   doubleStepIsPossible [ wordLength - 2 ] = true ; suffixes . add ( word . substring ( wordLength - 2 , wordLength ) ) ;   if ( wordLength > 7 ) { tripleStepIsPossible [ wordLength - 3 ] = true ; suffixes . add ( word . substring ( wordLength - 3 , wordLength ) ) ; }   for ( int i = wordLength - 4 ; i >= 5 ; i -- ) { tempSubstring = word . substring ( i , i + 2 ) ; if ( tripleStepIsPossible [ i + 2 ] || ( doubleStepIsPossible [ i + 2 ] && ( ! tempSubstring . equals ( word . substring ( i + 2 , i + 4 ) ) ) ) ) { doubleStepIsPossible [ i ] = true ; suffixes . add ( tempSubstring ) ; }   tempSubstring = word . substring ( i , i + 3 ) ; if ( doubleStepIsPossible [ i + 3 ] || ( tripleStepIsPossible [ i + 3 ] && ( ! tempSubstring . equals ( word . substring ( i + 3 , i + 6 ) ) ) ) ) { tripleStepIsPossible [ i ] = true ; suffixes . add ( tempSubstring ) ; }   }   System . out . println ( suffixes . size ( ) ) ; suffixes . forEach ( System . out :: println ) ;   } }

import java . util . * ; public class linguistics { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String in = sc . nextLine ( ) ; char [ ] ch = in . toCharArray ( ) ; int n = ch . length ; TreeSet < String > ans = new TreeSet < > ( ) ; boolean [ ] dp2 = new boolean [ n + 1 ] ; boolean [ ] dp3 = new boolean [ n + 1 ] ; dp2 [ n ] = true ; dp3 [ n ] = true ; dp3 [ n - 3 ] = true ; dp2 [ n - 2 ] = true ; boolean s2 , s3 ; for ( int i = n - 1 ; i >= 5 ; i -- ) {

string = input ( ) s = set ( ) finded = { } import syssys . setrecursionlimit ( 900000000 )   def get_substr ( string , start , parent ) : NEW_LINE

if __name__ == ' _ _ main _ _ ' :     word = input ( )   suffixes = set ( ) possible = set ( ) my_set = set ( ) not_poss = set ( )   possible . add ( ( len ( word ) , 2 ) )   while possible : tam , x = possible . pop ( ) a = tam + x for i in [ x , 5 - x ] : root = tam - i new_pos = ( root , i )   if root < 5 or new_pos in my_set or ( word [ root : tam ] == word [ tam : a ] ) : not_poss . add ( word [ root : tam ] ) else : suffixes . add ( word [ root : tam ] ) possible . add ( new_pos ) my_set . add ( new_pos )   suffixes_alph = sorted ( suffixes )   print ( len ( suffixes ) ) for i in suffixes_alph : print ( i ) NEW_LINE

import syssys . setrecursionlimit ( 10000 )   s = input ( ) s = s [ 5 : ] + " ▁ " res = set ( ) aux = set ( )   def getWords ( x , y ) : if ( x , y ) in aux : return aux . add ( ( x , y ) ) if x > 1 and s [ x : y ] != s [ x - 2 : x ] : res . add ( s [ x - 2 : x ] ) getWords ( x - 2 , x ) if x > 2 and s [ x : y ] != s [ x - 3 : x ] : res . add ( s [ x - 3 : x ] ) getWords ( x - 3 , x )   getWords ( len ( s ) - 1 , len ( s ) )   print ( len ( res ) ) for word in sorted ( list ( res ) ) : print ( word ) NEW_LINE

lectura = input ( ) sufix = set ( ) comb = { ( len ( lectura ) , 2 ) } setPrueba = set ( ) while comb : x , y = comb . pop ( ) pos3 = x + y for i in [ y , 5 - y ] : posIni = x - i stringActual = ( posIni , i ) if ( stringActual in setPrueba or ( posIni < 5 ) or ( lectura [ posIni : x ] == lectura [ x : pos3 ] ) ) : NEW_LINE

import sys   value = input ( ) if ( len ( value ) < 7 ) : print ( 0 ) sys . exit ( 0 )   res = set ( ) possible = { } possible [ len ( value ) ] = set ( [ 2 ] ) if ( len ( value ) > 7 ) : possible [ len ( value ) ] . add ( 3 ) possibleLen = [ 2 , 3 ]   for i in reversed ( range ( 7 , len ( value ) + 1 ) ) : possibleVal = possible . get ( i , set ( ) ) for length in possibleVal : nextI = i - length val = value [ nextI : i ] res . add ( val ) for posLen in possibleLen : if ( nextI >= 5 + posLen and value [ nextI - posLen : nextI ] != val ) : setNextI = possible . setdefault ( nextI , set ( ) ) setNextI . add ( posLen )   print ( len ( res ) ) for val in sorted ( res ) : print ( val ) NEW_LINE


import java . util . Scanner ;   public class A722 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int type = in . nextInt ( ) ; String input = in . next ( ) ; int hStart ; int hEnd ; if ( type == 12 ) { hStart = 1 ; hEnd = 12 ; } else { hStart = 0 ; hEnd = 23 ; } int minDiff = 5 ; String answer = null ; for ( int h = hStart ; h <= hEnd ; h ++ ) { for ( int m = 0 ; m <= 59 ; m ++ ) { String S = String . format ( " % 02d : %02d " , h , m ) ; int diff = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( input . charAt ( i ) != S . charAt ( i ) ) { diff ++ ; } } if ( diff < minDiff ) { minDiff = diff ; answer = S ; } } } System . out . println ( answer ) ; }   }

import java . util . * ; import java . lang . * ;   public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int format = scanner . nextInt ( ) ; String s = scanner . next ( ) ; int a = s . charAt ( 0 ) - '0' ; int b = s . charAt ( 1 ) - '0' ; int c = s . charAt ( 3 ) - '0' ; int d = s . charAt ( 4 ) - '0' ;   if ( c > 5 ) c = 0 ;   if ( format == 24 && a > 2 ) a = 0 ; if ( format == 24 && a == 2 && b >= 4 ) a = 0 ;   if ( format == 12 && a == 0 && b == 0 ) b = 1 ; else if ( format == 12 && a == 1 && b > 2 ) b = 1 ; else if ( format == 12 && a > 1 && b > 2 ) a = 0 ; else if ( format == 12 && a > 1 ) a = 1 ;   System . out . println ( a + " " + b + " : " + c + " " + d ) ; }   }

import java . util . Scanner ; import java . util . stream . IntStream ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int format = sc . nextInt ( ) ; String time = sc . next ( ) ; System . out . println ( solve ( format , time ) ) ;   sc . close ( ) ; }   static String solve ( int format , String time ) { int minHour ; int maxHour ; if ( format == 12 ) { minHour = 1 ; maxHour = 12 ; } else { minHour = 0 ; maxHour = 23 ; }   int minDiffNum = Integer . MAX_VALUE ; String result = null ; for ( int hour = minHour ; hour <= maxHour ; hour ++ ) { for ( int minute = 0 ; minute <= 59 ; minute ++ ) { String t = String . format ( " % 02d : %02d " , hour , minute ) ; int diffNum = ( int ) IntStream . range ( 0 , time . length ( ) ) . filter ( i -> time . charAt ( i ) != t . charAt ( i ) ) . count ( ) ; if ( diffNum < minDiffNum ) { minDiffNum = diffNum ; result = t ; } } }   return result ; } }

def solve ( ) : t = int ( input ( ) ) time = list ( input ( ) ) h , m = map ( int , " " . join ( time ) . split ( ' : ' ) )   if t == 12 : NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class Main   { static FastReader sc = new FastReader ( ) ; static int dp [ ] [ ] ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Random ; import java . util . StringTokenizer ;   public class Solution { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int hy = fs . nextInt ( ) , ay = fs . nextInt ( ) , dy = fs . nextInt ( ) ; int hm = fs . nextInt ( ) , am = fs . nextInt ( ) , dm = fs . nextInt ( ) ; int H = fs . nextInt ( ) , A = fs . nextInt ( ) , D = fs . nextInt ( ) ; int min = ( int ) 1e9 ; for ( int atk = ay ; atk <= 200 ; atk ++ ) { for ( int def = dy ; def <= 100 ; def ++ ) { if ( atk <= dm ) continue ; int t = ( hm + atk - dm - 1 ) / ( atk - dm ) ; int reqhp = t * Math . max ( 0 , am - def ) + 1 ; int coins = ( atk - ay ) * A + ( def - dy ) * D + Math . max ( 0 , reqhp - hy ) * H ; if ( coins < min ) { min = coins ; } } } out . println ( min ) ; } out . close ( ) ; } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;

N = 1000 hy , ay , dy = map ( int , input ( ) . split ( ) ) hm , am , dm = map ( int , input ( ) . split ( ) ) h , a , d = map ( int , input ( ) . split ( ) ) res , c = 2e9 , 0 if ay <= dm : c = ( dm - ay + 1 ) * a ay = dm + 1 for i in range ( N ) : for j in range ( N ) : for k in range ( N ) : if am <= dy + k : res = min ( res , h * i + a * j + d * k ) break x = hy + i - am + dy + k - 1 y = am - dy - k z = hm - ay - j + dm - 1 w = ay + j - dm if x // y > z / w : res = min ( res , h * i + a * j + d * k ) breakprint ( res + c ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Template implements Runnable {   BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer ( " " ) ;   void init ( ) throws FileNotFoundException { try { in = new BufferedReader ( new FileReader ( " input . txt " ) ) ; out = new PrintWriter ( " output . txt " ) ; } catch ( Exception e ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } }   String readString ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return tok . nextToken ( ) ; }   int readInt ( ) throws IOException { return Integer . parseInt ( readString ( ) ) ; }   int [ ] readIntArray ( int size ) throws IOException { int [ ] res = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { res [ i ] = readInt ( ) ; } return res ; }   long readLong ( ) throws IOException { return Long . parseLong ( readString ( ) ) ; }   double readDouble ( ) throws IOException { return Double . parseDouble ( readString ( ) ) ; }   < T > List < T > [ ] createGraphList ( int size ) { List < T > [ ] list = new List [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { list [ i ] = new ArrayList < > ( ) ; } return list ; }   public static void main ( String [ ] args ) { new Template ( ) . run ( ) ;

n = int ( input ( ) ) m = [ ] sc = [ ] for i in range ( n ) : m . append ( input ( ) ) sc . append ( set ( m [ i ] ) ) i = 0 while i < len ( m ) : j = i + 1 p = False while j < len ( m ) : z = len ( sc [ i ] . intersection ( sc [ j ] ) ) a = len ( sc [ i ] ) b = len ( sc [ j ] ) if z == a : sc . pop ( i ) m . pop ( i ) i -= 1 break elif z == b : sc . pop ( j ) m . pop ( j ) j -= 1 elif z > 0 : if m [ i ] [ - z : ] == m [ j ] [ : z ] : m [ i ] += m [ j ] [ z : ] else : m [ i ] = m [ j ] + m [ i ] [ z : ] sc [ i ] = set ( m [ i ] ) m . pop ( j ) sc . pop ( j ) j -= 1 p = True j += 1 if not p : i += 1 i = 0 print ( ' ' . join ( m ) ) NEW_LINE

n = int ( input ( ) ) d = { } p = { } ans = ' ' for x in [ input ( ) for i in range ( n ) ] : for i in range ( len ( x ) - 1 ) : d [ x [ i ] ] = x [ i + 1 ] for i in range ( 1 , len ( x ) ) : p [ x [ i ] ] = 1 d . setdefault ( x [ - 1 ] , ' ' ) for x in range ( 9 , 123 ) : x = chr ( x ) if p . get ( x , 0 ) > 0 or d . get ( x , ' Q ' ) == ' Q ' : continue while x != ' ' : ans += x t = d [ x ] del d [ x ] x = tprint ( ans ) NEW_LINE

from typing import Listfrom string import ascii_lowercase     def to_idx ( char : str ) -> int : return ord ( char ) - ord ( ' a ' )     def solve ( n : int , genomes : List [ str ] ) -> str : goto = [ - 1 ] * 26 for g in genomes : for curr , nxt in zip ( g , g [ 1 : ] ) : goto [ to_idx ( curr ) ] = to_idx ( nxt ) sources = set ( [ to_idx ( g [ 0 ] ) for g in genomes if to_idx ( g [ 0 ] ) not in goto ] ) ans = [ ] for source in sources : ptr = source ans . append ( ascii_lowercase [ ptr ] ) while goto [ ptr ] != - 1 : ptr = goto [ ptr ] ans . append ( ascii_lowercase [ ptr ] ) return ' ' . join ( ans ) n = int ( input ( ) ) genomes = [ input ( ) for _ in range ( n ) ]   print ( solve ( n , genomes ) ) NEW_LINE

def main ( ) : ab , tails , res = { } , set ( ) , [ ] for _ in range ( int ( input ( ) ) ) : a , * s = input ( ) for b in s : ab [ a ] = a = b tails . add ( b ) ab . setdefault ( a , ' ' ) for a in ab . keys ( ) : if a not in tails : while a : res . append ( a ) a = ab [ a ] print ( ' ' . join ( res ) )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main { private static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) throws IOException { int [ ] firstLineInput = Arrays . stream ( br . readLine ( ) . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int n = firstLineInput [ 0 ] ; int k = firstLineInput [ 1 ] ; int timeRemaining = 240 - k ; int sum = 0 ; int i = 0 ; for ( i = 1 ; i <= n ; i ++ ) { sum += 5 * i ; if ( sum > timeRemaining ) { break ; } } System . out . println ( i - 1 ) ; }   }

import java . io . * ; import java . util . * ;    public class Main {   public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class NewYearHurry { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ;   int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ;   int totalTime = 240 - k ;   for ( int i = n ; i >= 0 ; i -- ) { int time = i * ( 1 + i ) / 2 * 5 ;   if ( time <= totalTime ) { System . out . println ( i ) ; break ; } } } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int time_remaining = ( 4 * 60 ) - k ;   int sum = 0 ; int i = 0 ; while ( sum <= time_remaining && ( i ) <= n ) { i ++ ; sum += i * 5 ; } System . out . println ( i - 1 ) ; }

import java . util . Arrays ; import java . util . Random ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int decided = 0 ; int min = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( min + k > 240 ) { System . out . println ( decided - 1 ) ; return ; } else { decided ++ ; min += ( i + 1 ) * 5 ; } } if ( min + k > 240 ) { System . out . println ( decided - 1 ) ; } else { System . out . println ( decided ) ;   } } }

n , k = map ( int , input ( ) . split ( ) ) t = 240 - ki = 1 count = 0 while t >= i * 5 and count < n : count += 1 t = t - i * 5 i += 1 print ( count ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = 240 b = 240 - ks = 0 c = 0 for i in range ( 1 , n + 1 ) : s += 5 * i if ( s <= b ) : c += 1 print ( c ) NEW_LINE

a , b = [ int ( x ) for x in input ( ) . split ( ) ] b = 240 - bc = Trued = 0 for i in range ( a ) : if ( ( i + 1 ) * 5 + d > b ) : print ( i ) c = False break d += ( i + 1 ) * 5   if c : print ( a ) NEW_LINE

info = [ int ( x ) for x in input ( ) . split ( ) ] problem_times = [ int ( x ) * 5 for x in range ( 1 , info [ 0 ] + 1 ) ] time_to_do = 240 - info [ 1 ] problems_done = 0   for index , i in enumerate ( problem_times ) : if time_to_do >= problem_times [ index ] : time_to_do -= i problems_done += 1 else : breakprint ( problems_done ) NEW_LINE

n , k = [ int ( i ) for i in input ( ) . split ( ) ]   totalTime = 240 - k   for i in range ( n , - 1 , - 1 ) : time = i * ( i + 1 ) / 2 * 5   if ( time <= totalTime ) : print ( i ) break NEW_LINE


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; while ( t > 0 ) { t -- ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; boolean x = true ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( a [ i + 1 ] - a [ i ] > 1 ) { x = false ; break ; } } if ( x || n == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

import java . util . * ; public class a { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; for ( int tt = 0 ; tt < t ; tt ++ ) { int x = scan . nextInt ( ) ; ArrayList < Integer > nums = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < x ; i ++ ) { int temp = scan . nextInt ( ) ; nums . add ( temp ) ; } if ( nums . size ( ) == 1 ) { System . out . println ( " YES " ) ; continue ; } Collections . sort ( nums ) ; for ( int i = 0 ; i < nums . size ( ) - 1 ; i ++ ) { if ( nums . get ( i + 1 ) - nums . get ( i ) <= 1 ) { nums . remove ( i ) ; i -- ; } } System . out . println ( nums . size ( ) == 1 ? " YES " : " NO " ) ; } } }

import java . util . Scanner ; import java . lang . Math ; import java . util . Arrays ; public class pa { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { int t = sc . nextInt ( ) ; for ( int j = 0 ; j < t ; j ++ ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; boolean flag = true ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > arr [ i - 1 ] + 1 ) { System . out . println ( " NO " ) ; flag = false ; break ; } } if ( flag == true ) System . out . println ( " YES " ) ; } } }

import java . lang . * ; import java . util . * ; public final class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t > 0 ) { int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextInt ( ) ; Arrays . sort ( a ) ; List < Integer > l = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) l . add ( a [ i ] ) ; for ( int i = 0 ; i < l . size ( ) - 1 ; i ++ ) { if ( l . get ( i + 1 ) - l . get ( i ) <= 1 ) { l . remove ( i ) ; i = - 1 ; } } if ( l . size ( ) == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; t -- ; } } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { a [ k ] = sc . nextInt ( ) ; } int f = 1 ; Arrays . sort ( a ) ; for ( int j = 1 ; j < n ; j ++ ) { if ( Math . abs ( a [ j ] - a [ j - 1 ] ) > 1 ) { f = 0 ; break ; } } if ( f == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

n = int ( input ( ) ) NEW_LINE for t in range ( n ) : NEW_LINE INDENT q = int ( input ( ) ) NEW_LINE a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE g = 0 NEW_LINE for i in range ( 0 , q - 1 ) : NEW_LINE INDENT if abs ( a [ i ] - a [ i + 1 ] ) > 1 : NEW_LINE INDENT g = 1 NEW_LINE DEDENT DEDENT if g != 1 : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT DEDENT

for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE l = sorted ( [ int ( x ) for x in input ( ) . split ( ) ] ) NEW_LINE res = ' YES ' NEW_LINE for i in range ( len ( l ) - 1 ) : NEW_LINE INDENT if l [ i + 1 ] - l [ i ] > 1 : NEW_LINE INDENT res = ' NO ' NEW_LINE break NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE DEDENT

import random NEW_LINE def quick_sort ( array ) : NEW_LINE INDENT if len ( array ) < 2 : NEW_LINE INDENT return array NEW_LINE DEDENT index = random . randint ( 1 , len ( array ) ) - 1 NEW_LINE pivot = array [ index ] NEW_LINE smaller = [ i for i in array [ : index ] + array [ index + 1 : ] if i <= pivot ] NEW_LINE bigger = [ i for i in array [ : index ] + array [ index + 1 : ] if i > pivot ] NEW_LINE return quick_sort ( smaller ) + [ pivot ] + quick_sort ( bigger ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE for _ in range ( n ) : NEW_LINE INDENT inp = int ( input ( ) ) NEW_LINE numbers = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ] NEW_LINE numbers = quick_sort ( numbers ) NEW_LINE i = 0 NEW_LINE while True : NEW_LINE INDENT if i >= len ( numbers ) - 1 : NEW_LINE INDENT break NEW_LINE DEDENT if abs ( numbers [ i ] - numbers [ i + 1 ] ) <= 1 : NEW_LINE INDENT if numbers [ i ] <= numbers [ i + 1 ] : NEW_LINE INDENT numbers . pop ( i ) NEW_LINE DEDENT else : NEW_LINE INDENT numbers . pop ( i + 1 ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT i += 1 NEW_LINE DEDENT DEDENT if len ( numbers ) <= 1 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT DEDENT DEDENT

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = { * map ( int , s . split ( ) ) } ; print ( ' YNEOS ' [ len ( a ) <= max ( a ) - min ( a ) : : 2 ] ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for x in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE list_a = sorted ( [ int ( k ) for k in input ( ) . split ( ) ] ) NEW_LINE f = 1 NEW_LINE for i in range ( 0 , n - 1 ) : NEW_LINE INDENT if abs ( list_a [ i ] - list_a [ i + 1 ] ) > 1 : NEW_LINE INDENT f = 0 NEW_LINE DEDENT DEDENT if f == 1 : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT DEDENT


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int n = in . nextInt ( ) ; int x0 = in . nextInt ( ) ; int y0 = in . nextInt ( ) ; boolean x0Line = false ; boolean y0Line = false ; Set < Double > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) - x0 ; int y = in . nextInt ( ) - y0 ;   if ( x == 0 ) x0Line = true ; else if ( y == 0 ) y0Line = true ; else set . add ( ( double ) y / ( double ) x ) ;   }   System . out . println ( ( x0Line ? 1 : 0 ) + ( y0Line ? 1 : 0 ) + set . size ( ) ) ;   }    }

import java . util . * ; public class HanSoloAndLazerGun { static class Key { double m ; double c ; Key ( double m , double c ) { this . m = m ; this . c = c ; } public double hashcode ( ) { double hash = 7 ; hash = ( 17 * this . m ) + ( hash * this . c ) ; return hash ; } @ Override public boolean equals ( Object v ) { boolean ans = false ; if ( v instanceof Key ) { Key k = ( Key ) v ; return ( this . c == k . c && this . m == k . m ) ; } return ans ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double x0 = sc . nextDouble ( ) ; double y0 = sc . nextDouble ( ) ; int a [ ] [ ] = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = sc . nextInt ( ) ; a [ i ] [ 1 ] = sc . nextInt ( ) ; } ArrayList < Key > al = new ArrayList < > ( ) ; double slope , cut ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] [ 0 ] - x0 == 0 ) { slope = Double . MAX_VALUE ; cut = Double . MAX_VALUE ; } else { slope = ( a [ i ] [ 1 ] - y0 ) / ( a [ i ] [ 0 ] - x0 ) ; cut = y0 - ( x0 * slope ) ; }

import java . util . Scanner ;   public class StormTroopers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ;   if ( n == 1 ) { System . out . println ( 1 ) ; return ; } long Gx = scanner . nextLong ( ) ; long Gy = scanner . nextLong ( ) ;   boolean [ ] dead = new boolean [ n ] ; Long [ ] [ ] location = new Long [ n ] [ 2 ] ;   location [ 0 ] [ 0 ] = scanner . nextLong ( ) ; location [ 0 ] [ 1 ] = scanner . nextLong ( ) ; dead [ 0 ] = true ;   int count = 1 ;   for ( int i = 1 ; i < n ; i ++ ) { location [ i ] [ 0 ] = scanner . nextLong ( ) ; location [ i ] [ 1 ] = scanner . nextLong ( ) ;   boolean check = ( location [ i ] [ 1 ] - Gy ) * ( location [ 0 ] [ 0 ] - Gx ) == ( location [ 0 ] [ 1 ] - Gy ) * ( location [ i ] [ 0 ] - Gx ) ;   if ( check ) dead [ i ] = true ; }   for ( int i = 1 ; i < n ; i ++ ) { if ( ! dead [ i ] ) { count ++ ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( ! dead [ j ] ) { boolean check = ( location [ j ] [ 1 ] - Gy ) * ( location [ i ] [ 0 ] - Gx ) == ( location [ i ] [ 1 ] - Gy ) * ( location [ j ] [ 0 ] - Gx ) ;   if ( check ) { dead [ j ] = true ; } } } } }   System . out . println ( count ) ; } }

n , x0 , y0 = map ( int , input ( ) . split ( ) ) s = set ( ) for _ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) if x == x0 : s . add ( float ( ' inf ' ) ) else : s . add ( ( y - y0 ) / ( x - x0 ) ) print ( len ( s ) ) NEW_LINE

n , gx , gy = map ( int , input ( ) . split ( ) ) cx = 0 cy = 0 umap = { } for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) if ( x == gx ) : cx += 1 elif y == gy : cy += 1 else : d = ( y - gy ) / ( x - gx ) if ( d in umap ) : umap [ d ] += 1 else : umap [ d ] = 1 c = 0 NEW_LINE

n , x_0 , y_0 = map ( int , input ( ) . split ( ) ) arr = [ ] for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) [ : 2 ] arr . append ( a ) def tangent ( x_0 , y_0 , p1 , p2 ) : return float ( ( y_0 - p2 ) / ( x_0 - p1 ) ) arr1 = [ ] for i in range ( n ) : if arr [ i ] [ 0 ] == x_0 : arr1 . append ( - 0.0000001 ) continue for j in range ( 2 ) : a = tangent ( x_0 , y_0 , arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) arr1 . append ( a ) NEW_LINE


import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; } boolean check = true ; for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( ar [ j ] <= ar [ j + 1 ] ) { check = false ; break ; } } if ( check ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; }   }    }    public static long getAns ( int n ) {   if ( n == 0 ) { return n ; } int ans1 = n / 2 ; int ans2 = n / 3 ; int ans3 = n / 4 ;

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

import java . io . File ; import java . io . FileNotFoundException ; import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . FileReader ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Calendar ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; import java . util . Set ; import java . util . StringTokenizer ;     public class B { static int mx = 1000005 ; static MScanner in = new MScanner ( System . in ) ; static void solve ( ) throws Exception { MScanner sc = new MScanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextInt ( ) ; boolean can = false ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i - 1 ] <= a [ i ] ) { can = true ; break ; } } System . out . println ( can ? " YES " : " NO " ) ; } static Integer [ ] sort ( Integer [ ] arr , int n ) { Arrays . sort ( arr , new Comparator < Integer > ( ) { @ Override public int compare ( Integer arg0 , Integer arg1 ) {

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

import java . util . * ;   public class Example { static int [ ] dp ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) )   d = dict ( ) NEW_LINE for i in range ( len ( a ) ) : if NEW_LINE a [ i ] not in d : d [ a [ i ] ] = True   if len ( d . keys ( ) ) == len ( a ) : k = [ ] NEW_LINE for el in a : k . append ( el )   k . sort ( reverse = True ) NEW_LINE rev = True NEW_LINE for i in range ( len ( a ) ) : if NEW_LINE a [ i ] != k [ i ] : rev = False NEW_LINE break   if rev : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE print ( " YES " )   else : print ( " YES " ) NEW_LINE DEDENT

import NEW_LINE INDENT sysinput = sys . stdin . readline   NEW_LINE DEDENT

for u in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE x = [ int ( w ) for w in input ( ) . split ( ) ] NEW_LINE f = False NEW_LINE for i in range ( n - 1 ) : if NEW_LINE INDENT ( x [ i ] <= x [ i + 1 ] ) : f = True NEW_LINE DEDENT break NEW_LINE if ( f ) : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT

from sys import stdin , stdoutfrom NEW_LINE math NEW_LINE import floor , gcd , fabs , factorial , fmod , sqrt , inf , logfrom NEW_LINE collections NEW_LINE import defaultdict as dd , dequefrom NEW_LINE heapq NEW_LINE import merge , heapify , heappop , heappush , nsmallestfrom NEW_LINE bisect NEW_LINE import bisect_left as bl , bisect_right as br , bisect NEW_LINE mod = pow ( 10 , 9 ) + 7 NEW_LINE mod2 = 998244353 NEW_LINE def inp ( ) : return stdin . readline ( ) . strip ( ) NEW_LINE def iinp ( ) : return int ( inp ( ) ) NEW_LINE def out ( var , end = " \n " ) : stdout . write ( str ( var ) + " \n " ) NEW_LINE def outa ( * var , end = " \n " ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) NEW_LINE def lmp ( ) : return list ( mp ( ) ) NEW_LINE def mp ( ) : return map ( int , inp ( ) . split ( ) ) NEW_LINE def smp ( ) : return map ( str , inp ( ) . split ( ) ) NEW_LINE def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] NEW_LINE def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] NEW_LINE def remadd ( x , y ) : return 1 if x % y else 0 NEW_LINE def ceil ( a , b ) : return ( a + b - 1 ) // b NEW_LINE def isprime ( x ) : if NEW_LINE x <= 1 : NEW_LINE return False NEW_LINE if x in ( 2 , 3 ) : return True NEW_LINE if x % 2 == 0 : return False NEW_LINE for i in range ( 3 , int ( sqrt ( x ) ) + 1 , 2 ) : if NEW_LINE x % i == 0 : NEW_LINE return False NEW_LINE return True NEW_LINE for _ in range ( int ( inp ( ) ) ) : n = iinp ( ) NEW_LINE arr = lmp ( ) NEW_LINE print ( " NO " if arr == sorted ( arr , reverse = True ) and len ( set ( arr ) ) == n else " YES " ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int T = 1 ;

import java . util . Scanner ;   public class AnastasiaPebbles { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; double n = in . nextDouble ( ) , k = in . nextDouble ( ) , s = 0 ;   for ( int i = 0 ; i < n ; i ++ ) s += Math . ceil ( in . nextDouble ( ) / k ) ;   in . close ( ) ; System . out . println ( ( int ) Math . ceil ( s / 2 ) ) ; } }

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

import mathn , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) count1 = 0 count2 = 0 for i in range ( 0 , n ) : count2 += int ( l [ i ] / ( 2 * k ) ) if l [ i ] % ( 2 * k ) > 0 : if l [ i ] % ( 2 * k ) <= k : count1 += 1 else : count2 += 1 print ( math . ceil ( count1 / 2 ) + count2 ) NEW_LINE

import mathn , k = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) [ : n ] total = 0 for i in li : temp = math . ceil ( i / k ) total += tempans = math . ceil ( total / 2 ) print ( ans )   NEW_LINE

import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) ''' n , k = map ( int , input ( ) . split ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) s = 0 for i in range ( n ) : s += math . ceil ( lst [ i ] / k ) print ( math . ceil ( s / 2 ) ) NEW_LINE

from math import ceiln , k = map ( int , input ( ) . split ( ) ) w = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) minDay = 0 total = 0 for i in range ( 1 , n + 1 ) : total += ceil ( w [ i ] / k ) minDay = ceil ( total / 2 ) print ( minDay ) NEW_LINE


import java . util . * ; public class Books { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int sum = 0 , num = 0 ; for ( int i = 0 , j = 0 ; i < n ; i ++ ) { sum += ar [ i ] ; if ( sum <= m ) { num = num + 1 ; } else { sum = sum - ar [ j ] ; j ++ ; } }   System . out . println ( num ) ;   } }

import java . util . Arrays ; import java . util . Scanner ;   public class solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int time = sc . nextInt ( ) ; int [ ] book = new int [ n ] ; int ans = 0 ; int sum = 0 ; int l = 0 ; for ( int i = 0 ; i < n ; i ++ ) { book [ i ] = sc . nextInt ( ) ; sum += book [ i ] ; while ( sum > time ) { sum -= book [ l ++ ] ; } ans = Math . max ( i - l + 1 , ans ) ; } System . out . println ( ans ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . TreeSet ;   public class Books { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int t = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] books = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { books [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } br . close ( ) ;   int [ ] booksPrefixSum = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { booksPrefixSum [ i ] = booksPrefixSum [ i - 1 ] + books [ i - 1 ] ; } TreeSet < TimeIndexPair > booksPrefixSet = new TreeSet < TimeIndexPair > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { booksPrefixSet . add ( new TimeIndexPair ( booksPrefixSum [ i ] , i ) ) ; } int [ ] candidates = new int [ n ] ; for ( int i = 0 ; i <= n - 1 ; i ++ ) { int currTime = booksPrefixSum [ i ] ; TimeIndexPair optimal = new TimeIndexPair ( currTime + t , 0 ) ; TimeIndexPair best = booksPrefixSet . floor ( optimal ) ; if ( best != null ) { candidates [ i ] = best . index - i ; } } int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < candidates . length ; i ++ ) { max = Math . max ( candidates [ i ] , max ) ; } System . out . println ( max ) ; } }   class TimeIndexPair implements Comparable < TimeIndexPair > { int time ; int index ; TimeIndexPair ( int time , int index ) { this . time = time ; this . index = index ; }   @ Override public int compareTo ( TimeIndexPair o ) { return this . time - o . time ; } }

n , t = map ( int , input ( ) . split ( ) ) best = 0 a = list ( map ( int , input ( ) . split ( ) ) ) j = 0 s = 0 for i in range ( n ) : s += a [ i ] while s > t : s -= a [ j ] j += 1 best = max ( best , i - j + 1 ) print ( best ) NEW_LINE

n , t = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0 h = { } s = 0 l = 0 for i in range ( n ) : s += a [ i ] if s <= t : c = max ( c , i - l + 1 )   else : s -= a [ l ] l += 1 print ( c ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) )   p1 = 0 p2 = 0 best = 0   while p2 < a : if p1 == p2 : if l [ p1 ] <= b : top = l [ p1 ] p2 += 1   else : p1 += 1 p2 += 1 top = 0 elif p1 < p2 :   if top + l [ p2 ] <= b : top += l [ p2 ] p2 += 1   else : best = max ( best , p2 - p1 ) top -= l [ p1 ] p1 += 1     best = max ( best , p2 - p1 ) print ( best ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) e = s = best = 0 while e < a : if s == e : if l [ s ] <= b : top = l [ s ] e += 1 else : s = e = s + 1 elif s < e : if top + l [ e ] <= b : top += l [ e ] e += 1 else : best = max ( best , e - s ) top -= l [ s ] s += 1     best = max ( best , e - s ) print ( best ) NEW_LINE

n , t = [ int ( _ ) for _ in input ( ) . split ( ) ] b = [ int ( _ ) for _ in input ( ) . split ( ) ]   bc = 0j = 0 tr = t   for i in range ( n ) : while j < n and tr >= b [ j ] : tr -= b [ j ] j += 1   bc = max ( bc , j - i ) tr += b [ i ]     print ( bc ) NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; try { long x = in . nextLong ( ) ; if ( x <= 127 ) System . out . println ( " byte " ) ; else if ( x <= 32767 ) System . out . println ( " short " ) ; else if ( x <= 2147483647 ) System . out . println ( " int " ) ; else System . out . println ( " long " ) ; } catch ( Exception e ) { System . out . println ( " BigInteger " ) ; } } }

import java . util . * ; public class Solution { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { String s = sc . next ( ) ; long num = 0 ; String sarr [ ] = { " byte " , " short " , " int " , " long " , " BigInteger " } ; long upperlimit [ ] = { 127 , ( long ) Math . pow ( 2 , 15 ) - 1 , ( long ) Math . pow ( 2 , 31 ) - 1 , ( long ) ( 2 * ( Math . pow ( 2 , 62 ) - 0.5 ) ) } ; long lowerlimit [ ] = { - 128 , ( long ) - Math . pow ( 2 , 16 ) , ( long ) - Math . pow ( 2 , 32 ) , ( long ) - Math . pow ( 2 , 64 ) } ; int limitptr = 0 ;

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; long n ; try { n = stdin . nextLong ( ) ; } catch ( Exception e ) { System . out . println ( " BigInteger " ) ; return ; } if ( n >= - 128 && n <= 127 ) System . out . println ( " byte " ) ; else if ( n >= - 32768 && n <= 32767 ) System . out . println ( " short " ) ; else if ( n >= - 2147483648 && n <= 2147483647 ) System . out . println ( " int " ) ; else System . out . println ( " long " ) ; } }

import java . util . * ; import java . math . BigInteger ; import java . io . * ; public class Main {   public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String param [ ] = br . readLine ( ) . trim ( ) . split ( " \\ s + " ) ; BigInteger m = new BigInteger ( param [ 0 ] ) ; BigInteger A = new BigInteger ( "127" ) ; BigInteger B = new BigInteger ( "32767" ) ; BigInteger C = new BigInteger ( "2147483647" ) ; BigInteger D = new BigInteger ( "9223372036854775807" ) ; if ( m . compareTo ( A ) <= 0 ) System . out . println ( " byte " ) ; else if ( m . compareTo ( B ) <= 0 ) System . out . println ( " short " ) ; else if ( m . compareTo ( C ) <= 0 ) System . out . println ( " int " ) ; else if ( m . compareTo ( D ) <= 0 ) System . out . println ( " long " ) ; else System . out . println ( " BigInteger " ) ; } }

import java . util . Scanner ; public class p66A { public static void main ( String [ ] args ) { Scanner x = new Scanner ( new Scanner ( System . in ) . next ( ) ) ; String s ; if ( x . hasNextByte ( ) ) s = " byte " ; else if ( x . hasNextShort ( ) ) s = " short " ; else if ( x . hasNextInt ( ) ) s = " int " ; else if ( x . hasNextLong ( ) ) s = " long " ; else s = " BigInteger " ; System . out . println ( s ) ; } }

n = int ( input ( ) )   if n >= - 128 and n <= 127 : NEW_LINE INDENT print ( ' byte ' ) elif n >= - 32768 and n <= 32767 : NEW_LINE print ( ' short ' ) elif n >= - 2147483648 and n <= 2147483647 : NEW_LINE print ( ' int ' ) elif n >= - 9223372036854775808 and n <= 9223372036854775807 : NEW_LINE print ( ' long ' ) else : NEW_LINE print ( ' BigInteger ' ) NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE if - ( 2 ** 7 ) <= n <= 2 ** 7 - 1 : NEW_LINE INDENT print ( " byte " ) else : NEW_LINE if NEW_LINE DEDENT - ( 2 ** 15 ) <= n <= 2 ** 15 - 1 : print ( " short " ) else : if - ( 2 ** 31 ) <= n <= 2 ** 31 - 1 : NEW_LINE INDENT print ( " int " ) else : NEW_LINE if NEW_LINE DEDENT - ( 2 ** 63 ) <= n <= 2 ** 63 - 1 : print ( " long " ) else : print ( " BigInteger " ) NEW_LINE

import sysimport NEW_LINE mathimport NEW_LINE collectionsimport NEW_LINE bisectdef NEW_LINE get_ints ( ) : NEW_LINE return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) NEW_LINE def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE for t in range ( 1 ) : n = int ( input ( ) ) NEW_LINE if n >= - 128 and n <= 127 : NEW_LINE INDENT print ( " byte " ) elif n >= - 32768 and n <= 32767 : NEW_LINE print ( " short " ) elif n >= - 2147483648 and n <= 2147483647 : NEW_LINE print ( " int " ) elif n >= - 9223372036854775808 and n <= 9223372036854775807 : NEW_LINE print ( " long " ) else : NEW_LINE print ( " BigInteger " ) NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE if n >= - 128 and n <= 127 : NEW_LINE INDENT print ( ' byte ' ) elif n >= - 32768 and n <= 32767 : NEW_LINE print ( ' short ' ) elif n >= - 2147483648 and n <= 2147483647 : NEW_LINE print ( ' int ' ) elif n >= - 9223372036854775808 and n <= 9223372036854775807 : NEW_LINE print ( ' long ' ) else : NEW_LINE print ( ' BigInteger ' ) NEW_LINE DEDENT


import java . io . * ;   public class Main { static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { String s = input . nextLine ( ) ; String [ ] str = s . split ( " : " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; while ( true ) { m ++ ; n += m / 60 ; m = m % 60 ; n = n % 24 ; if ( n / 10 == m % 10 && n % 10 == m / 10 ) { break ; } } pr . printf ( " % d % d : % d % d " , n / 10 , n % 10 , m / 10 , m % 10 ) ; pr . flush ( ) ; } static class input { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StreamTokenizer in = new StreamTokenizer ( br ) ; static String nextLine ( ) throws IOException { return br . readLine ( ) ; } static int nextInt ( ) throws IOException { in . nextToken ( ) ; return ( int ) in . nval ; } static long nextLong ( ) throws IOException { in . nextToken ( ) ; return ( long ) in . nval ; } static double nextDouble ( ) throws IOException { in . nextToken ( ) ; return in . nval ; } } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; String [ ] split = s . split ( " : " ) ; int a = Integer . valueOf ( split [ 0 ] ) ; int b = Integer . valueOf ( split [ 1 ] ) ; while ( true ) { b ++ ; a += ( b / 60 ) ; b %= 60 ; a %= 24 ; if ( b / 10 == a % 10 && b % 10 == a / 10 ) { break ; } } System . out . println ( a / 10 + " " + a % 10 + " : " + b / 10 + b % 10 ) ; } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int h = Integer . valueOf ( s . substring ( 0 , 2 ) ) ; int m = Integer . valueOf ( s . substring ( 3 , 5 ) ) ; int rev = 0 ; int temp = h ; if ( h >= 16 && h <= 19 ) { h = 20 ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } else if ( h >= 6 && h <= 9 ) { h = 10 ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } else { for ( int i = 0 ; i < 2 ; i ++ , temp = temp / 10 ) rev = rev * 10 + temp % 10 ; if ( m < rev ) { h = ( h >= 16 && h <= 19 ) ? 20 : h ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } else { h = ( h + 1 != 24 ) ? h + 1 : 0 ; h = ( h >= 16 && h <= 19 ) ? 20 : h ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } } } }

import java . util . * ; public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( scanner . hasNext ( ) ) { String [ ] s = scanner . next ( ) . split ( " : " ) ; int h = Integer . parseInt ( s [ 0 ] ) ; int m = Integer . parseInt ( s [ 1 ] ) ; while ( true ) { m ++ ; h += m / 60 ; m %= 60 ; h %= 24 ; if ( h / 10 == m % 10 && h % 10 == m / 10 ) break ; } System . out . print ( h / 10 ) ; System . out . print ( h % 10 ) ; System . out . print ( " : " ) ; System . out . print ( m / 10 ) ; System . out . println ( m % 10 ) ; } } }


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

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Second {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; int t ; t = in . nextInt ( ) ;

import java . util . * ; import java . io . * ; import java . math . * ;   public class Practice   { static FastReader sc = new FastReader ( ) ; static int dx [ ] = { - 1 , 0 , 1 , 0 } ; static int dy [ ] = { 0 , 1 , 0 , - 1 } ; static int k ; public static void main ( String [ ] args ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main {   static String original ; static int n ; static String smallest ; public static int Smaller ( String s ) { int value = smallest . compareTo ( s ) ; return value ; } public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int tc = input . nextInt ( ) ; while ( tc -- > 0 ) { n = input . nextInt ( ) ; original = input . next ( ) ; smallest = original ; int ans = 1 ; int min = original . compareTo ( smallest ) ; int score = 2 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ( n % 2 == 0 && score % 2 == 0 ) || ( n % 2 != 0 && score % 2 != 0 ) ) {

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = input ( ) k = 1 z = ' ' a = [ s ] b = [ ] while k < n : z = s [ k : n ] if n % 2 == k % 2 : z += s [ 0 : k ] else : z += s [ 0 : k ] [ : : - 1 ] a . append ( z ) b . append ( k ) k += 1 print ( min ( a ) ) try : print ( b [ a . index ( min ( a ) ) ] ) except IndexError : print ( n ) NEW_LINE

def solve ( s , n , k ) : s = [ w for w in s ] i = k - 1 if ( n - k + 1 ) % 2 == 0 : ans = s [ i : ] + s [ 0 : i ] else : p = s [ : i ] p . reverse ( ) ans = s [ i : ] + p return ' ' . join ( ans ) for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = input ( ) NEW_LINE

import sysinput = sys . stdin . readlinet = int ( input ( ) ) for you in range ( t ) : n = int ( input ( ) ) s = input ( ) s = s [ : - 1 ] ans = 0 mina = s for i in range ( n ) : pref = s [ : i ] suff = s [ i : ] swaps = ( n - i ) if ( swaps % 2 ) : z = suff + pref [ : : - 1 ] else : z = suff + pref if ( z < mina ) : mina = z ans = i print ( mina ) print ( ans + 1 ) NEW_LINE

import mathfrom math import gcd , floor , sqrt , logdef iin ( ) : return int ( input ( ) ) def sin ( ) : return input ( ) . strip ( ) def listin ( ) : return list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) def liststr ( ) : return list ( map ( str , input ( ) . strip ( ) . split ( ) ) ) def ceill ( x ) : return int ( x ) if ( x == int ( x ) ) else int ( x ) + 1 def ceilldiv ( x , d ) : x // d if ( x % d == 0 ) else x // d + 1 def LCM ( a , b ) : return ( a * b ) // gcd ( a , b )     def solve ( ) : n = iin ( ) a = sin ( ) z = [ ] for k in range ( n - 1 ) : if n % 2 == k % 2 : z . append ( [ a [ k : ] + a [ : k ] , k + 1 ] ) continue z . append ( [ a [ k : ] + a [ : k ] [ : : - 1 ] , k + 1 ] ) z . append ( [ a [ : : - 1 ] , n ] ) NEW_LINE


import java . io . * ; import java . util . * ;   import static java . lang . Math . max ; import static java . lang . Math . min ; import static java . lang . StrictMath . abs ;    public class Solution implements Runnable { public static void main ( String [ ] args ) throws IOException , InterruptedException {

n = int ( input ( ) ) for t in range ( n ) : if t : input ( ) board = [ [ c for c in input ( ) ] for i in range ( 8 ) ] k1 , k2 = ( ( i , j ) for i in range ( 8 ) for j in range ( 8 ) if board [ i ] [ j ] == ' K ' ) if ( k1 [ 0 ] - k2 [ 0 ] ) % 4 == 0 and ( k1 [ 1 ] - k2 [ 1 ] ) % 4 == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : s = [ input ( ) for i in range ( 8 ) ] oh = True flag = True for i in range ( 8 ) : for j in range ( 8 ) : if ( s [ i ] [ j ] == ' K ' ) : if ( flag ) : pos1x = i pos1y = j flag = False else : pos2x = i pos2y = j if ( pos1x % 4 == pos2x % 4 ) and ( pos1y % 4 == pos2y % 4 ) : print ( ' YES ' ) else : print ( ' NO ' ) if ( _ < t - 1 ) : k = input ( ) NEW_LINE

t = int ( input ( ) ) while t : t += - 1 l = [ ] mp = [ ] for i in range ( 8 ) : tmp = list ( input ( ) ) l . append ( tmp ) mp . append ( [ 0 ] * 8 ) i1 , j1 , i2 , j2 = - 1 , - 1 , - 1 , - 1 for i in range ( 8 ) : for j in range ( 8 ) : if l [ i ] [ j ] == ' K ' and i1 == - 1 : i1 , j1 = i , j if l [ i ] [ j ] == ' K ' : i2 , j2 = i , j if abs ( i2 - i1 ) % 4 == 0 and abs ( j2 - j1 ) % 4 == 0 : print ( ' YES ' ) else : print ( ' NO ' ) if t != 0 : input ( ) NEW_LINE


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

import java . util . * ;    public class practice { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int index = 0 ; index < n ; index ++ ) { a [ index ] = scan . nextInt ( ) ; } long b [ ] = new long [ n ] , cnt = 0 ; for ( int index = 0 ; index < n ; index ++ ) { if ( a [ index ] == 0 ) cnt ++ ; b [ index ] = cnt ; } long sum = 0 ; for ( int index = n - 1 ; index >= 0 ; index -- ) { if ( a [ index ] != 0 ) sum += b [ n - 1 ] - b [ index ] ; } System . out . println ( sum ) ; return ; } }

import java . lang . * ; import java . text . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { arr [ i ] = scanner . nextInt ( ) ; } int cnt = 0 ; int [ ] tool = new int [ n ] ; for ( int i = n - 1 ; i >= 0 ; -- i ) { if ( arr [ i ] == 0 ) cnt ++ ; tool [ i ] = cnt ; } long lost = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( arr [ i ] == 1 ) lost += tool [ i ] ; } System . out . println ( lost ) ; scanner . close ( ) ; }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) x = l . count ( 0 ) y = l . count ( 1 ) if x >= y : a = [ ] k = 0 for i in range ( n - 1 , - 1 , - 1 ) : if l [ i ] == 1 : a . append ( k ) else : k += 1 else : a = [ ] k = 0 for i in range ( n ) : if l [ i ] == 0 : a . append ( k ) else : k += 1 print ( sum ( a ) ) NEW_LINE

n = int ( input ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) )   dp_0 = [ 0 for i in range ( n ) ] dp_1 = [ 0 for i in range ( n ) ]     count_1 = 0 for i in range ( n ) : dp_1 [ i ] = count_1 count_1 += lst [ i ]           count_0 = 0 for i in range ( n - 1 , - 1 , - 1 ) : dp_0 [ i ] = count_0 if ( lst [ i ] == 0 ) : count_0 += 1   num_0 = 0 num_1 = 0   total_0 = 0 total_1 = 0     for i in range ( n ) : if ( lst [ i ] == 1 ) : total_1 = total_1 + dp_0 [ i ] + dp_1 [ i ] total_1 = total_1 - ( n - i - 1 - dp_0 [ i ] ) else : total_0 = total_0 + dp_0 [ i ] + dp_1 [ i ] total_0 = total_0 - ( i - dp_1 [ i ] ) NEW_LINE

n = int ( input ( ) ) a = input ( ) a = [ int ( x ) for x in a . split ( ) ] sum = 0 ans = 0 for i in range ( n ) : if a [ i ] == 1 : sum += 1 else : ans += sumprint ( ans ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) dif = [ 0 ] * nl = 0 for i in range ( n - 1 , - 1 , - 1 ) : if arr [ i ] == 0 : l += 1 dif [ i ] = lnuksan = 0 for i in range ( n - 1 ) : if arr [ i ] == 1 : nuksan += dif [ i + 1 ] print ( nuksan ) NEW_LINE


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

import java . io . * ; import java . util . * ;    public class B_478 { public static void main ( String args [ ] ) {   InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ;   long n = in . nextLong ( ) ; long m = in . nextLong ( ) ; long max = ( ( n - m + 1 ) * ( n - m ) ) / 2 ; int i = 0 ; if ( m == 1 ) { System . out . println ( max + " ▁ " + max ) ; } else if ( n == m ) { System . out . println ( 0 + " ▁ " + 0 ) ; } else { long p = n / m ; long q = n % m ; long min = ( q * ( ( p + 1 ) * p ) / 2 ) + ( ( m - q ) * ( p * ( p - 1 ) ) / 2 ) ;

import java . util . * ; import java . math . * ; public class RandomTeams { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; long max = n - ( m - 1 ) ; max = max * ( max - 1 ) / 2 ; long x = n / m , y = n % m ; long min = 0 ; min += ( m - y ) * x * ( x - 1 ) / 2 ; x ++ ; min += y * x * ( x - 1 ) / 2 ; System . out . println ( min + " ▁ " + max ) ; } }

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

n , m = map ( int , input ( ) . split ( ) ) f = n // mq = n % m   mini = ( f * ( f - 1 ) ) // ( 1 + 1 ) mini *= mmini += f * q ma = n - mma = ( ma * ( ma + 1 ) ) // ( 1 + 1 ) print ( mini , ma ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) kmin = n // mkmax = n - m   pairMin = m * kmin * ( kmin - 1 ) // 2 + kmin * ( n % m ) pairMax = ( kmax + 1 ) * kmax // 2   print ( pairMin , pairMax ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) kmin = n // mkmax = n - mpairMin = m * kmin * ( kmin - 1 ) // 2 + kmin * ( n % m ) pairMax = ( kmax + 1 ) * kmax // 2 print ( pairMin , pairMax ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) f = n // mt = n % m   mini = ( f * ( f - 1 ) ) // ( 1 + 1 ) mini *= mmini += f * t ma = n - mma = ( ma * ( ma + 1 ) ) // ( 1 + 1 ) print ( mini , ma ) NEW_LINE


import java . util . * ; public class question {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ;   int j = 0 , a = 0 ; while ( j < s . length ( ) ) { System . out . print ( s . charAt ( j ) ) ; a ++ ; j += a ; } } }

import java . util . * ; import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class Trin { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int c = 1 ; int i = 0 ; String result = " " ; while ( i < s . length ( ) ) { result = result + s . charAt ( i ) ; i = i + c ; c ++ ;   } System . out . println ( result ) ; pw . flush ( ) ; pw . close ( ) ; }   public static int findMaxSumSubarray ( int [ ] arr , int k ) { int maxValue = Integer . MIN_VALUE ; int currentRunningSum = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { currentRunningSum += arr [ i ] ; if ( i >= k - 1 ) { maxValue = Math . max ( maxValue , currentRunningSum ) ; currentRunningSum -= arr [ i - ( k - 1 ) ] ;

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

n = int ( input ( ) ) m = input ( ) s = [ ] s [ : 0 ] = mc = 0 a = [ ] if n == 1 : print ( m ) else : for i in range ( 1 , n , 1 ) : if ( c < len ( s ) ) : a . append ( s [ c ] ) else : break c += i print ( ' ' . join ( map ( str , a ) ) )   NEW_LINE

size = int ( input ( ) ) string = input ( ) t = 0 for i in range ( len ( string ) ) : try : print ( string [ i + t ] , end = ' ' ) except IndexError : break t += i + 1 NEW_LINE

n = int ( input ( ) ) s = input ( )   res = ' ' counter = 0 k = 1 while counter <= n : res += s [ counter ] k += 1 counter += kprint ( res ) NEW_LINE

n = int ( input ( ) ) s = input ( ) . strip ( ) c = 1 i = 0   an = [ ] while ( i < n ) : an . append ( s [ i ] ) i += c c += 1 print ( ' ' . join ( an ) ) NEW_LINE

n = int ( input ( ) ) t = input ( ) s = ' ' i = j = 0 while i < n : s += t [ i ] ; j += 1 ; i += jprint ( s ) NEW_LINE


import java . io . * ; import java . util . * ; import java . math . * ; public class Main {    public int cost ( char c ) {   if ( c == ' w ' ) { return 1 + b ; } else { return 1 ; }   }   int n , a , b , t ;   public void solve ( ) throws IOException {   n = in . nextInt ( ) ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; t = in . nextInt ( ) ; char [ ] str = in . next ( ) . toCharArray ( ) ;   int cum = cost ( str [ 0 ] ) ; if ( cum > t ) { out . println ( 0 ) ; return ; } int res = 1 ; int l = n - 1 ; int r = 0 ;

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

read = lambda : map ( int , input ( ) . split ( ) ) per = lambda L , R : R - L - 1 + min ( R - n - 1 , n - L ) n , a , b , T = read ( ) f = [ 1 + ( i == ' w ' ) * b for i in input ( ) ] * 2 L , R = 0 , nans = 0 cur = sum ( f ) // 2 while L <= n and R < n * 2 : cur += f [ R ] ; R += 1 while R - L > n or cur + per ( L , R ) * a > T : cur -= f [ L ] ; L += 1 ans = max ( ans , R - L ) print ( ans ) NEW_LINE

def main ( ) : n , a , b , t = map ( int , input ( ) . split ( ) ) b += 1 l = [ b if char == " w " else 1 for char in input ( ) ] t -= sum ( l ) - a * ( n + 2 ) hi , n2 = n , n * 2 n3 = n2 + 1 lo = res = 0 l *= 2 while lo <= n and hi < n2 : t -= l [ hi ] hi += 1 while ( hi - lo + ( hi if hi < n3 else n3 ) ) * a > t or lo < hi - n : t += l [ lo ] lo += 1 n3 -= 1 if res < hi - lo : res = hi - lo if res == n : break print ( res )     if __name__ == ' _ _ main _ _ ' : main ( )         NEW_LINE


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

INDENT def main ( ) : n = int ( input ( ) ) if ( n < 3 ) : print ( - 1 ) else : n -= 1 p = n b = 10 res = 1 while p : if p & 0x1 : res *= b b *= b p >>= 1 for i in range ( 0 , 1000 ) : if ( res + i ) % 210 == 0 : print ( 10 ** n + i ) exit ( ) main ( ) NEW_LINE DEDENT

import mathn = int ( input ( ) ) if n <= 2 : print ( - 1 ) else : print ( 210 * ( ( 10 ** ( n - 1 ) + 209 ) // 210 ) ) NEW_LINE

def mypow ( a , b ) : base = a res = 1 while b : if b & 1 : res *= base base *= base b >>= 1 return resdef sol ( n ) : sum = mypow ( 10 , n - 1 ) for i in range ( sum , sum + 210 + 1 , 1 ) : if i % 210 == 0 : return in = int ( input ( ) ) if n < 3 : print ( - 1 ) else : print ( sol ( n ) ) NEW_LINE

def main ( ) : n = int ( input ( ) ) if ( n < 3 ) : print ( - 1 ) else : n -= 1 p = n b = 10 res = 1 while p : if p & 0x1 : res *= b b *= b p >>= 1 for i in range ( 0 , 211 ) :                           if ( res + i ) % 210 == 0 :   print ( 10 ** n + i ) exit ( )     main ( ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class BooBs { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str1 = sc . nextLine ( ) ; String str2 = sc . nextLine ( ) ; char [ ] arr1 = str1 . toCharArray ( ) ; char [ ] arr2 = str2 . toCharArray ( ) ; int [ ] map1 = new int [ 26 ] ; Arrays . fill ( map1 , 0 ) ; int [ ] map2 = new int [ 26 ] ; Arrays . fill ( map2 , 0 ) ; int count = 0 ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { map1 [ arr1 [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < str2 . length ( ) ; i ++ ) { map2 [ arr2 [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( map2 [ i ] > 0 ) { if ( map1 [ i ] == 0 ) { count = - 1 ; break ; } else if ( map1 [ i ] >= map2 [ i ] ) { count += map2 [ i ] ; } else { count += map1 [ i ] ; } } } if ( count == 0 ) { count = - 1 ; } System . out . println ( count ) ; } }

import java . util . * ; public class Garland { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String ava = sc . next ( ) ; String gar = sc . next ( ) ; HashMap < Character , Integer > mapava = new HashMap < > ( ) ; HashMap < Character , Integer > mapgar = new HashMap < > ( ) ; for ( int i = 0 ; i < ava . length ( ) ; i ++ ) { if ( ! mapava . containsKey ( ava . charAt ( i ) ) ) mapava . put ( ava . charAt ( i ) , 1 ) ; else mapava . put ( ava . charAt ( i ) , mapava . get ( ava . charAt ( i ) ) + 1 ) ; } for ( int i = 0 ; i < gar . length ( ) ; i ++ ) { if ( ! mapgar . containsKey ( gar . charAt ( i ) ) ) mapgar . put ( gar . charAt ( i ) , 1 ) ; else mapgar . put ( gar . charAt ( i ) , mapgar . get ( gar . charAt ( i ) ) + 1 ) ; } int ans = 0 ; for ( Map . Entry < Character , Integer > mape : mapgar . entrySet ( ) ) { if ( mapava . containsKey ( mape . getKey ( ) ) ) ans += Math . min ( mape . getValue ( ) , mapava . get ( mape . getKey ( ) ) ) ; else { ans = 0 ; break ; } } if ( ans == 0 ) System . out . println ( - 1 ) ; else System . out . println ( ans ) ; } }

import sysfrom collections import Counterdef fmax ( n , m ) : cn = Counter ( n ) cm = Counter ( m ) for i in cm : if cn [ i ] == 0 : return - 1 ta = 0 if len ( n ) <= len ( m ) : for i in cm : ta = ta + min ( cn [ i ] , cm [ i ] ) if len ( n ) > len ( m ) : for i in cm : ta = ta + min ( cn [ i ] , cm [ i ] )   return ta if __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( str , input . split ( ) ) ) n = data [ 0 ] m = data [ 1 ] print ( fmax ( n , m ) ) NEW_LINE

from collections import Countera = list ( input ( ) ) b = list ( input ( ) ) d1 = Counter ( a ) c = 0 d2 = Counter ( b ) for i in d2 : if i in d1 : if d1 [ i ] < d2 [ i ] : c += d1 [ i ] else : c += d2 [ i ] else : c = 0 breakif c == 0 : print ( - 1 ) else : print ( c ) NEW_LINE

import sysimport mathdef fn ( n , m ) : cnt = [ 0 ] * 123 cnt1 = [ 0 ] * 123 n = list ( n ) m = list ( m ) m1 = list ( set ( m ) ) for i in range ( len ( n ) ) : cnt [ ord ( n [ i ] ) ] = cnt [ ord ( n [ i ] ) ] + 1 for i in range ( len ( m ) ) : cnt1 [ ord ( m [ i ] ) ] = cnt1 [ ord ( m [ i ] ) ] + 1 for i in range ( len ( m ) ) : if cnt [ ord ( m [ i ] ) ] == 0 : return - 1 a = 0 for i in range ( len ( m1 ) ) : if cnt1 [ ord ( m1 [ i ] ) ] <= cnt [ ord ( m1 [ i ] ) ] : a = a + cnt1 [ ord ( m1 [ i ] ) ] elif cnt1 [ ord ( m1 [ i ] ) ] > cnt [ ord ( m1 [ i ] ) ] : a = a + cnt [ ord ( m1 [ i ] ) ] return aif __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( str , input . split ( ) ) ) n = data [ 0 ] m = data [ 1 ] print ( fn ( n , m ) ) NEW_LINE


import java . io . * ; import java . util . * ; import java . text . DecimalFormat ;   public class Main { static long mod = ( long ) 1e9 + 7 ; static long mod1 = 998244353 ; public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ;    int t = in . nextInt ( ) ; while ( t -- > 0 ) {   int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ;   char [ ] [ ] arr = new char [ n ] [ m ] ; int horizontal_pair = 0 ; int single_dots = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String st = in . next ( ) ; String temp = st ; horizontal_pair += ( m - temp . replace ( " . . " , " " ) . length ( ) ) / 2 ; for ( int j = 0 ; j < m ; j ++ ) { arr [ i ] [ j ] = st . charAt ( j ) ; if ( arr [ i ] [ j ] == ' . ' ) single_dots ++ ; } } int val1 = single_dots * x ; int val2 = horizontal_pair * y + ( single_dots - horizontal_pair * 2 ) * x ; out . println ( Math . min ( val1 , val2 ) ) ; } out . close ( ) ; }    static final Random random = new Random ( ) ;   static void ruffleSort ( int [ ] a ) { int n = a . length ;

import java . util . Scanner ;   public class Solution { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int t = sc . nextInt ( ) ; int [ ] answers = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { int n , m , x , y , totalCost = 0 ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; sc . nextLine ( ) ; for ( int j = 0 ; j < n ; j ++ ) { String input = sc . nextLine ( ) ; for ( int k = 0 , whites = 0 ; k <= m ; k ++ ) if ( k == m || input . charAt ( k ) == ' * ' ) { if ( ( y / 2.0f ) < x ) totalCost += ( ( whites / 2 ) * y + ( whites % 2 ) * x ) ; else totalCost += ( whites * x ) ; whites = 0 ; } else whites ++ ; } answers [ i ] = totalCost ; } for ( int answer : answers ) System . out . println ( answer ) ; } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) , m = sc . nextInt ( ) , x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int best = Math . min ( 2 * x , y ) , ans = 0 ; char [ ] [ ] ar = new char [ n ] [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) ar [ i ] [ j ] = s . charAt ( j ) ; }   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( ar [ i ] [ j ] == ' . ' ) { if ( j == m - 1 ) { ans += x ; ar [ i ] [ j ] = ' * ' ; } else { if ( ar [ i ] [ j + 1 ] == ' . ' ) { ans += best ; ar [ i ] [ j ] = ' * ' ; ar [ i ] [ j + 1 ] = ' * ' ; } else { ans += x ; ar [ i ] [ j ] = ' * ' ; } } } } } System . out . println ( ans ) ; } } }

import java . util . * ; import java . io . * ; import java . math . * ;   public class First { public static void process ( ) throws IOException { int n = ni ( ) ; int m = ni ( ) ; int x = ni ( ) ; int y = ni ( ) ; char a [ ] [ ] = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { String s [ ] = nln ( ) . trim ( ) . split ( " " ) ; for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = s [ j ] . charAt ( 0 ) ; } }   long cost = 0l ; for ( int i = 0 ; i < n ; i ++ ) { int j = 0 ; while ( j < m ) { if ( a [ i ] [ j ] == ' . ' ) { if ( ( 2 * x ) > y ) { if ( j + 1 < m ) { if ( a [ i ] [ j + 1 ] == ' . ' ) { cost += y ; j += 2 ; } else { cost += x ; j ++ ; } } else { cost += x ; j ++ ;   } } else { cost += x ; j ++ ; } } else { j ++ ; } } } pn ( cost ) ;     }    static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;

testcases = int ( input ( ) )   for testcase in range ( testcases ) : v , h , p1 , p2 = [ int ( i ) for i in input ( ) . split ( ) ] r = 0 for v in range ( v ) : tiles = input ( ) double_dot = tiles . count ( ' . . ' ) single_dot = tiles . count ( ' . ' ) r += min ( single_dot * p1 , double_dot * p2 + ( single_dot - double_dot * 2 ) * p1 ) print ( r ) NEW_LINE

if __name__ == " _ _ main _ _ " : t = int ( input ( ) ) for case in range ( t ) : n , m , x , y = map ( int , input ( ) . split ( ) )   grid = [ ]   for _ in range ( n ) : grid . append ( list ( input ( ) ) ) candidate , single_tile = 0 , 0   for i in range ( n ) : j = 0 while j < m : if grid [ i ] [ j ] == ' . ' and j + 1 < m and grid [ i ] [ j + 1 ] == ' . ' : candidate += 2 j += 2 elif grid [ i ] [ j ] == ' . ' : single_tile += 1 j += 1 else : j += 1 if candidate & 1 == 1 : candidate -= 1 single_tile += 1 NEW_LINE

for t in range ( int ( input ( ) ) ) : n , m , x , y = map ( int , input ( ) . split ( ) ) if y > 2 * x : y = 2 * x ans = 0 for i in range ( n ) : s = input ( ) . split ( ' * ' ) for item in s : r = len ( item ) ans += y * ( r // 2 ) + x * ( r % 2 ) print ( ans ) NEW_LINE

T = int ( input ( ) ) while T > 0 : T -= 1 cost , count = 0 , 0 n , m , x , y = map ( int , input ( ) . strip ( ) . split ( ) ) arr = [ ] for i in range ( n ) : arr . append ( [ ] ) arr [ i ] = [ x for x in input ( ) ] i , j = 0 , 0 while i < n : j = 0 while j < m : if arr [ i ] [ j ] == ' . ' : count += 1 if arr [ i ] [ j ] == ' * ' : j += 1 continue if j < ( m - 1 ) : if arr [ i ] [ j + 1 ] == ' . ' : count += 1 cost += y j += 2 continue cost += x j += 1 i += 1 print ( min ( cost , count * x ) )         NEW_LINE

def solver ( ) : pass   T = int ( input ( ) ) for _ in range ( T ) : n , m , x , y = [ int ( x ) for x in input ( ) . split ( ) ] stones = [ ] for _ in range ( n ) : stones . append ( input ( ) ) ans = 0 if 2 * x <= y : ans = 0 for s in stones : n = list ( s ) . count ( " . " ) ans += ( n * x ) print ( ans ) else : ans = 0 for s in stones : arr = s . split ( " * " ) for v in arr : if len ( v ) == 0 : continue else : n = len ( v ) ans += ( n // 2 ) * y ans += ( n % 2 ) * x print ( ans ) NEW_LINE