import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ;   public class First {   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 ( ) ;

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;    public class Main { public static int [ ] [ ] ans = new int [ 10 ] [ 1000005 ] ; public static int check ( int x , int y ) { while ( true ) { if ( y < 10 ) { if ( y == x ) return 1 ; else return 0 ; } else { int temp = 1 ; while ( y > 0 ) { int rem = y % 10 ; y /= 10 ; if ( rem > 0 ) temp *= rem ; } y = temp ; } } }   public static void init ( ) { for ( int i = 1 ; i < 10 ; i ++ ) for ( int j = 1 ; j < 1000002 ; j ++ ) ans [ i ] [ j ] = ans [ i ] [ j - 1 ] + check ( i , j ) ; }   public static void main ( String args [ ] ) throws IOException { init ( ) ; BufferedReader BR = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer ST ; PrintWriter out = new PrintWriter ( System . out ) ; int q , l , r , k ; q = Integer . parseInt ( BR . readLine ( ) ) ; while ( q -- > 0 ) { ST = new StringTokenizer ( BR . readLine ( ) ) ; l = Integer . parseInt ( ST . nextToken ( ) ) ; r = Integer . parseInt ( ST . nextToken ( ) ) ; k = Integer . parseInt ( ST . nextToken ( ) ) ; out . println ( ans [ k ] [ r ] - ans [ k ] [ l - 1 ] ) ; } out . close ( ) ; } }

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

import java . util . * ; import java . io . * ; import java . math . * ; public class A { static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) {

from sys import stdindef g ( t ) : t = str ( t ) s = 1 for i in range ( len ( t ) ) : if t [ i ] != "0" : s *= int ( t [ i ] ) return sdef main ( ) : memo = [ - 1 ] * ( 10 ** 6 + 1 ) for i in range ( 10 ) : memo [ i ] = i for i in range ( 10 , 10 ** 6 + 1 ) : x = i while x > 9 : if memo [ x ] > 0 : x = memo [ x ] x = g ( x ) memo [ i ] = x cnt = [ [ 0 ] * 10 for i in range ( 10 ** 6 + 1 ) ] for i in range ( 1 , 10 ** 6 + 1 ) : cnt [ i ] [ memo [ i ] ] += 1 for j in range ( 10 ) : cnt [ i ] [ j ] += cnt [ i - 1 ] [ j ] Q = int ( input ( ) ) for _ in range ( Q ) : l , r , k = map ( int , stdin . readline ( ) . split ( ) ) print ( cnt [ r ] [ k ] - cnt [ l - 1 ] [ k ] ) main ( ) NEW_LINE

z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from string import * from re import * from collections import * from queue import * from sys import * from collections import * from math import * from heapq import * from itertools import * from bisect import * from collections import Counter as ccfrom math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph )   NEW_LINE

fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from re import * from sys import * from math import * from heapq import * from queue import * from bisect import * from string import * from itertools import * from collections import * from math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom collections import Counter as ccfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph ) def output ( answer ) : stdout . write ( str ( answer ) ) NEW_LINE

from sys import stdin , stdoutans = ' ' ; z1 = [ [ ] ] def gh ( x ) : if x < 10 : return x p = 1 while x : if x % 10 : p *= ( x % 10 ) x //= 10 return gh ( p ) for i in range ( 9 ) : z1 += [ [ 0 ] * ( 1000001 ) ] for i in range ( 1 , 1000001 ) : z1 [ gh ( i ) ] [ i ] += 1 for i in range ( 1 , 10 ) : for j in range ( 1 , 1000001 ) : z1 [ i ] [ j ] += z1 [ i ] [ j - 1 ] for _ in " ▁ " * int ( stdin . readline ( ) ) : a , b , c = map ( int , stdin . readline ( ) . split ( ) ) ; print ( z1 [ c ] [ b ] - z1 [ c ] [ a - 1 ] ) NEW_LINE


import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m ; n = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a , new Comparator < Integer > ( ) { @ Override public int compare ( Integer o1 , Integer o2 ) { return o1 - o2 ; } } ) ; int cnt = 0 ; for ( int i = 1 ; i < n ; i ++ ) {

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

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

import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class temp4 { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } static class Print { private final BufferedWriter bw ; public Print ( ) { bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; } public void print ( String str ) throws IOException { bw . append ( str ) ; } public void println ( String str ) throws IOException { print ( str ) ; bw . append ( " \n " ) ; } public void close ( ) throws IOException { bw . close ( ) ; } } public static void main ( String [ ] args ) throws IOException { FastReader scn = new FastReader ( ) ;

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

n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) a = min ( x ) b = max ( x )   print ( b - a + 1 - n ) NEW_LINE

a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) print ( max ( b ) - min ( b ) + 1 - a ) NEW_LINE

n = int ( input ( ) ) arr = [ int ( num ) for num in input ( ) . split ( ) ]   arr = sorted ( arr )   x = arr [ 0 ]   ans = 0   for num in arr : ans += num - x x = num + 1 print ( ans ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; int maxint = Integer . MAX_VALUE ; int minint = Integer . MIN_VALUE ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) , m = ni ( ) ; int [ ] a = new int [ n ] , b = new int [ n ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = ni ( ) ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = ni ( ) ; map . put ( b [ i ] , map . getOrDefault ( b [ i ] , 0 ) + 1 ) ; } sort ( a ) ; sort ( b ) ; int ans = maxint ; for ( int i = 0 ; i < n ; i ++ ) { int x = ( ( b [ i ] - a [ 0 ] ) % m + m ) % m ; HashMap < Integer , Integer > has = new HashMap < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { int q = ( a [ j ] + x ) % m ; has . put ( q , has . getOrDefault ( q , 0 ) + 1 ) ; } boolean f = true ; for ( Map . Entry < Integer , Integer > m1 : map . entrySet ( ) ) { int k = m1 . getKey ( ) , v = m1 . getValue ( ) ; if ( has . get ( k ) == null || has . get ( k ) != v ) { f = ! f ; break ; } } if ( f ) { ans = min ( ans , x ) ; } } pl ( ans ) ; } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;

def solve ( a , b , m ) : n = len ( a ) a . sort ( ) b . sort ( ) best = None for d in range ( n ) : x = ( b [ 0 ] - a [ d ] ) % m if ( best is None or best > x ) and all ( ( a [ ( d + i ) % n ] + x ) % m == b [ i ] for i in range ( n ) ) : best = x return best     n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , b , m ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) b . sort ( ) a . sort ( ) ans = 100000000000000 for i in range ( n ) : if a [ i ] <= b [ 0 ] : x = b [ 0 ] - a [ i ] else : x = ( m - a [ i ] + b [ 0 ] ) if x < ans : f = True for j in range ( n ) : if ( a [ ( i + j + 1 ) % n ] + x ) % m != b [ ( j + 1 ) % n ] : f = False break if f == True : ans = xprint ( ans ) NEW_LINE

import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def main ( ) : NEW_LINE


import java . io . * ; import java . util . * ; import java . math . * ;     public class Main { public static final Long mod = Long . valueOf ( 998244353 ) ; public static final int N = 200020 ; public static Long [ ] ch = new Long [ N ] ; public static int [ ] deg = new int [ N ] ; public static void main ( String args [ ] ) { Scanner in ; PrintStream out ; try { in = new Scanner ( new FileInputStream ( " java . in " ) ) ; out = new PrintStream ( " java . out " ) ; } catch ( FileNotFoundException e ) { in = new Scanner ( new BufferedInputStream ( System . in ) ) ; out = System . out ; } ch [ 0 ] = Long . valueOf ( 1 ) ; for ( int i = 1 ; i < N ; i ++ ) { ch [ i ] = ( ch [ i - 1 ] * i ) % mod ; } int n = in . nextInt ( ) ; Long ans = Long . valueOf ( n ) ; for ( int i = 1 , u , v ; i < n ; i ++ ) { u = in . nextInt ( ) ; v = in . nextInt ( ) ; deg [ u ] ++ ; deg [ v ] ++ ; } for ( int i = 1 ; i <= n ; i ++ ) { ans = ans * ch [ deg [ i ] ] % mod ; } out . println ( ans ) ; } }

g = [ 0 ] * 200005 r = int ( input ( ) ) n = r for i in range ( 1 , n ) : u , v = map ( int , input ( ) . split ( ) ) g [ u ] += 1 g [ v ] += 1 r *= g [ u ] * g [ v ] r %= 998244353     print ( r ) NEW_LINE

n = int ( input ( ) ) r = n ; MAX = 998244353 arr = [ 0 ] * ( n + 1 ) for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) arr [ a ] += 1 ; arr [ b ] += 1 r *= arr [ a ] * arr [ b ] r %= MAXprint ( r ) NEW_LINE


import java . util . Scanner ;    public class Dasha_Stairs_761A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ;   if ( a == 0 && b == 0 ) { System . out . println ( " NO " ) ; } else { int diff = Math . abs ( a - b ) ; if ( diff == 1 || a == b ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ;   } } }

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

import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == 0 & b == 0 || Math . abs ( a - b ) > 1 ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } }

from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBaseimport math   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip       def main ( ) : a , b = map ( int , input ( ) . split ( ) ) if a == 0 and b == 0 : print ( " NO " ) else : if abs ( a - b ) > 1 : print ( " NO " ) else : print ( " YES " )         NEW_LINE

a , b = [ int ( i ) for i in input ( ) . split ( ) ] if ( abs ( a - b ) > 1 or ( a == 0 and b == 0 ) ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE

import mathdef solve ( a , b ) : if a == 0 and b == 0 : return ' NO ' if abs ( a - b ) <= 1 : return ' YES ' return ' NO '   def main ( ) : arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) if abs ( a - b ) > 1 or ( a == b == 0 ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE

from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport stringimport sysfrom io import BytesIO , IOBase   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip     def main ( ) : a , b = map ( int , input ( ) . split ( ) ) if b == a and b == 0 : print ( ' NO ' ) return if b - 1 == a or b + 1 == a or b == a : print ( ' YES ' ) else : print ( ' NO ' )             NEW_LINE


import java . util . Scanner ;   public class Main { static int n , m ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; n = scanner . nextInt ( ) ; m = scanner . nextInt ( ) ; String s1 = scanner . next ( ) ; String s2 = scanner . next ( ) ; if ( ! s1 . contains ( " * " ) ) { if ( ! s1 . equals ( s2 ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } else {

import java . util . Scanner ;   public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String s = sc . next ( ) ; String t = sc . next ( ) ;   int i = 0 ; while ( i < n && i < m && s . charAt ( i ) == t . charAt ( i ) ) { i ++ ; }   if ( n - m > 1 ) { System . out . println ( " NO " ) ; } else if ( i == n ) { if ( i == m ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( s . charAt ( i ) == ' * ' ) { i ++ ; while ( i < n && s . charAt ( i ) == t . charAt ( i + m - n ) ) { i ++ ; } if ( i == n ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } }

import java . util . Scanner ; import java . io . BufferedInputStream ; public class Solution { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( new BufferedInputStream ( System . in ) ) ; int lengthOfN = scanner . nextInt ( ) ; int lengthOfM = scanner . nextInt ( ) ; String n = scanner . next ( ) ; String m = scanner . next ( ) ; boolean flag = true ; int index = 0 ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { if ( n . charAt ( i ) == ' * ' ) { index = i ; flag = false ; break ; } }   if ( flag ) { if ( n . equals ( m ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { String temp1 = n . substring ( 0 , index ) ; String temp2 = n . substring ( index + 1 ) ; if ( temp1 . length ( ) + temp2 . length ( ) > m . length ( ) ) { System . out . println ( " NO " ) ; return ; } String temp3 = m . substring ( 0 , temp1 . length ( ) ) ; String temp4 = m . substring ( m . length ( ) - temp2 . length ( ) ) ; if ( temp3 . equals ( temp1 ) && temp4 . equals ( temp2 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

import java . io . * ;   import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int n = fr . nextInt ( ) ; int m = fr . nextInt ( ) ; String s = fr . next ( ) ; String t = fr . next ( ) ; boolean contains = false ; int idx = - 1 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' * ' ) { contains = true ; idx = i ; } } if ( ! contains ) { if ( n != m || ! s . equals ( t ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } else { if ( m < ( n - 1 ) ) System . out . println ( " NO " ) ; else { if ( m == n - 1 ) { int j = 0 ; boolean pos = true ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' * ' ) continue ; if ( s . charAt ( i ) != t . charAt ( j ) ) { pos = false ; break ; } j ++ ; } if ( pos ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } else { boolean pos = true ; for ( int i = 0 ; i < idx ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) { pos = false ; break ; } } if ( pos == false ) System . out . println ( " NO " ) ; else { int j = m - 1 ; for ( int i = n - 1 ; i > idx ; i -- ) { if ( s . charAt ( i ) != t . charAt ( j ) ) { pos = false ; break ; } j -- ; } if ( pos == true ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } } } } public static boolean check ( String s ) {

n , m = map ( int , input ( ) . split ( ) ) s = str ( input ( ) ) t = str ( input ( ) ) if ' * ' in s : a , b = s . split ( ' * ' ) s1 = t . startswith ( a ) s2 = t [ len ( a ) : ] . endswith ( b ) if s1 and s2 : print ( " YES " ) else : print ( " NO " ) else : if s == t : print ( " YES " ) else : print ( " NO " ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) s = input ( ) t = input ( ) if n == 1 : if s == t or s == ' * ' : print ( ' YES ' ) else : print ( ' NO ' ) elif s . count ( ' * ' ) == 0 : if s == t : print ( ' YES ' ) else : print ( ' NO ' ) elif n > m + 1 : print ( ' NO ' ) else : l = s . split ( ' * ' ) x = t [ : len ( l [ 0 ] ) ] y = t [ - len ( l [ 1 ] ) : ] if ( l [ 0 ] == x and l [ 1 ] == y ) or ( s [ : 1 ] == ' * ' and l [ 1 ] == y ) or ( l [ 0 ] == x and s [ - 1 : ] == ' * ' ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

a , b = [ * open ( 0 ) ] [ 1 : ] if ' * ' in a : x , y = a . split ( ' * ' ) r = b . startswith ( x ) and b [ len ( x ) : ] . endswith ( y ) else : r = a == bprint ( ' NYOE ▁ S ' [ r : : 2 ] ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) s = input ( ) t = input ( ) if m >= n - 1 and s [ : s . find ( ' * ' ) ] == t [ : s . find ( ' * ' ) ] and s [ s . find ( ' * ' ) + 1 : ] == t [ len ( t ) - len ( s ) + s . find ( ' * ' ) + 1 : ] : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

from sys import stdin , stdoutimport math , bisectfrom collections import Counter , deque , defaultdictL = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) M = lambda : map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) I = lambda : int ( stdin . readline ( ) . strip ( ) ) S = lambda : stdin . readline ( ) . strip ( ) C = lambda : stdin . readline ( ) . strip ( ) . split ( ) def pr ( a ) : return ( " ▁ " . join ( list ( map ( str , a ) ) ) ) NEW_LINE


import java . io . * ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . StringTokenizer ; public class realfast implements Runnable { private static final int INF = ( int ) 1e9 ; public void solve ( ) throws IOException { int n = readInt ( ) ; int m = readInt ( ) ; if ( n > m ) { int val = n ; n = m ; m = val ; } if ( n != 2 && n % 2 == 0 ) { out . println ( ( n / 2 ) * ( m ) ) ; } else if ( n != 1 && n % 2 == 1 ) { long val = n / 2 ; long val1 = ( m ) ; val = val * val1 ; val = val + ( m + 1 ) / 2 ; out . println ( val ) ; } else { if ( n == 1 ) out . println ( m ) ; else if ( n == 2 ) { if ( m % 2 == 0 ) { if ( m % 4 == 0 ) out . println ( m ) ; else out . println ( m + 2 ) ; } else out . println ( m + 1 ) ; } }   }

import java . io . * ; import java . util . * ;   public class MainClass { public static void main ( String [ ] args ) throws IOException { Reader in = new Reader ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int ans = 0 ; int min = Math . min ( m , n ) ; int max = Math . max ( m , n ) ; if ( min == 1 ) ans = max ; else if ( min == 2 ) ans = ( max / 4 ) * 4 + Math . min ( max % 4 , 2 ) * 2 ; else ans = ( m * n ) - ( m * n ) / 2 ; System . out . println ( ans ) ; } } class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ;   public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;

s = input ( ) . split ( ) n = int ( s [ 0 ] ) m = int ( s [ 1 ] ) if ( n > m ) : a = n n = m m = aif ( n == 1 ) : print ( m ) elif ( n == 2 ) : if ( m % 4 <= 2 ) : print ( m + m % 4 ) else : print ( m + 1 ) else : print ( ( n * m + 1 ) // 2 ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   if n > m :   n , m = m , n   if n > 2 and m > 2 :   print ( ( ( n * m ) + 1 ) // 2 )   elif n == 1 :   print ( m )   else :   print ( 2 * ( ( ( m // 4 ) * 2 ) + min ( m % 4 , 2 ) ) )           NEW_LINE

def voevoda ( n , m ) : if n == 1 : return m if n == 2 : return ( m - m % 4 ) + 2 * min ( m % 4 , 2 ) return ( n * m + 1 ) // 2     N , M = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) print ( voevoda ( N , M ) ) NEW_LINE

def li ( ) : return list ( map ( int , input ( ) . split ( " ▁ " ) ) ) n , m = li ( ) if n < m : t = n n = m m = tif m == 1 : print ( n ) elif m == 2 : print ( 2 * ( 2 * ( n // 4 ) + min ( n % 4 , 2 ) ) ) else : print ( ( n * m ) - ( n * m ) // 2 ) NEW_LINE


# include < iostream > # include < string > # include < algorithm > # include < cmath > # include < queue > # define iof ios :: sync_with_stdio ( false ) using namespace std ; const int maxn = 105 ; int X [ maxn ] [ maxn ] ; int n , m , k ; struct op { int a , b , c , d ; } q [ maxn * maxn ] ; void cl ( int x ) { int te = X [ x ] [ m ] ; for ( int i = m ; i >= 2 ; i -- ) X [ x ] [ i ] = X [ x ] [ i - 1 ] ; X [ x ] [ 1 ] = te ; } void cr ( int x ) { int te = X [ n ] [ x ] ; for ( int i = n ; i >= 2 ; i -- ) X [ i ] [ x ] = X [ i - 1 ] [ x ] ; X [ 1 ] [ x ] = te ; } void ad ( int x , int y , int z ) { X [ x ] [ y ] = z ; } int main ( ) { cin >> n >> m >> k ; for ( int i = 1 ; i <= k ; i ++ ) { cin >> q [ i ] . a ; if ( q [ i ] . a == 1 || q [ i ] . a == 2 ) cin >> q [ i ] . b ; if ( q [ i ] . a == 3 ) cin >> q [ i ] . b >> q [ i ] . c >> q [ i ] . d ; } for ( int i = k ; i >= 1 ; i -- ) { switch ( q [ i ] . a ) { case 1 : cl ( q [ i ] . b ) ; break ; case 2 : cr ( q [ i ] . b ) ; break ; case 3 : ad ( q [ i ] . b , q [ i ] . c , q [ i ] . d ) ; } } for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= m ; j ++ ) printf ( " % d ▁ " , X [ i ] [ j ] ) ; printf ( " \n " ) ; } return 0 ; }

f = lambda : map ( int , input ( ) . split ( ) )   n , m , q = f ( )   p = [ [ 0 ] * m for j in range ( n ) ]   for t in [ list ( f ( ) ) for k in range ( q ) ] [ :: - 1 ] :   j = t [ 1 ] - 1   if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) )   elif t [ 0 ] == 2 :   s = p [ - 1 ] [ j ]   for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ]   p [ 0 ] [ j ] = s   else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ]   for d in p : print ( * d )     # Made By Mostafa_Khaled

import java . util . Scanner ;   public class LittleArtemandMatrix {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , m = scan . nextInt ( ) , q = scan . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] c = new int [ q ] [ 4 ] ; for ( int i = 0 ; i < q ; i ++ ) { int cc = scan . nextInt ( ) ; c [ i ] [ 0 ] = cc ; if ( cc < 3 ) c [ i ] [ 1 ] = scan . nextInt ( ) ; else for ( int j = 1 ; j <= 3 ; j ++ ) c [ i ] [ j ] = scan . nextInt ( ) ; } for ( int i = q - 1 ; i >= 0 ; i -- ) { if ( c [ i ] [ 0 ] < 3 ) { if ( c [ i ] [ 0 ] == 1 ) {

f = lambda : map ( int , input ( ) . split ( ) ) n , m , q = f ( ) p = [ [ 0 ] * m for j in range ( n ) ] for t in [ list ( f ( ) ) for k in range ( q ) ] [ : : - 1 ] : j = t [ 1 ] - 1 if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) ) elif t [ 0 ] == 2 : s = p [ - 1 ] [ j ] for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ] p [ 0 ] [ j ] = s else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ] for d in p : print ( * d ) NEW_LINE


import java . util . * ; import java . io . * ;   public class New_Year_And_Old_Property {   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   }   public static void main ( String [ ] args ) {

import java . util . * ; import java . io . * ;    public class Solution { public static void solve ( long a , long b ) { int i = 0 ; long count = 0 ; while ( ( 1l << i ) / 2 <= b ) { int j = 0 ; while ( ( 1l << j ) < ( 1l << i ) / 2 ) { long x = ( ( 1l << i ) - 1 ) - ( 1l << j ) ; if ( x >= a && x <= b ) count ++ ; j ++ ; } i ++ ; } System . out . println ( count ) ; } public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] in = br . readLine ( ) . trim ( ) . split ( " ▁ " ) ; solve ( Long . parseLong ( in [ 0 ] ) , Long . parseLong ( in [ 1 ] ) ) ; } }

import java . util . * ; import java . lang . * ; import java . math . * ; import java . io . * ; import java . util . HashSet ; import java . util . Arrays ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; import java . util . TreeSet ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class D1343 { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ; while ( test -- > 0 ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long p = 0 ; long t = b ; while ( t > 0 ) { p ++ ; t = t >> 1 ; } int count = 0 ; boolean flag = false ; for ( long i = p ; i >= 0 ; i -- ) { for ( long j = 0 ; j < i - 1 ; j ++ ) { long x = ( ( 1L << i ) - 1 ) - ( 1L << j ) ; if ( x >= a && x <= b ) { count ++ ; } } } out . println ( count ) ; } out . close ( ) ; } public static long mul ( long a , long b ) { return ( ( a % MOD ) * ( b % MOD ) ) % MOD ; } public static long add ( long a , long b ) { return ( ( a % MOD ) + ( b % MOD ) ) % MOD ; }

import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ;   public class Bit_year { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; String s1 = Long . toBinaryString ( n ) ; String s2 = Long . toBinaryString ( m ) ; int diff = s2 . length ( ) - s1 . length ( ) ;   int ans = 0 ; while ( diff >= 0 ) { char [ ] a1 = new char [ s1 . length ( ) + diff ] ; Arrays . fill ( a1 , '1' ) ; for ( int i = a1 . length - 1 ; i > 0 ; i -- ) { a1 [ i ] = '0' ; if ( a1 . length > 16 ) { long k = Long . parseLong ( new String ( a1 ) , 2 ) ;

a , b = map ( int , input ( ) . split ( ) ) print ( len ( [ ( 2 ** i - 1 ) - 2 ** j for i in range ( 65 ) for j in range ( i - 1 ) if a <= 2 ** i - 1 - 2 ** j <= b ] ) ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) cnt = 0 for i in range ( 2 , 65 ) : num = ( 1 << i ) - 1 pow = 1 for j in range ( i - 1 ) : cur = num - pow if cur >= a and cur <= b : cnt += 1 pow <<= 1 print ( cnt ) NEW_LINE

from math import logfrom math import ceila , b = map ( int , input ( ) . split ( ) ) chislo = 1 mno = 1 ans = 0 flag = 1 while flag : flag = 0 chi = 1 m = 1 if chislo <= b : flag = 1 for _ in range ( 1 , ceil ( log ( chislo , 2 ) ) ) : m *= 2 if chislo - chi <= b or chislo - chi <= a : flag = 1 if chislo - chi >= a and chislo - chi <= b : ans += 1 chi += m - m // 2 mno *= 2 chislo += mnoprint ( ans ) NEW_LINE

def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


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

import java . io . * ; import java . util . * ; import java . math . * ; public class Main {   public void solve ( ) throws IOException {   int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ;   int [ ] aa = new int [ n ] ; int [ ] bb = new int [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) { aa [ i ] = in . nextInt ( ) ; }   for ( int i = 0 ; i < m ; i ++ ) { bb [ i ] = in . nextInt ( ) ; }

import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class FistWeight {   public static void main ( String [ ] args ) {   InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader sc = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ;

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

n , m , k = map ( int , input ( ) . split ( ) ) a = sorted ( map ( int , input ( ) . split ( ) ) , reverse = True ) b = sorted ( map ( int , input ( ) . split ( ) ) , reverse = True ) cou = ind = 0 l = min ( m , n ) aa = max ( b ) for i in range ( l ) : if a [ i ] > b [ i ] : cou += 1 ind = max ( ind , a [ i ] )   if m >= n and cou > 0 : print ( " YES " ) elif m < n : print ( " YES " ) else : print ( " NO " )                           NEW_LINE

import sysfrom math import gcd , sqrt , ceilfrom collections import defaultdict , Counter , dequefrom bisect import bisect_left , bisect_rightimport mathfrom itertools import permutations   NEW_LINE


import java . io . * ; import java . util . StringTokenizer ;   public class CardsNumber { public static void main ( String [ ] args ) throws IOException { File f = new File ( " input . txt " ) ; FileReader fileReader = new FileReader ( f ) ; BufferedReader reader = new BufferedReader ( fileReader ) ;   int n = Integer . parseInt ( reader . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ;   StringTokenizer st = new StringTokenizer ( reader . readLine ( ) ) ;   int [ ] [ ] number = new int [ 5001 ] [ 2 ] ;   for ( int i = 1 ; i <= 2 * n ; i ++ ) { int temp = Integer . parseInt ( st . nextToken ( ) ) ;   if ( number [ temp ] [ 0 ] > 0 ) { sb . append ( number [ temp ] [ 1 ] + " ▁ " + i + " \n " ) ; number [ temp ] [ 0 ] = 0 ; } else { number [ temp ] [ 0 ] ++ ; number [ temp ] [ 1 ] = i ; } }   FileWriter writer = new FileWriter ( " output . txt " ) ;   for ( int i = 1 ; i < 5001 ; i ++ ) { if ( number [ i ] [ 0 ] > 0 ) { sb = new StringBuilder ( ) ; sb . append ( " - 1" ) ; break ; } }   writer . write ( String . valueOf ( sb ) ) ;   writer . close ( ) ; } }

import java . io . * ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class CardsNumber { public static void main ( String [ ] args ) throws IOException { File f = new File ( " input . txt " ) ; FileReader fileReader = new FileReader ( f ) ; BufferedReader reader = new BufferedReader ( fileReader ) ;   int n = Integer . parseInt ( reader . readLine ( ) ) ; String s = " " ;   StringTokenizer st = new StringTokenizer ( reader . readLine ( ) ) ;   int [ ] [ ] number = new int [ 5001 ] [ 2 ] ; ArrayList < Integer > pair = new ArrayList < > ( ) ;   for ( int i = 1 ; i <= 2 * n ; i ++ ) { int temp = Integer . parseInt ( st . nextToken ( ) ) ;   if ( number [ temp ] [ 0 ] > 0 ) { pair . add ( number [ temp ] [ 1 ] ) ; pair . add ( i ) ; number [ temp ] [ 0 ] = 0 ; } else { number [ temp ] [ 0 ] ++ ; number [ temp ] [ 1 ] = i ; } }   FileWriter writer = new FileWriter ( " output . txt " ) ;   boolean flag = true ; for ( int i = 1 ; i < 5001 ; i ++ ) { if ( number [ i ] [ 0 ] > 0 ) { flag = false ; break ; } }   if ( flag ) { for ( int i = 0 ; i < 2 * n ; i += 2 ) { writer . write ( pair . get ( i ) + " ▁ " + pair . get ( i + 1 ) + " \n " ) ; } } else writer . write ( " - 1" ) ;   writer . close ( ) ; } }

import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . util . * ;   public class A254 { public static void main ( String [ ] args ) throws IOException { FileReader fin = new FileReader ( " input . txt " ) ; BufferedReader bin = new BufferedReader ( fin ) ; FileWriter fout = new FileWriter ( " output . txt " ) ; BufferedWriter bout = new BufferedWriter ( fout ) ; PrintWriter pout = new PrintWriter ( bout ) ; String num = bin . readLine ( ) ; int n = Integer . valueOf ( num ) ; String txt = bin . readLine ( ) ; String [ ] val = txt . split ( " \\ s + " ) ;

import java . io . BufferedReader ; import java . io . File ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ;   public class A254 {   public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new FileReader ( " input . txt " ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; Map < Integer , List < Integer > > map = new HashMap < Integer , List < Integer > > ( ) ; StringTokenizer tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; for ( int n = 0 ; n < 2 * N ; n ++ ) { int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ; map . computeIfAbsent ( a , key -> new ArrayList < Integer > ( ) ) . add ( n + 1 ) ; } PrintWriter out = new PrintWriter ( new File ( " output . txt " ) ) ; StringBuilder output = new StringBuilder ( ) ; for ( List < Integer > list : map . values ( ) ) { if ( list . size ( ) % 2 == 0 ) { int i = 0 ; while ( i < list . size ( ) ) { output . append ( list . get ( i ++ ) ) . append ( ' ▁ ' ) . append ( list . get ( i ++ ) ) . append ( ' \n ' ) ; } } else { out . println ( " - 1" ) ; out . close ( ) ; return ; } } out . print ( output ) ; out . close ( ) ; }   }

import java . io . BufferedReader ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . Vector ; public class A { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; in = new BufferedReader ( new InputStreamReader ( new FileInputStream ( " input . txt " ) ) ) ; out = new PrintWriter ( new FileOutputStream ( " output . txt " ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] inp = in . readLine ( ) . split ( " ▁ " ) ; Vector < Vector < Integer > > mas = new Vector < Vector < Integer > > ( ) ; for ( int i = 0 ; i < 5001 ; i ++ ) { mas . add ( new Vector < Integer > ( ) ) ; } for ( int i = 0 ; i < n * 2 ; i ++ ) { mas . get ( Integer . parseInt ( inp [ i ] ) ) . add ( i + 1 ) ; } boolean check = true ; for ( int i = 1 ; i < 5001 ; i ++ ) { if ( mas . get ( i ) . size ( ) % 2 == 1 ) { check = false ; break ; } } if ( ! check ) { out . println ( - 1 ) ; } else { for ( int i = 1 ; i < 5001 ; i ++ ) { for ( int j = 0 ; j < mas . get ( i ) . size ( ) ; j += 2 ) { out . println ( mas . get ( i ) . get ( j ) + " ▁ " + mas . get ( i ) . get ( j + 1 ) ) ; } } } out . close ( ) ; } }

f = open ( " input . txt " , " r " ) text = f . readlines ( ) f . close ( )   n = int ( text [ 0 ] )   cards = [ int ( c ) for c in text [ 1 ] . split ( ) ]   f = open ( " output . txt " , " w " )   dicti = { }   for bruh in sorted ( set ( cards ) ) : dicti [ bruh ] = [ ]   for i , j in enumerate ( cards ) : dicti [ j ] . append ( str ( i + 1 ) )   for k in dicti : v = dicti [ k ] if len ( v ) % 2 == 1 : f . write ( str ( - 1 ) ) exit ( ) for k1 in dicti : v1 = dicti [ k1 ] f . write ( ' ▁ ' . join ( v1 ) ) f . write ( ' \n ' )   f . close ( )     NEW_LINE

l = list ( map ( int , open ( " input . txt " ) . read ( ) . split ( ) [ 1 : ] ) ) s = set ( l ) f = open ( " output . txt " , ' w ' ) ans = [ ] dict = { } for i in range ( len ( l ) ) : if l [ i ] not in dict . keys ( ) : dict [ l [ i ] ] = i + 1 else : ans . append ( str ( dict [ l [ i ] ] ) + " ▁ " + str ( i + 1 ) ) del dict [ l [ i ] ] if len ( dict ) == 0 : f . write ( ' \n ' . join ( ans ) ) else : f . write ( " - 1" ) NEW_LINE

inf = open ( " input . txt " , ' r ' ) ouf = open ( " output . txt " , ' w ' ) n = int ( inf . readline ( ) ) l = list ( map ( int , inf . readline ( ) . split ( ) ) ) d = dict ( )   for j , i in enumerate ( l ) : if i in d : d [ i ] += [ j + 1 ] else : d [ i ] = [ j + 1 ]   ans = [ ]   for i in d : if len ( d [ i ] ) % 2 != 0 : ouf . write ( str ( - 1 ) + " \n " ) break ans += d [ i ] else : for i in range ( 0 , len ( ans ) , 2 ) : ouf . write ( str ( ans [ i ] ) + " ▁ " + str ( ans [ i + 1 ] ) + " \n " ) NEW_LINE

inp , out = open ( ' input . txt ' , ' r ' ) , open ( ' output . txt ' , ' w ' ) n = int ( inp . readline ( ) ) a = inp . readline ( ) . split ( ) b = { } s = [ ] for i in range ( 1 , 2 * n + 1 ) : e = int ( a [ i - 1 ] ) if not e in b : b [ e ] = i else : s . append ( str ( b [ e ] ) + ' ▁ ' + str ( i ) ) del ( b [ e ] ) if len ( b ) == 0 : out . write ( ' \n ' . join ( s ) ) else : out . write ( ' - 1' ) out . close ( ) NEW_LINE


import java . util . * ; import java . io . * ;   public class A1145 { private StreamTokenizer in ; private PrintWriter out ;   public static void main ( String [ ] args ) throws IOException { new A1145 ( ) . run ( ) ; }   private void run ( ) throws IOException { in = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; out = new PrintWriter ( System . out ) ;   execute ( ) ;   out . flush ( ) ; }   private void execute ( ) throws IOException { final int n = nextInt ( ) ; final int [ ] arr = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; }   final int length = solve ( arr , 0 , arr . length ) ; out . print ( length ) ; }   public int solve ( int [ ] arr , int start , int end ) throws IOException { if ( end - start < 2 ) { return 1 ; }   if ( isSorted ( arr , start , end ) ) { return end - start ; }   final int middle = start + ( end - start ) / 2 ;   final int leftLength = solve ( arr , start , middle ) ; final int rightLength = solve ( arr , middle , end ) ;   return Math . max ( leftLength , rightLength ) ; }   private boolean isSorted ( int [ ] arr , int start , int end ) { final int [ ] original = Arrays . copyOfRange ( arr , start , end ) ; final int [ ] subArray = Arrays . copyOf ( original , original . length ) ;   Arrays . sort ( subArray ) ;   return Arrays . equals ( original , subArray ) ; }    private String nextString ( ) throws IOException { in . nextToken ( ) ;   return in . sval ; }   private long nextLong ( ) throws IOException { in . nextToken ( ) ;   return ( long ) in . nval ; }   private int nextInt ( ) throws IOException { in . nextToken ( ) ;   return ( int ) in . nval ; } }

import java . util . Scanner ;   public class p1145A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; boolean ok = false ; for ( int len = n ; len > 0 ; len /= 2 ) { for ( int c = 0 ; c < n ; c += len ) { boolean sorted = true ; for ( int i = 1 ; i < len ; ++ i ) if ( a [ c + i ] < a [ c + i - 1 ] ) sorted = false ; if ( sorted ) { System . out . println ( len ) ; ok = true ; break ; } } if ( ok ) break ; }   } }

import java . util . * ; import java . io . * ; public class Main { private static int thanos ( int [ ] input ) { if ( input . length == 1 ) { return 1 ; } if ( sorted ( input ) ) { return input . length ; } int l [ ] = new int [ input . length / 2 ] ; int r [ ] = new int [ input . length / 2 ] ; for ( int i = 0 ; i < input . length / 2 ; i ++ ) { l [ i ] = input [ i ] ; } for ( int i = input . length / 2 ; i < input . length ; i ++ ) { r [ i - input . length / 2 ] = input [ i ] ; } int left = thanos ( l ) ; int right = thanos ( r ) ; return left > right ? left : right ; }    private static boolean sorted ( int [ ] input ) { for ( int i = 0 ; i < input . length - 1 ; i ++ ) { if ( input [ i ] > input [ i + 1 ] ) { return false ; } } return true ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int j = 0 ; j < arr . length ; j ++ ) { arr [ j ] = sc . nextInt ( ) ; } System . out . println ( thanos ( arr ) ) ; } }

import java . util . * ;   public class file {   private static final Scanner sc = new Scanner ( System . in ) ;   private static void foo ( ) { int n = sc . nextInt ( ) , count1 = 0 , max = 1 , istrue = 0 ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } System . out . println ( maxsort ( arr , 0 , n - 1 ) ) ; }   private static int maxsort ( int [ ] arr , int i , int j ) { int count = 1 ; for ( int k = i ; k <= j ; ) { if ( k + 1 <= j && arr [ k ] <= arr [ k + 1 ] ) { k ++ ; count ++ ; } else { break ; } } if ( count == j - i + 1 ) return count ; else return Math . max ( maxsort ( arr , i + ( j - i + 1 ) / 2 , j ) , maxsort ( arr , i , j - ( j - i + 1 ) / 2 ) ) ; }    public static void main ( String [ ] args ) {

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

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

ans = 0   def is_sorted ( array , l , r ) : for i in range ( l , r ) : if array [ i ] > array [ i + 1 ] : return False return True   def check_array ( array , l , r ) : if is_sorted ( array , l , r ) : global ans ans = max ( ans , r - l + 1 ) return   mid = ( l + r ) // 2 check_array ( array , l , mid ) check_array ( array , mid + 1 , r )   n = int ( input ( ) ) array = list ( map ( ( int ) , input ( ) . strip ( ) . split ( ) ) ) size = len ( array ) check_array ( array , 0 , size - 1 ) print ( ans ) NEW_LINE

def sol ( a , i , j ) : if ( len ( a ) == 1 ) : return True for i in range ( i + 1 , j + 1 ) : if ( a [ i ] < a [ i - 1 ] ) : return False return Truedef solve ( a , i , j ) : if ( i > j ) : return 0 ; if ( sol ( a , i , j ) ) : return j - i + 1 mid = ( j + i ) // 2 return max ( solve ( a , i , mid ) , solve ( a , mid + 1 , j ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , 0 , len ( a ) - 1 ) ) NEW_LINE

def check_thanossort ( arr , x , y ) : t = 0 for i in range ( x + 1 , y + 1 ) : if ( arr [ i ] >= arr [ i - 1 ] ) : t += 1 if ( t == y - x ) : p = 1 else : p = 0 return pa = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) j = awhile ( j >= 1 ) : k = 0 brk = False while ( k < a ) : if ( check_thanossort ( arr , k , k + j - 1 ) == 1 ) : ans = j ; brk = True ; break k += j if ( brk ) : break j //= 2 print ( ans ) NEW_LINE

import sysinput = sys . stdin . readline   def is_sorted ( a , n ) : if n == 1 : return 1 flag = 1 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : flag = 0 return flag   def f ( a , n ) : if is_sorted ( a , n ) : return n return max ( f ( a [ : n // 2 ] , n // 2 ) , f ( a [ n // 2 : ] , n // 2 ) )   t = 1   for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = f ( a , n ) print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class B { static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) { FS in = new FS ( ) ; long R = in . nextLong ( ) ; long C = in . nextLong ( ) ; long res = solve ( Math . min ( R , C ) , Math . max ( R , C ) ) ; out . println ( res ) ; out . close ( ) ; } static long solve ( long r , long c ) { if ( r < 3 && c < 3 ) return 0 ; if ( r == 1 ) { long res = c ; long m = c % 6 ; if ( m != 0 ) { if ( m <= 3 ) res -= m ; if ( m == 4 ) res -= 2 ; if ( m == 5 ) res -= 1 ; } return res ; } if ( r == 2 ) { if ( c == 3 || c == 7 ) return r * ( c - 1 ) ; return r * c ; } long res = r * c ; if ( res % 2 == 0 ) return res ; return res - 1 ; }

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; void run ( ) { work ( ) ; out . flush ( ) ; } long mod = 1000000007 ; long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } void work ( ) { long n = in . nextInt ( ) ; long m = in . nextInt ( ) ; if ( n > m ) { long t = m ; m = n ; n = t ; } long v = 0 ; if ( n == 1 ) { v = m / 6 * 6 ; if ( m % 6 == 4 ) v += 2 ; if ( m % 6 == 5 ) v += 4 ; } else if ( n <= 2 && m <= 2 ) { v = 0 ; } else if ( n == 2 && m == 3 ) { v = 4 ; } else if ( n == 2 && m == 7 ) { v = 12 ; } else if ( n % 2 == 0 ) {

import java . util . * ; import java . math . * ;   public class Main { public static void main ( String ards [ ] ) { Scanner cin = new Scanner ( System . in ) ; while ( cin . hasNext ( ) ) { long n = cin . nextLong ( ) ; long m = cin . nextLong ( ) ; if ( n > m ) { long x = n ; n = m ; m = x ; } if ( n == 1 ) { if ( m % 6 == 0 ) System . out . println ( m ) ; else if ( m % 6 <= 3 ) System . out . println ( m - ( m % 6 ) ) ; else System . out . println ( m - ( 6 - m % 6 ) ) ; } else if ( n == 2 && m == 2 ) System . out . println ( 0 ) ; else if ( n == 2 && m == 3 ) System . out . println ( 4 ) ; else if ( n == 2 && m == 7 ) System . out . println ( 12 ) ; else { if ( n % 2 == 1 && m % 2 == 1 ) System . out . println ( n * m - 1 ) ; else System . out . println ( n * m ) ; } } } }

def main ( ) : n , m = map ( int , input ( ) . split ( ) ) if m > n : n , m = m , n if n + m <= 4 : print ( 0 ) return if m == 1 : q = n // 6 ; r = n % 6 if r == 4 : print ( n - 2 ) elif r == 5 : print ( n - 1 ) else : print ( q * 6 ) return if ( n , m ) in [ ( 7 , 2 ) , ( 3 , 2 ) ] : print ( n * m - 2 ) return if n % 2 == 0 or m % 2 == 0 : print ( n * m ) return print ( n * m - 1 ) main ( ) NEW_LINE

import mathimport sysn , m = map ( int , input ( ) . split ( ) ) if n > m : n , m = m , nif n == 1 : print ( 6 * ( m // 6 ) + 2 * max ( 0 , ( m % 6 ) - 3 ) ) elif n == 2 : if m == 2 : print ( 0 ) elif m in ( 1 , 3 , 7 ) : print ( n * m - 2 ) else : print ( n * m ) else : print ( ( n * m // 2 ) * 2 ) NEW_LINE


import java . io . * ; import java . util . * ;   public class MikeandShortcuts {   public static void main ( String args [ ] ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int N = cin . nextInt ( ) ; int a [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = cin . nextInt ( ) ; } Queue < Integer > queue = new LinkedList < Integer > ( ) ; int [ ] dis = new int [ N ] ; boolean [ ] visited = new boolean [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) { dis [ i ] = - 1 ; visited [ 0 ] = false ; } visited [ 0 ] = true ; dis [ 0 ] = 0 ; queue . add ( 0 ) ;   while ( ! queue . isEmpty ( ) ) { int e = queue . poll ( ) ; int ahead = e + 1 , back = e - 1 ; if ( ahead >= 0 && ahead < N && ! visited [ ahead ] ) { queue . add ( ahead ) ; visited [ ahead ] = true ; dis [ ahead ] = dis [ e ] + 1 ; } if ( back >= 0 && back < N && ! visited [ back ] ) { if ( back >= 0 && back < N && ! visited [ back ] ) { queue . add ( back ) ; visited [ back ] = true ; dis [ back ] = dis [ e ] + 1 ; } } int target = a [ e ] - 1 ; if ( ! visited [ target ] ) { if ( ! visited [ target ] ) { queue . add ( target ) ; visited [ target ] = true ; dis [ target ] = dis [ e ] + 1 ; } } }   for ( int i = 0 ; i < N ; i ++ ) { if ( i == N ) System . out . println ( dis [ i ] ) ; System . out . print ( dis [ i ] + " ▁ " ) ; }   }   }

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

from collections import deque   intersections = int ( input ( ) ) shortcuts = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) costs = [ float ( ' inf ' ) ] * ( intersections + 1 ) costs [ 1 ] = 0 queue = deque ( [ 1 ] )   while queue : t = queue . popleft ( )   if t + 1 <= intersections and costs [ t ] + 1 < costs [ t + 1 ] : costs [ t + 1 ] = costs [ t ] + 1 queue . append ( t + 1 )   if t - 1 >= 1 and costs [ t ] + 1 < costs [ t - 1 ] : costs [ t - 1 ] = costs [ t ] + 1 queue . append ( t - 1 )   if costs [ t ] + 1 < costs [ shortcuts [ t ] ] : costs [ shortcuts [ t ] ] = costs [ t ] + 1 queue . append ( shortcuts [ t ] )   print ( ' ▁ ' . join ( str ( i ) for i in costs [ 1 : ] ) ) NEW_LINE

n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   for i in range ( n ) : A [ i ] -= 1   dist = [ - 1 for i in range ( n ) ] dist [ 0 ] = 0   Q = [ 0 ]   while len ( Q ) != 0 : k = 0 u = Q . pop ( 0 ) if dist [ A [ u ] ] == - 1 : dist [ A [ u ] ] = dist [ u ] + 1 k += 1 if A [ u ] not in Q : Q . append ( A [ u ] ) elif dist [ A [ u ] ] > dist [ u ] + 1 : dist [ A [ u ] ] = dist [ u ] + 1 k += 1 if A [ u ] not in Q : Q . append ( A [ u ] ) for v in range ( u - 1 , u + 2 ) : if v < 0 or v >= n : continue if dist [ v ] == - 1 : dist [ v ] = dist [ u ] + abs ( u - v ) if v not in Q : Q . append ( v ) elif dist [ u ] + abs ( u - v ) < dist [ v ] : dist [ v ] = dist [ u ] + abs ( u - v ) k += 1 if v not in Q : Q . append ( v ) print ( ' ▁ ' . join ( map ( str , dist ) ) ) NEW_LINE

def solve ( N , nums ) : ans = [ float ( ' inf ' ) ] * N ans [ 0 ] = str ( 0 )   for i in range ( N ) : v = nums [ i ] nums [ i ] = set ( [ min ( N - 1 , i + 1 ) , max ( 0 , i - 1 ) , v - 1 , ] ) d = 0 q = set ( [ 0 ] ) while q : next_q = set ( ) d += 1 for node in q : for next_node in nums [ node ] : if ans [ next_node ] == float ( ' inf ' ) : ans [ next_node ] = str ( d ) next_q . add ( next_node ) q = next_q   return ans   N = int ( input ( ) ) nums = list ( map ( int , input ( ) . split ( ) ) ) ans = solve ( N , nums ) print ( ( " ▁ " ) . join ( ans ) ) NEW_LINE


import java . util . * ; public class f {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = sc . nextInt ( ) ; if ( c == 0 ) System . out . println ( ( a == b ) ? " YES " : " NO " ) ; else System . out . println ( ( ( b - a ) % c == 0 && ( b - a ) / c >= 0 ) ? " YES " : " NO " ) ;   }   }

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ;    public class CF675AInfiniteSequence {   static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws IOException { int [ ] p = readArray ( ) ; int a = p [ 0 ] ; int b = p [ 1 ] ; int c = p [ 2 ] ;   if ( c == 0 ) { out . print ( a == b ? " YES " : " NO " ) ; } else if ( c > 0 ) { if ( b < a ) { out . print ( " NO " ) ; } else { out . print ( ( b - a ) % c == 0 ? " YES " : " NO " ) ; } } else if ( c < 0 ) { if ( b > a ) { out . print ( " NO " ) ; } else { out . print ( ( b - a ) % c == 0 ? " YES " : " NO " ) ; } } out . close ( ) ; }   private static String read ( ) throws IOException { return in . readLine ( ) ; }   private static int readInt ( ) throws IOException { return Integer . parseInt ( in . readLine ( ) ) ; }   private static int [ ] readArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( " \\ s " ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; return a ; }   private static int [ ] readSortedArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( " \\ s " ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; return a ; } }

''' a = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = a [ 0 ] y = a [ 1 ] z = a [ 2 ] if ▁ y = = x ▁ and ▁ z = = 0 : ▁ ▁ ▁ ▁ print ( '0 ' ) elif ▁ x > y + z : ▁ ▁ ▁ ▁ print ( ' + ' ) elif ▁ y > x + z : ▁ ▁ ▁ ▁ print ( ' - ' ) else : ▁ ▁ ▁ ▁ print ( ' ? ' ) n = int ( input ( ) ) z = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = [ ] d = 0v = ' ' for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ c = 0 ▁ ▁ ▁ ▁ e = 0 ▁ ▁ ▁ ▁ for ▁ f ▁ in ▁ range ( len ( z ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ z [ f ] > c ▁ and ▁ f + 1 ▁ not ▁ in ▁ x : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = z [ f ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ e = f + 1 ▁ ▁ ▁ ▁ d + = ( i * c ) + 1 ▁ ▁ ▁ ▁ x . append ( e ) print ( d ) for ▁ i ▁ in ▁ x : ▁ ▁ ▁ ▁ v + = str ( i ) ▁ ▁ ▁ ▁ v + = ' ▁ ' print ( v )  f = int ( input ( ) ) g = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] for ▁ i ▁ in ▁ range ( len ( g ) -1 ) : ▁ ▁ ▁ ▁ for ▁ f ▁ in ▁ range ( len ( g ) -1 - i ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ g [ f ] > g [ f + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ g [ f ] , g [ f + 1 ] = g [ f + 1 ] , g [ f ] if ▁ g [ 0 ] * g [ 1 ] > g [ -2 ] * g [ -3 ] ▁ and ▁ g [ -1 ] > 0 : ▁ ▁ ▁ ▁ print ( g [ -1 ] * g [ 0 ] * g [ 1 ] ) else : ▁ ▁ ▁ ▁ print ( g [ -1 ] * g [ -2 ] * g [ -3 ] ) for ▁ u ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ z = int ( input ( ) ) ▁ ▁ ▁ ▁ y = [ int ( f ) ▁ for ▁ f ▁ in ▁ input ( ) . split ( ) ] ▁ ▁ ▁ ▁ y . sort ( ) ▁ ▁ ▁ ▁ d = 0 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ d + = i ▁ ▁ ▁ ▁ if ▁ d < 2048 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' No ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ continue ▁ ▁ ▁ ▁ if ▁ 2048 ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' yes ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ continue ▁ ▁ ▁ ▁ for ▁ x ▁ in ▁ range ( z + 1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ 2048 ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' yes ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( y ) -1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ y [ i ] = = y [ i + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y [ i + 1 ] = y [ i ] *2 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y . pop ( i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i > len ( y ) -3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y . sort ( ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' no ' ) n = int ( input ( ) ) x = [ ] for ▁ i ▁ in ▁ range ( 1 , ( ( n * *2 ) / /2 ) + 1 ) : ▁ ▁ ▁ ▁ x . append ( n * *2 + 1 - i ) ▁ ▁ ▁ ▁ x . append ( i ) ▁ ▁ ▁ ▁ if ▁ len ( x ) = = n : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( * x ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ x = [ ] for ▁ z ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ z = int ( input ( ) ) ▁ ▁ ▁ ▁ x = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] ▁ ▁ ▁ ▁ f = 0 ▁ ▁ ▁ ▁ o = 0 ▁ ▁ ▁ ▁ t = 0 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( z ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ x [ i ] %3 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ f + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ elif ▁ x [ i ] %3 = = 1 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ o + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t + = 1 ▁ ▁ ▁ ▁ if ▁ o < t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( f + o + ( t - o ) / / 3 ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( f + t + ( o - t ) / / 3 ) n = int ( input ( ) ) if ▁ n % 2 = = 1 : ▁ ▁ ▁ ▁ print ( 0 ) elif ▁ n % 4 = = 0 : ▁ ▁ ▁ ▁ print ( ( n / /4 ) - 1 ) else : ▁ ▁ ▁ ▁ print ( n / /4 ) ''' n = [ int ( i ) for i in input ( ) . split ( ) ] if n [ 2 ] >= 0 and n [ 0 ] > n [ 1 ] : print ( ' NO ' ) elif n [ 2 ] <= 0 and n [ 0 ] < n [ 1 ] : print ( ' NO ' ) elif n [ 2 ] == 0 : if n [ 0 ] == n [ 1 ] : print ( ' YES ' ) else : print ( ' NO ' ) elif ( n [ 1 ] - n [ 0 ] ) % n [ 2 ] == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

a , b , d = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if d == 0 : if a == b : print ( ' yes ' ) else : print ( ' no ' ) elif a == b : print ( ' yes ' ) elif ( b - a ) % d == 0 and ( b - a ) * d > 0 : print ( ' yes ' ) else : print ( ' no ' ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) ; s = 0 if c == 0 : if a == b : print ( " YES " ) else : print ( " NO " ) elif c < 0 : if a < b : print ( " NO " ) else : if abs ( a - b ) % c == 0 : print ( " YES " ) else : print ( " NO " ) else : if a > b : print ( " NO " ) else : if abs ( a - b ) % c == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) if ( a != b and c == 0 ) : print ( " NO " ) else : print ( " YES " ) if ( a == b or ( ( b - a ) % c == 0 and ( abs ( b - a ) / abs ( c ) ) == ( ( b - a ) / c ) ) ) else print ( " NO " ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) )   if a == b : print ( ' YES ' ) elif c == 0 or b > a and c < 0 or b < a and c > 0 : print ( ' NO ' ) else : c = abs ( c )   if ( b - a ) % c == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


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

import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int nm [ ] = in . readA ( ) ; int n = nm [ 0 ] , m = nm [ 1 ] ; char [ ] [ ] board = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = in . readLine ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) { board [ i ] [ j ] = line [ j ] ; } } boolean possible = true ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { possible = possible && check ( i , j , board [ i ] [ j ] , board ) ; } } if ( ! possible ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } static int [ ] [ ] direction = { { - 1 , - 1 } , { - 1 , 0 } , { - 1 , 1 } , { 0 , - 1 } , { 0 , 1 } , { 1 , - 1 } , { 1 , 0 } , { 1 , 1 } } ; public static boolean check ( int x , int y , char val , char [ ] [ ] board ) { if ( board [ x ] [ y ] == ' * ' ) return true ; int mines = 0 ; for ( int [ ] dir : direction ) { int nx = x + dir [ 0 ] , ny = y + dir [ 1 ] ; if ( nx < 0 || nx >= board . length || ny < 0 || ny >= board [ 0 ] . length ) continue ; if ( board [ nx ] [ ny ] == ' * ' ) mines ++ ; }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; s . nextLine ( ) ; String [ ] s1 = new String [ n ] ; for ( int j1 = 0 ; j1 < n ; j1 ++ ) s1 [ j1 ] = s . nextLine ( ) ; int count = 0 , found = 0 , count1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { count = 0 ; count1 = 0 ; if ( Character . isDigit ( s1 [ i ] . charAt ( j ) ) ) { int digit = Character . getNumericValue ( s1 [ i ] . charAt ( j ) ) ; if ( i > 0 && s1 [ i - 1 ] . charAt ( j ) == ' * ' ) count ++ ; if ( i < n - 1 && s1 [ i + 1 ] . charAt ( j ) == ' * ' ) count ++ ; if ( j > 0 && s1 [ i ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( j < m - 1 && s1 [ i ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( i > 0 && j > 0 && s1 [ i - 1 ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( i > 0 && j < m - 1 && s1 [ i - 1 ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( i < n - 1 && j > 0 && s1 [ i + 1 ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( i < n - 1 && j < m - 1 && s1 [ i + 1 ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( digit != count ) {

n , m = map ( int , input ( ) . split ( ) ) S = [ input ( ) for i in range ( n ) ]   res = [ [ 0 ] * m for i in range ( n ) ] d = [ ( - 1 , - 1 ) , ( - 1 , 0 ) , ( - 1 , 1 ) , ( 0 , - 1 ) , ( 0 , 1 ) , ( 1 , - 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] for i in range ( n ) : for j in range ( m ) : if S [ i ] [ j ] == ' * ' : for di , dj in d : ni , nj = i + di , j + dj if 0 <= ni < n and 0 <= nj < m : if S [ ni ] [ nj ] != ' * ' : res [ ni ] [ nj ] += 1 NEW_LINE

from itertools import product   I = lambda : map ( int , input ( ) . split ( ) )   n , m = I ( ) A = [ input ( ) . replace ( ' . ' , '0' ) for _ in range ( n ) ]   for x , y in product ( range ( n ) , range ( m ) ) : if ( A [ x ] [ y ] != ' * ' and sum ( A [ x + dx ] [ y + dy ] == ' * ' for dx in range ( - 1 , 2 ) for dy in range ( - 1 , 2 ) if 0 <= x + dx < n and 0 <= y + dy < m ) != int ( A [ x ] [ y ] ) ) : print ( ' NO ' ) breakelse : print ( ' YES ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = [ input ( ) . replace ( ' . ' , '0' ) for i in range ( n ) ] for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] != ' * ' and int ( a [ i ] [ j ] ) != sum ( map ( lambda b : b [ max ( 0 , j - 1 ) : j + 2 ] . count ( ' * ' ) , a [ max ( 0 , i - 1 ) : i + 2 ] ) ) : print ( ' NO ' ) exit ( ) print ( ' YES ' ) NEW_LINE


import java . util . Scanner ;   public class UltrafastMath { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String word1 = scanner . nextLine ( ) . trim ( ) ; String word2 = scanner . nextLine ( ) . trim ( ) ;   StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < word1 . length ( ) ; i ++ ) { sb . append ( word1 . charAt ( i ) == word2 . charAt ( i ) ? "0" : "1" ) ; }   System . out . println ( sb . toString ( ) ) ; } }

import java . util . Scanner ;   public class Ultra_Fast_Mathematician {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; StringBuilder sum = new StringBuilder ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { int n = s1 . charAt ( i ) - '0' ; int m = s2 . charAt ( i ) - '0' ; if ( ( n + m ) == 1 ) { sum . append ( "1" ) ; } else { sum . append ( "0" ) ; } } System . out . println ( sum . toString ( ) ) ; } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner scn = new Scanner ( System . in ) ; String num = scn . nextLine ( ) ; String num2 = scn . nextLine ( ) ; String str = " " ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) { if ( num . charAt ( i ) == num2 . charAt ( i ) ) { str = str + 0 ; } else { str = str + 1 ; } } System . out . print ( str ) ;   } }

import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextLine ( ) ; String b = sc . nextLine ( ) ; char [ ] c = new char [ a . length ( ) ] ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) == b . charAt ( i ) ) { c [ i ] = '0' ; } else { c [ i ] = '1' ; } } System . out . println ( c ) ; }   }

import java . io . * ; import java . util . * ; public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ( ) ; String b = br . readLine ( ) ; String rs = " " ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { int ch1 = a . charAt ( i ) - '0' ; int ch2 = b . charAt ( i ) - '0' ; rs += ( ch1 ^ ch2 ) ; } System . out . println ( rs ) ; } }

first = input ( ) NEW_LINE second = input ( )     res = " " NEW_LINE for u , v in zip ( first , second ) : if NEW_LINE u == v : res += "0" else : res += "1" NEW_LINE print ( res ) NEW_LINE

a = input ( ) NEW_LINE b = input ( ) NEW_LINE a = [ x for x in a ] NEW_LINE b = [ y for y in b ]   x = [ '0' if i1 == i2 else '1' for ( i1 , i2 ) in zip ( a , b ) ] NEW_LINE print ( ' ' . join ( x ) ) NEW_LINE

a , b = input ( ) , input ( ) NEW_LINE c = [ 0 ] * len ( a ) NEW_LINE for i in range ( len ( a ) ) : if NEW_LINE a [ i ] != b [ i ] : c [ i ] = 1 NEW_LINE print ( * c , sep = ' ' ) NEW_LINE

m = input ( ) NEW_LINE n = input ( ) NEW_LINE for i in range ( len ( m ) ) : if NEW_LINE INDENT ( m [ i ] == n [ i ] ) : print ( '0' , end = ' ' ) else : print ( '1' , end = ' ' ) NEW_LINE DEDENT


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } public static int lcm ( int a , int b ) { return ( a / gcd ( a , b ) ) * b ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int A = a , B = b , C = c , D = d ; int num , p , q ; if ( c > d ) { num = lcm ( c , a ) ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; if ( b < d ) { a = A ; b = B ; c = C ; d = D ; num = lcm ( d , b ) ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; } } else { num = lcm ( d , b ) ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; if ( a < c ) { a = A ; b = B ; c = C ; d = D ; num = lcm ( c , a ) ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; } } if ( p == 0 ) { q = 1 ; }

import java . util . * ;   public class RoutineProblem { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long a = in . nextLong ( ) ; long b = in . nextLong ( ) ; long c = in . nextLong ( ) ; long d = in . nextLong ( ) ;   double A = ( double ) a , B = ( double ) b , C = ( double ) c , D = ( double ) d ;   if ( Math . abs ( A / B - C / D ) <= 1e-9 ) { System . out . println ( "0/1" ) ; } else if ( C / D > A / B ) { long ans1 = b * c - a * d ; long ans2 = b * c ; long cp = gcd ( ans1 , ans2 ) ; System . out . println ( ans1 / cp + " / " + ans2 / cp ) ; } else if ( C / D < A / B ) { long ans1 = a * d - b * c ; long ans2 = a * d ; long cp = gcd ( ans1 , ans2 ) ; System . out . println ( ans1 / cp + " / " + ans2 / cp ) ; } } public static long gcd ( long a , long b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } }

import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int A = a , B = b , C = c , D = d ; int num , p , q ; if ( c > d ) { num = c * a ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; if ( b < d ) { a = A ; b = B ; c = C ; d = D ; num = b * d ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; } } else { num = b * d ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; if ( a < c ) { a = A ; b = B ; c = C ; d = D ; num = a * c ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; } } if ( p == 0 ) { q = 1 ; }

from fractions import Fractiona , b , c , d = map ( int , input ( ) . split ( ) ) v = Fraction ( abs ( a * d - b * c ) , max ( a * d , b * c ) ) print ( v . numerator , ' / ' , v . denominator , sep = ' ' ) NEW_LINE

from fractions import Fractiona , b , c , d = map ( int , input ( ) . split ( ) ) if ( a / b == c / d ) : print ( '0/1' ) elif ( a / b < c / d ) : r1 = ( ( b * c ) - ( a * d ) ) / ( b * c ) print ( Fraction ( r1 ) . limit_denominator ( ) ) elif ( a / b > c / d ) : r = ( ( a * d ) - ( b * c ) ) / ( a * d ) print ( Fraction ( r ) . limit_denominator ( ) ) NEW_LINE

import mathn , k , l , m = map ( int , input ( ) . split ( ) ) k = k * lm = m * na = abs ( k - m ) b = max ( k , m ) x = math . gcd ( a , b ) a //= xb //= xprint ( str ( a ) + " / " + str ( b ) ) NEW_LINE

import sysimport mathdef gcd ( a , b ) : c = max ( a , b ) d = min ( a , b ) r = c % d if r == 0 : return d return gcd ( d , r ) def lcm ( a , b ) : def gcd_naive ( a , b ) : c = max ( a , b ) d = min ( a , b ) r = c % d if r == 0 : return d return gcd_naive ( d , r )   return int ( a * b / gcd_naive ( a , b ) )   def fn ( a , b , c , d ) : k1 = lcm ( a , c ) k2 = lcm ( b , d ) f = k1 // a b1 = b * f f2 = k1 // c d1 = d * f2 if b1 == d1 : print ( "0/1" ) return 0 elif b1 > d1 : nu = b1 - d1 de = b1 else : f1 = k2 // b a1 = f1 * a f3 = k2 // d c1 = f3 * c nu = a1 - c1 de = a1 g = gcd ( nu , de ) nu = int ( nu // g ) de = int ( de // g ) print ( str ( nu ) + " / " + str ( de ) ) if __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( float , input . split ( ) ) ) a = ( data [ 0 ] ) b = data [ 1 ] c = data [ 2 ] d = data [ 3 ] ( fn ( a , b , c , d ) ) NEW_LINE

def gcd ( a , b ) : while a % b != 0 : a , b = b , a % b return b   l = input ( ) . split ( ' ▁ ' ) a , b , c , d = int ( l [ 0 ] ) , int ( l [ 1 ] ) , int ( l [ 2 ] ) , int ( l [ 3 ] ) if a * d > b * c : p = a * d - b * c q = a * delse : p = b * c - a * d q = b * ce = gcd ( p , q ) p //= eq //= eprint ( str ( p ) + " / " + str ( q ) ) NEW_LINE


import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String str = s . next ( ) ; int b = 0 , w = 0 ; ArrayList < Integer > black = new ArrayList < > ( ) ; ArrayList < Integer > white = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . charAt ( i ) == ' B ' ) { b ++ ; black . add ( i + 1 ) ; } else { w ++ ; white . add ( i + 1 ) ; } } if ( b % 2 == 1 && w % 2 == 1 ) { System . out . println ( - 1 ) ; return ; } ArrayList < Integer > ans = new ArrayList < > ( ) ; if ( b % 2 == 1 ) { for ( int i = 1 ; i < white . size ( ) ; i = i + 2 ) { for ( int start = white . get ( i ) - 1 ; start >= white . get ( i - 1 ) ; start -- ) { ans . add ( start ) ; } } } else { for ( int i = 1 ; i < black . size ( ) ; i = i + 2 ) { for ( int start = black . get ( i ) - 1 ; start >= black . get ( i - 1 ) ; start -- ) { ans . add ( start ) ; } } } System . out . println ( ans . size ( ) ) ; for ( int num : ans ) { System . out . print ( num + " ▁ " ) ; } } }

import java . awt . Desktop ;    import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; } }

import java . util . * ; import java . math . BigInteger ; public class asd { static Scanner s = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws Exception { int t = 1 ; while ( t -- > 0 ) { solve ( ) ; } } public static void solve ( ) { int n = s . nextInt ( ) ; String str = s . next ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; char [ ] ch = str . toCharArray ( ) ; int b = 0 ; int w = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( ch [ i ] == ' W ' ) w ++ ; else b ++ ; } if ( w % 2 == 1 && b % 2 == 1 ) { System . out . println ( " - 1" ) ; return ; } int col = 9 ; if ( w % 2 == 0 ) col = 2 ; else if ( b % 2 == 0 ) col = 3 ; if ( col == 2 ) {

import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; StringBuilder sb = new StringBuilder ( ) ; char [ ] ar = rl ( ) ; int a = 0 , b = 0 ; for ( char ch : ar ) { if ( ch == ' W ' ) a ++ ; else b ++ ; } if ( a % 2 != 0 && b % 2 != 0 ) pl ( " - 1" ) ; else { int p = 0 ; if ( a % 2 == 0 ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ar [ i ] == ' W ' && ar [ i + 1 ] == ' W ' ) { sb . append ( i + 1 + " ▁ " ) ; ar [ i + 1 ] = ' B ' ; p ++ ; } else if ( ar [ i ] == ' W ' ) { ar [ i + 1 ] = ' W ' ; sb . append ( i + 1 + " ▁ " ) ; p ++ ; } } } else { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ar [ i ] == ' B ' && ar [ i + 1 ] == ' B ' ) { ar [ i + 1 ] = ' W ' ; sb . append ( i + 1 + " ▁ " ) ; p ++ ; } else if ( ar [ i ] == ' B ' ) { ar [ i + 1 ] = ' B ' ; sb . append ( i + 1 + " ▁ " ) ; p ++ ; } } } pl ( p ) ; pl ( sb ) ; } } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;

n = int ( input ( ) ) s1 = list ( input ( ) ) s2 = s1ans1 = ans2 = [ ] for i in range ( n - 1 ) : if s1 [ i ] == ' B ' : s1 [ i ] = ' W ' if s1 [ i + 1 ] == ' B ' : s1 [ i + 1 ] = ' W ' else : s1 [ i + 1 ] = ' B ' ans1 . append ( i + 1 ) if s1 [ n - 1 ] == ' W ' : print ( len ( ans1 ) ) if len ( ans1 ) > 0 : print ( * ans1 ) else : for i in range ( n - 1 ) : if s2 [ i ] == ' W ' : s2 [ i ] = ' B ' if s2 [ i + 1 ] == ' W ' : s2 [ i + 1 ] = ' B ' else : s2 [ i + 1 ] = ' W ' ans2 . append ( i + 1 ) if s2 [ n - 1 ] != ' W ' : print ( len ( ans2 ) ) if len ( ans2 ) > 0 : print ( * ans2 ) else : print ( " - 1" )   NEW_LINE

import sysimport mathfrom collections import defaultdict , Counter , deque   NEW_LINE


import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public static FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static Set < Integer > [ ] graph ; public static long [ ] written ;   public static void main ( String [ ] args ) { int n = in . nextInt ( ) ;   graph = new Set [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new HashSet < > ( ) ;   for ( int i = 0 ; i < n - 1 ; i ++ ) { int a = in . nextInt ( ) - 1 ; int b = in . nextInt ( ) - 1 ;   graph [ a ] . add ( b ) ; graph [ b ] . add ( a ) ; }   written = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) written [ i ] = in . nextInt ( ) ;   long [ ] answer = dfs ( 0 , - 1 ) ;   out . println ( abs ( answer [ 0 ] ) + abs ( answer [ 1 ] ) ) ;   out . close ( ) ; }   public static long [ ] dfs ( int vertex , int parent )

import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class Solveaproblem { private static long [ ] arr ; private static ArrayList < Integer > [ ] graph ; private static long [ ] dfs ( int item , int prev ) { long min = 0 , max = 0 ; for ( int elem : graph [ item ] ) { if ( elem == prev ) continue ; long [ ] next = dfs ( elem , item ) ; min = Math . min ( min , next [ 0 ] ) ; max = Math . max ( max , next [ 1 ] ) ; } long x = arr [ item ] + min + max ; if ( x > 0 ) min -= x ; else max -= x ; return new long [ ] { min , max } ; } public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; graph = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new ArrayList < > ( ) ; for ( int i = 1 ; i < n ; i ++ ) { StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; int x = Integer . parseInt ( sToken . nextToken ( ) ) - 1 ; int y = Integer . parseInt ( sToken . nextToken ( ) ) - 1 ; graph [ x ] . add ( y ) ; graph [ y ] . add ( x ) ; } arr = new long [ n ] ; StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = Integer . parseInt ( sToken . nextToken ( ) ) ; long [ ] res = dfs ( 0 , - 1 ) ; System . out . println ( ( res [ 0 ] * ( - 1 ) ) + res [ 1 ] ) ; } }

n = int ( input ( ) ) r = [ [ ] for i in range ( n + 1 ) ] r [ 1 ] = [ 0 ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) r [ a ] . append ( b ) r [ b ] . append ( a ) t = list ( map ( int , input ( ) . split ( ) ) ) u , v = [ 0 ] * ( n + 1 ) , [ 0 ] * ( n + 1 ) for i , j in enumerate ( t , 1 ) : if j < 0 : u [ i ] = - j else : v [ i ] = j NEW_LINE

from sys import stdin , stdout , setrecursionlimitfrom collections import defaultdict , deque , Counter , OrderedDictfrom heapq import heappop , heappushimport threading   n = int ( stdin . readline ( ) )   graph = [ set ( ) for x in range ( n ) ]   for x in range ( n - 1 ) : a , b = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] a -= 1 b -= 1   graph [ a ] . add ( b ) graph [ b ] . add ( a )   vals = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   bruh = [ ( 0 , - 1 ) ]   for x in range ( n ) : num , p = bruh [ x ] for y in graph [ num ] : if y != p : bruh . append ( ( y , num ) )   result = [ - 1 for x in range ( n ) ]   for v , parent in bruh [ : : - 1 ] : nP = 0 nN = 0 for x in graph [ v ] : if x != parent : p , n = result [ x ] nP = max ( nP , p ) nN = max ( nN , n ) nN = max ( nN , nP + vals [ v ] ) nP = max ( nP , nN - vals [ v ] ) result [ v ] = ( nP , nN )   ng , ps = result [ 0 ]   vals [ 0 ] += ps - ng   stdout . write ( str ( ng + ps ) ) NEW_LINE


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

import java . util . * ;   public class Check2 { 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 ] ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; map . putIfAbsent ( ar [ j ] , 0 ) ; map . put ( ar [ j ] , map . get ( ar [ j ] ) + 1 ) ; } boolean check = false ; for ( Integer integer : map . keySet ( ) ) { if ( map . get ( integer ) >= 2 ) { check = true ; break ; } } if ( check ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; }

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

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = set ( b ) NEW_LINE if len ( s ) == len ( b ) : NEW_LINE INDENT print ( " No " ) else : NEW_LINE print ( " Yes " ) NEW_LINE DEDENT

import sysimport NEW_LINE mathfrom NEW_LINE collections NEW_LINE import deque NEW_LINE

def func ( ) : dic = dict ( ) NEW_LINE for i in lst : if NEW_LINE i in dic : print ( ' YES ' ) NEW_LINE return else : dic [ i ] = 0 NEW_LINE print ( ' NO ' )     for _ in range ( int ( input ( ) ) ) : num = int ( input ( ) ) NEW_LINE lst = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE func ( ) NEW_LINE

from collections import defaultdict   for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE d = defaultdict ( int ) NEW_LINE for x in b : d [ x ] += 1 NEW_LINE ok = False NEW_LINE for v in d . values ( ) : if NEW_LINE v > 1 : ok = True NEW_LINE break NEW_LINE print ( " YES " if ok else " NO " ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l1 = list ( set ( a ) ) NEW_LINE if len ( a ) == len ( l1 ) : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE print ( " YES " )   NEW_LINE DEDENT


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

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

import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ;    public class CodeForce { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ;

import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = Long . MAX_VALUE ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 2000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;

def solve ( ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] d = [ float ( ' inf ' ) ] * n prev = - float ( ' inf ' ) for i in range ( n ) : if a [ i ] == 0 : prev = i d [ i ] = min ( d [ i ] , i - prev ) next = float ( ' inf ' ) for i in range ( n - 1 , - 1 , - 1 ) : if a [ i ] == 0 : next = i d [ i ] = min ( d [ i ] , next - i ) return d   print ( * solve ( ) )   NEW_LINE

from bisect import bisect_left as blt = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) q , l = [ ] , [ 0 ] * tfor i in range ( t ) : if a [ i ] == 0 : q . append ( i ) r = len ( q ) for i in range ( t ) : if a [ i ] != 0 : p = bl ( q , i ) if p == 0 : l [ i ] = q [ 0 ] - i elif p == r : l [ i ] = i - q [ - 1 ] else : l [ i ] = min ( i - q [ p - 1 ] , q [ p ] - i ) print ( * l ) NEW_LINE

from array import * n = int ( input ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) dist1 = [ ] dist2 = [ ] for i in range ( n ) : dist1 . append ( 0 ) dist2 . append ( 0 )   st = nfor i in range ( n ) : if ar [ i ] != 0 : dist1 [ i ] = st else : st = 0 st += 1 st = nar . reverse ( ) for i in range ( n ) : if ar [ i ] != 0 : dist2 [ i ] = st else : st = 0 st += 1 dist2 . reverse ( ) for i in range ( n ) : m = min ( dist1 [ i ] , dist2 [ i ] ) print ( m , end = " ▁ " ) ; print ( " \n " )   NEW_LINE


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

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int t = in . nextInt ( ) ; out . println ( t ) ; for ( int i = 0 ; i < t ; i ++ ) { out . print ( "1 ▁ " ) ; } }   } }

import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = 0 ; System . out . println ( n ) ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( 1 + " ▁ " ) ;    } System . out . println ( ) ; } }

import java . util . Scanner ;    public class num {   public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int n = 0 ; n = Input . nextInt ( ) ; System . out . println ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( "1 ▁ " ) ; }    } }

def main ( ) : n = int ( input ( ) ) print ( f ' { n } \n { " ▁ " . join ( [ " 1 " ▁ for ▁ _ ▁ in ▁ range ( n ) ] ) } ' )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) for i in range ( 9 , 0 , - 1 ) : if not n % i : return n // i , ( n // i * f ' { i } ▁ ' ) . strip ( )   print ( * main ( ) , sep = ' \n ' ) NEW_LINE

a = int ( input ( ) ) print ( a ) print ( * ( [ 1 ] * a ) ) NEW_LINE

def rec ( n , z , l , x , y ) : if n > z : return l elif n == z : l . append ( n ) return l else : if n not in l : l . append ( n ) rec ( n * x , z , l , x , y ) rec ( n * y , z , l , x , y )     def gcd ( x , y ) : if x < y : x , y = y , x if y == 0 : return x return gcd ( y , x % y )     def lcm ( x , y ) : if x < y : x , y = y , x gcd_ = gcd ( x , y ) return x * y // gcd_     def main_func ( ) : output_list = [ ] t = int ( input ( ) ) return str ( t ) + " \n " + " ▁ " . join ( [ str ( 1 ) for i in range ( t ) ] )     print ( main_func ( ) )       NEW_LINE


import java . util . * ; import java . io . * ; import java . io . BufferedReader ;   public class Z_A { public static long mod = 1000000007 ; public static Debug db ;   public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Autocompletion solver = new Autocompletion ( ) ; db = new Debug ( System . getSecurityManager ( ) == null ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Autocompletion {   public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int w = in . nextInt ( ) ; int warr [ ] = in . nextIntArr ( n ) ; int b [ ] = in . nextIntArr ( n ) ; UnionFind uf = new UnionFind ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int x = in . nextInt ( ) - 1 ; int y = in . nextInt ( ) - 1 ; uf . combine ( x , y ) ;

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

import java . util . * ; import java . io . * ;   public class b { static int [ ] parent , rank , weight , beauty , wt , bt ; static List < Integer > [ ] al ;   static void merge ( int a , int b ) { int u = find ( a ) ; int v = find ( b ) ; if ( u == v ) return ;   if ( rank [ u ] >= rank [ v ] ) { parent [ v ] = u ; beauty [ u ] += beauty [ v ] ; weight [ u ] += weight [ v ] ; } else { parent [ u ] = v ; beauty [ v ] += beauty [ u ] ; weight [ v ] += weight [ u ] ; } }   static int find ( int k ) { if ( parent [ k ] != k ) parent [ k ] = find ( parent [ k ] ) ; return parent [ k ] ; }   static long f ( List < Integer > list , int n , int w , long [ ] [ ] dp ) { if ( w < 0 ) return Integer . MIN_VALUE ; if ( n == 0 ) return 0 ; if ( dp [ n ] [ w ] != - 1 ) return dp [ n ] [ w ] ;   long a = f ( list , n - 1 , w , dp ) ;

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

def ler ( ) : return [ int ( x ) for x in input ( ) . split ( ) ]     def dfs ( u , adj , visited , s , Pesos , Belezas ) : visited [ u ] = True total_p = Pesos [ u ] total_b = Belezas [ u ] s . append ( u ) for v in adj [ u ] : if not visited [ v ] : w , b = dfs ( v , adj , visited , s , Pesos , Belezas ) total_p += w total_b += b return total_p , total_b n , m , w = ler ( ) Pesos = ler ( ) Belezas = ler ( ) adj = [ [ ] for _ in range ( n ) ] for _ in range ( m ) : x , y = ler ( ) x -= 1 y -= 1 adj [ x ] . append ( y ) adj [ y ] . append ( x ) visited = [ False ] * nf = [ 0 ] * ( w + 1 ) for i in range ( n ) : if visited [ i ] : continue   s = [ ] total_p , total_b = dfs ( i , adj , visited , s , Pesos , Belezas ) for j in range ( w , - 1 , - 1 ) : jw = j + total_p if jw <= w : f [ jw ] = max ( f [ jw ] , f [ j ] + total_b ) for v in s : jw = j + Pesos [ v ] if jw <= w : f [ jw ] = max ( f [ jw ] , f [ j ] + Belezas [ v ] ) print ( f [ w ] )   NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) a = map ( int , input ( ) . split ( ) ) b = map ( int , input ( ) . split ( ) ) ab = [ ( 0 , 0 ) ] + list ( zip ( a , b ) ) l = list ( range ( n + 1 ) )   def f ( x ) : if x == l [ x ] : return x l [ x ] = f ( l [ x ] ) return l [ x ] for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) x , y = f ( x ) , f ( y ) if x != y : l [ y ] = x p = [ [ ] for j in range ( n + 1 ) ] for i in range ( 1 , n + 1 ) : p [ f ( i ) ] . append ( i ) r = ( k + 1 ) * [ 0 ] r [ 0 ] = 1 for i in p : if len ( i ) > 1 : l = [ ab [ x ] for x in i ] x0 = sum ( x [ 0 ] for x in l ) x1 = sum ( x [ 1 ] for x in l ) l . append ( ( x0 , x1 ) ) l . sort ( ) for j in range ( k , - 1 , - 1 ) : if r [ j ] : for w , b in l : if j + w > k : break r [ j + w ] = max ( r [ j + w ] , r [ j ] + b ) elif len ( i ) == 1 : w , b = ab [ i [ 0 ] ] for j in range ( k - w , - 1 , - 1 ) : if r [ j ] : r [ j + w ] = max ( r [ j + w ] , r [ j ] + b ) res = max ( r ) - 1 print ( res ) NEW_LINE