from itertools import product c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] a = [ 0 , None , None ] b = [ c [ 0 ] [ i ] - a [ 0 ] for i in range ( 3 ) ] a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] f = True for i in range ( 3 ) : for j in range ( 3 ) : if c [ i ] [ j ] ! = a [ i ] + b [ j ] : f = False break if f : print ( ' Yes ' ) else : print ( ' No ' ) A = [ 0 ] B = [ ] C = [ ] for i in range ( 3 ) : C . append ( list ( map ( int , input ( ) . split ( ) ) ) ) B . append ( C [ 0 ] [ 0 ] ) B . append ( C [ 0 ] [ 1 ] ) B . append ( C [ 0 ] [ 2 ] ) A . append ( C [ 1 ] [ 0 ] - B [ 0 ] ) A . append ( C [ 2 ] [ 0 ] - B [ 0 ] ) for i in range ( 3 ) : for j in range ( 3 ) : if ( C [ i ] [ j ] ! = A [ i ] + B [ j ] and C [ i ] [ j ] ! = B [ i ] + A [ j ] ) : print ( ' No ' ) exit ( ) print ( ' Yes ' ) [ C11 , C12 , C13 ] = [ int ( i ) for i in input ( ) . split ( ) ] [ C21 , C22 , C23 ] = [ int ( i ) for i in input ( ) . split ( ) ] [ C31 , C32 , C33 ] = [ int ( i ) for i in input ( ) . split ( ) ] b1 = C11 b2 = C12 b3 = C13 flag _ a2 = False if ( C21 - b1 ) = = ( C22 - b2 ) and ( C21 - b1 ) = = ( C23 - b3 ) : flag _ a2 = True flag _ a3 = False if ( C31 - b1 ) = = ( C32 - b2 ) and ( C31 - b1 ) = = ( C33 - b3 ) : flag _ a3 = True if flag _ a2 is True and flag _ a3 is True : print ( ' Yes ' ) else : print ( ' No ' ) C = list ( list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ) for a in range ( 3 ) : if ( C [ a ] [ 0 ] - C [ a ] [ 1 ] ! = C [ 0 ] [ 0 ] - C [ 0 ] [ 1 ] or C [ a ] [ 1 ] - C [ a ] [ 2 ] ! = C [ 0 ] [ 1 ] - C [ 0 ] [ 2 ] ) : print ( " No " ) exit ( ) for b in range ( 3 ) : if ( C [ 0 ] [ b ] - C [ 1 ] [ b ] ! = C [ 0 ] [ 0 ] - C [ 1 ] [ 0 ] or C [ 1 ] [ b ] - C [ 2 ] [ b ] ! = C [ 1 ] [ 0 ] - C [ 2 ] [ 0 ] ) : print ( " No " ) exit ( ) print ( " Yes " ) c = [ ] for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) D1 = [ ] stp = 0 for i in range ( 3 ) : for j in range ( 3 ) : for k in range ( j + 1 , 3 ) : D1 . append ( c [ i ] [ j ] - c [ i ] [ k ] ) for i in range ( 6 ) : if D1 [ i ] ! = D1 [ i + 3 ] : stp + = 1 D2 = [ ] for i in range ( 3 ) : for j in range ( 3 ) : for k in range ( j + 1 , 3 ) : D2 . append ( c [ j ] [ i ] - c [ k ] [ i ] ) for i in range ( 6 ) : if D2 [ i ] ! = D2 [ i + 3 ] : stp + = 1 if stp = = 0 : print ( ' Yes ' ) else : print ( ' No ' ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c3 = list ( map ( int , input ( ) . split ( ) ) ) sw = 1 b1 = min ( c1 ) a = [ c1 [ 0 ] - b1 , c1 [ 1 ] - b1 , c1 [ 2 ] - b1 ] if not ( c2 [ 0 ] - a [ 0 ] = = c2 [ 1 ] - a [ 1 ] = = c2 [ 2 ] - a [ 2 ] ) : sw = 0 if not ( c3 [ 0 ] - a [ 0 ] = = c3 [ 1 ] - a [ 1 ] = = c3 [ 2 ] - a [ 2 ] ) : sw = 0 print ( [ " No " , " Yes " ] [ sw ] ) c = [ list ( map ( int , input ( ) . split ( ' ' ) ) ) for _ in range ( 3 ) ] a = [ - 1 ] * 3 b = [ - 1 ] * 3 a [ 0 ] = 0 for i in range ( 3 ) : b [ i ] = c [ 0 ] [ i ] - a [ 0 ] for i in range ( 3 ) : a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ans = True for i in range ( 3 ) : for j in range ( 3 ) : if c [ i ] [ j ] ! = a [ i ] + b [ j ] : ans = False break if ans = = True : print ( ' Yes ' ) else : print ( ' No ' ) cr = list ( ) for i in range ( 3 ) : cw = list ( map ( int , input ( ) . split ( ) ) ) cr . append ( cw ) a = list ( ) b = list ( ) a . append ( 0 ) b . append ( cr [ 0 ] [ 0 ] - a [ 0 ] ) a . append ( cr [ 1 ] [ 0 ] - b [ 0 ] ) b . append ( cr [ 0 ] [ 1 ] - a [ 0 ] ) a . append ( cr [ 2 ] [ 0 ] - b [ 0 ] ) b . append ( cr [ 0 ] [ 2 ] - a [ 0 ] ) wkans = list ( ) for i in range ( 3 ) : wkrow = list ( ) for j in range ( 3 ) : wkrow . append ( cr [ i ] [ j ] - ( a [ i ] + b [ j ] ) ) wkans . append ( wkrow ) if min ( wkans ) = = max ( wkans ) : ans = ' Yes ' else : ans = ' No ' print ( ans ) k = [ list ( map ( int , list ( input ( ) . split ( ) ) ) ) for i in range ( 3 ) ] for a1 in range ( 101 ) : for a2 in range ( 101 ) : for a3 in range ( 101 ) : if ( k [ 0 ] [ 0 ] - a1 ) = = ( k [ 0 ] [ 1 ] - a2 ) = = ( k [ 0 ] [ 2 ] - a3 ) : if ( k [ 1 ] [ 0 ] - a1 ) = = ( k [ 1 ] [ 1 ] - a2 ) = = ( k [ 1 ] [ 2 ] - a3 ) : if ( k [ 2 ] [ 0 ] - a1 ) = = ( k [ 2 ] [ 1 ] - a2 ) = = ( k [ 2 ] [ 2 ] - a3 ) : if k [ 0 ] [ 0 ] - a1 > = 0 and k [ 0 ] [ 1 ] - a2 > = 0 and k [ 0 ] [ 2 ] - a3 > = 0 : if ( k [ 1 ] [ 0 ] - a1 ) > = 0 and ( k [ 1 ] [ 1 ] - a2 ) > = 0 and ( k [ 1 ] [ 2 ] - a3 ) > = 0 : if ( k [ 2 ] [ 0 ] - a1 ) > = 0 and ( k [ 2 ] [ 1 ] - a2 ) > = 0 and ( k [ 2 ] [ 2 ] - a3 ) > = 0 : print ( " Yes " ) exit ( ) print ( " No " ) def l ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def m ( ) : return map ( int , input ( ) . split ( ) ) def main ( ) : c = [ 0 ] * 3 for i in range ( 3 ) : c [ i ] = l ( ) for i in range ( 2 ) : x = c [ 2 ] [ i + 1 ] - c [ 2 ] [ i ] for j in range ( 2 ) : if c [ j ] [ i + 1 ] - c [ j ] [ i ] ! = x : print ( ' No ' ) exit ( ) print ( ' Yes ' ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] c0 = [ c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] , c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] , c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ] c1 = [ c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] , c [ 1 ] [ 0 ] - c [ 1 ] [ 2 ] , c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ] c2 = [ c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] , c [ 2 ] [ 0 ] - c [ 2 ] [ 2 ] , c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ] if c0 = = c1 = = c2 : print ( " Yes " ) else : print ( " No " ) import sys YES = " Yes " NO = " No " def solve ( c : " List [ List [ int ] ] " ) : for a1 in range ( 101 ) : b1 = c [ 0 ] [ 0 ] - a1 b2 = c [ 0 ] [ 1 ] - a1 b3 = c [ 0 ] [ 2 ] - a1 a2 = c [ 1 ] [ 0 ] - b1 a3 = c [ 2 ] [ 0 ] - b1 if ( a1 + b1 = = c [ 0 ] [ 0 ] and a2 + b1 = = c [ 1 ] [ 0 ] and a3 + b1 = = c [ 2 ] [ 0 ] and a1 + b2 = = c [ 0 ] [ 1 ] and a2 + b2 = = c [ 1 ] [ 1 ] and a3 + b2 = = c [ 2 ] [ 1 ] and a1 + b3 = = c [ 0 ] [ 2 ] and a2 + b3 = = c [ 1 ] [ 2 ] and a3 + b3 = = c [ 2 ] [ 2 ] ) : print ( YES ) exit ( ) print ( NO ) return def main ( ) : def iterate _ tokens ( ) : for line in sys . stdin : for word in line . split ( ) : yield word tokens = iterate _ tokens ( ) c = [ [ int ( next ( tokens ) ) for _ in range ( 3 ) ] for _ in range ( 3 ) ] solve ( c ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) def LIHW ( h ) : return [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( h ) ] masu = LIHW ( 3 ) ans = " Yes " for i in range ( 2 ) : if masu [ i + 1 ] [ 1 ] - masu [ i + 1 ] [ 0 ] ! = masu [ 0 ] [ 1 ] - masu [ 0 ] [ 0 ] : ans = " No " if masu [ i + 1 ] [ 2 ] - masu [ i + 1 ] [ 1 ] ! = masu [ 0 ] [ 2 ] - masu [ 0 ] [ 1 ] : ans = " No " for i in range ( 2 ) : if masu [ 1 ] [ i + 1 ] - masu [ 0 ] [ i + 1 ] ! = masu [ 1 ] [ 0 ] - masu [ 0 ] [ 0 ] : ans = " No " if masu [ 2 ] [ i + 1 ] - masu [ 1 ] [ i + 1 ] ! = masu [ 2 ] [ 0 ] - masu [ 1 ] [ 0 ] : ans = " No " print ( ans ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] list _ a = [ 0 , C [ 1 ] [ 0 ] - C [ 0 ] [ 0 ] , C [ 2 ] [ 0 ] - C [ 0 ] [ 0 ] ] list _ b = [ C [ 0 ] [ 0 ] , C [ 0 ] [ 1 ] , C [ 0 ] [ 2 ] ] for i in range ( 3 ) : for j in range ( 3 ) : if C [ i ] [ j ] ! = list _ a [ i ] + list _ b [ j ] : print ( " No " ) exit ( ) print ( " Yes " ) import sys C11 , C12 , C13 = map ( int , input ( ) . split ( ) ) C21 , C22 , C23 = map ( int , input ( ) . split ( ) ) C31 , C32 , C33 = map ( int , input ( ) . split ( ) ) if ( C11 + C22 = = C12 + C21 ) and ( C12 + C23 = = C13 + C22 ) and ( C21 + C32 = = C22 + C31 ) and ( C22 + C33 = = C23 + C32 ) : print ( ' Yes ' ) sys . exit ( ) print ( " No " ) from sys import stdin if _ _ name _ _ = = " _ _ main _ _ " : _ in = [ _ . rstrip ( ) for _ in stdin . readlines ( ) ] c _ arr = [ ] for i in range ( 3 ) : _ = list ( map ( int , _ in [ i ] . split ( ' ' ) ) ) c _ arr . append ( _ ) sum _ c _ arr = sum ( [ sum ( c ) for c in c _ arr ] ) if ( c _ arr [ 0 ] [ 0 ] + c _ arr [ 1 ] [ 1 ] + c _ arr [ 2 ] [ 2 ] ) = = sum _ c _ arr / 3 and \ ( c _ arr [ 1 ] [ 0 ] + c _ arr [ 2 ] [ 1 ] + c _ arr [ 0 ] [ 2 ] ) = = sum _ c _ arr / 3 and \ ( c _ arr [ 0 ] [ 1 ] + c _ arr [ 1 ] [ 2 ] + c _ arr [ 2 ] [ 0 ] ) = = sum _ c _ arr / 3 and \ ( c _ arr [ 2 ] [ 0 ] + c _ arr [ 1 ] [ 1 ] + c _ arr [ 0 ] [ 2 ] ) = = sum _ c _ arr / 3 and \ ( c _ arr [ 1 ] [ 0 ] + c _ arr [ 0 ] [ 1 ] + c _ arr [ 2 ] [ 2 ] ) = = sum _ c _ arr / 3 and \ ( c _ arr [ 0 ] [ 0 ] + c _ arr [ 2 ] [ 1 ] + c _ arr [ 1 ] [ 2 ] ) = = sum _ c _ arr / 3 : TF = ' Yes ' else : TF = ' No ' print ( TF ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c3 = list ( map ( int , input ( ) . split ( ) ) ) c = [ c1 , c2 , c3 ] for i in range ( 2 ) : if c [ i ] [ 0 ] - c [ i + 1 ] [ 0 ] ! = c [ i ] [ 1 ] - c [ i + 1 ] [ 1 ] or c [ i ] [ 1 ] - c [ i + 1 ] [ 1 ] ! = c [ i ] [ 2 ] - c [ i + 1 ] [ 2 ] : print ( " No " ) exit ( ) for j in range ( 2 ) : if c [ 0 ] [ i + 1 ] - c [ 0 ] [ i ] ! = c [ 1 ] [ i + 1 ] - c [ 1 ] [ i ] or c [ 1 ] [ i + 1 ] - c [ 1 ] [ i ] ! = c [ 2 ] [ i + 1 ] - c [ 2 ] [ i ] : print ( " No " ) exit ( ) print ( " Yes " ) a , b = [ 0 ] * 3 , [ 10 ] * 3 c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 3 ) : b [ i ] = c [ 0 ] [ i ] - a [ 0 ] for i in range ( 1 , 3 ) : a [ i ] = c [ i ] [ 0 ] - b [ 0 ] for i in range ( 3 ) : for j in range ( 3 ) : if c [ i ] [ j ] ! = a [ i ] + b [ j ] : print ( " No " ) exit ( ) print ( " Yes " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] for i in range ( c [ 0 ] [ 0 ] + 1 ) : a = [ 0 ] * 3 b = [ 0 ] * 3 a [ 0 ] = i b [ 0 ] = c [ 0 ] [ 0 ] - i for j in range ( 1 , 3 ) : a [ j ] = c [ j ] [ 0 ] - b [ 0 ] b [ j ] = c [ 0 ] [ j ] - a [ 0 ] flag = True for k in range ( 3 ) : for l in range ( 3 ) : if c [ k ] [ l ] ! = a [ k ] + b [ l ] : flag = False if flag : print ( " Yes " ) exit ( ) print ( " No " ) def solve ( c1 _ list , c2 _ list , c3 _ list ) : a1 = 0 ans = " No " while a1 < = 100 : b _ list = [ c - a1 for c in c1 _ list ] a2 = len ( set ( [ c - b for c , b in zip ( c2 _ list , b _ list ) ] ) ) a3 = len ( set ( [ c - b for c , b in zip ( c3 _ list , b _ list ) ] ) ) if a2 = = 1 and a3 = = 1 : ans = " Yes " break else : a1 + = 1 return ans if _ _ name _ _ = = " _ _ main _ _ " : c1 _ list = [ int ( i ) for i in input ( ) . split ( ) ] c2 _ list = [ int ( i ) for i in input ( ) . split ( ) ] c3 _ list = [ int ( i ) for i in input ( ) . split ( ) ] print ( solve ( c1 _ list , c2 _ list , c3 _ list ) ) import sys check _ ary = [ [ 0 for i in range ( 3 ) ] for i in range ( 2 ) ] num _ ary = [ [ 0 for i in range ( 3 ) ] for i in range ( 3 ) ] check _ minus = False for i in range ( 3 ) : num _ ary [ i ] = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( num _ ary [ 0 ] [ 0 ] + 1 ) : for x in range ( 3 ) : check _ ary [ 1 ] [ x ] = num _ ary [ 0 ] [ x ] - i for a in range ( 3 ) : check _ ary [ 0 ] [ a ] = num _ ary [ a ] [ 0 ] - check _ ary [ 1 ] [ 0 ] for x in range ( 3 ) : for y in range ( 3 ) : if not check _ ary [ 0 ] [ x ] + check _ ary [ 1 ] [ y ] = = num _ ary [ x ] [ y ] : break else : continue break else : print ( " Yes " ) sys . exit ( ) print ( " No " ) grid = [ [ ] , [ ] , [ ] ] for i in range ( 3 ) : grid [ i ] = [ int ( i ) for i in input ( ) . split ( ) ] x = [ 0 ] * 3 y = [ ] ret = True for i in range ( 3 ) : y . append ( grid [ 0 ] [ i ] - x [ 0 ] ) for i in range ( 3 ) : x [ i ] = grid [ i ] [ 0 ] - y [ 0 ] for i in range ( 3 ) : for j in range ( 3 ) : if not x [ i ] + y [ j ] = = grid [ i ] [ j ] : ret = False else : continue break print ( " Yes " if ret else " No " ) import sys sys . setrecursionlimit ( 10 * * 6 ) input = sys . stdin . readline int1 = lambda x : int ( x ) - 1 p2D = lambda x : print ( * x , sep = " \ n " ) def main ( ) : t = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 2 ) : if not t [ i ] [ 0 ] - t [ i + 1 ] [ 0 ] = = t [ i ] [ 1 ] - t [ i + 1 ] [ 1 ] = = t [ i ] [ 2 ] - t [ i + 1 ] [ 2 ] : print ( " No " ) exit ( ) for j in range ( 2 ) : if not t [ 0 ] [ j ] - t [ 0 ] [ j + 1 ] = = t [ 1 ] [ j ] - t [ 1 ] [ j + 1 ] = = t [ 2 ] [ j ] - t [ 2 ] [ j + 1 ] : print ( " No " ) exit ( ) print ( " Yes " ) main ( ) import numpy as np import sys def validation ( c , a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if c [ i ] [ j ] ! = a [ i ] + b [ j ] : print ( ' No ' ) return sys . exit ( ) print ( ' Yes ' ) return sys . exit ( ) c _ 1 = list ( map ( int , input ( ) . split ( ) ) ) c _ 2 = list ( map ( int , input ( ) . split ( ) ) ) c _ 3 = list ( map ( int , input ( ) . split ( ) ) ) c = np . array ( [ c _ 1 , c _ 2 , c _ 3 ] ) for i in range ( np . max ( c ) + 1 ) : a = [ ] b = [ ] a . append ( i ) b . append ( c [ 0 ] [ 0 ] - a [ 0 ] ) b . append ( c [ 0 ] [ 1 ] - a [ 0 ] ) b . append ( c [ 0 ] [ 2 ] - a [ 0 ] ) a . append ( c [ 1 ] [ 0 ] - b [ 0 ] ) a . append ( c [ 2 ] [ 0 ] - b [ 0 ] ) validation ( c , a , b ) def mod3 ( num ) : if num % 3 = = 0 : return True else : return False cList = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] row = [ sum ( cList [ 0 ] ) , sum ( cList [ 1 ] ) , sum ( cList [ 2 ] ) ] col = [ cList [ 0 ] [ i ] + cList [ 1 ] [ i ] + cList [ 2 ] [ i ] for i in range ( 3 ) ] differenceRow = [ row [ i - 1 ] - row [ i ] for i in range ( 3 ) ] differenceCol = [ col [ i - 1 ] - col [ i ] for i in range ( 3 ) ] difference = [ sum ( row ) ] + differenceRow + differenceCol if list ( filter ( mod3 , difference ) ) ! = difference : print ( " No " ) else : print ( " Yes " ) grid = [ [ int ( i ) for i in input ( ) . split ( ) ] for _ in range ( 3 ) ] fin = False for a1 in range ( 101 ) : if fin : break for a2 in range ( 101 ) : if fin : break for a3 in range ( 101 ) : if ( grid [ 0 ] [ 0 ] - a1 = = grid [ 1 ] [ 0 ] - a2 and grid [ 1 ] [ 0 ] - a2 = = grid [ 2 ] [ 0 ] - a3 ) and ( grid [ 0 ] [ 1 ] - a1 = = grid [ 1 ] [ 1 ] - a2 and grid [ 1 ] [ 1 ] - a2 = = grid [ 2 ] [ 1 ] - a3 ) and ( grid [ 0 ] [ 2 ] - a1 = = grid [ 1 ] [ 2 ] - a2 and grid [ 1 ] [ 2 ] - a2 = = grid [ 2 ] [ 2 ] - a3 ) : print ( " Yes " ) fin = True break if not fin : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for a0 in range ( 101 ) : b0 = c [ 0 ] [ 0 ] - a0 b1 = c [ 0 ] [ 1 ] - a0 b2 = c [ 0 ] [ 2 ] - a0 a1 = c [ 1 ] [ 0 ] - b0 if a1 ! = c [ 1 ] [ 1 ] - b1 or a1 ! = c [ 1 ] [ 2 ] - b2 : continue a2 = c [ 2 ] [ 0 ] - b0 if a2 ! = c [ 2 ] [ 1 ] - b1 or a2 ! = c [ 2 ] [ 2 ] - b2 : continue print ( " Yes " ) exit ( ) print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] yoko = [ c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] , c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] ] tate = [ c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] , c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] ] flag = 1 for i in range ( 1 , 3 ) : if not ( ( c [ i ] [ 1 ] - c [ i ] [ 0 ] = = yoko [ 0 ] ) and ( c [ i ] [ 2 ] - c [ i ] [ 1 ] = = yoko [ 1 ] ) ) : flag = 0 if not ( ( c [ 1 ] [ i ] - c [ 0 ] [ i ] = = tate [ 0 ] ) and ( c [ 2 ] [ i ] - c [ 1 ] [ i ] = = tate [ 1 ] ) ) : flag = 0 if flag = = 1 : print ( " Yes " ) else : print ( " No " ) r1 = list ( map ( int , input ( ) . split ( ) ) ) r2 = list ( map ( int , input ( ) . split ( ) ) ) r3 = list ( map ( int , input ( ) . split ( ) ) ) a = [ 0 ] * 3 b = [ 0 ] * 3 for i in range ( 101 ) : a [ 0 ] = i for j in range ( 3 ) : b [ j ] = r1 [ j ] - a [ 0 ] a [ 1 ] = r2 [ 0 ] - b [ 0 ] a [ 2 ] = r3 [ 0 ] - b [ 0 ] flag = False for j in range ( 3 ) : if r1 [ j ] = = a [ 0 ] + b [ j ] and r2 [ j ] = = a [ 1 ] + b [ j ] and r3 [ j ] = = a [ 2 ] + b [ j ] : flag = True else : flag = False break if flag : break print ( " Yes " ) if flag else print ( " No " ) s = [ ] ; for i in range ( 3 ) : s . append ( list ( map ( int , input ( ) . split ( ) ) ) ) sum = 0 for i in range ( 3 ) : for j in range ( 3 ) : sum + = s [ i ] [ j ] c1 = s [ 0 ] [ 0 ] + s [ 1 ] [ 1 ] + s [ 2 ] [ 2 ] c2 = s [ 0 ] [ 2 ] + s [ 1 ] [ 1 ] + s [ 2 ] [ 0 ] print ( ' Yes ' if sum = = c1 * 3 and sum = = c2 * 3 else ' No ' ) import math import numpy as np from fractions import gcd import collections C = [ list ( map ( int , input ( ) . split ( ) ) ) for l in range ( 3 ) ] C = np . array ( C ) cross1 = C [ 0 ] [ 0 ] + C [ 1 ] [ 1 ] + C [ 2 ] [ 2 ] cross2 = C [ 0 ] [ 2 ] + C [ 1 ] [ 1 ] + C [ 2 ] [ 0 ] if ( cross1 = = cross2 and np . sum ( C ) / 6 = = cross1 / 2 ) : print ( ' Yes ' ) else : print ( ' No ' ) def main ( ) : c = [ ] for _ in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) a = [ 0 ] * 3 b = [ 0 ] * 3 for i in range ( 3 ) : b [ i ] = c [ 0 ] [ i ] - a [ 0 ] for i in range ( 1 , 3 ) : a [ i ] = c [ i ] [ 0 ] - b [ 0 ] is _ able = True for i in range ( 3 ) : for j in range ( 3 ) : if a [ i ] + b [ j ] ! = c [ i ] [ j ] : is _ able = False break if is _ able : print ( " Yes " ) else : print ( " No " ) if _ _ name _ _ = = " _ _ main _ _ " : main ( ) import collections import math import numpy as np is _ true = True field = [ ] for i in range ( 3 ) : field . append ( list ( map ( int , input ( ) . split ( ) ) ) ) field = np . array ( field ) for i in range ( 3 ) : field [ i ] - = min ( field [ i ] ) is _ true = np . where ( field = = field [ 0 ] , True , False ) . all ( ) field = np . array ( field ) . T for i in range ( 3 ) : field [ i ] - = min ( field [ i ] ) is _ true2 = np . where ( field = = field [ 0 ] , True , False ) . all ( ) print ( ' Yes ' if is _ true * is _ true2 else ' No ' ) with open ( 0 ) as f : C = [ list ( map ( int , line . split ( ) ) ) for line in f . readlines ( ) ] b = [ ( C [ i ] [ 1 ] - C [ i ] [ 0 ] , C [ i ] [ 2 ] - C [ i ] [ 1 ] ) for i in range ( 3 ) ] a = [ ( C [ 1 ] [ j ] - C [ 0 ] [ j ] , C [ 2 ] [ j ] - C [ 1 ] [ j ] ) for j in range ( 3 ) ] print ( ' Yes ' if a [ 0 ] = = a [ 1 ] = = a [ 2 ] and b [ 0 ] = = b [ 1 ] = = b [ 2 ] else ' No ' ) grid = [ list ( map ( int , input ( ) . split ( " " ) ) ) for _ in range ( 3 ) ] a = [ 0 , 0 , 0 ] b = [ 0 , 0 , 0 ] b [ 0 ] = grid [ 0 ] [ 0 ] - a [ 0 ] b [ 1 ] = grid [ 0 ] [ 1 ] - a [ 0 ] b [ 2 ] = grid [ 0 ] [ 2 ] - a [ 0 ] a [ 1 ] = grid [ 1 ] [ 0 ] - b [ 0 ] a [ 2 ] = grid [ 2 ] [ 0 ] - b [ 0 ] ans _ date = [ ] for i in a : date = [ ] for j in b : num = i + j date . append ( num ) ans _ date . append ( date ) if grid = = ans _ date : print ( " Yes " ) else : print ( " No " ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] for row in range ( 3 ) : for col in range ( 3 ) : if C [ row ] [ col ] - C [ ( row + 1 ) % 3 ] [ col ] ! = C [ row ] [ ( col + 1 ) % 3 ] - C [ ( row + 1 ) % 3 ] [ ( col + 1 ) % 3 ] : print ( ' No ' ) exit ( ) for col in range ( 3 ) : for row in range ( 3 ) : if C [ row ] [ col ] - C [ row ] [ ( col + 1 ) % 3 ] ! = C [ ( row + 1 ) % 3 ] [ col ] - C [ ( row + 1 ) % 3 ] [ ( col + 1 ) % 3 ] : print ( ' No ' ) exit ( ) print ( ' Yes ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for j in range ( 3 ) ] if c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] and c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] = = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] and c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] = = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] : print ( " Yes " ) else : print ( " No " ) b = list ( map ( int , input ( ) . split ( ) ) ) a2 = list ( map ( int , input ( ) . split ( ) ) ) a3 = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( max ( 0 , b [ 0 ] - 100 , b [ 1 ] - 100 , b [ 2 ] - 100 ) , min ( 100 , b [ 0 ] , b [ 1 ] , b [ 2 ] ) + 1 ) : t1 = set ( ) t2 = set ( ) for j in range ( 3 ) : t1 . add ( a2 [ j ] - ( b [ j ] - i ) ) t2 . add ( a3 [ j ] - ( b [ j ] - i ) ) if len ( t1 ) = = 1 and len ( t2 ) = = 1 and list ( t1 ) [ 0 ] > = 0 and list ( t2 ) [ 0 ] > = 0 : print ( ' Yes ' ) break else : print ( ' No ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] a = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] b = c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] d = c [ 0 ] [ 0 ] - c [ 2 ] [ 0 ] if ( a = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ) and ( a = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ) : if ( b = = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] ) and ( b = = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ) : if ( d = = c [ 0 ] [ 1 ] - c [ 2 ] [ 1 ] ) and ( d = = c [ 0 ] [ 2 ] - c [ 2 ] [ 2 ] ) : print ( ' Yes ' ) exit ( ) print ( ' No ' ) A = [ ] for i in range ( 3 ) : A . append ( list ( map ( int , input ( ) . split ( ) ) ) ) t = 0 if A [ 0 ] [ 0 ] - A [ 1 ] [ 0 ] = = A [ 0 ] [ 1 ] - A [ 1 ] [ 1 ] = = A [ 0 ] [ 2 ] - A [ 1 ] [ 2 ] : if A [ 2 ] [ 0 ] - A [ 1 ] [ 0 ] = = A [ 2 ] [ 1 ] - A [ 1 ] [ 1 ] = = A [ 2 ] [ 2 ] - A [ 1 ] [ 2 ] : if A [ 0 ] [ 0 ] - A [ 0 ] [ 1 ] = = A [ 1 ] [ 0 ] - A [ 1 ] [ 1 ] = = A [ 2 ] [ 0 ] - A [ 2 ] [ 1 ] : if A [ 0 ] [ 2 ] - A [ 0 ] [ 1 ] = = A [ 1 ] [ 2 ] - A [ 1 ] [ 1 ] = = A [ 2 ] [ 2 ] - A [ 2 ] [ 1 ] : t = 1 if t = = 1 : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a = [ 0 ] * 3 b = [ 0 ] * 3 for i in range ( 3 ) : b [ i ] = c [ 0 ] [ i ] - a [ 0 ] for i in range ( 3 ) : a [ i ] = c [ i ] [ 0 ] - b [ 0 ] for i in range ( 3 ) : for j in range ( 3 ) : if a [ i ] + b [ j ] ! = c [ i ] [ j ] : print ( ' No ' ) exit ( ) print ( ' Yes ' ) def solve ( ) : c = [ [ int ( i ) for i in input ( ) . split ( ) ] for _ in range ( 3 ) ] for i in range ( 2 ) : for j in range ( 2 ) : if not c [ i ] [ j ] - c [ i + 1 ] [ j ] = = c [ i ] [ j + 1 ] - c [ i + 1 ] [ j + 1 ] : return ' No ' for i in range ( 2 ) : for j in range ( 2 ) : if not c [ j ] [ i ] - c [ j ] [ i + 1 ] = = c [ j + 1 ] [ i ] - c [ j + 1 ] [ i + 1 ] : return ' No ' return ' Yes ' if _ _ name _ _ = = ' _ _ main _ _ ' : print ( solve ( ) ) l = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] x = l [ 0 ] [ 0 ] y = l [ 0 ] [ 1 ] z = l [ 0 ] [ 2 ] a = 0 b = l [ 1 ] [ 0 ] - x c = l [ 2 ] [ 0 ] - x if b + y = = l [ 1 ] [ 1 ] and b + z = = l [ 1 ] [ 2 ] and c + y = = l [ 2 ] [ 1 ] and c + z = = l [ 2 ] [ 2 ] : print ( ' Yes ' ) else : print ( ' No ' ) M = [ ] for i in range ( 3 ) : row = list ( map ( int , input ( ) . split ( ) ) ) M . append ( row ) flg = True for i in range ( 3 ) : if M [ 0 ] [ i ] - M [ 0 ] [ i - 1 ] = = M [ 1 ] [ i ] - M [ 1 ] [ i - 1 ] = = M [ 2 ] [ i ] - M [ 2 ] [ i - 1 ] : continue else : flg = False if M [ i ] [ 0 ] - M [ i - 1 ] [ 0 ] = = M [ i ] [ 1 ] - M [ i - 1 ] [ 1 ] = = M [ i ] [ 2 ] - M [ i - 1 ] [ 2 ] : continue else : flg = False if flg : print ( " Yes " ) else : print ( " No " ) def solve ( ) : if not ( c11 - c21 = = c12 - c22 = = c13 - c23 ) : return False if not ( c11 - c31 = = c12 - c32 = = c13 - c33 ) : return False if not ( c11 - c12 = = c21 - c22 = = c31 - c32 ) : return False if not ( c11 - c13 = = c21 - c23 = = c31 - c33 ) : return False return True c11 , c12 , c13 = map ( int , input ( ) . split ( ) ) c21 , c22 , c23 = map ( int , input ( ) . split ( ) ) c31 , c32 , c33 = map ( int , input ( ) . split ( ) ) print ( ' Yes ' if solve ( ) else ' No ' ) xy = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] result = sum ( map ( sum , xy ) ) if result % 3 ! = 0 : print ( " No " ) exit ( ) if result ! = ( xy [ 0 ] [ 0 ] + xy [ 1 ] [ 1 ] + xy [ 2 ] [ 2 ] ) * 3 : print ( " No " ) exit ( ) if result ! = ( xy [ 0 ] [ 2 ] + xy [ 1 ] [ 1 ] + xy [ 2 ] [ 0 ] ) * 3 : print ( " No " ) exit ( ) else : print ( " Yes " ) a , b , c = [ int ( v ) for v in input ( ) . split ( ) ] d , e , f = [ int ( v ) for v in input ( ) . split ( ) ] g , h , i = [ int ( v ) for v in input ( ) . split ( ) ] if a + e + i = = d + h + c and a + e + i = = b + f + g : print ( " Yes " ) else : print ( " No " ) [ ( a , b , c ) , ( d , e , f ) , ( g , h , i ) ] = [ map ( int , input ( ) . split ( ) ) for _ in range ( 3 ) ] print ( " Yes " if a - b = = d - e = = g - h and b - c = = e - f = = h - i else " No " ) C = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] print ( " YNeos " [ not all ( C [ i ] [ j ] + C [ ( i + 1 ) % 3 ] [ ( j + 1 ) % 3 ] = = C [ ( i + 1 ) % 3 ] [ j ] + C [ i ] [ ( j + 1 ) % 3 ] for i in range ( 3 ) for j in range ( 3 ) ) : : 2 ] ) C = [ ] for i in range ( 0 , 3 ) : C . append ( [ int ( x ) for x in input ( ) . split ( ' ' ) ] ) def sol ( ) : if ( sum ( C [ 0 ] ) - sum ( C [ 1 ] ) ) % 3 ! = 0 : return ( ' No ' ) elif ( sum ( C [ 1 ] ) - sum ( C [ 2 ] ) ) % 3 ! = 0 : return ( ' No ' ) elif ( sum ( C [ 2 ] ) - sum ( C [ 0 ] ) ) % 3 ! = 0 : return ( ' No ' ) elif ( C [ 0 ] [ 0 ] + C [ 1 ] [ 0 ] + C [ 2 ] [ 0 ] - ( C [ 0 ] [ 1 ] + C [ 1 ] [ 1 ] + C [ 2 ] [ 1 ] ) ) % 3 ! = 0 : return ( ' No ' ) elif ( C [ 0 ] [ 1 ] + C [ 1 ] [ 1 ] + C [ 2 ] [ 1 ] - ( C [ 0 ] [ 2 ] + C [ 1 ] [ 2 ] + C [ 2 ] [ 2 ] ) ) % 3 ! = 0 : return ( ' No ' ) elif ( C [ 0 ] [ 2 ] + C [ 1 ] [ 2 ] + C [ 2 ] [ 2 ] - ( C [ 0 ] [ 0 ] + C [ 1 ] [ 0 ] + C [ 2 ] [ 0 ] ) ) % 3 ! = 0 : return ( ' No ' ) else : return ( ' Yes ' ) print ( sol ( ) ) cs = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] r _ sum = [ sum ( l ) for l in cs ] total = sum ( r _ sum ) ok = True for i in range ( 3 ) : diffs = [ cs [ i ] [ j ] - cs [ ( i + 1 ) % 3 ] [ j ] for j in range ( 3 ) ] d0 = diffs [ 0 ] for j in range ( 1 , 3 ) : if diffs [ j ] ! = d0 : ok = False break if not ok : break if ok : print ( ' Yes ' ) else : print ( ' No ' ) import numpy as np c1 = list ( map ( int , input ( ) . split ( ) ) ) A = np . array ( c1 ) c1 = list ( map ( int , input ( ) . split ( ) ) ) B = np . array ( c1 ) c1 = list ( map ( int , input ( ) . split ( ) ) ) C = np . array ( c1 ) D = A - B D1 = list ( D ) D1 = set ( D1 ) if len ( D1 ) = = 1 : pass else : print ( ' No ' ) exit ( ) E = B - C E1 = list ( E ) E1 = set ( E1 ) if len ( E1 ) = = 1 : print ( ' Yes ' ) else : print ( ' No ' ) import string import sys from itertools import chain , dropwhile , takewhile def read ( * shape , f = int , it = chain . from _ iterable ( sys . stdin ) , whitespaces = set ( string . whitespace ) ) : def read _ word ( ) : w = lambda c : c in whitespaces nw = lambda c : c not in whitespaces return f ( " " . join ( takewhile ( nw , dropwhile ( w , it ) ) ) ) if not shape : return read _ word ( ) elif len ( shape ) = = 1 : return [ read _ word ( ) for _ in range ( shape [ 0 ] ) ] elif len ( shape ) = = 2 : return [ [ read _ word ( ) for _ in range ( shape [ 1 ] ) ] for _ in range ( shape [ 0 ] ) ] def readi ( * shape ) : return read ( * shape ) def readi1 ( * shape ) : return [ i - 1 for i in read ( * shape ) ] def readf ( * shape ) : return read ( * shape , f = float ) def reads ( * shape ) : return read ( * shape , f = str ) def arr ( * shape , fill _ value = 0 ) : if len ( shape ) = = 1 : return [ fill _ value ] * shape [ fill _ value ] elif len ( shape ) = = 2 : return [ [ fill _ value ] * shape [ 1 ] for _ in range ( shape [ 0 ] ) ] def dbg ( * * kwargs ) : print ( " , " . join ( " { } = { } " . format ( k , repr ( v ) ) for k , v in kwargs . items ( ) ) , file = sys . stderr , ) def main ( ) : c = readi ( 3 , 3 ) d = list ( zip ( * c ) ) print ( " Yes " if all ( len ( set ( i - j for i , j in zip ( e [ n ] , e [ m ] ) ) ) = = 1 for e in [ c , d ] for n in range ( 3 ) for m in range ( n ) ) else " No " ) if _ _ name _ _ = = " _ _ main _ _ " : main ( ) d = [ None ] * 3 for i in range ( 3 ) : c = list ( map ( int , input ( ) . split ( ) ) ) d [ i ] = [ c [ i ] - c [ i + 1 ] for i in range ( 2 ) ] print ( ' Yes ' if all ( d [ i ] = = d [ i + 1 ] for i in range ( 2 ) ) else ' No ' ) C = [ ] for i in range ( 3 ) : C . append ( list ( map ( int , input ( ) . split ( ) ) ) ) A = [ 0 ] B = [ C [ 0 ] [ i ] - A [ 0 ] for i in range ( 3 ) ] for i in range ( 1 , 3 ) : A . append ( C [ i ] [ 0 ] - B [ 0 ] ) for i , a in enumerate ( A ) : for j , b in enumerate ( B ) : if a + b ! = C [ i ] [ j ] : print ( " No " ) exit ( ) print ( " Yes " ) points = [ [ None for j in range ( 3 ) ] for i in range ( 3 ) ] from itertools import product for i in range ( 3 ) : c1 , c2 , c3 = map ( int , input ( ) . split ( ) ) points [ i ] [ 0 ] = c1 points [ i ] [ 1 ] = c2 points [ i ] [ 2 ] = c3 valid = False for a1 in range ( 101 ) : maxA1 = min ( points [ 0 ] ) if a1 > maxA1 : continue b1 = points [ 0 ] [ 0 ] - a1 b2 = points [ 0 ] [ 1 ] - a1 b3 = points [ 0 ] [ 2 ] - a1 a2 = points [ 1 ] [ 0 ] - b1 a3 = points [ 2 ] [ 0 ] - b1 A = { 0 : a1 , 1 : a2 , 2 : a3 } B = { 0 : b1 , 1 : b2 , 2 : b3 } for i in range ( 3 ) : for j in range ( 3 ) : if points [ i ] [ j ] ! = A [ i ] + B [ j ] : print ( " No " ) exit ( ) print ( " Yes " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] ans = " Yes " for i in range ( 1 , 3 ) : if c [ i ] [ 0 ] - c [ 0 ] [ 0 ] ! = c [ i ] [ 1 ] - c [ 0 ] [ 1 ] or c [ i ] [ 1 ] - c [ 0 ] [ 1 ] ! = c [ i ] [ 2 ] - c [ 0 ] [ 2 ] : ans = " No " print ( ans ) c = [ ] for i in range ( 3 ) : x = list ( map ( int , input ( ) . split ( ) ) ) c . append ( x ) flag = False if c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] : if c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] : if c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 2 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 2 ] : if c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] : if c [ 0 ] [ 0 ] - c [ 2 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 2 ] [ 1 ] = = c [ 0 ] [ 2 ] - c [ 2 ] [ 2 ] : if c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] : flag = True if flag : print ( ' Yes ' ) else : print ( ' No ' ) import numpy as np A = np . array ( [ list ( map ( int , input ( ) . split ( ) ) ) for I in range ( 3 ) ] ) for I in range ( 3 ) : j , k , l = A [ 1 ] - A [ 0 ] if not ( j = = k and k = = l ) : print ( " No " ) quit ( ) j , k , l = A [ 2 ] - A [ 0 ] if not ( j = = k and k = = l ) : print ( " No " ) quit ( ) print ( " Yes " ) A = list ( map ( int , input ( ) . split ( ) ) ) A + = list ( map ( int , input ( ) . split ( ) ) ) A + = list ( map ( int , input ( ) . split ( ) ) ) flag = 0 for a1 in range ( 101 ) : for a2 in range ( 101 ) : for a3 in range ( 101 ) : b1 = A [ 6 ] - a1 b2 = A [ 7 ] - a1 b3 = A [ 8 ] - a1 if b1 < 0 or b2 < 0 or b3 < 0 : break if a3 + b1 = = A [ 0 ] and a3 + b2 = = A [ 1 ] and a3 + b3 = = A [ 2 ] and a2 + b1 = = A [ 3 ] and a2 + b2 = = A [ 4 ] and a2 + b3 = = A [ 5 ] : flag = 1 print ( " Yes " if flag = = 1 else " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] c1 _ 2 = [ ] for i in range ( 3 ) : c1 _ 1 = [ ] for j in range ( 2 ) : c1 _ 1 . append ( c [ i ] [ j ] - c [ i ] [ j + 1 ] ) c1 _ 2 . append ( c1 _ 1 ) c1 _ 1 = [ ] for i in range ( 3 ) : for j in range ( 1 ) : c1 _ 1 . append ( c1 _ 2 [ i ] [ j ] - c1 _ 2 [ i ] [ j + 1 ] ) if ( len ( set ( c1 _ 1 ) ) = = 1 ) : print ( " Yes " ) else : print ( " No " ) import sys c _ ls = [ ] for i in range ( 3 ) : c = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] c _ ls . append ( c ) yoko = [ c _ ls [ 0 ] [ i + 1 ] - c _ ls [ 0 ] [ i ] for i in range ( 2 ) ] flg = True for i in range ( 3 ) : flg & = yoko = = [ c _ ls [ i ] [ j + 1 ] - c _ ls [ i ] [ j ] for j in range ( 2 ) ] print ( " Yes " if flg else " No " ) c = [ [ int ( i ) for i in input ( ) . split ( ) ] for j in range ( 3 ) ] f = True a , b = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] , c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] for i in range ( 1 , 3 ) : if not ( c [ i ] [ 0 ] - c [ i ] [ 1 ] = = a and c [ i ] [ 1 ] - c [ i ] [ 2 ] = = b ) : f = False a , b = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] , c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] for i in range ( 1 , 3 ) : if not ( c [ 0 ] [ i ] - c [ 1 ] [ i ] = = a and c [ 1 ] [ i ] - c [ 2 ] [ i ] = = b ) : f = False print ( " Yes " if f else " No " ) X = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] if ( X [ 1 ] [ 0 ] - X [ 0 ] [ 0 ] = = X [ 1 ] [ 1 ] - X [ 0 ] [ 1 ] = = X [ 1 ] [ 2 ] - X [ 0 ] [ 2 ] and \ X [ 2 ] [ 0 ] - X [ 0 ] [ 0 ] = = X [ 2 ] [ 1 ] - X [ 0 ] [ 1 ] = = X [ 2 ] [ 2 ] - X [ 0 ] [ 2 ] ) : print ( " Yes " ) else : print ( " No " ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a = [ 0 for _ in range ( 3 ) ] b = [ 0 for _ in range ( 3 ) ] A = [ sum ( c ) for c in C ] B = [ C [ 0 ] [ i ] + C [ 1 ] [ i ] + C [ 2 ] [ i ] for i in range ( 3 ) ] is _ correct = True for i in range ( 3 ) : for j in range ( i , 3 ) : if abs ( A [ i ] - A [ j ] ) % 3 ! = 0 : is _ correct = False if abs ( B [ i ] - B [ j ] ) % 3 ! = 0 : is _ correct = False print ( " Yes " if is _ correct else " No " ) ls = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] cnt = 0 for i in range ( 3 ) : for j in range ( 3 ) : if ls [ i % 3 ] [ j % 3 ] - ls [ i % 3 ] [ ( j + 1 ) % 3 ] = = ls [ ( i + 1 ) % 3 ] [ j % 3 ] - ls [ ( i + 1 ) % 3 ] [ ( j + 1 ) % 3 ] : cnt + = 1 print ( ' Yes ' if cnt = = 9 else ' No ' ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] Dif _ H = [ [ ] for _ in range ( 3 ) ] Dif _ V = [ [ ] for _ in range ( 3 ) ] for i in range ( 3 ) : Dif _ H [ i ] = [ C [ i ] [ 0 ] - C [ i ] [ 1 ] , C [ i ] [ 1 ] - C [ i ] [ 2 ] , C [ i ] [ 2 ] - C [ i ] [ 0 ] ] for i in range ( 3 ) : Dif _ V [ i ] = [ C [ 0 ] [ i ] - C [ 1 ] [ i ] , C [ 1 ] [ i ] - C [ 2 ] [ i ] , C [ 2 ] [ i ] - C [ 0 ] [ i ] ] if Dif _ H [ 0 ] = = Dif _ H [ 1 ] = = Dif _ H [ 2 ] and Dif _ V [ 0 ] = = Dif _ V [ 1 ] = = Dif _ V [ 2 ] : print ( ' Yes ' ) else : print ( ' No ' ) c = [ ' ' for _ in range ( 3 ) ] c [ 0 ] = list ( map ( int , input ( ) . split ( ) ) ) c [ 1 ] = list ( map ( int , input ( ) . split ( ) ) ) c [ 2 ] = list ( map ( int , input ( ) . split ( ) ) ) ans = ' Yes ' for i in range ( 2 ) : line = [ 0 for _ in range ( 3 ) ] column = [ 0 for _ in range ( 3 ) ] for j in range ( 3 ) : line [ j ] = c [ i + 1 ] [ j ] - c [ i ] [ j ] column [ j ] = c [ i + 1 ] [ j ] - c [ i ] [ j ] if len ( set ( line ) ) ! = 1 or len ( set ( column ) ) ! = 1 : ans = ' No ' break print ( ans ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a = [ 0 ] * 3 b = [ 0 ] * 3 b [ 0 ] , b [ 1 ] , b [ 2 ] = C [ 0 ] [ 0 ] , C [ 0 ] [ 1 ] , C [ 0 ] [ 2 ] a [ 0 ] , a [ 1 ] , a [ 2 ] = 0 , C [ 1 ] [ 0 ] - b [ 0 ] , C [ 2 ] [ 0 ] - b [ 0 ] ans = " Yes " for i in range ( 3 ) : for j in range ( 3 ) : if C [ i ] [ j ] = = ( a [ i ] + b [ j ] ) : pass else : ans = " No " break print ( ans ) import sys input = sys . stdin . readline grid = [ ] for i in range ( 3 ) : aa = list ( map ( int , input ( ) . split ( ) ) ) grid . append ( aa ) flag = True for i in range ( 2 ) : for j in range ( i + 1 , 3 ) : c = grid [ i ] [ 0 ] - grid [ j ] [ 0 ] for k in range ( 1 , 3 ) : if ( c ! = ( grid [ i ] [ 1 ] - grid [ j ] [ 1 ] ) or c ! = ( grid [ i ] [ 2 ] - grid [ j ] [ 2 ] ) ) : flag = False for i in range ( 2 ) : for j in range ( i + 1 , 3 ) : c = grid [ 0 ] [ i ] - grid [ 0 ] [ j ] for k in range ( 1 , 3 ) : if ( c ! = ( grid [ 1 ] [ i ] - grid [ 1 ] [ j ] ) or c ! = ( grid [ 2 ] [ i ] - grid [ 2 ] [ j ] ) ) : flag = False if ( flag ) : print ( " Yes " ) else : print ( " No " ) A1 = 0 B1 , B2 , B3 = map ( int , input ( ) . split ( ) ) C1 , C2 , C3 = map ( int , input ( ) . split ( ) ) D1 , D2 , D3 = map ( int , input ( ) . split ( ) ) flag = 0 if not ( C2 - B2 = = C1 - B1 and C3 - B3 = = C1 - B1 and C2 - B2 = = C3 - B3 ) : flag = 1 if not ( D2 - B2 = = D1 - B1 and D3 - B3 = = D1 - B1 and D2 - B2 = = D3 - B3 ) : flag = 1 print ( " Yes " if flag = = 0 else " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for a1 in range ( 100 ) : b1 = c [ 0 ] [ 0 ] - a1 b2 = c [ 0 ] [ 1 ] - a1 b3 = c [ 0 ] [ 2 ] - a1 a2 = c [ 1 ] [ 0 ] - b1 a3 = c [ 2 ] [ 0 ] - b1 if ( a2 + b2 ) = = c [ 1 ] [ 1 ] and ( a2 + b3 ) = = c [ 1 ] [ 2 ] and ( a3 + b2 ) = = c [ 2 ] [ 1 ] and ( a3 + b3 ) = = c [ 2 ] [ 2 ] : print ( " Yes " ) break else : print ( " No " ) N = 3 C = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] f = True for i in range ( N - 1 ) : a = C [ i ] [ 0 ] - C [ i + 1 ] [ 0 ] b = C [ i ] [ 1 ] - C [ i + 1 ] [ 1 ] c = C [ i ] [ 2 ] - C [ i + 1 ] [ 2 ] if a = = b = = c : continue else : f = False for j in range ( N - 1 ) : a = C [ 0 ] [ j ] - C [ 0 ] [ j + 1 ] b = C [ 1 ] [ j ] - C [ 1 ] [ j + 1 ] c = C [ 2 ] [ j ] - C [ 2 ] [ j + 1 ] if a = = b = = c : continue else : f = False if f : print ( ' Yes ' ) else : print ( ' No ' ) c = [ ] for h in range ( 3 ) : c . append ( [ int ( x ) for x in input ( ) . split ( ) ] ) b = c [ 0 ] a = [ 0 , c [ 1 ] [ 0 ] - b [ 0 ] , c [ 2 ] [ 0 ] - b [ 0 ] ] for n in range ( 1 , 3 ) : for h in range ( 1 , 3 ) : if c [ h ] [ n ] ! = a [ h ] + b [ n ] : print ( " No " ) exit ( ) print ( " Yes " ) [ ( a , b , c ) , ( d , e , f ) , ( g , h , i ) ] = [ map ( int , input ( ) . split ( ) ) for i in range ( 3 ) ] if a - b = = d - e = = g - h and b - c = = e - f = = h - i : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] for i in range ( 2 ) : if ( c [ i + 1 ] [ 0 ] - c [ i ] [ 0 ] ) = = ( c [ i + 1 ] [ 1 ] - c [ i ] [ 1 ] ) = = ( c [ i + 1 ] [ 2 ] - c [ i ] [ 2 ] ) : continue else : print ( ' No ' ) exit ( 0 ) for j in range ( 2 ) : if ( c [ 0 ] [ j + 1 ] - c [ 0 ] [ j ] ) = = ( c [ 1 ] [ j + 1 ] - c [ 1 ] [ j ] ) = = ( c [ 2 ] [ j + 1 ] - c [ 2 ] [ j ] ) : continue else : print ( ' No ' ) exit ( 0 ) print ( ' Yes ' ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 1 , 3 ) : if C [ i ] [ 0 ] - C [ 0 ] [ 0 ] = = C [ i ] [ 1 ] - C [ 0 ] [ 1 ] and C [ i ] [ 0 ] - C [ 0 ] [ 0 ] = = C [ i ] [ 2 ] - C [ 0 ] [ 2 ] : pass else : print ( " No " ) exit ( ) print ( " Yes " ) l = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] flag = " No " if l [ 0 ] [ 1 ] - l [ 0 ] [ 0 ] = = l [ 1 ] [ 1 ] - l [ 1 ] [ 0 ] = = l [ 2 ] [ 1 ] - l [ 2 ] [ 0 ] : if l [ 0 ] [ 2 ] - l [ 0 ] [ 1 ] = = l [ 1 ] [ 2 ] - l [ 1 ] [ 1 ] = = l [ 2 ] [ 2 ] - l [ 2 ] [ 1 ] : flag = " Yes " print ( flag ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] flag = True if not C [ 0 ] [ 0 ] - C [ 0 ] [ 1 ] = = C [ 1 ] [ 0 ] - C [ 1 ] [ 1 ] = = C [ 2 ] [ 0 ] - C [ 2 ] [ 1 ] : flag = False if not C [ 0 ] [ 1 ] - C [ 0 ] [ 2 ] = = C [ 1 ] [ 1 ] - C [ 1 ] [ 2 ] = = C [ 2 ] [ 1 ] - C [ 2 ] [ 2 ] : flag = False print ( " Yes " if flag is True else " No " ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 2 ) : for j in range ( 2 ) : if C [ i + 1 ] [ j ] - C [ i ] [ j ] ! = C [ i + 1 ] [ j + 1 ] - C [ i ] [ j + 1 ] : print ( ' No ' ) exit ( ) print ( ' Yes ' ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a = [ 0 ] * 3 b = [ 0 ] * 3 for j in range ( 3 ) : b [ j ] = C [ 0 ] [ j ] - a [ 0 ] for i in range ( 3 ) : a [ i ] = C [ i ] [ 0 ] - b [ 0 ] ans = True for i in range ( 1 , 3 ) : for j in range ( 1 , 3 ) : if C [ i ] [ j ] ! = a [ i ] + b [ j ] : ans = False print ( ' Yes ' if ans else ' No ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] import sys a = [ 0 , 0 , 0 ] b = [ 0 , 0 , 0 ] min _ 1 = min ( c [ 0 ] ) for j in range ( 0 , min _ 1 + 1 ) : a [ 0 ] = j b [ 0 ] = c [ 0 ] [ 0 ] - j b [ 1 ] = c [ 0 ] [ 1 ] - j b [ 2 ] = c [ 0 ] [ 2 ] - j a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] if a [ 1 ] < 0 or a [ 2 ] < 0 : continue for i in [ 1 , 2 ] : for k in [ 1 , 2 ] : if c [ i ] [ k ] ! = a [ i ] + b [ k ] : break else : if i = = 2 and k = = 2 : print ( " Yes " ) sys . exit ( ) else : continue break print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] ans = " Yes " for i in range ( 1 , 3 ) : if c [ i ] [ 0 ] - c [ 0 ] [ 0 ] ! = c [ i ] [ 1 ] - c [ 0 ] [ 1 ] or c [ i ] [ 1 ] - c [ 0 ] [ 1 ] ! = c [ i ] [ 2 ] - c [ 0 ] [ 2 ] : ans = " No " print ( ans ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] ans = " Yes " for i in range ( 2 ) : if c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] = = c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] : pass else : ans = " No " print ( ans ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] and c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] and c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] and c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] : print ( " Yes " ) else : print ( " No " ) g = [ ] for i in range ( 3 ) : g . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( 1 , 3 ) : offset = g [ i ] [ 0 ] - g [ 0 ] [ 0 ] if not ( ( g [ i ] [ 1 ] - g [ 0 ] [ 1 ] = = offset ) and ( g [ i ] [ 2 ] - g [ 0 ] [ 2 ] = = offset ) ) : print ( " No " ) exit ( ) print ( " Yes " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] m = 0 for col in c : for v in col : m = max ( m , v ) for a1 in range ( m + 1 ) : b1 = c [ 0 ] [ 0 ] - a1 b2 = c [ 0 ] [ 1 ] - a1 b3 = c [ 0 ] [ 2 ] - a1 a2 = c [ 1 ] [ 0 ] - b1 a3 = c [ 2 ] [ 0 ] - b1 if a2 + b2 ! = c [ 1 ] [ 1 ] : continue elif a2 + b3 ! = c [ 1 ] [ 2 ] : continue elif a3 + b2 ! = c [ 2 ] [ 1 ] : continue elif a3 + b3 ! = c [ 2 ] [ 2 ] : continue else : print ( ' Yes ' ) break else : print ( ' No ' ) l = [ ] for i in range ( 3 ) : ll = [ int ( x ) for x in input ( ) . split ( ) ] l . append ( ll ) if l [ 0 ] [ 0 ] - l [ 0 ] [ 1 ] ! = l [ 1 ] [ 0 ] - l [ 1 ] [ 1 ] or l [ 2 ] [ 0 ] - l [ 2 ] [ 1 ] ! = l [ 1 ] [ 0 ] - l [ 1 ] [ 1 ] : print ( " No " ) exit ( ) if l [ 0 ] [ 2 ] - l [ 0 ] [ 1 ] ! = l [ 1 ] [ 2 ] - l [ 1 ] [ 1 ] or l [ 2 ] [ 2 ] - l [ 2 ] [ 1 ] ! = l [ 1 ] [ 2 ] - l [ 1 ] [ 1 ] : print ( " No " ) exit ( ) if l [ 0 ] [ 0 ] - l [ 1 ] [ 0 ] ! = l [ 0 ] [ 1 ] - l [ 1 ] [ 1 ] or l [ 0 ] [ 2 ] - l [ 1 ] [ 2 ] ! = l [ 0 ] [ 1 ] - l [ 1 ] [ 1 ] : print ( " No " ) exit ( ) if l [ 2 ] [ 0 ] - l [ 1 ] [ 0 ] ! = l [ 2 ] [ 1 ] - l [ 1 ] [ 1 ] or l [ 2 ] [ 2 ] - l [ 1 ] [ 2 ] ! = l [ 2 ] [ 1 ] - l [ 1 ] [ 1 ] : print ( " No " ) exit ( ) print ( " Yes " ) a , b , c = map ( int , input ( ) . split ( ) ) aa , bb , cc = map ( int , input ( ) . split ( ) ) aaa , bbb , ccc = map ( int , input ( ) . split ( ) ) ans = " No " if a - aa = = b - bb and b - bb = = c - cc : if aa - aaa = = bb - bbb and bb - bbb = = cc - ccc : if a - b = = aa - bb and aa - bb = = aaa - bbb : if b - c = = bb - cc and bb - cc = = bbb - ccc : ans = " Yes " print ( ans ) import numpy as np X = np . array ( [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] ) T = True if X [ 0 ] [ 0 ] - X [ 0 ] [ 1 ] = = X [ 1 ] [ 0 ] - X [ 1 ] [ 1 ] = = X [ 2 ] [ 0 ] - X [ 2 ] [ 1 ] \ and X [ 0 ] [ 1 ] - X [ 0 ] [ 2 ] = = X [ 1 ] [ 1 ] - X [ 1 ] [ 2 ] = = X [ 2 ] [ 1 ] - X [ 2 ] [ 2 ] : pass else : T = False X = X . T if X [ 0 ] [ 0 ] - X [ 0 ] [ 1 ] = = X [ 1 ] [ 0 ] - X [ 1 ] [ 1 ] = = X [ 2 ] [ 0 ] - X [ 2 ] [ 1 ] \ and X [ 0 ] [ 1 ] - X [ 0 ] [ 2 ] = = X [ 1 ] [ 1 ] - X [ 1 ] [ 2 ] = = X [ 2 ] [ 1 ] - X [ 2 ] [ 2 ] : pass else : T = False print ( " Yes " if T else " No " ) def myAnswer ( C : list ) - > int : return " Yes " if ( C [ 0 ] [ 0 ] + C [ 1 ] [ 1 ] + C [ 2 ] [ 2 ] = = C [ 0 ] [ 1 ] + C [ 1 ] [ 2 ] + C [ 2 ] [ 0 ] = = C [ 0 ] [ 2 ] + C [ 1 ] [ 0 ] + C [ 2 ] [ 1 ] ) else " No " def modelAnswer ( ) : return def main ( ) : C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] print ( myAnswer ( C [ : ] ) ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) r = range M = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in r ( 3 ) ] for i in r ( 2 ) : x = M [ 0 ] [ i ] - M [ 0 ] [ i + 1 ] y = M [ i ] [ 0 ] - M [ i + 1 ] [ 0 ] for j in r ( 3 ) : if x ! = M [ j ] [ i ] - M [ j ] [ i + 1 ] or y ! = M [ i ] [ j ] - M [ i + 1 ] [ j ] : print ( ' No ' ) exit ( ) print ( ' Yes ' ) c = [ ] for i in range ( 3 ) : c _ = list ( map ( int , input ( ) . split ( ) ) ) c . append ( c _ ) if c [ 2 ] [ 2 ] = = c [ 0 ] [ 2 ] + c [ 2 ] [ 0 ] - c [ 0 ] [ 0 ] and c [ 2 ] [ 2 ] = = c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] and c [ 1 ] [ 1 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] : print ( ' Yes ' ) else : print ( ' No ' ) c = [ [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( 3 ) ] ans = False for a _ 1 in range ( 101 ) : b _ 1 = c [ 0 ] [ 0 ] - a _ 1 b _ 2 = c [ 0 ] [ 1 ] - a _ 1 b _ 3 = c [ 0 ] [ 2 ] - a _ 1 a _ 2 = c [ 1 ] [ 0 ] - b _ 1 a _ 3 = c [ 2 ] [ 0 ] - b _ 1 if a _ 2 + b _ 2 = = c [ 1 ] [ 1 ] and a _ 2 + b _ 3 = = c [ 1 ] [ 2 ] and a _ 3 + b _ 2 = = c [ 2 ] [ 1 ] and a _ 3 + b _ 3 = = c [ 2 ] [ 2 ] : ans = True break if ans : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] \ = = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] \ = = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] \ = = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] : print ( ' Yes ' ) else : print ( ' No ' ) c = [ ] for i in range ( 3 ) : c _ i = list ( map ( int , input ( ) . split ( ) ) ) c . append ( c _ i ) h01 = c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] h12 = c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] v01 = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] v12 = c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] buf = 1 for i in range ( 1 , 3 ) : if c [ i ] [ 1 ] - c [ i ] [ 0 ] ! = h01 or c [ i ] [ 2 ] - c [ i ] [ 1 ] ! = h12 or c [ 1 ] [ i ] - c [ 0 ] [ i ] ! = v01 or c [ 2 ] [ i ] - c [ 1 ] [ i ] ! = v12 : buf = 0 break if buf = = 1 : print ( " Yes " ) else : print ( " No " ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if a [ 0 ] [ 1 ] - a [ 0 ] [ 0 ] = = a [ 1 ] [ 1 ] - a [ 1 ] [ 0 ] = = a [ 2 ] [ 1 ] - a [ 2 ] [ 0 ] and a [ 0 ] [ 2 ] - a [ 0 ] [ 0 ] = = a [ 1 ] [ 2 ] - a [ 1 ] [ 0 ] = = a [ 2 ] [ 2 ] - a [ 2 ] [ 0 ] : print ( ' Yes ' ) else : print ( ' No ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] OK = False for a1 in range ( 101 ) : for a2 in range ( 101 ) : for a3 in range ( 101 ) : a = [ a1 , a2 , a3 ] ok = True for j in range ( 3 ) : v = c [ 0 ] [ j ] - a [ 0 ] for i in range ( 2 ) : if c [ i + 1 ] [ j ] - a [ i + 1 ] ! = v : ok = False if ok : OK = True if OK : print ( ' Yes ' ) else : print ( ' No ' ) def resolve ( ) : grid = [ [ int ( i ) for i in input ( ) . split ( ) ] for _ in range ( 3 ) ] is _ flag = True for i in range ( 3 ) : A = grid [ 0 ] [ i - 1 ] - grid [ 0 ] [ i ] C = grid [ 2 ] [ i - 1 ] - grid [ 2 ] [ i ] B = grid [ 1 ] [ i - 1 ] - grid [ 1 ] [ i ] if A = = B and B = = C : pass else : is _ flag = False print ( ' Yes ' ) if is _ flag else print ( ' No ' ) if _ _ name _ _ = = " _ _ main _ _ " : resolve ( ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] ! = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] : print ( " No " ) exit ( ) if c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] ! = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] : print ( " No " ) exit ( ) if c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ! = c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] : print ( " No " ) exit ( ) if c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ! = c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] : print ( " No " ) exit ( ) print ( " Yes " ) import numpy as np def main ( ) - > None : c _ 1 = list ( map ( int , input ( ) . split ( ) ) ) c _ 2 = list ( map ( int , input ( ) . split ( ) ) ) c _ 3 = list ( map ( int , input ( ) . split ( ) ) ) c = np . array ( [ c _ 1 , c _ 2 , c _ 3 ] , dtype = int ) a = np . empty ( 3 , dtype = int ) b = np . empty ( 3 , dtype = int ) a [ 0 ] = 0 range _ 3 = range ( 3 ) for j in range _ 3 : b [ j ] = c _ 1 [ j ] - a [ 0 ] for i in range ( 1 , 3 ) : a [ i ] = c [ i ] [ 0 ] - b [ 0 ] good = True for i , a _ i in enumerate ( a ) : for j , b _ j in enumerate ( b ) : if a _ i + b _ j ! = c [ i ] [ j ] : good = False if good : print ( " Yes " ) else : print ( " No " ) if _ _ name _ _ = = " _ _ main _ _ " : main ( ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] x = [ 0 ] * 3 y = [ 0 ] * 3 flag = 0 for i in range ( 3 ) : y [ i ] = a [ 0 ] [ i ] x [ i ] = a [ i ] [ 0 ] - y [ 0 ] for j in range ( 3 ) : for k in range ( 3 ) : if not a [ j ] [ k ] = = ( x [ j ] + y [ k ] ) : flag = 1 break if flag = = 0 : print ( ' Yes ' ) else : print ( ' No ' ) X = list ( map ( int , input ( ) . split ( ) ) ) Y = list ( map ( int , input ( ) . split ( ) ) ) Z = list ( map ( int , input ( ) . split ( ) ) ) res = " Yes " for i in range ( 2 ) : if X [ i ] - X [ i + 1 ] = = Y [ i ] - Y [ i + 1 ] and X [ i ] - X [ i + 1 ] = = Z [ i ] - Z [ i + 1 ] : res = " No " break i if ( X [ 0 ] - X [ 1 ] = = Y [ 0 ] - Y [ 1 ] and X [ 0 ] - X [ 1 ] = = Z [ 0 ] - Z [ 1 ] and X [ 2 ] - X [ 1 ] = = Y [ 2 ] - Y [ 1 ] and X [ 2 ] - X [ 1 ] = = Z [ 2 ] - Z [ 1 ] ) : print ( " Yes " ) else : print ( " No " ) c = [ ] ans = " No " for i in range ( 3 ) : nc = list ( map ( int , input ( ) . split ( ) ) ) c . append ( nc ) if c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] and c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] and c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] and c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] : if c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] and c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] and c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] and c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] : ans = " Yes " print ( ans ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 3 ) : for j in range ( i + 1 , 3 ) : t = c [ i ] [ 0 ] - c [ j ] [ 0 ] for k in [ 1 , 2 ] : if t ! = c [ i ] [ k ] - c [ j ] [ k ] : print ( " No " ) exit ( 0 ) t = c [ 0 ] [ i ] - c [ 0 ] [ j ] for k in [ 1 , 2 ] : if t ! = c [ k ] [ i ] - c [ k ] [ j ] : print ( " No " ) exit ( 0 ) print ( " Yes " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 2 ) : for j in range ( 2 ) : d = c [ i ] [ j ] - c [ i + 1 ] [ j ] e = c [ i ] [ j + 1 ] - c [ i + 1 ] [ j + 1 ] if d ! = e : print ( " No " ) exit ( 0 ) for i in range ( 2 ) : for j in range ( 2 ) : d = c [ i ] [ j ] - c [ i ] [ j + 1 ] e = c [ i + 1 ] [ j ] - c [ i + 1 ] [ j + 1 ] if d ! = e : print ( " No " ) exit ( 0 ) print ( " Yes " ) import sys cl = [ ] for _ in range ( 3 ) : c = list ( map ( int , input ( ) . split ( ) ) ) cl . append ( c ) if cl [ 0 ] [ 0 ] + cl [ 1 ] [ 1 ] ! = cl [ 1 ] [ 0 ] + cl [ 0 ] [ 1 ] : print ( " No " ) sys . exit ( ) if cl [ 1 ] [ 1 ] + cl [ 2 ] [ 2 ] ! = cl [ 1 ] [ 2 ] + cl [ 2 ] [ 1 ] : print ( " No " ) sys . exit ( ) if cl [ 0 ] [ 0 ] + cl [ 2 ] [ 2 ] ! = cl [ 0 ] [ 2 ] + cl [ 2 ] [ 0 ] : print ( " No " ) sys . exit ( ) print ( " Yes " ) import numpy as np def test ( ) : c = np . array ( [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] ) a = c - np . min ( c , axis = 0 ) if a [ 0 ] [ 0 ] = = a [ 0 ] [ 1 ] = = a [ 0 ] [ 2 ] and a [ 1 ] [ 0 ] = = a [ 1 ] [ 1 ] = = a [ 1 ] [ 2 ] and a [ 2 ] [ 0 ] = = a [ 2 ] [ 1 ] = = a [ 2 ] [ 2 ] : print ( " Yes " ) else : print ( " No " ) if _ _ name _ _ = = " _ _ main _ _ " : test ( ) import numpy as np c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] c = np . array ( c ) flg = True for i in range ( 2 ) : if not c [ 0 , i ] - c [ 0 , i + 1 ] = = c [ 1 , i ] - c [ 1 , i + 1 ] = = c [ 2 , i ] - c [ 2 , i + 1 ] : flg = False break if not c [ i , 0 ] - c [ i + 1 , 0 ] = = c [ i , 1 ] - c [ i + 1 , 1 ] = = c [ i , 2 ] - c [ i + 1 , 2 ] : flg = False break print ( ' Yes ' ) if flg else print ( ' No ' ) mat = [ ] for i in range ( 3 ) : a = list ( map ( int , input ( ) . split ( ) ) ) mat . append ( a ) ans = False if mat [ 1 ] [ 0 ] - mat [ 0 ] [ 0 ] = = mat [ 1 ] [ 1 ] - mat [ 0 ] [ 1 ] = = mat [ 1 ] [ 2 ] - mat [ 0 ] [ 2 ] : if mat [ 2 ] [ 0 ] - mat [ 0 ] [ 0 ] = = mat [ 2 ] [ 1 ] - mat [ 0 ] [ 1 ] and mat [ 2 ] [ 1 ] - mat [ 0 ] [ 1 ] = = mat [ 2 ] [ 2 ] - mat [ 0 ] [ 2 ] : ans = True if ans : print ( " Yes " ) else : print ( " No " ) import sys , math , itertools , heapq , collections , bisect input = lambda : sys . stdin . buffer . readline ( ) . rstrip ( ) . decode ( ' utf-8 ' ) sys . setrecursionlimit ( 10 * * 8 ) inf = float ( ' inf ' ) ans = count = 0 B = list ( map ( int , input ( ) . split ( ) ) ) A2 = list ( map ( int , input ( ) . split ( ) ) ) tmp = A2 [ 0 ] - B [ 0 ] for i in range ( 3 ) : if not tmp = = A2 [ i ] - B [ i ] : print ( " No " ) exit ( ) A2 = list ( map ( int , input ( ) . split ( ) ) ) tmp = A2 [ 0 ] - B [ 0 ] for i in range ( 3 ) : if not tmp = = A2 [ i ] - B [ i ] : print ( " No " ) exit ( ) print ( " Yes " ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] Bs = [ C [ 0 ] [ i ] for i in range ( 3 ) ] As = [ 0 , C [ 1 ] [ 0 ] - Bs [ 0 ] , C [ 2 ] [ 0 ] - Bs [ 0 ] ] if all ( As [ i ] + Bs [ j ] = = C [ i ] [ j ] for i in range ( 3 ) for j in range ( 3 ) ) : print ( " Yes " ) else : print ( " No " ) l = [ ] for i in range ( 3 ) : l . append ( list ( map ( int , input ( ) . split ( ) ) ) ) std = l [ i ] [ 0 ] for j in range ( 3 ) : l [ i ] [ j ] - = std if l [ 0 ] = = l [ 1 ] and l [ 0 ] = = l [ 2 ] : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a1 = 0 b1 = c [ 0 ] [ 0 ] - a1 a2 = c [ 1 ] [ 0 ] - b1 b2 = c [ 0 ] [ 1 ] - a1 a3 = c [ 2 ] [ 0 ] - b1 b3 = c [ 0 ] [ 2 ] - a1 if a2 + b2 ! = c [ 1 ] [ 1 ] : print ( " No " ) exit ( ) if a2 + b3 ! = c [ 1 ] [ 2 ] : print ( " No " ) exit ( ) if a3 + b2 ! = c [ 2 ] [ 1 ] : print ( " No " ) exit ( ) if a3 + b3 ! = c [ 2 ] [ 2 ] : print ( " No " ) exit ( ) print ( " Yes " ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) if a [ 0 ] - b [ 0 ] = = a [ 1 ] - b [ 1 ] = = a [ 2 ] - b [ 2 ] and b [ 0 ] - c [ 0 ] = = b [ 1 ] - c [ 1 ] = = b [ 2 ] - c [ 2 ] : print ( ' Yes ' ) else : print ( ' No ' ) a = [ list ( map ( int , input ( ) . split ( ) ) ) , list ( map ( int , input ( ) . split ( ) ) ) , list ( map ( int , input ( ) . split ( ) ) ) ] def main ( ) : for i in range ( 1 , 3 ) : x = a [ 0 ] [ 0 ] - a [ 0 ] [ i ] = = a [ 1 ] [ 0 ] - a [ 1 ] [ i ] = = a [ 2 ] [ 0 ] - a [ 2 ] [ i ] y = a [ 0 ] [ 0 ] - a [ i ] [ 0 ] = = a [ 0 ] [ 1 ] - a [ i ] [ 1 ] = = a [ 0 ] [ 2 ] - a [ i ] [ 2 ] if x is False or y is False : return " No " return " Yes " if _ _ name _ _ = = " _ _ main _ _ " : print ( main ( ) ) c = [ ] for i in range ( 3 ) : x = list ( map ( int , input ( ) . split ( ) ) ) c . append ( x ) a = [ 0 ] * 3 b = [ 0 ] * 3 x = 0 for i in range ( 3 ) : a [ i ] = c [ i ] [ 0 ] - x for i in range ( 3 ) : b [ i ] = c [ 0 ] [ i ] - a [ 0 ] flag = True for i in range ( 3 ) : for j in range ( 3 ) : x = a [ i ] + b [ j ] if x ! = c [ i ] [ j ] : flag = False if flag : print ( " Yes " ) else : print ( " No " ) c = [ tuple ( map ( int , input ( ) . split ( ' ' ) ) ) for _ in range ( 3 ) ] def diff ( arr ) : return tuple ( [ pre _ x - x for pre _ x , x in zip ( arr [ : - 1 ] , arr [ 1 : ] ) ] ) diffs = [ diff ( row ) for row in c ] if diffs [ 0 ] = = diffs [ 1 ] = = diffs [ 2 ] : print ( ' Yes ' ) else : print ( ' No ' ) c = [ input ( ) . split ( ) for i in range ( 3 ) ] for i in range ( 3 ) : for j in range ( 3 ) : c [ i ] [ j ] = int ( c [ i ] [ j ] ) for i in range ( 100 ) : for j in range ( 100 ) : if i + j = = c [ 0 ] [ 0 ] : a0 , b0 = i , j a1 , b1 = c [ 1 ] [ 0 ] - b0 , c [ 0 ] [ 1 ] - a0 a2 , b2 = c [ 2 ] [ 0 ] - b0 , c [ 0 ] [ 2 ] - a0 if ( a1 + b1 = = c [ 1 ] [ 1 ] ) and ( a1 + b2 = = c [ 1 ] [ 2 ] ) and ( a2 + b1 = = c [ 2 ] [ 1 ] ) and ( a2 + b2 = = c [ 2 ] [ 2 ] ) : print ( " Yes " ) exit ( ) print ( " No " ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c3 = list ( map ( int , input ( ) . split ( ) ) ) c = [ c1 , c2 , c3 ] for a1 in range ( 100 ) : b1 = c1 [ 0 ] - a1 b2 = c1 [ 1 ] - a1 b3 = c1 [ 2 ] - a1 a21 = c2 [ 0 ] - b1 a22 = c2 [ 1 ] - b2 a23 = c2 [ 2 ] - b3 a31 = c3 [ 0 ] - b1 a32 = c3 [ 1 ] - b2 a33 = c3 [ 2 ] - b3 if ( a21 = = a22 = = a23 ) and ( a31 = = a32 = = a33 ) : print ( ' Yes ' ) break elif a1 = = 99 : print ( ' No ' ) break else : continue * m , = map ( int , open ( 0 ) . read ( ) . split ( ) ) b = m [ : 3 ] a = [ 0 , m [ 3 ] - b [ 0 ] , m [ 6 ] - b [ 0 ] ] for i in range ( 9 ) : if m [ i ] ! = a [ i / / 3 ] + b [ i % 3 ] : print ( " No " ) exit ( ) print ( " Yes " ) c = [ ] for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) n1 = max ( c [ 0 ] ) n2 = max ( c [ 1 ] ) n3 = max ( c [ 2 ] ) ans = ' No ' for a1 in range ( n1 + 1 ) : for a2 in range ( n2 + 1 ) : for a3 in range ( n3 + 1 ) : if c [ 0 ] [ 0 ] - a1 = = c [ 1 ] [ 0 ] - a2 = = c [ 2 ] [ 0 ] - a3 : if c [ 0 ] [ 1 ] - a1 = = c [ 1 ] [ 1 ] - a2 = = c [ 2 ] [ 1 ] - a3 : if c [ 0 ] [ 2 ] - a1 = = c [ 1 ] [ 2 ] - a2 = = c [ 2 ] [ 2 ] - a3 : ans = ' Yes ' break print ( ans ) import sys c = [ list ( map ( int , l . split ( ) ) ) for l in sys . stdin . read ( ) . splitlines ( ) ] for i in range ( 2 ) : c [ 2 - i ] = [ x - y for x , y in zip ( c [ 2 - i ] , c [ 1 - i ] ) ] for i in range ( 2 ) : for j in range ( 3 ) : c [ j ] [ 2 - i ] - = c [ j ] [ 1 - i ] if c [ 1 ] [ 1 : ] = = c [ 2 ] [ 1 : ] = = [ 0 , 0 ] : print ( ' Yes ' ) else : print ( ' No ' ) from itertools import permutations l = list ( range ( 3 ) ) l = list ( permutations ( l , 2 ) ) C = [ [ 0 ] * 3 for i in range ( 3 ) ] r = ' Yes ' for i in range ( 3 ) : C [ i ] = list ( map ( int , input ( ) . split ( ) ) ) for i in l : if not C [ 0 ] [ i [ 0 ] ] - C [ 0 ] [ i [ 1 ] ] = = C [ 1 ] [ i [ 0 ] ] - C [ 1 ] [ i [ 1 ] ] = = C [ 2 ] [ i [ 0 ] ] - C [ 2 ] [ i [ 1 ] ] : r = ' No ' break print ( r ) c11 , c12 , c13 = list ( map ( int , input ( ) . split ( ) ) ) c21 , c22 , c23 = list ( map ( int , input ( ) . split ( ) ) ) c31 , c32 , c33 = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( min ( c11 , c12 , c13 ) + 1 ) : t1 = c11 - i t2 = c12 - i t3 = c13 - i if c21 - t1 = = c22 - t2 and c21 - t1 = = c23 - t3 and c31 - t1 = = c32 - t2 and c31 - t1 = = c33 - t3 : print ( " Yes " ) break else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if not ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) : print ( ' No ' ) elif not ( c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ) : print ( ' No ' ) elif not ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ) : print ( ' No ' ) elif not ( c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ) : print ( ' No ' ) else : print ( ' Yes ' ) c11 , c12 , c13 = map ( int , input ( ) . split ( ) ) c21 , c22 , c23 = map ( int , input ( ) . split ( ) ) c31 , c32 , c33 = map ( int , input ( ) . split ( ) ) for a1 in range ( 101 ) : b1 = c11 - a1 b2 = c12 - a1 b3 = c13 - a1 a2 = c21 - b1 a3 = c31 - b1 if ( c22 = = a2 + b2 and c23 = = a2 + b3 and c32 = = a3 + b2 and c33 = = a3 + b3 ) : print ( " Yes " ) break else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] x1 = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] x2 = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] x3 = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] x4 = c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] x5 = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] x6 = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] if x1 = = x2 and x2 = = x3 : pass else : print ( ' No ' ) exit ( ) if x4 = = x5 and x5 = = x6 : pass else : print ( ' No ' ) exit ( ) x1 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] x2 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] x3 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] x4 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] x5 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] x6 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] if x1 = = x2 and x2 = = x3 : pass else : print ( ' No ' ) exit ( ) if x4 = = x5 and x5 = = x6 : pass else : print ( ' No ' ) exit ( ) print ( ' Yes ' ) c11 , c12 , c13 = map ( int , input ( ) . split ( ) ) c21 , c22 , c23 = map ( int , input ( ) . split ( ) ) c31 , c32 , c33 = map ( int , input ( ) . split ( ) ) ans = " No " for a1 in range ( c11 + 1 ) : b1 = c11 - a1 b2 = c12 - a1 b3 = c13 - a1 a2 = c21 - b1 a3 = c31 - b1 if c22 = = a2 + b2 and c23 = = a2 + b3 and c32 = = a3 + b2 and c33 = = a3 + b3 : ans = " Yes " break print ( ans ) c11 , c12 , c13 = map ( int , input ( ) . split ( ) ) c21 , c22 , c23 = map ( int , input ( ) . split ( ) ) c31 , c32 , c33 = map ( int , input ( ) . split ( ) ) def correct ( ) : if a1 + b2 ! = c12 : return False if a1 + b3 ! = c13 : return False if a2 + b1 ! = c21 : return False if a2 + b3 ! = c23 : return False if a3 + b1 ! = c31 : return False if a3 + b2 ! = c32 : return False return True for i in range ( c11 + 1 ) : for j in range ( c22 + 1 ) : for k in range ( c33 + 1 ) : a1 = i b1 = c11 - i a2 = j b2 = c22 - j a3 = k b3 = c33 - k if correct ( ) : print ( ' Yes ' ) exit ( 0 ) print ( ' No ' ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c3 = list ( map ( int , input ( ) . split ( ) ) ) d1 = [ c2 [ i ] - c1 [ i ] for i in range ( 3 ) ] d2 = [ c3 [ i ] - c1 [ i ] for i in range ( 3 ) ] if ( d1 [ 0 ] = = d1 [ 1 ] and d1 [ 0 ] = = d1 [ 2 ] and d2 [ 0 ] = = d2 [ 1 ] and d2 [ 0 ] = = d2 [ 2 ] ) : print ( " Yes " ) else : print ( " No " ) import sys c = [ ] for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) coldif = [ c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] , c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] ] for i in range ( 1 , 3 ) : dif = [ c [ i ] [ 1 ] - c [ i ] [ 0 ] , c [ i ] [ 2 ] - c [ i ] [ 1 ] ] if dif ! = coldif : print ( ' No ' ) sys . exit ( ) rowdif = [ c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] , c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] ] for i in range ( 1 , 3 ) : dif = [ c [ 1 ] [ i ] - c [ 0 ] [ i ] , c [ 2 ] [ i ] - c [ 1 ] [ i ] ] if dif ! = rowdif : print ( ' No ' ) sys . exit ( ) print ( ' Yes ' ) c11 , c12 , c13 = map ( int , input ( ) . split ( ) ) c21 , c22 , c23 = map ( int , input ( ) . split ( ) ) c31 , c32 , c33 = map ( int , input ( ) . split ( ) ) if c21 - c11 = = c22 - c12 = = c23 - c13 and c31 - c21 = = c32 - c22 = = c33 - c23 : print ( " Yes " ) else : print ( " No " ) import numpy as np c = [ [ 0 ] * 3 ] * 3 for i in range ( 3 ) : c [ i ] = list ( map ( int , input ( ) . split ( ) ) ) c = np . array ( c ) if len ( set ( c [ 0 ] - c [ 1 ] ) ) = = 1 and len ( set ( c [ 1 ] - c [ 2 ] ) ) = = 1 and len ( set ( c [ : , 0 ] - c [ : , 1 ] ) ) = = 1 and len ( set ( c [ : , 1 ] - c [ : , 2 ] ) ) = = 1 : print ( " Yes " ) else : print ( " No " ) def main ( ) : import sys sys . setrecursionlimit ( 10 * * 7 ) G = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] def recursion ( ai = 0 , b0 = - 1 , b1 = - 1 , b2 = - 1 ) : if ai = = 3 : return True if ai > 0 : d = G [ ai ] [ 0 ] - b0 if ( G [ ai ] [ 0 ] - b0 ) = = ( G [ ai ] [ 1 ] - b1 ) = = ( G [ ai ] [ 2 ] - b2 ) and 0 < = d < = 100 : return recursion ( ai + 1 , b0 , b1 , b2 ) else : return False for a in range ( 100 + 1 ) : d = G [ 0 ] [ 0 ] - a if d < 0 : break b0 = d d = G [ 0 ] [ 1 ] - a if d < 0 : break b1 = d d = G [ 0 ] [ 2 ] - a if d < 0 : break b2 = d if recursion ( ai + 1 , b0 , b1 , b2 ) : return True return False cond = recursion ( ) print ( ' Yes ' if cond else ' No ' ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) c _ list = [ ] for i in range ( 3 ) : c = list ( map ( int , input ( ) . split ( ) ) ) c _ list . append ( c ) a _ list = [ [ ] for i in range ( 3 ) ] b _ list = [ [ ] for i in range ( 3 ) ] a _ list [ 0 ] = 0 b _ list [ 0 ] = c _ list [ 0 ] [ 0 ] a _ list [ 1 ] = c _ list [ 0 ] [ 1 ] - b _ list [ 0 ] a _ list [ 2 ] = c _ list [ 0 ] [ 2 ] - b _ list [ 0 ] b _ list [ 1 ] = c _ list [ 1 ] [ 0 ] - a _ list [ 0 ] b _ list [ 2 ] = c _ list [ 2 ] [ 0 ] - a _ list [ 0 ] if ( ( ( a _ list [ 1 ] + b _ list [ 1 ] ) = = c _ list [ 1 ] [ 1 ] ) and ( ( a _ list [ 2 ] + b _ list [ 1 ] ) = = c _ list [ 1 ] [ 2 ] ) and ( ( a _ list [ 1 ] + b _ list [ 2 ] ) = = c _ list [ 2 ] [ 1 ] ) and ( ( a _ list [ 2 ] + b _ list [ 2 ] ) = = c _ list [ 2 ] [ 2 ] ) ) : print ( ' Yes ' ) else : print ( ' No ' ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) ans = ' No ' if a [ 1 ] - a [ 0 ] = = b [ 1 ] - b [ 0 ] = = c [ 1 ] - c [ 0 ] and a [ 2 ] - a [ 1 ] = = b [ 2 ] - b [ 1 ] = = c [ 2 ] - c [ 1 ] : if b [ 0 ] - a [ 0 ] = = b [ 1 ] - a [ 1 ] = = b [ 2 ] - a [ 2 ] and c [ 0 ] - b [ 0 ] = = c [ 1 ] - b [ 1 ] = = c [ 2 ] - b [ 2 ] : ans = ' Yes ' print ( ans ) import sys from functools import reduce import copy import math from pprint import pprint sys . setrecursionlimit ( 4100000 ) def inputs ( num _ of _ input ) : ins = [ input ( ) for i in range ( num _ of _ input ) ] return ins def int _ inputs ( num _ of _ input ) : ins = [ int ( input ( ) ) for i in range ( num _ of _ input ) ] return ins def solve ( inputs ) : grid = list ( map ( string _ to _ int , inputs ) ) for x in range ( 101 ) : a = [ - 1 , - 1 , - 1 ] b = [ - 1 , - 1 , - 1 ] a [ 0 ] = x for j in range ( 3 ) : b [ j ] = grid [ 0 ] [ j ] - a [ 0 ] a [ 1 ] = grid [ 1 ] [ 0 ] - b [ 0 ] a [ 2 ] = grid [ 2 ] [ 0 ] - b [ 0 ] for i in range ( 3 ) : for j in range ( 3 ) : if grid [ i ] [ j ] ! = a [ i ] + b [ j ] : return ' No ' return ' Yes ' def string _ to _ int ( string ) : return list ( map ( int , string . split ( ) ) ) if _ _ name _ _ = = " _ _ main _ _ " : ret = solve ( inputs ( 3 ) ) print ( ret ) from _ _ future _ _ import print _ function import sys sys . setrecursionlimit ( 500000 ) import re import array import copy import functools import operator import math import string import fractions from fractions import Fraction import collections import itertools import bisect import random import time import heapq from heapq import heappush from heapq import heappop from heapq import heappushpop from heapq import heapify from heapq import heapreplace from queue import PriorityQueue as pq from queue import Queue from itertools import accumulate from collections import deque from collections import Counter from operator import mul from functools import reduce input = sys . stdin . readline def eprint ( * args , * * kwargs ) : print ( * args , file = sys . stderr , * * kwargs ) return def combinations _ count ( n , r ) : r = min ( r , n - r ) numer = reduce ( mul , range ( n , n - r , - 1 ) , 1 ) denom = reduce ( mul , range ( 1 , r + 1 ) , 1 ) return numer / / denom def main ( ) : c = [ [ ] for _ in range ( 4 ) ] for i in range ( 1 , 4 ) : c [ i ] = [ 0 ] + list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) def diff ( i , j , k ) : return c [ k ] [ i ] - c [ k ] [ j ] if diff ( 3 , 2 , 1 ) = = diff ( 3 , 2 , 2 ) = = diff ( 3 , 2 , 3 ) and diff ( 2 , 1 , 1 ) = = diff ( 2 , 1 , 2 ) = = diff ( 2 , 1 , 3 ) : print ( " Yes " ) else : print ( " No " ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) def main ( ) : C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for i in range ( 101 ) : for j in range ( 101 ) : for k in range ( 101 ) : A = [ i , j , k ] B = [ C [ 0 ] [ 0 ] - A [ 0 ] , C [ 1 ] [ 1 ] - A [ 1 ] , C [ 2 ] [ 2 ] - A [ 2 ] ] count = 0 for l in range ( 3 ) : for m in range ( 3 ) : if C [ l ] [ m ] = = A [ l ] + B [ m ] : count + = 1 if count = = 9 : print ( ' Yes ' ) return print ( ' No ' ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) mat = [ map ( int , raw _ input ( ) . split ( ) ) for _ in range ( 3 ) ] def f ( m ) : return ( m [ 1 ] - m [ 0 ] , m [ 2 ] - m [ 1 ] ) b = True s = set ( [ ] ) for l in mat : s . add ( f ( l ) ) if len ( s ) > 1 : b = False s = set ( [ ] ) for j in range ( 3 ) : c = [ mat [ i ] [ j ] for i in range ( 3 ) ] s . add ( f ( c ) ) if len ( s ) > 1 : b = False print ' Yes ' if b else ' No ' c0 = list ( map ( int , input ( ) . split ( ) ) ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c = [ c0 , c1 , c2 ] judge = 0 if c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] and c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] : judge + = 1 if c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] and c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] : judge + = 1 if c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] and c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] : judge + = 1 if c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] and c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] : judge + = 1 if judge = = 4 : print ( " Yes " ) else : print ( " No " ) C = [ ] for _ in range ( 3 ) : c = list ( map ( int , input ( ) . split ( ) ) ) C . append ( c ) b0 = C [ 0 ] [ 0 ] b1 = C [ 0 ] [ 1 ] b2 = C [ 0 ] [ 2 ] a2 _ 1 = C [ 1 ] [ 0 ] - b0 a2 _ 2 = C [ 1 ] [ 1 ] - b1 a2 _ 3 = C [ 1 ] [ 2 ] - b2 a3 _ 1 = C [ 2 ] [ 0 ] - b0 a3 _ 2 = C [ 2 ] [ 1 ] - b1 a3 _ 3 = C [ 2 ] [ 2 ] - b2 if a2 _ 1 = = a2 _ 2 and a2 _ 2 = = a2 _ 3 : if a3 _ 1 = = a3 _ 2 and a3 _ 2 = = a3 _ 3 : print ( ' Yes ' ) else : print ( ' No ' ) else : print ( ' No ' ) C = [ [ int ( i ) for i in input ( ) . split ( ) ] for k in range ( 3 ) ] tC = [ list ( k ) for k in zip ( * C ) ] for i in range ( 2 ) : p = [ C [ i ] [ k ] - C [ i + 1 ] [ k ] for k in range ( 3 ) ] tp = [ tC [ i ] [ k ] - tC [ i + 1 ] [ k ] for k in range ( 3 ) ] if p [ 0 ] = = p [ 1 ] = = p [ 2 ] and tp [ 0 ] = = tp [ 1 ] = = tp [ 2 ] : continue else : print ( " No " ) exit ( ) else : print ( " Yes " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] and c [ 0 ] [ 0 ] - c [ 2 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 2 ] [ 1 ] = = c [ 0 ] [ 2 ] - c [ 2 ] [ 2 ] : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] x = [ 0 ] * 3 y = [ 0 ] * 3 for i in range ( 3 ) : y [ i ] = c [ 0 ] [ i ] - x [ 0 ] for i in range ( 3 ) : x [ i ] = c [ i ] [ 0 ] - y [ 0 ] flag = True for i in range ( 3 ) : for j in range ( 3 ) : if x [ i ] + y [ j ] ! = c [ i ] [ j ] : flag = False if flag : print ( " Yes " ) else : print ( " No " ) l = [ [ int ( i ) for i in input ( ) . split ( ) ] for M in range ( 3 ) ] ans = " No " for i in range ( min ( l [ 0 ] ) + 1 ) : for j in range ( min ( l [ 1 ] ) + 1 ) : for k in range ( min ( l [ 2 ] ) + 1 ) : if ( l [ 0 ] [ 0 ] - i ) = = ( l [ 1 ] [ 0 ] - j ) and ( l [ 0 ] [ 0 ] - i ) = = ( l [ 2 ] [ 0 ] - k ) and \ ( l [ 0 ] [ 1 ] - i ) = = ( l [ 1 ] [ 1 ] - j ) and ( l [ 0 ] [ 1 ] - i ) = = ( l [ 2 ] [ 1 ] - k ) and \ ( l [ 0 ] [ 2 ] - i ) = = ( l [ 1 ] [ 2 ] - j ) and ( l [ 0 ] [ 2 ] - i ) = = ( l [ 2 ] [ 2 ] - k ) : ans = " Yes " print ( ans ) S = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] check = False for i in range ( 101 ) : for j in range ( 101 ) : if ( S [ 0 ] [ 0 ] - i = = S [ 1 ] [ 0 ] - j and S [ 0 ] [ 1 ] - i = = S [ 1 ] [ 1 ] - j ) and S [ 0 ] [ 2 ] - i = = S [ 1 ] [ 2 ] - j : if ( S [ 2 ] [ 0 ] - S [ 0 ] [ 0 ] = = S [ 2 ] [ 1 ] - S [ 0 ] [ 1 ] ) and ( S [ 2 ] [ 0 ] - S [ 0 ] [ 0 ] = = S [ 2 ] [ 2 ] - S [ 0 ] [ 2 ] ) : check = True print ( ' Yes ' ) exit ( ) if check = = False : print ( ' No ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] a = [ 0 ] * 3 b = [ 0 ] * 3 a [ 0 ] = min ( c [ 0 ] ) b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] a [ 1 ] = c [ 1 ] [ 1 ] - b [ 1 ] a [ 2 ] = c [ 2 ] [ 2 ] - b [ 2 ] for i in range ( 3 ) : for j in range ( 3 ) : if a [ i ] + b [ j ] ! = c [ i ] [ j ] : print ( " No " ) break else : continue break else : print ( " Yes " ) import numpy as np c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a0 = 0 B = np . array ( [ c [ 0 ] [ 0 ] , c [ 0 ] [ 1 ] , c [ 0 ] [ 2 ] ] ) if len ( set ( np . array ( c [ 1 ] ) - B ) ) = = 1 and len ( set ( np . array ( c [ 2 ] ) - B ) ) = = 1 : print ( " Yes " ) else : print ( " No " ) l = list ( ) for i in range ( 3 ) : l . append ( list ( map ( int , input ( ) . split ( ) ) ) ) if l [ 0 ] [ 0 ] - l [ 1 ] [ 0 ] = = l [ 0 ] [ 1 ] - l [ 1 ] [ 1 ] = = l [ 0 ] [ 2 ] - l [ 1 ] [ 2 ] : if l [ 2 ] [ 0 ] - l [ 1 ] [ 0 ] = = l [ 2 ] [ 1 ] - l [ 1 ] [ 1 ] = = l [ 2 ] [ 2 ] - l [ 1 ] [ 2 ] : print ( " Yes " ) else : print ( " No " ) else : print ( " No " ) import sys c = [ ] for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( 2 ) : arr1 = c [ i ] arr2 = c [ i + 1 ] d = arr1 [ 2 ] - arr2 [ 2 ] for j in range ( 2 ) : if d ! = arr1 [ j ] - arr2 [ j ] : print ( ' No ' ) sys . exit ( 0 ) for i in range ( 2 ) : d = c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] for j in range ( 2 ) : if d ! = c [ j ] [ i ] - c [ j ] [ i + 1 ] : print ( ' No ' ) sys . exit ( 0 ) print ( ' Yes ' ) c = [ ] for _ in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) ans = False for a1 in range ( min ( c [ 0 ] ) + 1 ) : b1 = c [ 0 ] [ 0 ] - a1 b2 = c [ 0 ] [ 1 ] - a1 b3 = c [ 0 ] [ 2 ] - a1 a2 = c [ 1 ] [ 0 ] - b1 a3 = c [ 2 ] [ 0 ] - b1 if c [ 1 ] [ 1 ] - b2 = = a2 and c [ 1 ] [ 2 ] - b3 = = a2 : if c [ 2 ] [ 1 ] - b2 = = a3 and c [ 2 ] [ 2 ] - b3 = = a3 : ans = True break if ans = = True : print ( " Yes " ) else : print ( " No " ) c = [ ] for i in range ( 3 ) : x , y , z = map ( int , input ( ) . split ( ) ) c . append ( x ) c . append ( y ) c . append ( z ) for a1 in range ( 101 ) : for a2 in range ( 101 ) : for a3 in range ( 101 ) : b1 = c [ 0 ] - a1 b2 = c [ 1 ] - a1 b3 = c [ 2 ] - a1 if c [ 3 ] = = a2 + b1 and c [ 4 ] = = a2 + b2 and c [ 5 ] = = a2 + b3 and c [ 6 ] = = a3 + b1 and c [ 7 ] = = a3 + b2 and c [ 8 ] = = a3 + b3 : print ( ' Yes ' ) exit ( ) print ( ' No ' ) import io array = [ ] for i in range ( 3 ) : array . append ( list ( map ( int , input ( ) . split ( ) ) ) ) if ( array [ 0 ] [ 0 ] + array [ 1 ] [ 1 ] + array [ 2 ] [ 2 ] ) * 3 = = ( sum ( array [ 0 ] ) + sum ( array [ 1 ] ) + sum ( array [ 2 ] ) ) : print ( ' Yes ' ) else : print ( ' No ' ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c3 = list ( map ( int , input ( ) . split ( ) ) ) b1 , b2 , b3 = c1 [ 0 ] , c1 [ 1 ] , c1 [ 2 ] if c2 [ 0 ] - b1 = = c2 [ 1 ] - b2 = = c2 [ 2 ] - b3 and c3 [ 0 ] - b1 = = c3 [ 1 ] - b2 = = c3 [ 2 ] - b3 : print ( ' Yes ' ) else : print ( ' No ' ) l1 = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) l3 = list ( map ( int , input ( ) . split ( ) ) ) s = 0 for i in range ( 0 , min ( l1 [ 0 ] , l1 [ 1 ] , l1 [ 2 ] , l2 [ 0 ] , l3 [ 0 ] ) + 1 ) : j = l1 [ 0 ] - i m = l1 [ 1 ] - i n = l1 [ 2 ] - i if l2 [ 0 ] - j = = l2 [ 1 ] - m = = l2 [ 2 ] - n and l3 [ 0 ] - j = = l3 [ 1 ] - m = = l3 [ 2 ] - n : s = 1 break print ( " Yes " if s = = 1 else " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] ans = " Yes " for i in range ( 1 , 3 ) : if c [ i ] [ 0 ] - c [ 0 ] [ 0 ] ! = c [ i ] [ 1 ] - c [ 0 ] [ 1 ] or c [ i ] [ 1 ] - c [ 0 ] [ 1 ] ! = c [ i ] [ 2 ] - c [ 0 ] [ 2 ] : ans = " No " print ( ans ) C = [ ] for i in range ( 3 ) : C . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( 1 , 101 ) : b1 = C [ 0 ] [ 0 ] - i b2 = C [ 0 ] [ 1 ] - i b3 = C [ 0 ] [ 2 ] - i a2 = C [ 1 ] [ 0 ] - b1 a3 = C [ 2 ] [ 0 ] - b1 if [ [ i + b1 , i + b2 , i + b3 ] , [ a2 + b1 , a2 + b2 , a2 + b3 ] , [ a3 + b1 , a3 + b2 , a3 + b3 ] ] = = C : print ( " Yes " ) exit ( ) print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] check = False for i in range ( 101 ) : for j in range ( 101 ) : for k in range ( 101 ) : o = c [ 0 ] [ 0 ] - i p = c [ 1 ] [ 1 ] - j q = c [ 2 ] [ 2 ] - k if o < 0 or p < 0 or q < 0 : continue ls = [ [ i + o , i + p , i + q ] , [ j + o , j + p , j + q ] , [ k + o , k + p , k + q ] ] if ls = = c : check = True break print ( " Yes " if check else " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] if ( c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ) * 2 = = c [ 0 ] [ 1 ] + c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] + c [ 2 ] [ 1 ] : print ( ' Yes ' ) else : print ( ' No ' ) grid = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] ans = " Yes " for i in range ( 2 ) : x = grid [ 0 ] [ 2 ] - grid [ 0 ] [ i ] y = grid [ 1 ] [ 2 ] - grid [ 1 ] [ i ] z = grid [ 2 ] [ 2 ] - grid [ 2 ] [ i ] if x ! = y or x ! = z : ans = " No " print ( ans ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] def check ( c ) : for a1 in range ( c [ 0 ] [ 0 ] ) : b = [ c [ 0 ] [ i ] - a1 for i in range ( 3 ) ] a = [ a1 ] + [ c [ i ] [ 0 ] - b [ 0 ] for i in range ( 1 , 3 ) ] for ai in range ( len ( a ) ) : for bi in range ( len ( b ) ) : if c [ ai ] [ bi ] ! = a [ ai ] + b [ bi ] : print ( ' No ' ) return print ( ' Yes ' ) check ( c ) c = [ ] for i in range ( 3 ) : c . append ( [ int ( x ) for x in input ( ) . split ( ) ] ) res = " No " for i in range ( 101 ) : for j in range ( 101 ) : for k in range ( 101 ) : if c [ 0 ] [ 0 ] - i = = c [ 1 ] [ 0 ] - j = = c [ 2 ] [ 0 ] - k : if c [ 0 ] [ 1 ] - i = = c [ 1 ] [ 1 ] - j = = c [ 2 ] [ 1 ] - k : if c [ 0 ] [ 2 ] - i = = c [ 1 ] [ 2 ] - j = = c [ 2 ] [ 2 ] - k : res = " Yes " print ( res ) def solve ( ) : c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] if c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] = = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] : print ( ' Yes ' ) else : print ( ' No ' ) if _ _ name _ _ = = ' _ _ main _ _ ' : solve ( ) A = [ tuple ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] for x , y in zip ( A , A [ 1 : ] ) : if not ( y [ 0 ] - x [ 0 ] = = y [ 1 ] - x [ 1 ] = = y [ 2 ] - x [ 2 ] ) : print ( " No " ) exit ( ) for x in range ( 2 ) : if not ( A [ 0 ] [ x + 1 ] - A [ 0 ] [ x ] = = A [ 1 ] [ x + 1 ] - A [ 1 ] [ x ] = = A [ 2 ] [ x + 1 ] - A [ 2 ] [ x ] ) : print ( " No " ) exit ( ) if A [ 0 ] [ 0 ] + A [ 2 ] [ 2 ] ! = A [ 0 ] [ 2 ] + A [ 2 ] [ 0 ] : print ( " No " ) exit ( ) print ( " Yes " ) import sys sys . setrecursionlimit ( 10 * * 9 ) INF = 10 * * 18 MOD = 10 * * 9 + 7 input = lambda : sys . stdin . readline ( ) . rstrip ( ) YesNo = lambda b : bool ( [ print ( ' Yes ' ) ] if b else print ( ' No ' ) ) YESNO = lambda b : bool ( [ print ( ' YES ' ) ] if b else print ( ' NO ' ) ) int1 = lambda x : int ( x ) - 1 def main ( ) : c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a = [ [ 0 ] * 3 for _ in range ( 3 ) ] b = [ [ 0 ] * 3 for _ in range ( 3 ) ] for i in range ( 3 ) : for j in range ( 3 ) : a [ i ] [ j ] = c [ i ] [ j ] - min ( c [ i ] ) b [ j ] [ i ] = c [ i ] [ j ] - min ( c [ 0 ] [ j ] , c [ 1 ] [ j ] , c [ 2 ] [ j ] ) YesNo ( a [ 0 ] = = a [ 1 ] = = a [ 2 ] and b [ 0 ] = = b [ 1 ] = = b [ 2 ] ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) import numpy as np A = np . array ( [ [ 1 , 0 , 0 , 1 , 0 , 0 ] , [ 1 , 0 , 0 , 0 , 1 , 0 ] , [ 1 , 0 , 0 , 0 , 0 , 1 ] , [ 0 , 1 , 0 , 1 , 0 , 0 ] , [ 0 , 1 , 0 , 0 , 1 , 0 ] , [ 0 , 1 , 0 , 0 , 0 , 1 ] , [ 0 , 0 , 1 , 1 , 0 , 0 ] , [ 0 , 0 , 1 , 0 , 1 , 0 ] , [ 0 , 0 , 1 , 0 , 0 , 1 ] ] ) b = np . array ( [ ] , int ) for l in range ( 3 ) : buf = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) b = np . concatenate ( ( b , buf ) , axis = None ) b = np . reshape ( b , ( 9 , 1 ) ) Ab = np . concatenate ( ( A , b ) , axis = 1 ) rA = np . linalg . matrix _ rank ( A ) rAb = np . linalg . matrix _ rank ( Ab ) if rA = = rAb : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) , list ( map ( int , input ( ) . split ( ) ) ) , list ( map ( int , input ( ) . split ( ) ) ) ] if ( sum ( c [ 0 ] ) + sum ( c [ 1 ] ) + sum ( c [ 2 ] ) ) % 3 ! = 0 : print ( ' No ' ) exit ( ) if c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ! = c [ 2 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 0 ] [ 2 ] : print ( ' No ' ) else : print ( ' Yes ' ) c = [ ] S = 0 for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) S + = sum ( c [ i ] ) a = [ 0 ] * 3 b = [ 0 ] * 3 for i in range ( 3 ) : a [ i ] = sum ( c [ i ] [ 0 : 3 ] ) b [ i ] = sum ( c [ 0 : 3 ] [ i ] ) if S % 3 ! = 0 : ans = " No " if ( a [ 0 ] - a [ 1 ] ) % 3 ! = 0 or ( a [ 1 ] - a [ 2 ] ) % 3 ! = 0 or ( a [ 2 ] - a [ 0 ] ) % 3 ! = 0 : ans = " No " elif ( b [ 0 ] - b [ 1 ] ) % 3 ! = 0 or ( b [ 1 ] - b [ 2 ] ) % 3 ! = 0 or ( b [ 2 ] - b [ 0 ] ) % 3 ! = 0 : ans = " No " elif c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ! = S / / 3 : ans = " No " else : ans = " Yes " print ( ans ) S = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] C1 = S [ 0 ] [ 0 ] C2 = S [ 0 ] [ 1 ] C3 = S [ 0 ] [ 2 ] C4 = S [ 1 ] [ 0 ] C5 = S [ 1 ] [ 1 ] C6 = S [ 1 ] [ 2 ] C7 = S [ 2 ] [ 0 ] C8 = S [ 2 ] [ 1 ] C9 = S [ 2 ] [ 2 ] if C4 - C1 = = C6 - C3 and C6 - C3 = = C5 - C2 and C7 - C1 = = C8 - C2 and C8 - C2 = = C9 - C3 : print ( ' Yes ' ) else : print ( ' No ' ) c = [ ] for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) flag = True for i in range ( 2 ) : x = c [ i ] [ 0 ] - c [ i + 1 ] [ 0 ] y = c [ i ] [ 1 ] - c [ i + 1 ] [ 1 ] z = c [ i ] [ 2 ] - c [ i + 1 ] [ 2 ] p = c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] q = c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] r = c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] if x ! = y or y ! = z or x ! = z : flag = False break elif p ! = q or q ! = r or p ! = r : flag = False break if flag : print ( " Yes " ) else : print ( " No " ) c = [ 0 for i in range ( 3 ) ] for i in range ( 3 ) : c [ i ] = list ( map ( int , input ( ) . split ( ) ) ) ans = ' Yes ' for i in range ( 1 , 3 ) : if c [ i ] [ 0 ] - c [ 0 ] [ 0 ] ! = c [ i ] [ 1 ] - c [ 0 ] [ 1 ] or c [ i ] [ 1 ] - c [ 0 ] [ 1 ] ! = c [ i ] [ 2 ] - c [ 0 ] [ 2 ] : ans = ' No ' print ( ans ) c1 = list ( map ( int , input ( ) . split ( ) ) ) c2 = list ( map ( int , input ( ) . split ( ) ) ) c3 = list ( map ( int , input ( ) . split ( ) ) ) ans = True a1 = 0 b = [ ] for i in range ( 3 ) : b . append ( c1 [ i ] - a1 ) a2 = c2 [ 0 ] - b [ 0 ] a3 = c3 [ 0 ] - b [ 0 ] for i in range ( 1 , 3 ) : if a2 + b [ i ] ! = c2 [ i ] or a3 + b [ i ] ! = c3 [ i ] : ans = False break if ans = = True : print ( " Yes " ) else : print ( " No " ) import math import heapq import bisect import numpy as np from collections import Counter C = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] A = [ 0 ] * 3 B = [ 0 ] * 3 flg = 0 for i in range ( C [ 0 ] [ 0 ] + 1 ) : A [ 0 ] = i B [ 0 ] = C [ 0 ] [ 0 ] - i for j in range ( 1 , 3 ) : A [ j ] = C [ j ] [ 0 ] - B [ 0 ] B [ j ] = C [ 0 ] [ j ] - A [ 0 ] tmp = abs ( C [ 1 ] [ 1 ] - A [ 1 ] - B [ 1 ] ) + abs ( C [ 1 ] [ 2 ] - A [ 1 ] - B [ 2 ] ) + abs ( C [ 2 ] [ 1 ] - A [ 2 ] - B [ 1 ] ) + abs ( C [ 2 ] [ 2 ] - A [ 2 ] - B [ 2 ] ) if tmp = = 0 : flg = 1 if flg : print ( " Yes " ) else : print ( " No " ) import numpy as np M = np . array ( list ( map ( int , open ( 0 ) . read ( ) . split ( ) ) ) ) . reshape ( 3 , 3 ) hSum = M . sum ( axis = 0 ) vSum = M . sum ( axis = 1 ) f = True for i in range ( 3 ) : if ( hSum [ i ] - hSum [ ( i + 1 ) % 3 ] ) % 3 ! = 0 : f = False for i in range ( 3 ) : if ( vSum [ i ] - vSum [ ( i + 1 ) % 3 ] ) % 3 ! = 0 : f = False print ( " Yes " if f else " No " ) from functools import reduce from itertools import * def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) l = [ read ( ) , read ( ) , read ( ) ] a = len ( list ( set ( [ l [ 1 ] [ i ] - l [ 0 ] [ i ] for i in range ( 3 ) ] ) ) ) b = len ( list ( set ( [ l [ 2 ] [ i ] - l [ 1 ] [ i ] for i in range ( 3 ) ] ) ) ) c = len ( list ( set ( [ l [ i ] [ 1 ] - l [ i ] [ 0 ] for i in range ( 3 ) ] ) ) ) d = len ( list ( set ( [ l [ i ] [ 2 ] - l [ i ] [ 1 ] for i in range ( 3 ) ] ) ) ) if a = = 1 and b = = 1 and c = = 1 and d = = 1 : print ( " Yes " ) else : print ( " No " ) c = [ ] for i in range ( 3 ) : tmp = list ( map ( int , input ( ) . split ( ) ) ) c . append ( tmp ) flag = True abs _ a = [ ] for i in range ( 3 ) : abs _ a . append ( abs ( c [ 0 ] [ i ] - c [ 1 ] [ i ] ) ) abs _ a . append ( abs ( c [ 1 ] [ i ] - c [ 2 ] [ i ] ) ) abs _ a . append ( abs ( c [ 0 ] [ i ] - c [ 2 ] [ i ] ) ) if abs _ a [ 0 ] = = abs _ a [ 3 ] and abs _ a [ 0 ] = = abs _ a [ 6 ] : pass else : flag = False if abs _ a [ 1 ] = = abs _ a [ 4 ] and abs _ a [ 1 ] = = abs _ a [ 7 ] : pass else : flag = False if abs _ a [ 2 ] = = abs _ a [ 5 ] and abs _ a [ 2 ] = = abs _ a [ 8 ] : pass else : flag = False if flag : print ( " Yes " ) else : print ( " No " ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a0 = 0 b = [ 0 , 0 , 0 ] for i in range ( 3 ) : b [ i ] = c [ 0 ] [ i ] - a0 a1 = c [ 1 ] [ 0 ] - b [ 0 ] a2 = c [ 2 ] [ 0 ] - b [ 0 ] a = [ a0 , a1 , a2 ] is _ ok = True for i in range ( 3 ) : for j in range ( 3 ) : if c [ i ] [ j ] ! = a [ i ] + b [ j ] : is _ ok = False if is _ ok : print ( " Yes " ) else : print ( " No " ) import sys C = [ ] A = [ 0 ] * 3 B = [ 0 ] * 3 for i in range ( 3 ) : C . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( 3 ) : A [ i ] = min ( C [ i ] ) for i in range ( 3 ) : B [ i ] = C [ 0 ] [ i ] - A [ 0 ] for i in range ( 3 ) : for j in range ( 1 , 3 ) : if B [ i ] + A [ j ] ! = C [ j ] [ i ] : print ( ' No ' ) sys . exit ( ) print ( ' Yes ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] a = sum ( c [ 0 ] ) + sum ( c [ 1 ] ) + sum ( c [ 2 ] ) b = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] print ( ' Yes ' if a = = 3 * b else ' No ' ) a = [ ] for i in range ( 3 ) : a + = [ list ( map ( int , input ( ) . split ( ) ) ) ] for i in range ( 3 ) : x = a [ i ] [ 0 ] - a [ ( i + 1 ) % 3 ] [ 0 ] y = a [ 0 ] [ i ] - a [ 0 ] [ ( i + 1 ) % 3 ] if x ! = a [ i ] [ 1 ] - a [ ( i + 1 ) % 3 ] [ 1 ] or x ! = a [ i ] [ 2 ] - a [ ( i + 1 ) % 3 ] [ 2 ] : print ( ' No ' ) exit ( ) if y ! = a [ 1 ] [ i ] - a [ 1 ] [ ( i + 1 ) % 3 ] or y ! = a [ 2 ] [ i ] - a [ 2 ] [ ( i + 1 ) % 3 ] : print ( ' No ' ) exit ( ) print ( ' Yes ' ) def main ( ) : import numpy as np A = np . array ( [ [ 1 , 0 , 0 , 1 , 0 , 0 ] , [ 1 , 0 , 0 , 0 , 1 , 0 ] , [ 1 , 0 , 0 , 0 , 0 , 1 ] , [ 0 , 1 , 0 , 1 , 0 , 0 ] , [ 0 , 1 , 0 , 0 , 1 , 0 ] , [ 0 , 1 , 0 , 0 , 0 , 1 ] , [ 0 , 0 , 1 , 1 , 0 , 0 ] , [ 0 , 0 , 1 , 0 , 1 , 0 ] , [ 0 , 0 , 1 , 0 , 0 , 1 ] ] ) C = [ [ int ( i ) for i in input ( ) . split ( ) ] for j in range ( 3 ) ] C = np . array ( C ) C = C . reshape ( [ 9 , 1 ] ) ext _ A = np . concatenate ( [ A , C ] , axis = 1 ) A _ rank = np . linalg . matrix _ rank ( A ) ext _ A _ rank = np . linalg . matrix _ rank ( ext _ A ) if A _ rank = = ext _ A _ rank : print ( " Yes " ) else : print ( " No " ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) c = [ ] for i in range ( 3 ) : c . append ( list ( map ( int , input ( ) . split ( ) ) ) ) i = 0 flaga12 = True flaga23 = True flaga31 = True flagb12 = True flagb23 = True flagb31 = True b12 = c [ i ] [ 0 ] - c [ i ] [ 1 ] b23 = c [ i ] [ 1 ] - c [ i ] [ 2 ] b31 = c [ i ] [ 2 ] - c [ i ] [ 0 ] for i in range ( 3 ) : flagb12 = flagb12 and ( b12 = = c [ i ] [ 0 ] - c [ i ] [ 1 ] ) flagb23 = flagb23 and ( b23 = = c [ i ] [ 1 ] - c [ i ] [ 2 ] ) flagb31 = flagb31 and ( b31 = = c [ i ] [ 2 ] - c [ i ] [ 0 ] ) j = 0 a12 = c [ 0 ] [ j ] - c [ 1 ] [ j ] a23 = c [ 1 ] [ j ] - c [ 2 ] [ j ] a31 = c [ 2 ] [ j ] - c [ 0 ] [ j ] for i in range ( 3 ) : a12 = c [ 0 ] [ j ] - c [ 1 ] [ j ] a23 = c [ 1 ] [ j ] - c [ 2 ] [ j ] a31 = c [ 2 ] [ j ] - c [ 0 ] [ j ] flaga12 = flaga12 and ( a12 = = c [ 0 ] [ j ] - c [ 1 ] [ j ] ) flaga23 = flaga23 and ( a23 = = c [ 1 ] [ j ] - c [ 2 ] [ j ] ) flaga31 = flaga31 and ( a31 = = c [ 2 ] [ j ] - c [ 0 ] [ j ] ) judge = ( flaga12 and flaga23 and flaga31 and flagb12 and flagb23 and flagb31 ) if judge : print ( " Yes " ) else : print ( " No " ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 0 , 3 ) : for j in range ( i , 3 ) : if a [ i ] + b [ j ] ! = a [ j ] + b [ i ] or a [ i ] + c [ j ] ! = a [ j ] + c [ i ] or b [ i ] + c [ j ] ! = b [ j ] + c [ i ] : print ( " No " ) quit ( 0 ) print ( " Yes " ) C = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( 3 ) ] ans = C [ 0 ] [ 0 ] + C [ 1 ] [ 1 ] + C [ 2 ] [ 2 ] if ( ans = = C [ 0 ] [ 2 ] + C [ 1 ] [ 0 ] + C [ 2 ] [ 1 ] and ans = = C [ 0 ] [ 1 ] + C [ 1 ] [ 2 ] + C [ 2 ] [ 0 ] ) : print ( ' Yes ' ) else : print ( ' No ' ) a , b , c = map ( int , input ( ) . split ( ) ) d , e , f = map ( int , input ( ) . split ( ) ) g , h , i = map ( int , input ( ) . split ( ) ) if a - b = = d - e : if d - e = = g - h : if b - c = = e - f : if e - f = = h - i : if a - d = = b - e : if b - e = = c - f : if d - g = = e - h : if e - h = = f - i : print ( " Yes " ) exit ( ) print ( " No " ) import sys try : from typing import List except ImportError : pass YES = " Yes " NO = " No " def solve ( c : " List [ List [ int ] ] " ) : print ( YES if all ( c [ i ] [ j ] = = c [ 0 ] [ j ] + c [ i ] [ 0 ] - c [ 0 ] [ 0 ] for i in range ( 1 , 3 ) for j in range ( 1 , 3 ) ) else NO ) def main ( ) : def iterate _ tokens ( ) : for line in sys . stdin : for word in line . split ( ) : yield word tokens = iterate _ tokens ( ) c = [ [ int ( next ( tokens ) ) for _ in range ( 3 ) ] for _ in range ( 3 ) ] solve ( c ) if _ _ name _ _ = = ' _ _ main _ _ ' : main ( ) import sys input = sys . stdin . readline a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] dx = [ 0 ] * 2 dy = [ 0 ] * 2 for i in range ( 2 ) : dx [ i ] = a [ 0 ] [ i + 1 ] - a [ 0 ] [ i ] for i in range ( 2 ) : dy [ i ] = a [ i + 1 ] [ 0 ] - a [ i ] [ 0 ] for i in range ( 3 ) : for j in range ( 2 ) : if a [ i ] [ j + 1 ] - a [ i ] [ j ] ! = dx [ j ] : print ( " No " ) exit ( 0 ) for i in range ( 3 ) : for j in range ( 2 ) : if a [ j + 1 ] [ i ] - a [ j ] [ i ] ! = dy [ j ] : print ( " No " ) exit ( 0 ) print ( " Yes " ) import sys C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for j in range ( 2 ) : for i in range ( 2 ) : if C [ i + 1 ] [ j + 1 ] - C [ i + 1 ] [ j ] ! = C [ i ] [ 1 + j ] - C [ i ] [ j ] : print ( ' No ' ) sys . exit ( ) print ( ' Yes ' ) l = [ ] for i in range ( 3 ) : l . append ( list ( map ( int , input ( ) . split ( ) ) ) ) a2 = l [ 0 ] [ 1 ] - l [ 0 ] [ 0 ] a3 = l [ 0 ] [ 2 ] - l [ 0 ] [ 0 ] b2 = l [ 1 ] [ 0 ] - l [ 0 ] [ 0 ] b3 = l [ 2 ] [ 0 ] - l [ 0 ] [ 0 ] is _ takahashi _ true = True for i in range ( 1 , 3 ) : ta2 = l [ i ] [ 1 ] - l [ i ] [ 0 ] ta3 = l [ i ] [ 2 ] - l [ i ] [ 0 ] tb2 = l [ 1 ] [ i ] - l [ 0 ] [ i ] tb3 = l [ 2 ] [ i ] - l [ 0 ] [ i ] if a2 ! = ta2 or a3 ! = ta3 or b2 ! = tb2 or b3 ! = tb3 : is _ takahashi _ true = False print ( " YNeos " [ not is _ takahashi _ true : : 2 ] ) hog1 = list ( map ( int , input ( ) . split ( ) ) ) hog2 = list ( map ( int , input ( ) . split ( ) ) ) hog3 = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 100 ) : if ( hog1 [ 0 ] ! = 0 and hog1 [ 1 ] ! = 0 and hog1 [ 2 ] ! = 0 ) : hog1 [ 0 ] - = 1 hog1 [ 1 ] - = 1 hog1 [ 2 ] - = 1 if ( hog2 [ 0 ] ! = 0 and hog2 [ 1 ] ! = 0 and hog2 [ 2 ] ! = 0 ) : hog2 [ 0 ] - = 1 hog2 [ 1 ] - = 1 hog2 [ 2 ] - = 1 if ( hog3 [ 0 ] ! = 0 and hog3 [ 1 ] ! = 0 and hog3 [ 2 ] ! = 0 ) : hog3 [ 0 ] - = 1 hog3 [ 1 ] - = 1 hog3 [ 2 ] - = 1 if ( hog1 [ 0 ] ! = 0 and hog2 [ 0 ] ! = 0 and hog3 [ 0 ] ! = 0 ) : hog1 [ 0 ] - = 1 hog2 [ 0 ] - = 1 hog3 [ 0 ] - = 1 if ( hog1 [ 1 ] ! = 0 and hog2 [ 1 ] ! = 0 and hog3 [ 1 ] ! = 0 ) : hog1 [ 1 ] - = 1 hog2 [ 1 ] - = 1 hog3 [ 1 ] - = 1 if ( hog1 [ 2 ] ! = 0 and hog2 [ 2 ] ! = 0 and hog3 [ 2 ] ! = 0 ) : hog1 [ 2 ] - = 1 hog2 [ 2 ] - = 1 hog3 [ 2 ] - = 1 ans = sum ( hog1 ) + sum ( hog2 ) + sum ( hog3 ) if ( ans = = 0 ) : print ( " Yes " ) else : print ( " No " ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] A = [ 0 ] * ( 3 ) B = [ 0 ] * ( 3 ) for i in range ( 3 ) : B [ i ] = C [ 0 ] [ i ] - A [ 0 ] A [ 1 ] = C [ 1 ] [ 0 ] - B [ 0 ] A [ 2 ] = C [ 2 ] [ 0 ] - B [ 0 ] for i in range ( 3 ) : for j in range ( 3 ) : if C [ i ] [ j ] ! = A [ i ] + B [ j ] : print ( ' No ' ) exit ( ) print ( ' Yes ' ) C = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] flg = True a1 = 0 b1 = C [ 0 ] [ 0 ] b2 = C [ 0 ] [ 1 ] b3 = C [ 0 ] [ 2 ] if not ( C [ 1 ] [ 0 ] - b1 = = C [ 1 ] [ 1 ] - b2 and C [ 1 ] [ 1 ] - b2 = = C [ 1 ] [ 2 ] - b3 ) : flg = False if not ( C [ 2 ] [ 0 ] - b1 = = C [ 2 ] [ 1 ] - b2 and C [ 2 ] [ 1 ] - b2 = = C [ 2 ] [ 2 ] - b3 ) : flg = False if flg : print ( ' Yes ' ) else : print ( ' No ' ) data = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 3 ) ] for a1 in range ( 101 ) : for a2 in range ( 101 ) : for a3 in range ( 101 ) : b1 = data [ 0 ] [ 0 ] - a1 b2 = data [ 0 ] [ 1 ] - a1 b3 = data [ 0 ] [ 2 ] - a1 if ( b1 + a2 = = data [ 1 ] [ 0 ] and b2 + a2 = = data [ 1 ] [ 1 ] and b3 + a2 = = data [ 1 ] [ 2 ] and b1 + a3 = = data [ 2 ] [ 0 ] and b2 + a3 = = data [ 2 ] [ 1 ] and b3 + a3 = = data [ 2 ] [ 2 ] ) : print ( " Yes " ) exit ( 0 ) print ( " No " ) C = [ ] for _ in range ( 3 ) : c1 , c2 , c3 = map ( int , input ( ) . split ( ) ) tmp = [ c1 , c2 , c3 ] C . append ( tmp ) if not ( C [ 0 ] [ 0 ] - C [ 0 ] [ 1 ] = = C [ 1 ] [ 0 ] - C [ 1 ] [ 1 ] = = C [ 2 ] [ 0 ] - C [ 2 ] [ 1 ] ) : print ( ' No ' ) exit ( 0 ) if not ( C [ 0 ] [ 1 ] - C [ 0 ] [ 2 ] = = C [ 1 ] [ 1 ] - C [ 1 ] [ 2 ] = = C [ 2 ] [ 1 ] - C [ 2 ] [ 2 ] ) : print ( ' No ' ) exit ( 0 ) if not ( C [ 0 ] [ 0 ] - C [ 1 ] [ 0 ] = = C [ 0 ] [ 1 ] - C [ 1 ] [ 1 ] = = C [ 0 ] [ 2 ] - C [ 1 ] [ 2 ] ) : print ( ' No ' ) exit ( 0 ) if not ( C [ 1 ] [ 0 ] - C [ 2 ] [ 0 ] = = C [ 1 ] [ 1 ] - C [ 2 ] [ 1 ] = = C [ 1 ] [ 2 ] - C [ 2 ] [ 2 ] ) : print ( ' No ' ) exit ( 0 ) print ( ' Yes ' ) c _ list = [ ] for i in range ( 3 ) : c _ list . append ( [ int ( i ) for i in input ( ) . split ( ) ] ) c _ 11 = c _ list [ 0 ] [ 0 ] ans = 0 for a _ 1 in range ( c _ 11 + 1 ) : b _ 1 = c _ 11 - a _ 1 b _ 2 = c _ list [ 0 ] [ 1 ] - a _ 1 b _ 3 = c _ list [ 0 ] [ 2 ] - a _ 1 if c _ list [ 1 ] [ 0 ] - b _ 1 = = c _ list [ 1 ] [ 1 ] - b _ 2 = = c _ list [ 1 ] [ 2 ] - b _ 3 and c _ list [ 2 ] [ 0 ] - b _ 1 = = c _ list [ 2 ] [ 1 ] - b _ 2 = = c _ list [ 2 ] [ 2 ] - b _ 3 : print ( " Yes " ) ans = 1 exit ( ) if ans = = 0 : print ( " No " ) l = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] m = [ [ 0 , 0 , 0 ] for _ in range ( 3 ) ] for i in range ( 3 ) : for j in range ( 3 ) : m [ i ] [ j ] = l [ i ] [ j ] - l [ 0 ] [ j ] for i in range ( 3 ) : f = True for j in range ( 3 ) : if m [ i ] [ j ] ! = m [ i ] [ 0 ] : f = False break if not f : print ( ' No ' ) exit ( ) print ( ' Yes ' ) C = [ [ ] for i in range ( 3 ) ] for i in range ( 3 ) : C [ i ] . extend ( list ( map ( int , input ( ) . split ( ) ) ) ) flag = True for i in range ( 2 ) : if ( C [ 1 ] [ i + 1 ] - C [ 1 ] [ i ] = = C [ 2 ] [ i + 1 ] - C [ 2 ] [ i ] ) and ( C [ 1 ] [ i + 1 ] - C [ 1 ] [ i ] = = C [ 0 ] [ i + 1 ] - C [ 0 ] [ i ] ) : continue else : flag = False break for i in range ( 2 ) : if not flag : break if ( C [ i + 1 ] [ 1 ] - C [ i ] [ 1 ] = = C [ i + 1 ] [ 2 ] - C [ i ] [ 2 ] ) and ( C [ i + 1 ] [ 1 ] - C [ i ] [ 1 ] = = C [ i + 1 ] [ 0 ] - C [ i ] [ 0 ] ) : continue else : flag = False break if flag : print ( ' Yes ' ) else : print ( ' No ' ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 3 ) ] for a1 in range ( min ( c [ 0 ] ) + 1 ) : for a2 in range ( min ( c [ 1 ] ) + 1 ) : for a3 in range ( min ( c [ 2 ] ) + 1 ) : b1 = c [ 0 ] [ 0 ] - a1 b2 = c [ 0 ] [ 1 ] - a1 b3 = c [ 0 ] [ 2 ] - a1 if c [ 1 ] [ 0 ] = = a2 + b1 and c [ 1 ] [ 1 ] = = a2 + b2 and c [ 1 ] [ 2 ] = = a2 + b3 and c [ 2 ] [ 0 ] = = a3 + b1 and c [ 2 ] [ 1 ] = = a3 + b2 and c [ 2 ] [ 2 ] = = a3 + b3 : print ( ' Yes ' ) exit ( ) print ( ' No ' ) import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; 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 ) ; KEYENCE2019 _ A solver = new KEYENCE2019 _ A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class KEYENCE2019 _ A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String [ ] c = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { c [ i ] = in . next ( ) ; } Arrays . sort ( c ) ; if ( String . join ( " " , c ) . equals ( " 1479 " ) ) { out . print ( " YES " ) ; } else { out . print ( " NO " ) ; } } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) a [ i ] [ j ] = sc . nextInt ( ) ; int _ 1 = a [ 0 ] [ 1 ] + a [ 0 ] [ 2 ] + a [ 1 ] [ 2 ] ; int _ 2 = a [ 1 ] [ 0 ] + a [ 2 ] [ 0 ] + a [ 2 ] [ 1 ] ; int _ 3 = a [ 0 ] [ 0 ] + a [ 1 ] [ 1 ] + a [ 2 ] [ 2 ] ; if ( _ 1 + _ 2 = = 2 * _ 3 ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { int a = i ; int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; if ( c [ 1 ] [ 0 ] - b1 = = c [ 1 ] [ 1 ] - b2 & & c [ 1 ] [ 1 ] - b2 = = c [ 1 ] [ 2 ] - b3 ) { if ( c [ 2 ] [ 0 ] - b1 = = c [ 2 ] [ 1 ] - b2 & & c [ 2 ] [ 1 ] - b2 = = c [ 2 ] [ 2 ] - b3 ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { solve ( in ) ; } } private static void solve ( Scanner in ) { int K = in . nextInt ( ) , S = in . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < K + 1 ; x + + ) { for ( int y = 0 ; y < K + 1 ; y + + ) { int z = S - ( x + y ) ; if ( z > = 0 & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; list . add ( n1 ) ; list . add ( n2 ) ; list . add ( n3 ) ; list . add ( n4 ) ; if ( list . contains ( 1 ) ) { if ( list . contains ( 9 ) ) { if ( list . contains ( 7 ) ) { if ( list . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int [ ] p = new int [ n ] ; int min = 100000 * 2 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( str [ i ] ) ; min = Math . min ( p [ i ] , min ) ; if ( p [ i ] > min ) count + + ; } System . out . println ( n - count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int csum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; csum + = c [ i ] [ j ] ; } } int [ ] threesum = new int [ 6 ] ; threesum [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; threesum [ 1 ] = c [ 0 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 1 ] [ 2 ] ; threesum [ 2 ] = c [ 1 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 2 ] [ 2 ] ; threesum [ 3 ] = c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 0 ] [ 2 ] ; threesum [ 4 ] = c [ 2 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 0 ] [ 2 ] ; threesum [ 5 ] = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] ; for ( int i = 1 ; i < 6 ; i + + ) { if ( threesum [ 0 ] ! = threesum [ i ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = n ; i + + ) { for ( int j = 0 ; j < = n ; j + + ) { int z = s ; z = z - i - j ; if ( z > = 0 & & z < = n ) counter + + ; } } System . out . println ( counter ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; solver . readP ( in . readLine ( ) ) ; } } class Solver { int N ; int cnt ; public void init ( ) { N = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " \ \ s + " ) ; N = Integer . parseInt ( strArr [ 0 ] ) ; } public void readP ( String str ) { String [ ] strArr = str . split ( " \ \ s + " ) ; int min = N + 1 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int p = Integer . parseInt ( strArr [ i ] ) ; if ( min > p ) { ans + + ; min = p ; } } System . out . println ( ans ) ; } public boolean hasNext ( ) { return cnt < N ; } public void readBody ( String str ) { cnt + + ; } public void solve ( ) { } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( ( S - i - j ) < = K & & 0 < = ( S - i - j ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; int answer = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a < = max ; a + + ) { for ( int b = 0 ; b < = max ; b + + ) { if ( answer - a - b < = max & & answer - a - b > = 0 ) count + + ; } } System . out . println ( count ) ; ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( ( z < = k ) & & ( z > = 0 ) ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { long n = sc . nextLong ( ) ; List < Long > an = new ArrayList < > ( ) ; for ( long i = 0 ; i < n ; i + + ) { an . add ( sc . nextLong ( ) ) ; } long result = 0 ; long min = Integer . MAX _ VALUE ; for ( long l : an ) { if ( min > l ) { result + + ; min = l ; } } System . out . println ( result ) ; } } static long lcm ( long a , long b ) { long temp ; long c = a ; c * = b ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return c / b ; } static long gcd ( long a , long b ) { long temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; ; } } System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = k ; x > = 0 ; x -- ) { for ( int y = Math . min ( s - x , k ) ; y > = 0 ; y -- ) { int z = s - x - y ; if ( z < = k ) { ans + + ; } else { break ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] temp = scanner . nextLine ( ) . split ( " " ) ; int tmp = 0 ; int count = 0 ; int min = Integer . parseInt ( temp [ 0 ] ) ; for ( int i = 1 ; i < n ; i + + ) { tmp = Integer . parseInt ( temp [ i ] ) ; if ( tmp = = Math . min ( min , tmp ) ) { count + + ; min = tmp ; } } System . out . println ( count + 1 ) ; } } import java . io . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _ out = new PrintWriter ( System . out ) ; private static PrintWriter _ err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { + + cnt ; } } } _ out . println ( cnt ) ; } private long C ( long n , long r ) { long res = 1 ; for ( long i = n ; i > n - r ; -- i ) { res * = i ; } for ( long i = r ; i > 1 ; -- i ) { res / = i ; } return res ; } private long P ( long n , long r ) { long res = 1 ; for ( long i = n ; i > n - r ; -- i ) { res * = i ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _ out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _ err . println ( ( G - S ) + " ms " ) ; } _ err . flush ( ) ; } } import java . util . Scanner ; class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int K = in . nextInt ( ) , S = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( i + j > = S - K & & i + j < = S ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] map = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { map [ i ] [ j ] = sc . nextInt ( ) ; } } boolean bool = true ; if ( ! ( map [ 0 ] [ 0 ] - map [ 0 ] [ 1 ] = = map [ 1 ] [ 0 ] - map [ 1 ] [ 1 ] & & map [ 0 ] [ 1 ] - map [ 0 ] [ 2 ] = = map [ 1 ] [ 1 ] - map [ 1 ] [ 2 ] & & map [ 0 ] [ 0 ] - map [ 0 ] [ 1 ] = = map [ 2 ] [ 0 ] - map [ 2 ] [ 1 ] & & map [ 0 ] [ 1 ] - map [ 0 ] [ 2 ] = = map [ 2 ] [ 1 ] - map [ 2 ] [ 2 ] ) ) bool = false ; if ( ! ( map [ 0 ] [ 0 ] - map [ 1 ] [ 0 ] = = map [ 0 ] [ 1 ] - map [ 1 ] [ 1 ] & & map [ 1 ] [ 0 ] - map [ 2 ] [ 0 ] = = map [ 1 ] [ 1 ] - map [ 2 ] [ 1 ] & & map [ 0 ] [ 0 ] - map [ 1 ] [ 0 ] = = map [ 0 ] [ 2 ] - map [ 1 ] [ 2 ] & & map [ 1 ] [ 0 ] - map [ 2 ] [ 0 ] = = map [ 1 ] [ 2 ] - map [ 2 ] [ 2 ] ) ) bool = false ; System . out . println ( bool ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { static int A , B ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < A + 1 ; i + + ) { for ( int j = 0 ; j < A + 1 ; j + + ) { if ( B - i - j < = A & & B - i - j > = 0 ) { ans + = 1 ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] List = new int [ 3 ] [ 3 ] ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { List [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = List [ 0 ] [ i ] - a [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = List [ i ] [ 0 ] - b [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( List [ i ] [ j ] ! = a [ i ] + b [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int b [ ] = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = b [ i ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int [ ] [ ] map = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { map [ i ] [ j ] = scan . nextInt ( ) ; } } boolean found = true ; int b1 = map [ 0 ] [ 0 ] ; int b2 = map [ 0 ] [ 1 ] ; int b3 = map [ 0 ] [ 2 ] ; int a1 = 0 ; int a2 = map [ 1 ] [ 0 ] - b1 ; int a3 = map [ 2 ] [ 0 ] - b1 ; if ( map [ 1 ] [ 1 ] ! = a2 + b2 | | map [ 1 ] [ 2 ] ! = a2 + b3 | | map [ 2 ] [ 1 ] ! = a3 + b2 | | map [ 2 ] [ 2 ] ! = a3 + b3 ) { found = false ; } System . out . println ( found ? " Yes " : " No " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { try ( Scanner sc = new Scanner ( System . in ) ) { int X = sc . nextInt ( ) ; long ans = 2 ; for ( int i = X ; i > 0 ; i -- ) { ans = ans * 2 + 2 ; } System . out . println ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int c = 0 ; int ans = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { c = s - a - b ; if ( c > = 0 & & c < = k ) { ans + + ; } } } System . out . println ( ans ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; import java . util . TreeSet ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; TreeSet < Character > ts = new TreeSet < > ( ) ; int n = Integer . valueOf ( sc . nextLine ( ) ) ; for ( int i = 0 ; i < n ; i + + ) ts . add ( sc . next ( ) . charAt ( 0 ) ) ; if ( ts . size ( ) = = 3 ) out . println ( " Three " ) ; else out . println ( " Four " ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x , y , z ; int s , k ; int count = 0 ; Scanner sc = new Scanner ( System . in ) ; k = Integer . parseInt ( sc . next ( ) ) ; s = Integer . parseInt ( sc . next ( ) ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int K = s . nextInt ( ) ; int S = s . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 ; for ( i = 0 ; i < = K ; i + + ) { for ( j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) count + + ; } } System . out . print ( count ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int a1 , b1 , b2 , b3 ; a1 = 0 ; b1 = c [ 0 ] [ 0 ] ; b2 = c [ 0 ] [ 1 ] ; b3 = c [ 0 ] [ 2 ] ; if ( c [ 1 ] [ 0 ] - b1 = = c [ 1 ] [ 1 ] - b2 & & c [ 1 ] [ 1 ] - b2 = = c [ 1 ] [ 2 ] - b3 ) { } else { System . out . println ( " No " ) ; return ; } if ( c [ 2 ] [ 0 ] - b1 = = c [ 2 ] [ 1 ] - b2 & & c [ 2 ] [ 1 ] - b2 = = c [ 2 ] [ 2 ] - b3 ) { } else { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] r = new int [ 3 ] ; boolean flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } outside : for ( int i = 0 ; i < 3 ; i + + ) { int a = 101 ; for ( int j = 0 ; j < 3 ; j + + ) { a = Math . min ( c [ i ] [ j ] , a ) ; } if ( i = = 0 ) { for ( int j = 0 ; j < 3 ; j + + ) { r [ j ] = c [ i ] [ j ] - a ; } } if ( i > 0 ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( r [ j ] ! = c [ i ] [ j ] - a ) { flag = false ; System . out . println ( " No " ) ; break outside ; } } } } if ( flag = = true ) { System . out . println ( " Yes " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String ans = " Yes " ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ! ( ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] ) & & ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] ) ) ) { ans = " No " ; } } System . out . println ( ans ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] p = in . readIntArray ( n ) ; int answer = 0 ; for ( int i = 0 , min = Integer . MAX _ VALUE ; i < n ; i + + ) { if ( p [ i ] < min ) answer + + ; min = Math . min ( min , p [ i ] ) ; } out . println ( answer ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public int [ ] readIntArray ( int n ) { int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = nextInt ( ) ; } return x ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 1 & & num [ 1 ] = = 4 & & num [ 2 ] = = 7 & & num [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int a = 0 ; int b = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = b ) { a + + ; b = P [ i ] ; } } System . out . println ( a ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] permutaion = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { permutaion [ i ] = in . nextInt ( ) ; } int min = permutaion [ 0 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( permutaion [ i ] < = min ) { ans + + ; min = permutaion [ i ] ; } } System . out . println ( ans ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) , S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { static int [ ] data ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { int c = s - ( b + a ) ; if ( c < = k & & c > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } static void num ( int n ) { int num = n ; for ( int i = 1 ; i < = n ; i + + ) { if ( n % i = = 0 ) { data [ i ] + + ; n / = i ; i = 1 ; } } return ; } } class Pair implements Comparable { Character from ; int end ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 200001 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { ans + = 1 ; min = p ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z < 0 ) break ; if ( z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int g [ ] [ ] = new int [ 3 ] [ 3 ] ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { g [ i ] [ j ] = sc . nextInt ( ) ; } } if ( ( g [ 0 ] [ 0 ] + g [ 1 ] [ 1 ] = = g [ 0 ] [ 1 ] + g [ 1 ] [ 0 ] ) & & ( g [ 0 ] [ 1 ] + g [ 1 ] [ 2 ] = = g [ 0 ] [ 2 ] + g [ 1 ] [ 1 ] ) & & ( g [ 1 ] [ 0 ] + g [ 2 ] [ 1 ] = = g [ 1 ] [ 1 ] + g [ 2 ] [ 0 ] ) & & ( g [ 1 ] [ 1 ] + g [ 2 ] [ 2 ] = = g [ 1 ] [ 2 ] + g [ 2 ] [ 1 ] ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; ArrayList < Integer > p = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { p . add ( scanner . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( p ) ; for ( int i = 0 ; i < n ; i + + ) { if ( p . get ( i ) < = min ) { min = p . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , a = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) a + + ; } } System . out . println ( a ) ; } } import java . util . Scanner ; final class Solver { static final Solver INSTANCE = new Solver ( ) ; void solve ( Scanner sc ) { int [ ] [ ] grid = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = grid [ 0 ] [ ( i + 2 ) % 3 ] - grid [ 0 ] [ ( i + 1 ) % 3 ] ; b [ i ] = grid [ ( i + 2 ) % 3 ] [ 0 ] - grid [ ( i + 1 ) % 3 ] [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] ! = grid [ j ] [ ( i + 2 ) % 3 ] - grid [ j ] [ ( i + 1 ) % 3 ] | | b [ i ] ! = grid [ ( i + 2 ) % 3 ] [ j ] - grid [ ( i + 1 ) % 3 ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } class Main { public static void main ( String ... args ) { Scanner in = new Scanner ( System . in ) ; Solver . INSTANCE . solve ( in ) ; in . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { int n = ni ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; + + i ) { a [ i ] = ni ( ) ; } int max = 1 ; long cnt = a [ 0 ] - 1 ; for ( int i = 1 ; i < n ; + + i ) { if ( a [ i ] = = max + 1 ) { + + max ; continue ; } long v = ( a [ i ] - 1 ) / ( max + 1 ) ; cnt + = v ; } System . out . println ( cnt ) ; } int ni ( ) { return Integer . parseInt ( sc . next ( ) ) ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int N = scan . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scan . nextInt ( ) ; } int count = 1 ; int min = P [ 0 ] ; if ( N = = 1 ) { System . out . println ( 1 ) ; } else { for ( int i = 0 ; i < N - 1 ; i + + ) { if ( P [ i ] > P [ i + 1 ] & & min > = P [ i + 1 ] ) { min = P [ i + 1 ] ; count + = 1 ; } } System . out . println ( count ) ; } } } } import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( list [ i ] , min ) ; if ( min < list [ i ] ) { continue ; } ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . lang . Integer ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String tokens1 [ ] = scanner . nextLine ( ) . split ( " " ) ; String tokens2 [ ] = scanner . nextLine ( ) . split ( " " ) ; int min = Integer . parseInt ( tokens2 [ 0 ] ) ; int count = 1 ; for ( int i = 1 ; i < tokens2 . length ; i + + ) { int val = Integer . parseInt ( tokens2 [ i ] ) ; if ( val < = min ) { count + + ; } min = Math . min ( min , val ) ; } System . out . print ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; String moji = " " ; int flag = 0 ; for ( int i = 0 ; i < N ; i + + ) { moji = in . next ( ) ; if ( moji . equals ( " Y " ) ) { flag = 1 ; } } if ( flag = = 1 ) { System . out . print ( " Four " ) ; } else { System . out . print ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] numbers = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { numbers [ i ] [ j ] = sc . nextInt ( ) ; } } if ( ( ( numbers [ 0 ] [ 0 ] - numbers [ 0 ] [ 1 ] ) = = ( numbers [ 1 ] [ 0 ] - numbers [ 1 ] [ 1 ] ) ) & & ( ( numbers [ 0 ] [ 0 ] - numbers [ 0 ] [ 1 ] ) = = ( numbers [ 2 ] [ 0 ] - numbers [ 2 ] [ 1 ] ) ) & & ( ( numbers [ 0 ] [ 1 ] - numbers [ 0 ] [ 2 ] ) = = ( numbers [ 1 ] [ 1 ] - numbers [ 1 ] [ 2 ] ) ) & & ( ( numbers [ 0 ] [ 1 ] - numbers [ 0 ] [ 2 ] ) = = ( numbers [ 2 ] [ 1 ] - numbers [ 2 ] [ 2 ] ) ) & & ( ( numbers [ 1 ] [ 0 ] - numbers [ 1 ] [ 1 ] ) = = ( numbers [ 1 ] [ 0 ] - numbers [ 1 ] [ 1 ] ) & & ( numbers [ 1 ] [ 0 ] - numbers [ 1 ] [ 1 ] ) = = ( numbers [ 2 ] [ 0 ] - numbers [ 2 ] [ 1 ] ) ) & & ( ( numbers [ 1 ] [ 1 ] - numbers [ 1 ] [ 2 ] ) = = ( numbers [ 1 ] [ 1 ] - numbers [ 1 ] [ 2 ] ) & & ( numbers [ 1 ] [ 1 ] - numbers [ 1 ] [ 2 ] ) = = ( numbers [ 2 ] [ 1 ] - numbers [ 2 ] [ 2 ] ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int num = s - i - j ; if ( num > = 0 & & num < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { z = s - ( x + y ) ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int num = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) num + + ; } } System . out . println ( num ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyReader r = new MyReader ( ) ; int K , S ; { int [ ] a = r . ii ( ) ; K = a [ 0 ] ; S = a [ 1 ] ; } int count = 0 ; for ( int i = 0 ; i < K + 1 ; i + + ) for ( int j = 0 , k ; j < K + 1 ; j + + ) if ( 0 < = ( k = S - i - j ) & & k < = K ) count + + ; println ( count ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static int Int ( String s ) { return Integer . parseInt ( s ) ; } static long Long ( String s ) { return Long . parseLong ( s ) ; } static class MyReader extends BufferedReader { MyReader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Integer . parseInt ( ss [ j ] ) ; return ii ; } long l ( ) throws IOException { return Long ( s ( ) ) ; } long [ ] ll ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; long [ ] ll = new long [ size ] ; for ( int j = 0 ; j < size ; j + + ) ll [ j ] = Long . parseLong ( ss [ j ] ) ; return ll ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; a [ 0 ] = 0 ; b [ 0 ] = c [ 0 ] [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] ; b [ 2 ] = c [ 0 ] [ 2 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; int x = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { x = 1 ; } } } System . out . println ( x = = 0 ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } out ( count ) ; } static long gcd ( long a , long b ) { return ( b = = 0 ) ? a : gcd ( b , a % b ) ; } static int gcd ( int a , int b ) { return ( b = = 0 ) ? a : gcd ( b , a % b ) ; } static void out ( String info ) { System . out . println ( info ) ; } static void out ( int info ) { System . out . println ( info ) ; } static void out ( double info ) { System . out . println ( info ) ; } static void out ( long info ) { System . out . println ( info ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . nextLine ( ) ; StringTokenizer st = new StringTokenizer ( s ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; a + + ; int original = ( b + 2 ) * ( b + 1 ) / 2 ; if ( b > = a ) { original - = ( b - a + 2 ) * ( b - a + 1 ) * 3 / 2 ; } if ( b > = 2 * a ) { original + = ( b - 2 * a + 2 ) * ( b - 2 * a + 1 ) * 3 / 2 ; } System . out . println ( original ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X = 0 , Y = 0 , Z = 0 ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { X = i ; Y = j ; Z = S - X - Y ; int total = X + Y + Z ; if ( total = = S & & Z > = 0 & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; boolean find = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = c [ 0 ] [ 0 ] ; i + + ) { a [ 0 ] = i ; for ( int j = 0 ; j < 3 ; j + + ) { b [ j ] = c [ 0 ] [ j ] - a [ 0 ] ; } a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; for ( int j = 0 ; j < 3 ; j + + ) { int b1 = c [ 1 ] [ j ] - a [ 1 ] ; if ( b1 ! = b [ j ] ) { find = false ; } } if ( find = = true ) { a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; for ( int j = 0 ; j < 3 ; j + + ) { int b2 = c [ 2 ] [ j ] - a [ 2 ] ; if ( b2 ! = b [ j ] ) { find = false ; } } } if ( find = = true ) { System . out . println ( " Yes " ) ; return ; } find = true ; } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int K = keyboard . nextInt ( ) ; int S = keyboard . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - ( i + j ) & & S - ( i + j ) < = K ) { ans + + ; } } } System . out . println ( ans ) ; keyboard . close ( ) ; } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int ans = 0 ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) ans + + ; } } out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } loop : for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { if ( c [ i ] [ 0 ] - c [ j ] [ 0 ] = = c [ i ] [ 1 ] - c [ j ] [ 1 ] & & c [ i ] [ 1 ] - c [ j ] [ 1 ] = = c [ i ] [ 2 ] - c [ j ] [ 2 ] ) { } else { b = false ; break loop ; } } } loop : for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { if ( c [ 0 ] [ i ] - c [ 0 ] [ j ] = = c [ 1 ] [ i ] - c [ 1 ] [ j ] & & c [ 1 ] [ i ] - c [ 1 ] [ j ] = = c [ 2 ] [ i ] - c [ 2 ] [ j ] ) { } else { b = false ; break loop ; } } } if ( b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String [ ] s = new String [ n ] ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = c [ j ] [ 0 ] - i ; for ( int j = 0 ; j < 3 ; j + + ) b [ j ] = c [ 0 ] [ j ] - a [ 0 ] ; boolean ok = true ; for ( int j = 0 ; j < 3 ; j + + ) { for ( int k = 0 ; k < 3 ; k + + ) { if ( c [ j ] [ k ] ! = a [ j ] + b [ k ] ) ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int X = 0 ; X < = Math . min ( K , S ) ; X + + ) { for ( int Y = 0 ; Y < = Math . min ( K , S - X ) ; Y + + ) { int Z = S - X - Y ; if ( 0 < = Z & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . math . BigInteger ; 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 . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Scanner ; class Main { static final int MOD = 1000000007 ; static final int INF = 1 < < 30 ; Main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean ok = false ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) ok = true ; } System . out . println ( ok ? " Four " : " Three " ) ; } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . util . * ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; Set < String > s = new HashSet < String > ( ) ; int N = sc . nextInt ( ) ; while ( N -- > 0 ) s . add ( sc . next ( ) ) ; System . out . println ( s . size ( ) = = 4 ? " Four " : " Three " ) ; sc . close ( ) ; } public static void main ( String args [ ] ) { solve ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = scan . nextInt ( ) ; } } int min = C [ 0 ] [ 0 ] ; for ( int i = 0 ; i < 2 ; i + + ) { if ( C [ 0 ] [ i ] < min ) min = C [ 0 ] [ i ] ; } int check ; for ( int a1 = 0 ; a1 < = min ; a1 + + ) { int c11 = C [ 0 ] [ 0 ] - a1 ; int a2 = C [ 1 ] [ 0 ] - c11 ; int a3 = C [ 2 ] [ 0 ] - c11 ; boolean flag = true ; for ( int i = 1 ; i < 3 ; i + + ) { check = C [ 0 ] [ i ] - a1 ; if ( C [ 1 ] [ i ] - a2 ! = check | | C [ 2 ] [ i ] - a3 ! = check ) { flag = false ; break ; } } if ( flag = = true ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } String ans = " No " ; for ( int i = 0 ; i < = 100 ; i + + ) { a [ 0 ] = i ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - i ; b [ 2 ] = c [ 0 ] [ 2 ] - i ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; if ( c [ 1 ] [ 1 ] = = a [ 1 ] + b [ 1 ] & & c [ 1 ] [ 2 ] = = a [ 1 ] + b [ 2 ] & & c [ 2 ] [ 1 ] = = a [ 2 ] + b [ 1 ] & & c [ 2 ] [ 2 ] = = a [ 2 ] + b [ 2 ] ) { ans = " Yes " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; int max = 0 ; int min = 100000000 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int M = Integer . parseInt ( sc . next ( ) ) ; if ( M > max ) { max = M ; } if ( M < = min ) { min = M ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) c [ i ] [ j ] = sc . nextInt ( ) ; } boolean ok = true ; for ( int i = 1 ; i < = 2 ; i + + ) { if ( c [ 0 ] [ i ] - c [ 0 ] [ i - 1 ] ! = c [ 1 ] [ i ] - c [ 1 ] [ i - 1 ] | | c [ 0 ] [ i ] - c [ 0 ] [ i - 1 ] ! = c [ 2 ] [ i ] - c [ 2 ] [ i - 1 ] ) ok = false ; } for ( int i = 1 ; i < = 2 ; i + + ) { if ( c [ i ] [ 0 ] - c [ i - 1 ] [ 0 ] ! = c [ i ] [ 1 ] - c [ i - 1 ] [ 1 ] | | c [ i ] [ 0 ] - c [ i - 1 ] [ 0 ] ! = c [ i ] [ 2 ] - c [ i - 1 ] [ 2 ] ) ok = false ; } System . out . println ( ok ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long ans = sc . nextLong ( ) - 1 ; long p = 2 ; for ( int i = 1 ; i < n ; i + + ) { long a = sc . nextLong ( ) ; if ( a = = p ) { p + + ; } else { long r = ( a % p ) ; if ( r = = 0 ) { if ( a > p ) { ans + + ; a - = ( p + 1 ) ; r = ( a % p ) ; ans + = ( ( a - r ) / p ) ; } } else { ans + = ( ( a - r ) / p ) ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] intArray = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { intArray [ i ] = sc . nextInt ( ) ; } double curMin = 1e9 ; for ( int value : intArray ) { curMin = Math . min ( curMin , value ) ; if ( curMin = = value ) { count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int min = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > a [ i ] ) { ans + + ; min = a [ i ] ; } } System . out . println ( ans + 1 ) ; } } import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { int N ; int [ ] P ; List < Integer > results = new ArrayList < > ( ) ; public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { N = Integer . parseInt ( in . readLine ( ) ) ; String [ ] tokens = in . readLine ( ) . split ( " " ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { P [ i ] = Integer . parseInt ( tokens [ i ] ) ; } } void calc ( ) { results . add ( P [ 0 ] ) ; int prevMin = P [ 0 ] ; for ( int i = 1 ; i < N ; + + i ) { if ( prevMin > = P [ i ] ) { results . add ( P [ i ] ) ; prevMin = P [ i ] ; } } } void showResult ( ) { System . out . println ( results . size ( ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & x + y + k > = s ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] c1 = new Integer [ 3 ] ; Integer [ ] c2 = new Integer [ 3 ] ; Integer [ ] c3 = new Integer [ 3 ] ; Arrays . setAll ( c1 , i - > Integer . parseInt ( sc . next ( ) ) ) ; Arrays . setAll ( c2 , i - > Integer . parseInt ( sc . next ( ) ) ) ; Arrays . setAll ( c3 , i - > Integer . parseInt ( sc . next ( ) ) ) ; sc . close ( ) ; Integer [ ] vertical = new Integer [ ] { c1 [ 0 ] - c1 [ 0 ] , c2 [ 0 ] - c1 [ 0 ] , c3 [ 0 ] - c1 [ 0 ] } ; Integer [ ] newC1 = new Integer [ ] { vertical [ 0 ] + c1 [ 0 ] , vertical [ 0 ] + c1 [ 1 ] , vertical [ 0 ] + c1 [ 2 ] } ; Integer [ ] newC2 = new Integer [ ] { vertical [ 1 ] + c1 [ 0 ] , vertical [ 1 ] + c1 [ 1 ] , vertical [ 1 ] + c1 [ 2 ] } ; Integer [ ] newC3 = new Integer [ ] { vertical [ 2 ] + c1 [ 0 ] , vertical [ 2 ] + c1 [ 1 ] , vertical [ 2 ] + c1 [ 2 ] } ; boolean judge1 = Arrays . equals ( c1 , newC1 ) ; boolean judge2 = Arrays . equals ( c2 , newC2 ) ; boolean judge3 = Arrays . equals ( c3 , newC3 ) ; boolean judge = judge1 & & judge2 & & judge3 ; String result = judge ? " Yes " : " No " ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; int i = 0 , j = 0 ; int temp ; boolean flag = true ; for ( i = 0 ; i < 3 ; i + + ) for ( j = 0 ; j < 3 ; j + + ) { temp = stdin . nextInt ( ) ; c [ i ] [ j ] = temp ; } for ( i = 0 ; i < 3 ; i + + ) { for ( j = 0 ; j < 3 ; j + + ) { if ( ( c [ i ] [ j ] - c [ i ] [ ( j + 1 ) % 3 ] ) ! = ( c [ ( i + 1 ) % 3 ] [ j ] - c [ ( i + 1 ) % 3 ] [ ( j + 1 ) % 3 ] ) ) flag = false ; } } if ( flag ) System . out . println ( " Yes " ) ; else if ( ! flag ) System . out . println ( " No " ) ; } } import java . util . * ; import static java . lang . System . * ; class Main { public static final int MOD = 1000000007 ; public static final int INF = 1000000000 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; Integer c [ ] [ ] = new Integer [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a , b ; a = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; b = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; String ans = " Yes " ; for ( int i = 1 ; i < 3 ; i + + ) { if ( a ! = c [ i ] [ 0 ] - c [ i ] [ 1 ] | | b ! = c [ i ] [ 1 ] - c [ i ] [ 2 ] ) { ans = " No " ; break ; } } for ( int j = 1 ; j < 3 ; j + + ) { if ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ! = c [ 0 ] [ j ] - c [ 1 ] [ j ] | | c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ! = c [ 1 ] [ j ] - c [ 2 ] [ j ] ) { ans = " No " ; break ; } } out . println ( ans ) ; } public static int gcd ( int a , int b ) { if ( b = = 0 ) return a ; return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int [ ] nums = new int [ k + 1 ] ; for ( int i = 0 ; i < nums . length ; i + + ) { nums [ i ] = i ; } int count = 0 ; for ( int i = 0 ; i < nums . length ; i + + ) { int x = nums [ i ] ; for ( int j = 0 ; j < nums . length ; j + + ) { int y = nums [ j ] ; int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int n = Integer . parseInt ( str ) ; int ans = 1 ; int min = 0 ; str = scan . nextLine ( ) ; String [ ] substr = str . split ( " " , 0 ) ; int [ ] array = new int [ 200000 ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = Integer . parseInt ( substr [ i ] ) ; } if ( array [ 1 ] = = 0 ) { System . out . println ( ans ) ; return ; } if ( array [ 1 ] < = array [ 0 ] ) { min = array [ 1 ] ; ans + + ; } else { min = array [ 0 ] ; } for ( int i = 2 ; i < n ; i + + ) { if ( min > = array [ i ] ) { min = array [ i ] ; ans + + ; } } System . out . println ( ans ) ; scan . close ( ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( ( S - ( i + j ) > = 0 ) & & ( S - ( i + j ) < = K ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . lang . * ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } } class TaskA { public void solve ( InputReader in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; int x , y , z ; int ans = 0 ; for ( x = 0 ; x < = k & & x < = s ; + + x ) { for ( y = 0 ; y < = k & & x + y < = s ; + + y ) { z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) + + ans ; } } out . println ( ans ) ; } } class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } import java . util . * ; import java . io . PrintWriter ; import static java . lang . Integer . * ; import static java . lang . Long . * ; import static java . lang . Math . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int k = parseInt ( sc . next ( ) ) ; int s = parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cnt = 0 ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( 0 < = s - ( i + j ) & & s - ( i + j ) < = k ) cnt + + ; } } out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ sc . nextInt ( ) ] + + ; } if ( n [ 1 ] = = 1 & & n [ 9 ] = = 1 & & n [ 7 ] = = 1 & & n [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . math . * ; import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws FileNotFoundException { new Main ( ) . run ( ) ; } class SegTree { int n = 1 ; int [ ] v ; public SegTree ( int n ) { while ( this . n < n ) this . n * = 2 ; v = new int [ 2 * this . n - 1 ] ; } void set ( int k ) { v [ k ] = 1 ; while ( k > 0 ) { k = ( k - 1 ) / 2 ; v [ k ] = v [ 2 * k + 1 ] + v [ 2 * k + 2 ] ; } } int query ( int a , int b ) { return query ( 0 , n , a , b , 0 ) ; } int query ( int l , int r , int a , int b , int k ) { if ( r < = a | | b < = l ) return 0 ; else if ( a < = l & & r < = b ) return v [ k ] ; else { int vl = query ( l , ( l + r ) / 2 , a , b , 2 * k + 1 ) ; int vr = query ( ( l + r ) / 2 , r , a , b , 2 * k + 2 ) ; return vl + vr ; } } } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = Integer . MAX _ VALUE / 3 ; int ans = 0 ; for ( int i = 0 ; i < N ; + + i ) { P [ i ] = sc . nextInt ( ) ; -- P [ i ] ; if ( min > = P [ i ] ) + + ans ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( ans ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] [ ] b = new int [ 3 ] [ 3 ] ; for ( int x = 0 ; x < 3 ; x + + ) { String [ ] foo = br . readLine ( ) . split ( " " ) ; for ( int y = 0 ; y < 3 ; y + + ) { b [ x ] [ y ] = Integer . parseInt ( foo [ y ] ) ; } } int a2 = 0 ; int a3 = 0 ; int b1 = 0 ; int b2 = 0 ; int b3 = 0 ; for ( int a1 = 0 ; a1 < 100 ; a1 + + ) { b1 = b [ 0 ] [ 0 ] - a1 ; b2 = b [ 0 ] [ 1 ] - a1 ; b3 = b [ 0 ] [ 2 ] - a1 ; int [ ] bls = { b1 , b2 , b3 } ; for ( int x = 0 ; x < 3 ; x + + ) { if ( x = = 0 ) { a2 = b [ 1 ] [ x ] - bls [ x ] ; a3 = b [ 2 ] [ x ] - bls [ x ] ; } else { if ( a2 ! = b [ 1 ] [ x ] - bls [ x ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } if ( a3 ! = b [ 2 ] [ x ] - bls [ x ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } a2 = b [ 1 ] [ x ] - bls [ x ] ; a3 = b [ 2 ] [ x ] - bls [ x ] ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; import java . util . Vector ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] sequence = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { sequence [ i ] = sc . nextInt ( ) ; } int koike = 1 ; int tanaka = 0 ; int min = sequence [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = sequence [ i ] ) { tanaka + + ; } min = Math . min ( min , sequence [ i ] ) ; } System . out . println ( tanaka ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) c [ i ] [ j ] = sc . nextInt ( ) ; } if ( ( ( c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) ) & & ( ( c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) = = ( c [ 3 ] [ 2 ] - c [ 3 ] [ 1 ] ) ) & & ( ( c [ 1 ] [ 3 ] - c [ 1 ] [ 2 ] ) = = ( c [ 2 ] [ 3 ] - c [ 2 ] [ 2 ] ) ) & & ( ( c [ 1 ] [ 3 ] - c [ 1 ] [ 2 ] ) = = ( c [ 3 ] [ 3 ] - c [ 3 ] [ 2 ] ) ) & & ( ( c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) ) & & ( ( c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 3 ] - c [ 1 ] [ 3 ] ) ) & & ( ( c [ 3 ] [ 1 ] - c [ 2 ] [ 1 ] ) = = ( c [ 3 ] [ 2 ] - c [ 2 ] [ 2 ] ) ) & & ( ( c [ 3 ] [ 1 ] - c [ 2 ] [ 1 ] ) = = ( c [ 3 ] [ 3 ] - c [ 2 ] [ 3 ] ) ) ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s < = i + j + k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int maxValue = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = maxValue ; x + + ) { for ( int y = 0 ; y < = maxValue ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = maxValue ) cnt + + ; } } System . out . println ( cnt ) ; } } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { scanner . nextLine ( ) ; System . out . println ( scanner . nextLine ( ) . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; ArrayList < Integer > numbers = new ArrayList < > ( ) ; int temp = 0 ; for ( int i = 0 ; i < a ; i + + ) { numbers . add ( sc . nextInt ( ) ) ; } int low = numbers . get ( 0 ) ; for ( int i = 0 ; i < a ; i + + ) { if ( numbers . get ( i ) < low ) { low = numbers . get ( i ) ; } if ( numbers . get ( i ) < = low ) { temp + + ; } } System . out . println ( temp ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; int count = 0 ; if ( c12 - c11 = = c22 - c21 & & c22 - c21 = = c32 - c31 ) { if ( c13 - c12 = = c23 - c22 & & c23 - c22 = = c33 - c32 ) { if ( c11 - c13 = = c21 - c23 & & c21 - c23 = = c31 - c33 ) { if ( c21 - c11 = = c22 - c12 & & c22 - c12 = = c23 - c13 ) { if ( c31 - c21 = = c32 - c22 & & c32 - c22 = = c33 - c23 ) { if ( c11 - c31 = = c12 - c32 & & c12 - c32 = = c13 - c33 ) { } } else { count + + ; } } else { count + + ; } } else { count + + ; } } else { count + + ; } } else { count + + ; } if ( count ! = 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } sc . close ( ) ; } public static int gcd ( int a , int b ) { if ( a < b ) { int tmp = a ; a = b ; b = tmp ; } int r = - 1 ; while ( r ! = 0 ) { r = a % b ; a = b ; b = r ; } return a ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long K = sc . nextLong ( ) ; long S = sc . nextLong ( ) ; long count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & 0 < = S - i - j ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( n - i - j < = k & & n - i - j > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int min = in . nextInt ( ) ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { int p = in . nextInt ( ) ; if ( p < min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = scan . nextInt ( ) ; } } int min = C [ 0 ] [ 0 ] ; for ( int i = 1 ; i < 3 ; i + + ) { if ( C [ 0 ] [ i ] < min ) min = C [ 0 ] [ i ] ; } int check ; for ( int a1 = 0 ; a1 < = min ; a1 + + ) { int c11 = C [ 0 ] [ 0 ] - a1 ; int a2 = C [ 1 ] [ 0 ] - c11 ; int a3 = C [ 2 ] [ 0 ] - c11 ; boolean flag = true ; for ( int i = 1 ; i < 3 ; i + + ) { check = C [ 0 ] [ i ] - a1 ; if ( C [ 1 ] [ i ] - a2 ! = check | | C [ 2 ] [ i ] - a3 ! = check ) { flag = false ; break ; } } if ( flag = = true ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - ( i + j ) & & S - ( i + j ) < = K ) { answer + + ; } } } System . out . println ( answer ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String msg = " Yes " ; for ( int i = 1 ; i < 3 ; i + + ) { int a = c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] ; if ( c [ i ] [ 1 ] - c [ i ] [ 0 ] ! = a ) { msg = " No " ; break ; } a = c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] ; if ( c [ i ] [ 2 ] - c [ i ] [ 1 ] ! = a ) { msg = " No " ; break ; } a = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( c [ 1 ] [ i ] - c [ 0 ] [ i ] ! = a ) { msg = " No " ; break ; } a = c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] ; if ( c [ 2 ] [ i ] - c [ 1 ] [ i ] ! = a ) { msg = " No " ; break ; } } System . out . println ( msg ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int k = 0 ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { k = S - i - j ; if ( ( k < = K ) & & ( k > = 0 ) ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { String line = " " ; try { line = readLine ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; String k = st . nextToken ( ) ; String s = st . nextToken ( ) ; int k1Value = Integer . parseInt ( k ) ; int sValue = Integer . parseInt ( s ) ; int cnt = 0 ; int x = 0 ; for ( int i = 0 ; i < sValue + 1 ; i + + ) { if ( i > k1Value ) { continue ; } for ( int j = 0 ; j < sValue + 1 ; j + + ) { if ( j > k1Value ) { continue ; } else if ( sValue - i - j > k1Value ) { continue ; } if ( i + j < = sValue ) { cnt + + ; } } } System . out . println ( cnt ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static String readLine ( ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int res = 0 ; int mi = N + 1 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; mi = Math . min ( mi , P ) ; if ( mi = = P ) { res + + ; } } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; ArrayList < String > c = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; if ( ! c . contains ( S [ i ] ) ) { c . add ( S [ i ] ) ; } } if ( c . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . nextLine ( ) ) ; String line = scanner . nextLine ( ) ; String [ ] split = line . split ( " " ) ; List < Integer > intList = new ArrayList < Integer > ( ) ; for ( String s : split ) { intList . add ( Integer . parseInt ( s ) ) ; } int cnt = 1 ; int min = intList . get ( 0 ) ; for ( int i = 1 ; i < intList . size ( ) ; i + + ) { int target = intList . get ( i ) ; if ( target < = min ) { cnt + + ; min = target ; } } int result = cnt ; System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdIn . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; b [ 0 ] = c [ 0 ] [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] ; b [ 2 ] = c [ 0 ] [ 2 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; boolean flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N ; N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; long sum = 0 ; int check = s - 2 * k ; int initial = ( int ) Math . max ( 0 , check ) ; for ( int i = initial ; i < = k ; i + + ) { int current = s - i ; int start = 0 ; int end = k ; if ( current > 2 * k ) { continue ; } else if ( current > k ) { start = current - k ; sum + = end - start + 1 ; } else if ( current > = 0 ) { end = current ; sum + = end - start + 1 ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( ( z > = 0 ) & & ( z < = k ) ) { count + + ; } } } System . out . println ( count ) ; } } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < list . length ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int min = list [ 0 ] ; for ( int i = 1 ; i < list . length ; i + + ) { if ( min > = list [ i ] ) { cnt + + ; min = list [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABeginning solver = new ABeginning ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABeginning { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = 4 ; int [ ] arr = in . nextArray ( n ) ; Arrays . sort ( arr ) ; out . println ( Arrays . equals ( arr , new int [ ] { 1 , 4 , 7 , 9 } ) ? " YES " : " NO " ) ; } } static class InputReader implements AutoCloseable { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = nextInt ( ) ; } return arr ; } public void close ( ) { } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = scan . nextInt ( ) ; N [ 1 ] = scan . nextInt ( ) ; N [ 2 ] = scan . nextInt ( ) ; N [ 3 ] = scan . nextInt ( ) ; Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; System . out . println ( sc . nextLine ( ) . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int temp = 0 ; for ( int i = 0 ; i < ( t - 1 ) ; i + + ) { int k = sc . nextInt ( ) ; if ( k < min ) { min = k ; temp + + ; } } System . out . println ( temp + 1 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] ; Arrays . setAll ( a , i - > s . nextInt ( ) ) ; Arrays . sort ( a ) ; int [ ] b = { 1 , 4 , 7 , 9 } ; System . out . println ( Arrays . equals ( a , b ) ? " YES " : " NO " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sa = br . readLine ( ) . split ( " " ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { 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 E = sc . nextInt ( ) ; int F = sc . nextInt ( ) ; int G = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int I = sc . nextInt ( ) ; int sum = A + E + I ; Main main = new Main ( ) ; if ( main . checkSum ( sum , A , H , F ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , D , B , I ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , D , H , C ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , G , E , C ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , G , B , F ) = = false ) { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } public boolean checkSum ( int sum , int A , int B , int C ) { if ( A + B + C = = sum ) return true ; return false ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] pArray = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { pArray [ i ] = sc . nextInt ( ) ; } int min = pArray [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( pArray [ i ] < min ) { count + + ; min = pArray [ i ] ; } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = i ; j + + ) { for ( int k = 0 ; k < = j ; k + + ) { int a = i + j + k ; if ( a = = S ) { if ( i = = j & & j = = k ) { count + + ; } else if ( i ! = j & & j ! = k & & k ! = i ) { count + = 6 ; } else { count + = 3 ; } } } } } System . out . println ( count ) ; } } import java . util . * ; class Main { 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 ( ) ; } int [ ] arr1 = new int [ n ] ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] < min ) { min = arr [ i ] ; arr1 [ i ] = min ; } else { arr1 [ i ] = min ; } } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] < = arr1 [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] Pz = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { Pz [ i ] = sc . nextInt ( ) ; } int minVal = 1000000000 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( Pz [ i ] < minVal ) { minVal = Pz [ i ] ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int n = sc . nextInt ( ) ; if ( n < = min ) { min = n ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = Long . parseLong ( sc . nextLine ( ) ) ; String [ ] arrays = sc . nextLine ( ) . split ( " " ) ; sc . close ( ) ; int count = 0 ; long tmpMax = Long . parseLong ( arrays [ 0 ] ) ; for ( int i = 0 ; i < N ; i + + ) { long Pi = Long . parseLong ( arrays [ i ] ) ; if ( tmpMax > = Pi ) { count + + ; tmpMax = Pi ; } else { continue ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) a [ i ] [ j ] = sc . nextInt ( ) ; } int sum1 , sum2 , sum3 , sum4 ; sum1 = a [ 0 ] [ 0 ] + a [ 1 ] [ 1 ] + a [ 2 ] [ 2 ] ; sum2 = a [ 0 ] [ 1 ] + a [ 1 ] [ 2 ] + a [ 2 ] [ 0 ] ; sum3 = a [ 1 ] [ 0 ] + a [ 2 ] [ 1 ] + a [ 0 ] [ 2 ] ; if ( sum1 = = sum2 & & sum2 = = sum3 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int t = S - x - y ; if ( t > = 0 & & t < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) > = 0 & & s - ( i + j ) < = k ) count + + ; } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( n -- > 0 ) { if ( sc . next ( ) . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; break ; } if ( n = = 0 ) System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] a = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) a [ i ] = sc . next ( ) ; boolean four = false ; for ( int i = 0 ; i < N ; i + + ) { if ( a [ i ] . equals ( " Y " ) ) { four = true ; break ; } } if ( four ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) ; long s = f ( n ) ; System . out . println ( s ) ; } private static long f ( long n ) { if ( n = = 0 ) return 2 ; return ( f ( n - 1 ) * 2 ) + 2 ; } } import java . util . Scanner ; public class Main { static int c [ ] [ ] = new int [ 3 ] [ 3 ] ; @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { if ( judge ( i ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } private static boolean judge ( int i ) { int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; boolean jua2 = false ; boolean jua3 = false ; for ( int j = 0 ; j < = 100 ; j + + ) { if ( c [ 1 ] [ 0 ] - b1 = = j & & c [ 1 ] [ 1 ] - b2 = = j & & c [ 1 ] [ 2 ] - b3 = = j ) jua2 = true ; } for ( int j = 0 ; j < = 100 ; j + + ) { if ( c [ 2 ] [ 0 ] - b1 = = j & & c [ 2 ] [ 1 ] - b2 = = j & & c [ 2 ] [ 2 ] - b3 = = j ) jua3 = true ; } if ( 0 < = b1 & & b1 < = 100 & & 0 < = b2 & & b2 < = 100 & & 0 < = b3 & & b3 < = 100 & & jua2 & & jua3 ) return true ; else return false ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; if ( 3 * k < s ) { System . out . println ( " " ) ; System . exit ( 0 ) ; } int r = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k & & y < = s - x ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) { r + + ; } } } System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] strlist = str . split ( " " ) ; int k = Integer . parseInt ( strlist [ 0 ] ) ; int s = Integer . parseInt ( strlist [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count = count + 1 ; continue ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int res = 0 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; if ( P < = min ) { res + + ; min = P ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { int c = s - a - b ; if ( 0 < = c & & c < = k ) { count + + ; } } } System . out . println ( count ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } 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 = 0 ; int min = sc . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { m = sc . nextInt ( ) ; if ( m < min ) { min = m ; count + + ; } if ( m = = 1 ) { break ; } } System . out . println ( count ) ; sc . close ( ) ; } } import java . io . * ; import java . util . * ; class Main { Scanner sc ; int N ; int [ ] P ; private void calc ( ) { sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int N = sc . nextInt ( ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = sc . nextInt ( ) ; int c = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) c + + ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( c ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] numbers = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { numbers [ i ] = in . nextInt ( ) ; } int tempMin = numbers [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( numbers [ i ] < tempMin ) { count + + ; tempMin = numbers [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = K ; i + + ) { if ( i > S ) { break ; } for ( int j = i ; j < = K ; j + + ) { if ( i + j > S ) { break ; } for ( int l = j ; l < = K ; l + + ) { if ( i + j + l = = S ) { if ( i < j & & j < l ) { answer = answer + 6 ; } else if ( ( i = = j & & j < l ) | | ( i < j & & j = = l ) ) { answer = answer + 3 ; } else { answer + + ; } break ; } } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { static int ans = 1 ; static int min ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } min = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { check ( n , a , i ) ; } System . out . println ( ans ) ; } public static void check ( int n , int [ ] a , int i ) { if ( a [ i ] < min ) { min = a [ i ] ; ans + + ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int [ ] b = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = b [ i ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdin . nextInt ( ) ; } } String result = " No " ; int a2 = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; int a3 = c [ 2 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( ( c [ 1 ] [ 1 ] = = ( a2 + c [ 0 ] [ 1 ] ) ) & & ( c [ 1 ] [ 2 ] = = ( a2 + c [ 0 ] [ 2 ] ) ) & & ( c [ 2 ] [ 1 ] = = ( a3 + c [ 0 ] [ 1 ] ) ) & & ( c [ 2 ] [ 2 ] = = ( a3 + c [ 0 ] [ 2 ] ) ) ) { result = " Yes " ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) for ( int y = 0 ; y < = k ; y + + ) if ( s - x - y < = k & & 0 < = s - x - y ) count + + ; System . out . print ( count ) ; sc . close ( ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { 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 ( ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; list . add ( d ) ; Collections . sort ( list ) ; if ( list . get ( 0 ) = = 1 & & list . get ( 1 ) = = 4 & & list . get ( 2 ) = = 7 & & list . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int kari = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; boolean hanbetsu = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( ( c [ i ] [ j ] + c [ ( i + 1 ) % 3 ] [ ( j + 1 ) % 3 ] + c [ ( i + 2 ) % 3 ] [ ( j + 2 ) % 3 ] ! = kari ) ) { hanbetsu = false ; break ; } } } if ( hanbetsu ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int result = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int sum = i + j ; if ( sum < = s & & s - sum < = k ) { result + + ; } } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) b [ i ] = arr [ 0 ] [ i ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = arr [ i ] [ 0 ] - b [ 0 ] ; boolean isGood = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ i ] [ j ] ! = a [ i ] + b [ j ] ) { isGood = false ; } } } System . out . println ( isGood ? " Yes " : " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int count = 1 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int min = P [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > = P [ i ] ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int tmp = s - ( i + j ) ; if ( 0 < = tmp & & tmp < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { static int [ ] a ; static boolean res ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) a [ i ] = sc . nextInt ( ) ; dfs ( " " ) ; System . out . println ( res ? " YES " : " NO " ) ; } public static void dfs ( String current ) { if ( res ) { return ; } if ( current . length ( ) = = 4 ) { if ( current . equals ( " 1974 " ) ) { res = true ; } return ; } dfs ( current + a [ 0 ] ) ; dfs ( current + a [ 1 ] ) ; dfs ( current + a [ 2 ] ) ; dfs ( current + a [ 3 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputs = sc . nextInt ( ) ; int num ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < inputs ; i + + ) { num = sc . nextInt ( ) ; if ( min > num ) { min = num ; } if ( min = = num ) { count + + ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { private static BufferedReader br ; private static StringTokenizer tokenizer ; private static void solve ( ) throws IOException { int n = nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = nextInt ( ) ; } int min = arr [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , arr [ i ] ) ; if ( min > = arr [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; solve ( ) ; } public static String next ( ) throws IOException { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { String line = br . readLine ( ) ; if ( line = = null ) throw new IOException ( ) ; tokenizer = new StringTokenizer ( line ) ; } return tokenizer . nextToken ( ) ; } public static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; void solve ( ) throws IOException { int x = ni ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans + + ; ans * = 2 ; } out . println ( ans ) ; } String ns ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) , " " ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( ns ( ) ) ; } double nd ( ) throws IOException { return Double . parseDouble ( ns ( ) ) ; } String [ ] nsa ( int n ) throws IOException { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ns ( ) ; } return res ; } int [ ] nia ( int n ) throws IOException { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ni ( ) ; } return res ; } long [ ] nla ( int n ) throws IOException { long [ ] res = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nl ( ) ; } return res ; } public static void main ( String [ ] args ) throws IOException { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; tok = new StringTokenizer ( " " ) ; Main main = new Main ( ) ; main . solve ( ) ; out . close ( ) ; } } import java . util . * ; import java . io . * ; public class Main { void solve ( InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; + + i ) { int x = in . nextInt ( ) ; if ( x < min ) { + + ans ; } min = Math . min ( min , x ) ; } out . println ( ans ) ; } public static void main ( String [ ] args ) throws Exception { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Main solver = new Main ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class InputReader { BufferedReader in ; StringTokenizer st ; public InputReader ( InputStream is ) { in = new BufferedReader ( new InputStreamReader ( is ) ) ; } public String next ( ) { try { while ( st = = null | | ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P [ ] = new int [ N ] ; int min = Integer . MAX _ VALUE ; int answer = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; if ( P [ i ] < = min ) answer + + ; if ( P [ i ] < min ) min = P [ i ] ; } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; if ( s . contains ( " 1 " ) & & s . contains ( " 9 " ) & & s . contains ( " 4 " ) & & s . contains ( " 7 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . lang . * ; import java . util . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ; int ca = 1 ; solver . solve ( ca , in , out ) ; out . close ( ) ; } static class Solver { public void solve ( int ca , InputReader in , PrintWriter out ) { while ( ca -- ! = 0 ) { int cnt [ ] = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { cnt [ in . nextInt ( ) ] + + ; } if ( cnt [ 1 ] = = 1 & & cnt [ 9 ] = = 1 & & cnt [ 7 ] = = 1 & & cnt [ 4 ] = = 1 ) { out . print ( " YES " ) ; } else { out . println ( " NO " ) ; } } } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public BigInteger nextBigInteger ( ) { return new BigInteger ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int K = stdIn . nextInt ( ) ; int S = stdIn . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( S - X - Y < = K & & S - X - Y > = 0 ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int x , y , z ; int count = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & s - x - y < = k ) count + + ; } } System . out . println ( count ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int matrix [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int j = 0 ; j < 2 ; j + + ) { for ( int i = 1 ; i < 3 ; i + + ) { if ( matrix [ i - 1 ] [ j ] - matrix [ i - 1 ] [ j + 1 ] ! = matrix [ i ] [ j ] - matrix [ i ] [ j + 1 ] ) { System . out . println ( " No " ) ; return ; } } } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { if ( matrix [ i + 1 ] [ j - 1 ] - matrix [ i ] [ j - 1 ] ! = matrix [ i + 1 ] [ j ] - matrix [ i ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] values = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { values [ i ] [ j ] = sc . nextInt ( ) ; } } boolean ok = false ; for ( int i = 0 ; i < 101 ; i + + ) { for ( int j = 0 ; j < 101 ; j + + ) { for ( int k = 0 ; k < 101 ; k + + ) { int b1 = values [ 0 ] [ 0 ] - i ; int b2 = values [ 0 ] [ 1 ] - i ; int b3 = values [ 0 ] [ 2 ] - i ; if ( b1 < 0 | | b2 < 0 | | b3 < 0 ) continue ; if ( ( values [ 1 ] [ 0 ] = = j + b1 & & values [ 1 ] [ 1 ] = = j + b2 & & values [ 1 ] [ 2 ] = = j + b3 ) & & ( values [ 2 ] [ 0 ] = = k + b1 & & values [ 2 ] [ 1 ] = = k + b2 & & values [ 2 ] [ 2 ] = = k + b3 ) ) { ok = true ; } } } } System . out . println ( ok ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public void main ( Scanner sc ) { int n [ ] = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } if ( ! check ( n [ 0 ] - n [ 1 ] , n [ 3 ] - n [ 4 ] , n [ 6 ] - n [ 7 ] ) | | ! check ( n [ 1 ] - n [ 2 ] , n [ 4 ] - n [ 5 ] , n [ 7 ] - n [ 8 ] ) | | ! check ( n [ 0 ] - n [ 3 ] , n [ 1 ] - n [ 4 ] , n [ 2 ] - n [ 5 ] ) | | ! check ( n [ 3 ] - n [ 6 ] , n [ 4 ] - n [ 7 ] , n [ 5 ] - n [ 8 ] ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } private boolean check ( int sa1 , int sa2 , int sa3 ) { return ( sa1 = = sa2 ) & & ( sa2 = = sa3 ) & & ( sa3 = = sa1 ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . print ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; int a = c11 - c21 ; int b = c12 - c22 ; int d = c13 - c23 ; int e = c21 - c31 ; int f = c22 - c32 ; int g = c23 - c33 ; if ( a = = b & b = = d & e = = f & f = = g ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 1 ; i < = N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int min = 100000000 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int M = Integer . parseInt ( S [ i ] ) ; if ( M < = min ) { min = M ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { static final long MOD = 1 _ 000 _ 000 _ 007 ; static final int MAX = 2 _ 147 _ 483 _ 646 ; static final int INF = 1 _ 000 _ 000 _ 000 ; public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int min = MAX ; for ( int i = 0 ; i < n ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp < = min ) { min = tmp ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; int sum = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int tmp = sum - i - j ; if ( 0 < = tmp & & tmp < = max ) result + + ; } } System . out . println ( Integer . toString ( result ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int sum = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( ( 0 < = Z ) & & ( Z < = K ) ) sum + + ; } } System . out . println ( sum ) ; } } import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int mini = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( i = = 0 ) { mini = p [ i ] ; } else { mini = Math . min ( mini , p [ i ] ) ; } if ( mini < p [ i ] ) { count + + ; } } System . out . println ( n - count ) ; } } 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 [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int minium = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = minium ) { minium = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } br . close ( ) ; long ans = 0 ; int x = 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] = = x ) { x + + ; } ans + = ( a [ i ] - 1 ) / x ; if ( x = = 1 ) { x + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int i , j ; int count = 0 ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) > = 0 & & s - ( i + j ) < = k ) { count + = 1 ; } } } System . out . print ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = 0 ; Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { a [ 0 ] = i ; a [ 1 ] = j ; a [ 2 ] = k ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - i ; b [ 2 ] = c [ 0 ] [ 2 ] - i ; if ( check ( a , b , c ) ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } static boolean check ( int a [ ] , int b [ ] , int c [ ] [ ] ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { return false ; } } } return true ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { TakashiInfo solver = new TakashiInfo ( ) ; solver . readInput ( ) ; solver . solve ( ) ; solver . writeOutput ( ) ; } static class TakashiInfo { private int map [ ] [ ] = new int [ 3 ] [ 3 ] ; private Scanner scanner ; private String output ; public TakashiInfo ( ) { scanner = new Scanner ( System . in ) ; } public void readInput ( ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { map [ i ] [ j ] = Integer . parseInt ( scanner . next ( ) ) ; } } } public void solve ( ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { map [ i ] [ j ] - = map [ i ] [ 0 ] ; } } output = ( map [ 0 ] [ 1 ] = = map [ 1 ] [ 1 ] & & map [ 1 ] [ 1 ] = = map [ 2 ] [ 1 ] & & map [ 0 ] [ 2 ] = = map [ 1 ] [ 2 ] & & map [ 1 ] [ 2 ] = = map [ 2 ] [ 2 ] ) ? " Yes " : " No " ; } public void writeOutput ( ) { System . out . println ( output ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cou = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) { cou + + ; } } } System . out . println ( cou ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < = min ) { ans + + ; min = p ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int p = 0 ; p < = K ; p + + ) { for ( int q = 0 ; q < = K ; q + + ) { if ( S - p - q < = K & & 0 < = S - p - q ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int cou = 1 ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 999999999 ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , p [ i - 1 ] ) ; if ( p [ i ] < min ) { cou + + ; } } System . out . print ( cou ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j < 0 | | s - i - j > k ) { continue ; } cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int count = 1 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int min = P [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( P [ i ] < min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] tokens = in . nextLine ( ) . split ( " " ) ; in . close ( ) ; Set < Integer > values = new HashSet < > ( ) ; for ( int i = 0 ; i < tokens . length ; + + i ) { values . add ( Integer . parseInt ( tokens [ i ] ) ) ; } if ( values . contains ( 1 ) & & values . contains ( 9 ) & & values . contains ( 7 ) & & values . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { InputStream in = System . in ; Scanner sc = new Scanner ( in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int num = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( z > = 0 & & z < = K ) { num + + ; } } } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int P [ ] = new int [ N ] ; int Pj = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; Pj = P [ 0 ] ; } for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = Pj ) { count + + ; Pj = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; long next = 2 ; for ( int i = 0 ; i < x ; i + + ) { next = ( next + 1 ) * 2 ; } System . out . println ( next ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int Z = S - i - j ; if ( Z > = 0 & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } function main ( input ) { var arr = [ ] ; var rows = input . split ( " " ) ; rows = rows . sort ( ) ; if ( rows [ 0 ] = = 5 & & rows [ 1 ] = = 5 & & rows [ 2 ] = = 7 ) { console . log ( " YES " ) ; } else { console . log ( " NO " ) ; } } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var out = function ( x ) { console . log ( x ) ; return x ; } var calc = function ( x ) { return Math . pow ( x , 3 ) ; } process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( x ) { out ( calc ( x ) ) ; } ) ; function main ( input ) { var val = input . split ( ' ' ) ; var K = parseInt ( val [ 0 ] ) ; var S = parseInt ( val [ 1 ] ) ; var sum = 0 ; for ( let i = 0 ; i < = K ; i + + ) { for ( let j = 0 ; j < = K ; j + + ) { var value = S - ( i + j ) ; if ( value > = 0 & & value < = K ) { sum + + ; } } } console . log ( sum ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; " use strict " ; const main = arg = > { let A = parseInt ( arg . split ( " \ n " ) [ 0 ] . split ( " " ) [ 0 ] ) ; let B = parseInt ( arg . split ( " \ n " ) [ 0 ] . split ( " " ) [ 1 ] ) ; if ( A = = 1 ) A = 14 ; if ( B = = 1 ) B = 14 ; if ( A = = B ) { console . log ( " Draw " ) ; } else if ( A > B ) { console . log ( " Alice " ) } else { console . log ( " Bob " ) } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function zero _ padding _ number ( num ) { return ( ' 000000 ' + num . toString ( ) ) . slice ( - 6 ) ; } function main ( input ) { const lines = input . split ( ' \ n ' ) ; const N = parseInt ( lines [ 0 ] . split ( ' ' ) [ 0 ] ) ; const M = parseInt ( lines [ 0 ] . split ( ' ' ) [ 1 ] ) ; var pys = [ ] ; for ( var i = 0 ; i < M ; i + + ) { var line = lines [ 1 + i ] . split ( ' ' ) . map ( x = > parseInt ( x ) ) pys . push ( [ i , line [ 0 ] , line [ 1 ] ] ) ; } var p _ y _ sorted = pys . sort ( function ( a , b ) { if ( a [ 1 ] = = b [ 1 ] ) { return a [ 2 ] - b [ 2 ] ; } return a [ 1 ] - b [ 1 ] ; } ) var current _ p = 0 ; var current _ city _ index = 1 ; for ( var i = 0 ; i < p _ y _ sorted . length ; i + + ) { var current _ city = p _ y _ sorted [ i ] ; if ( current _ p ! = current _ city [ 1 ] ) { current _ p = current _ city [ 1 ] current _ city _ index = 1 ; } var id = zero _ padding _ number ( current _ city [ 1 ] ) + zero _ padding _ number ( current _ city _ index ) ; p _ y _ sorted [ i ] . push ( id ) ; current _ city _ index + + ; } const stdin _ sorted _ cities = p _ y _ sorted . sort ( function ( a , b ) { return a [ 0 ] - b [ 0 ] ; } ) for ( var i = 0 ; i < M ; i + + ) { console . log ( stdin _ sorted _ cities [ i ] [ 3 ] ) } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; const main = function ( input ) { let num = 3 ; let ans = input ; for ( let i = 0 ; i < num - 1 ; i + + ) { ans * = input ; } console . log ( ans ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function main ( input ) { let [ a , b , h , m ] = input [ 0 ] . trim ( ) . split ( " " ) . map ( i = > parseInt ( i ) ) ; const p = [ ( h * 5 * 6 ) + 30 / 60 * m , m * 6 ] ; const diff = Math . max ( ... p ) - Math . min ( ... p ) ; const rad = Math . min ( diff , 360 - diff ) * Math . PI / 180 ; const cosine = Math . cos ( rad ) ; const result = a * a + b * b - ( 2 * a * b * cosine ) ; console . log ( Math . sqrt ( result ) ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) . trim ( ) . split ( " \ n " ) ) ; " use strict " ; function main ( input ) { const args = input . trim ( ) . split ( ' ' ) . map ( _ = > parseInt ( _ , 10 ) ) ; const rects = [ args [ 0 ] * args [ 1 ] , args [ 2 ] * args [ 3 ] ] . sort ( ( a , b ) = > { return a - b ; } ) ; console . log ( rects [ 1 ] ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ( function ( stdin ) { const inputs = stdin . toString ( ) . trim ( ) . split ( ' \ n ' ) ; const result = ( function ( x ) { return Math . pow ( x , 3 ) ; } ( parseInt ( inputs [ 0 ] , 10 ) ) ) ; console . log ( result ) ; } ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ) ; " use strict " function Main ( input ) { const total = input . split ( ' ' ) . map ( Number ) . reduce ( ( acc , cur ) = > acc + cur , 0 ) ; const ave = Math . ceil ( total / 2 ) ; console . log ( ave ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " " ) ; var a = parseInt ( input [ 0 ] , 10 ) ; var b = parseInt ( input [ 1 ] , 10 ) ; var c = parseInt ( input [ 2 ] , 10 ) ; var total = a + b + c ; if ( a > 4 & & b > 4 & & c > 4 & & total = = = 17 ) { console . log ( ' YES ' ) ; } else { console . log ( ' NO ' ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var A = parseInt ( input [ 0 ] . split ( " " ) [ 0 ] ) ; var B = parseInt ( input [ 0 ] . split ( " " ) [ 1 ] ) ; var H = parseInt ( input [ 0 ] . split ( " " ) [ 2 ] ) ; var M = parseInt ( input [ 0 ] . split ( " " ) [ 3 ] ) ; var hrad = Math . PI * 2 / ( 12 * 60 ) ; var mrad = Math . PI * 2 / 60 ; var ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( ( H * 60 + M ) * hrad - M * mrad ) ) ; console . log ( ' % s ' , ans ) ; return ans ; } function debug ( n ) { var input = document . getElementById ( " input " + n ) . value ; var ans = Main ( input ) ; var result = " WA " ; if ( ans = = document . getElementById ( " output " + n ) . value . split ( " \ n " ) [ 0 ] ) { result = " AC " ; } document . getElementById ( " result " + n ) . innerHTML = result ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) [ 0 ] . split ( " " ) . map ( Number ) . sort ( ( a , b ) = > b > a ) ; console . log ( input [ 0 ] = = 7 & & input [ 1 ] = = 5 & & input [ 2 ] = = 5 ? " YES " : " NO " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( input ) { const nums = input . split ( " " ) ; var count5 = 0 , count7 = 0 ; nums . forEach ( num = > { if ( num = = 5 ) { count5 + = 1 ; } if ( num = = 7 ) { count7 + = 1 ; } } ) console . log ( count5 = = 2 & & count7 = = 1 ? " YES " : " NO " ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ' use strict ' ; function Main ( input ) { const N = parseInt ( input . split ( " \ n " ) [ 0 ] , 10 ) ; const x = 800 * N ; let y = 0 ; if ( N > = 15 ) { y = Math . floor ( N / 15 ) * 200 ; } console . log ( x - y ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { var five = ( input . match ( / 5 / g ) | | [ ] ) . length ; var seven = ( input . match ( / 7 / g ) | | [ ] ) . length ; ( five = = 2 & & seven = = 1 ) ? console . log ( " YES " ) : console . log ( " NO " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( input ) { let nums = input . split ( " \ n " ) ; let i = 0 ; while ( nums [ i ] ! = = " 0 " ) { let sum = 0 ; while ( nums [ i ] . length > 0 ) { let char = nums [ i ] . slice ( - 1 ) ; nums [ i ] = nums [ i ] . slice ( 0 , - 1 ) ; sum + = parseInt ( char ) ; } console . log ( sum ) ; i + + ; } } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf-8 " ) ) ; var stdin = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var x = parseInt ( stdin , 10 ) ; console . log ( x * x * x ) ; const input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; const list = input . split ( ' ' ) ; const sortedList = list . sort ( ( a , b ) = > a - b ) ; console . log ( sortedList [ 2 ] - sortedList [ 0 ] ) ; function main ( input ) { input = input . trim ( ) . split ( " \ n " ) ; n = parseInt ( input [ 0 ] ) ; x = input [ 1 ] . split ( " " ) . map ( p = > Number ( p ) ) ; var total = 0 ; for ( var i = 0 ; i < x . length ; i + + ) { total + = x [ i ] ; } var c = Math . round ( total / n ) ; var ans = 0 ; for ( var i = 0 ; i < x . length ; i + + ) { ans + = Math . pow ( Math . abs ( x [ i ] - c ) , 2 ) ; } console . log ( ans ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; " use strict " ; function Main ( input ) { const n = parseInt ( input , 10 ) ; const nums = [ 64 , 32 , 16 , 8 , 4 , 2 , 1 ] ; const ans = nums . find ( v = > n > = v ) ; console . log ( ans ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var stdin = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var x = parseInt ( stdin , 10 ) ; console . log ( Math . pow ( x , 3 ) ) ; ' use strict ' const main = ( input ) = > { const a = parseInt ( input . split ( ' ' ) [ 0 ] ) const b = parseInt ( input . split ( ' ' ) [ 1 ] ) console . log ( Math . ceil ( ( a + b ) / 2 ) ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf-8 ' ) ) var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var kotae ; kotae = parseInt ( input , 10 ) ; kotae = kotae * kotae * kotae ; console . log ( kotae ) ; const main = ( args ) = > { const input = args . trim ( ) . split ( ' ' ) ; const A = input [ 0 ] ; const B = input [ 1 ] ; const H = input [ 2 ] ; const M = input [ 3 ] ; const c = ( H / 12.0 + M / ( 12.0 * 60.0 ) - M / 60.0 ) * Math . PI * 2 ; const ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B ) * Math . cos ( c ) ) ; console . log ( ans ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf-8 ' ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var g _ input = ' ' ; process . stdin . on ( ' data ' , function ( chunk ) { g _ input + = chunk ; } ) ; process . stdin . on ( ' end ' , function ( ) { main ( g _ input . split ( / \ r ? \ n / ) ) ; } ) ; function main ( inputs ) { var N = parseInt ( inputs [ 0 ] ) ; var vs = inputs [ 1 ] . split ( " " ) . map ( function ( a ) { return parseInt ( a ) ; } ) ; var max = 0 ; var min = 100000 ; for ( var i in vs ) { max = Math . max ( max , vs [ i ] ) ; min = Math . min ( min , vs [ i ] ) ; } console . log ( max - min ) ; } ' use strict ' ; let stdin = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; let a = 0 , b = 0 ; for ( let x of stdin . split ( ' ' ) ) { x = parseInt ( x ) ; if ( x = = 5 ) { a + + ; } else if ( x = = 7 ) { b + + ; } } console . log ( a = = 2 & & b = = 1 ? " YES " : " NO " ) ; var pass = 0 ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( input ) { var result = input . match ( / [ 0-9 ] + / g ) ; for ( var i in result ) { pass + = Number ( result [ i ] ) ; } } ) ; process . stdin . on ( ' end ' , function ( ) { console . log ( pass ) ; } ) ; var lines = [ ] ; var readline = require ( ' readline ' ) ; var rl = readline . createInterface ( { input : process . stdin , output : process . stdout , } ) ; rl . on ( ' line ' , function ( x ) { lines . push ( x ) ; } ) ; rl . on ( ' close ' , function ( ) { var c = lines . map ( i = > i . split ( " " ) . map ( i = > Number ( i ) ) ) ; for ( var a1 = 0 ; a1 < = 100 ; a1 + + ) { var b1 = c [ 0 ] [ 0 ] - a1 var b2 = c [ 1 ] [ 0 ] - a1 var b3 = c [ 2 ] [ 0 ] - a1 for ( var a2 = 0 ; a2 < = 100 ; a2 + + ) { if ( a2 + b1 ! = = c [ 0 ] [ 1 ] ) { continue } if ( a2 + b2 ! = = c [ 1 ] [ 1 ] ) { continue } if ( a2 + b3 ! = = c [ 2 ] [ 1 ] ) { continue } for ( var a3 = 0 ; a3 < = 100 ; a3 + + ) { if ( a3 + b1 ! = = c [ 0 ] [ 2 ] ) { continue } if ( a3 + b2 ! = = c [ 1 ] [ 2 ] ) { continue } if ( a3 + b3 ! = = c [ 2 ] [ 2 ] ) { continue } console . log ( " Yes " ) ; return ( 0 ) } } } console . log ( " No " ) } ) ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) . split ( " " ) ; console . log ( Math . max ( input [ 0 ] * input [ 1 ] , input [ 2 ] * input [ 3 ] ) ) ; ' use strict ' ; let equalAll = ( a , b , c ) = > { return a = = = b & & a = = = c ; } ; let equalSome = ( a , b , c ) = > { return a = = = b | | b = = = c | | a = = = c ; } ; let permutationSize = pattern = > { if ( equalAll ( pattern [ 0 ] , pattern [ 1 ] , pattern [ 2 ] ) ) { return 1 ; } if ( equalSome ( pattern [ 0 ] , pattern [ 1 ] , pattern [ 2 ] ) ) { return 3 ; } return 6 ; } ; function Main ( input ) { const line = input . split ( ' ' ) . map ( el = > + el ) ; let patterns = [ ] ; for ( let x = 0 ; x < = line [ 0 ] ; x + + ) { if ( x > line [ 1 ] ) continue ; for ( let y = x ; y < = line [ 0 ] ; y + + ) { if ( y > line [ 1 ] ) continue ; const z = line [ 1 ] - x - y ; if ( z < 0 | | z > line [ 0 ] ) continue ; if ( z < x | | z < y ) continue ; patterns . push ( [ x , y , z ] ) ; } } let result = 0 ; for ( let i = 0 ; i < patterns . length ; i + + ) { result + = permutationSize ( patterns [ i ] ) ; } console . log ( result ) ; } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var x = parseInt ( input [ 0 ] , 10 ) ; console . log ( x * x * x ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( s ) { s = s . split ( " " ) . map ( a = > + a ) ; console . log ( Math . max ( ... s ) - Math . min ( ... s ) ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var Arr = ( input . trim ( ) ) . split ( " \ n " ) ; for ( var I = 0 ; I < Arr . length ; I + + ) { var a = Arr [ I ] . split ( " , " ) . map ( Number ) ; var arr = [ ] ; for ( var i = 0 ; i < 13 ; i + + ) arr [ i ] = 0 ; a . forEach ( function ( v ) { arr [ v - 1 ] + + ; } ) ; var copy = arr . slice ( ) ; arr . sort ( function ( a , b ) { return b - a ; } ) ; var ans ; if ( arr [ 0 ] > = 4 ) ans = " four card " ; else if ( arr [ 0 ] = = 3 & & arr [ 1 ] = = 2 ) ans = " full house " ; else if ( ( copy . join ( " " ) ) . match ( / 11111 | 1000000001111 / ) ) ans = " straight " ; else if ( arr [ 0 ] = = 3 ) ans = " three card " ; else if ( arr [ 0 ] = = 2 & & arr [ 1 ] = = 2 ) ans = " two pair " ; else if ( arr [ 0 ] = = 2 ) ans = " one pair " ; else ans = " null " ; console . log ( ans ) ; } var calc = function ( x ) { return x * x * x ; } process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( x ) { console . log ( calc ( x ) ) ; } ) ; ' use strict ' const main = input = > { const s = input . trim ( ) . split ( ' \ n ' ) [ 1 ] . split ( ' ' ) let cnt = 0 for ( let i = 0 ; i < s . length ; i + + ) { if ( s [ i ] = = = ' Y ' ) cnt + + } if ( cnt > 0 ) console . log ( ' Four ' ) else console . log ( ' Three ' ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) " use strict " ; const main = arg = > { arg = arg . trim ( ) . split ( " \ n " ) ; const N = parseInt ( arg [ 0 ] . split ( " " ) [ 0 ] ) ; const K = parseInt ( arg [ 0 ] . split ( " " ) [ 1 ] ) ; console . log ( K = = = 1 ? 0 : N - K ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { const heisei = input . split ( " / " ) ; for ( i = 0 ; i < = 2 ; i + + ) { heisei [ i ] = parseInt ( heisei [ i ] , 10 ) ; } if ( heisei [ 0 ] < = 2019 & & heisei [ 1 ] < = 4 & & heisei [ 2 ] < = 30 ) { console . log ( " Heisei " ) ; } else { console . log ( " TBD " ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { for ( var i = 0 ; i < = 10 ; i + + ) { if ( Math . pow ( 2 , i ) > input ) { i -- ; break ; } } console . log ( Math . pow ( 2 , i ) ) } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) ) ; " use strict " function Main ( input ) { const inputArray = input . split ( " " ) ; let count5 = 0 , count7 = 0 ; inputArray . forEach ( value = > { if ( value = = 5 ) count5 + + ; else if ( value = = 7 ) count7 + + ; } ) ; if ( count5 = = = 2 & & count7 = = = 1 ) console . log ( " YES " ) ; else console . log ( " NO " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var input _ lines = [ ] ; var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; let count5 = 0 ; let count7 = 0 ; let result = ' NO ' reader . on ( ' line ' , ( line ) = > { input _ lines = line . split ( " " ) for ( let i = 0 ; i < input _ lines . length ; i + + ) { if ( input _ lines [ i ] = = 5 ) { count5 + + } if ( input _ lines [ i ] = = 7 ) { count7 + + } } if ( count7 = = 1 & & count5 = = 2 ) { result = ' YES ' } } ) ; reader . on ( ' close ' , ( ) = > { console . log ( result ) ; } ) ; function main ( input ) { const args = input . split ( ' \ n ' ) ; var a = parseInt ( args [ 0 ] ) var b = parseInt ( args [ 1 ] ) var c = parseInt ( args [ 2 ] ) var d = parseInt ( args [ 3 ] ) var e = parseInt ( args [ 4 ] ) var k = parseInt ( args [ 5 ] ) var distance = ( e - a ) if ( distance < = k ) { console . log ( ' Yay ! ' ) ; } else { console . log ( ' : ( ' ) ; } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ' use strict ' const INF = 900719925474099 ; function Main ( input ) { let temp = input . trim ( ) . split ( ' ' ) ; let a = parseInt ( temp [ 0 ] ) ; let b = parseInt ( temp [ 1 ] ) ; if ( a > = 13 ) { console . log ( b ) ; } else if ( a > = 6 ) { console . log ( b / 2 ) ; } else { console . log ( 0 ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " UTF-8 " ) ) ; function main ( input ) { input = input . trim ( ) . split ( " \ n " ) ; const N = parseInt ( input . shift ( ) ) ; const permutation = input [ 0 ] . split ( " " ) . map ( Number ) ; let result = 0 ; let min = permutation [ 0 ] ; for ( let i = 0 ; i < N ; i + + ) { if ( min > = permutation [ i ] ) { result + + ; min = permutation [ i ] ; } } console . log ( result ) ; } var si = process . stdin ; si . resume ( ) ; si . setEncoding ( ' utf8 ' ) ; si . on ( ' data ' , function ( chunk ) { var x = Number ( chunk . toString ( ) . trim ( ) ) ; console . log ( x * x * x ) ; } ) ; function myin ( ) { return require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) ; } function myout ( t ) { console . log ( t ) ; } function myconv ( i , no ) { switch ( no ) { case 0 : return i ; case 1 : return parseInt ( i ) ; case 2 : return i . split ( " " ) ; case 3 : return i . split ( " \ n " ) ; case 4 : return i . split ( " " ) . map ( ( a ) = > Number ( a ) ) ; case 5 : return i . split ( " \ n " ) . map ( ( a ) = > Number ( a ) ) ; case 6 : return i . split ( " " ) ; case 7 : return i . split ( " " ) . map ( ( a ) = > Number ( a ) ) ; } } function Main ( input ) { input = myconv ( input , 3 ) ; var N = myconv ( input [ 0 ] , 1 ) ; var xList = new Array ( N ) ; var yList = new Array ( N ) ; input . shift ( ) ; for ( var i = 0 ; i < N ; i + + ) { var tmp = myconv ( input [ i ] , 4 ) ; xList [ i ] = tmp [ 0 ] ; yList [ i ] = tmp [ 1 ] ; } var sum = 0 ; for ( var i = 0 ; i < N - 1 ; i + + ) { for ( var j = i + 1 ; j < N ; j + + ) { var x = Math . abs ( xList [ i ] - xList [ j ] ) ; var y = Math . abs ( yList [ i ] - yList [ j ] ) ; sum + = Math . sqrt ( Math . pow ( x , 2 ) + Math . pow ( y , 2 ) ) ; } } sum * = 2 ; var fact = 1 ; for ( var i = 1 ; i < = N ; i + + ) { fact * = i ; } myout ( sum / N ) ; } Main ( myin ( ) ) ; function Main ( input ) { var inputs = input . split ( " " ) ; var k = Number ( inputs [ 0 ] ) ; var s = Number ( inputs [ 1 ] ) ; var cnt = 0 ; for ( var x = 0 ; x < = k ; x + + ) for ( var y = 0 ; y < = k ; y + + ) if ( s - ( x + y ) > = 0 & & s - ( x + y ) < = k ) cnt + + ; console . log ( cnt ) } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var stdin = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var input = stdin . toString ( ) . trim ( ) . split ( ' \ n ' ) ; var x = parseInt ( input [ 0 ] , 10 ) ; console . log ( Math . pow ( x , 3 ) ) ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var lines = input . trim ( ) . split ( ' \ n ' ) ; var ret = lines . filter ( function ( line ) { var items = line . split ( ' , ' ) ; var w = + items [ 1 ] ; var h = + items [ 2 ] ; return w / ( h * h ) > = 25 ; } ) ; ret . forEach ( function ( line ) { console . log ( line . split ( ' , ' ) [ 0 ] ) ; } ) ; " use strict " ; function main ( input ) { const args = input . split ( ' \ n ' ) ; let ans _ time = 0 ; let first = 9 ; let food _ first ; let flag = false for ( var i = 0 ; i < args . length - 1 ; i + + ) { const food = parseInt ( args [ i ] ) ; ans _ time + = Math . ceil ( food / 10 ) * 10 ; food _ first = food % 10 ; if ( food _ first ! = = 0 & & food _ first < = first ) { first = food _ first ; flag = true ; } } if ( ! flag ) { first = 10 ; } console . log ( ans _ time - 10 + first ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var arr = input . trim ( ) . split ( " \ n " ) ; var nmab = arr [ 0 ] . split ( " " ) . map ( Number ) ; var d = arr [ 1 ] . split ( " " ) . map ( Number ) ; var m = nmab [ 1 ] ; var a = nmab [ 2 ] ; var b = nmab [ 3 ] ; var haiki = [ ] ; for ( var i = 0 ; i < d . length ; i + + ) { if ( d [ i ] > = a ) haiki . push ( d [ i ] ) ; else break ; } if ( d . length - haiki . length < m ) { haiki . reverse ( ) ; var cnt = 0 ; for ( var i = 0 ; i < haiki . length ; i + + ) { if ( haiki [ i ] < = b ) cnt + + ; else break ; } console . log ( haiki . length - cnt ) ; } else { console . log ( haiki . length ) ; } function Main ( input ) { input = input . split ( " \ n " ) ; var T = input [ 0 ] . split ( " " ) ; var A = input [ 1 ] . split ( " " ) ; var B = input [ 2 ] . split ( " " ) ; var T0 = T [ 0 ] ; var T1 = T [ 1 ] ; var A0 = A [ 0 ] ; var A1 = A [ 1 ] ; var B0 = B [ 0 ] ; var B1 = B [ 1 ] ; var Ma = T0 * ( A0 - B0 ) ; var Mb = ( T1 * A1 + Ma ) - ( T1 * B1 ) ; if ( Math . sign ( Ma ) = = Math . sign ( Mb ) ) { console . log ( 0 ) ; } else if ( Mb = = 0 ) { console . log ( " infinity " ) ; } else { Ma = Math . abs ( Ma ) ; Mb = Math . abs ( Mb ) ; if ( Ma % Mb = = 0 ) { console . log ( ( Ma / Mb ) * 2 ) ; } else { console . log ( Math . ceil ( Ma / Mb ) * 2 - 1 ) ; } } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; const main = arg = > { arg = arg . trim ( ) . split ( " \ n " ) ; const N = arg [ 0 ] . split ( " " ) . map ( n = > ~ ~ n ) ; console . log ( ~ ~ N . sort ( ( a , b ) = > a - b ) . join ( " " ) = = = 1479 ? " YES " : " NO " ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ' use strict ' function main ( s ) { const houses = s . split ( ' \ n ' ) [ 1 ] . split ( ' ' ) . map ( n = > Number ( n ) ) ; const min = Math . min ( ... houses ) ; const max = Math . max ( ... houses ) ; const answer = max - min ; console . log ( answer ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ' use strict ' function main ( input ) { input = input . trim ( ) . split ( ' ' ) . map ( Number ) const ans = Math . ceil ( ( input [ 0 ] + input [ 1 ] ) / 2 ) console . log ( ans ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) function main ( input ) { input = input . trim ( ) ; const a = input . split ( " " ) . map ( Number ) ; console . log ( Math . max ( a [ 0 ] , Math . max ( a [ 1 ] , a [ 2 ] ) ) - Math . min ( a [ 0 ] , Math . min ( a [ 1 ] , a [ 2 ] ) ) ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ' use strict ' ; process . stdin . on ( ' data ' , function ( chunk ) { var inputs = chunk . toString ( ) ; var x = Number ( inputs ) ; console . log ( x * x * x ) ; } ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; function Main ( input ) { var input = input . split ( ' \ n ' ) ; var answer ; var nums = input [ 0 ] . split ( ' ' ) ; nums = nums . map ( ( e ) = > parseInt ( e ) ) ; answer = nums [ 0 ] + nums [ 1 ] > = nums [ 2 ] ; console . log ( answer ? ' Yes ' : ' No ' ) ; } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . split ( ' \ n ' ) ; nidan = input [ 1 ] . split ( ' ' ) ; flag = null ; for ( i = 0 ; i < nidan . length - 1 ; i + + ) { if ( nidan [ i ] = = = ' Y ' ) { flag = true ; } } if ( flag ) { console . log ( ' Four ' ) ; } else { console . log ( ' Three ' ) ; } } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var a = ~ ~ input [ 0 ] ; var b = ~ ~ input [ 1 ] ; var c = ~ ~ input [ 2 ] ; var d = ~ ~ input [ 3 ] ; var e = ~ ~ input [ 4 ] ; var k = ~ ~ input [ 5 ] ; var AtCoder = function ( a , b , c , d , e , k ) { this . antena = [ a , b , c , d , e ] ; this . distance = k ; } ; AtCoder . prototype = { procedure : function ( ) { for ( var antena1 of this . antena ) { for ( var antena2 of this . antena ) { if ( Math . abs ( antena1 - antena2 ) > this . distance ) return false ; } } return true ; } } var atcoder = new AtCoder ( a , b , c , d , e , k ) ; if ( atcoder . procedure ( ) = = true ) { console . log ( " Yay ! " ) ; } else { console . log ( " : ( " ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var input _ lines = [ ] ; var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; let count5 = 0 ; let count7 = 0 ; let result = ' NO ' reader . on ( ' line ' , ( line ) = > { input _ lines = line . split ( " " ) if ( input _ lines [ 0 ] = = 5 ) { count5 + + } if ( input _ lines [ 0 ] = = 7 ) { count7 + + } if ( input _ lines [ 1 ] = = 5 ) { count5 + + } if ( input _ lines [ 1 ] = = 7 ) { count7 + + } if ( input _ lines [ 2 ] = = 5 ) { count5 + + } if ( input _ lines [ 2 ] = = 7 ) { count7 + + } if ( count7 = = 1 & & count5 = = 2 ) { result = ' YES ' } } ) ; reader . on ( ' close ' , ( ) = > { console . log ( result ) ; } ) ; " use strict " ; var input = require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ; var cin = input . split ( / | \ n / ) , cid = 0 ; function next ( ) { return + cin [ cid + + ] ; } function nextstr ( ) { return cin [ cid + + ] ; } function nextbig ( ) { return BigInt ( cin [ cid + + ] ) ; } function nexts ( n , a ) { return a ? cin . slice ( cid , cid + = n ) : cin . slice ( cid , cid + = n ) . map ( a = > + a ) ; } function nextm ( h , w , a ) { var r = [ ] , i = 0 ; if ( a ) for ( ; i < h ; i + + ) r . push ( cin . slice ( cid , cid + = w ) ) ; else for ( ; i < h ; i + + ) r . push ( cin . slice ( cid , cid + = w ) . map ( a = > + a ) ) ; return r ; } function xArray ( v ) { var a = arguments , l = a . length , r = " Array ( a [ " + -- l + " ] ) .fill ( ) .map ( x = > { return " + v + " ; } ) " ; while ( -- l ) r = " Array ( a [ " + l + " ] ) .fill ( ) .map ( x = > " + r + " ) " ; return eval ( r ) ; } var myOut = main ( ) ; if ( myOut ! = = undefined ) console . log ( myOut ) ; function main ( ) { var [ h1 , m1 , h2 , m2 , k ] = nexts ( 5 ) ; m1 + = h1 * 60 ; m2 + = h2 * 60 ; return m2 - m1 - k ; } ' use strict ' const main = arg = > { const n = parseInt ( arg . split ( ' \ n ' ) [ 0 ] , 10 ) const xn = arg . split ( ' \ n ' ) [ 1 ] . split ( ' ' ) . map ( e = > parseInt ( e , 10 ) ) const avg = Math . round ( xn . reduce ( ( val , e ) = > val + e , 0 ) / n ) const w = xn . reduce ( ( v , e ) = > v + ( e - avg ) * ( e - avg ) , 0 ) console . log ( w ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf-8 ' ) ) function Main ( input ) { input = input . split ( " \ n " ) ; var line = input [ 0 ] . split ( " " ) ; var K = parseInt ( line [ 0 ] ) ; var S = parseInt ( line [ 1 ] ) ; var roop = Math . min ( K , S ) ; var ans = 0 ; for ( var A = 0 ; A < = roop ; A + + ) { if ( S - K - A > = 0 ) { if ( 2 * K - S + A + 1 > 0 ) { ans + = 2 * K - S + A + 1 ; } } else if ( S - K - A < 0 ) { if ( S - A + 1 > 0 ) { ans + = S - A + 1 ; } } } console . log ( ans ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { var xs = input . trim ( ) . split ( ' ' ) . map ( v = > parseInt ( v , 10 ) ) ; var result = xs . reduce ( function ( previous , current , index , xs ) { return previous + current ; } ) ; console . log ( Math . ceil ( result / xs . length ) ) ; } Main ( require ( ' fs ' ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { var lines = input . split ( " \ n " ) ; var nums = lines [ 0 ] . replace ( / \ s / g , ' ' ) console . log ( nums . replace ( ' 5 ' , ' ' ) . replace ( ' 5 ' , ' ' ) . replace ( ' 7 ' , ' ' ) . length = = = 0 ? ' YES ' : ' NO ' ) } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' ascii ' ) ; var input _ stdin = " " ; var input _ stdin _ array = " " ; var input _ currentline = 0 ; process . stdin . on ( ' data ' , function ( data ) { input _ stdin + = data ; } ) ; process . stdin . on ( ' end ' , function ( ) { input _ stdin _ array = input _ stdin . split ( " \ n " ) ; main ( ) ; } ) ; function readLine ( ) { return input _ stdin _ array [ input _ currentline + + ] ; } function main ( ) { var s = readLine ( ) ; s = s . split ( " " ) ; var N = parseInt ( s [ 0 ] ) ; var M = parseInt ( s [ 1 ] ) ; var A = [ ] ; var B = [ ] ; for ( var i = 0 ; i < N ; i + + ) { s = readLine ( ) . substr ( 0 , N ) ; A . push ( s ) ; } for ( var i = 0 ; i < M ; i + + ) { s = readLine ( ) . substr ( 0 , M ) ; B . push ( s ) ; } var ans = " No " ; for ( var i = 0 ; i < N - M + 1 ; i + + ) { for ( var j = 0 ; j < N - M + 1 ; j + + ) { var iguales = 1 ; for ( var k = 0 ; k < M ; k + + ) { if ( A [ i + k ] . substr ( j , M ) . localeCompare ( B [ k ] ) ! = 0 ) { iguales = 0 ; break ; } } if ( iguales = = 1 ) { process . stdout . write ( " Yes " ) ; process . exit ( ) ; } } } process . stdout . write ( " No " ) ; process . exit ( ) ; } function main ( input ) { input = input . trim ( ) ; var list = input . split ( " " ) ; var jHari = parseInt ( list [ 0 ] ) ; var fHari = parseInt ( list [ 1 ] ) ; var ji = parseInt ( list [ 2 ] ) ; var fun = parseInt ( list [ 3 ] ) ; function deg ( deg ) { return ( deg * Math . PI / 180 ) ; } var posJ = [ Math . cos ( deg ( ji * 30 + fun * 0.5 ) ) * jHari , Math . sin ( deg ( ji * 30 + fun * 0.5 ) ) * jHari ] ; var posF = [ Math . cos ( deg ( fun * 6 ) ) * fHari , Math . sin ( deg ( fun * 6 ) ) * fHari ] ; function kyori ( ax , ay , bx , by ) { return ( Math . sqrt ( ( ax - bx ) * * 2 + ( ay - by ) * * 2 ) ) ; } var answer = kyori ( posJ [ 0 ] , posJ [ 1 ] , posF [ 0 ] , posF [ 1 ] ) ; console . log ( answer . toString ( ) ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { ' use strict ' ; const temp = input . split ( " " ) ; const a = parseInt ( temp [ 0 ] , 10 ) ; const b = parseInt ( temp [ 1 ] , 10 ) ; let payment ; if ( a < = 5 ) payment = 0 ; else if ( a < = 12 ) payment = b / 2 ; else payment = b ; console . log ( payment ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( arg ) { arg = arg . trim ( ) . split ( " \ n " ) . map ( Number ) var k = arg . pop ( ) var data = arg for ( var i = 0 ; i < data . length ; i + + ) { for ( var j = i + 1 ; j < data . length ; j + + ) { var ans = Math . abs ( data [ i ] - data [ j ] ) if ( ans > k ) { console . log ( ' : ( ' ) return } } } console . log ( ' Yay ! ' ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { console . log ( input * 800 - Math . floor ( input / 15 ) * 200 ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ( function main ( input ) { var x = parseInt ( input ) ; console . log ( x * x * x ) ; } ) ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ( function ( stdin ) { ' use strict ' ; var inputs = stdin . toString ( ) . trim ( ) . split ( ' \ n ' ) ; var lines = inputs . map ( function ( v ) { return v . split ( ' ' ) . map ( Number ) ; } ) ; var result = ( function ( lines ) { return lines . map ( function ( v ) { return v . reduce ( function add ( a , b ) { return a + b ; } ) ; } ) . join ( ' \ n ' ) ; } ) ( lines ) ; console . log ( result ) ; } ) ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . trim ( ) in put = input . split ( " " ) ; if ( input [ 0 ] = = 1 ) { input [ 0 ] = 14 ; } if ( input [ 1 ] = = 1 ) { input [ 1 ] = 14 ; } input [ 0 ] - = 0 in put [ 1 ] - = 0 if ( input [ 0 ] > input [ 1 ] ) { console . log ( " Alice " ) ; } else if ( input [ 0 ] < input [ 1 ] ) { console . log ( " Bob " ) ; } else { console . log ( " Draw " ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . trim ( ) in put = input . split ( " / " ) . map ( Number ) ; if ( input [ 1 ] < = 4 ) console . log ( " Heisei " ) ; else console . log ( " TBD " ) } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( input ) { input = input . split ( " \ n " ) ; input = input [ 0 ] . split ( " " ) ; let a = parseInt ( input [ 0 ] , 10 ) ; let b = parseInt ( input [ 1 ] , 10 ) ; let h = parseInt ( input [ 2 ] , 10 ) ; let m = parseInt ( input [ 3 ] , 10 ) ; console . log ( Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( 2 * Math . PI * Math . abs ( h / 12 + m / 60 / 12 - m / 60 ) ) ) . toFixed ( 20 ) ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { var inputs = input . split ( " " ) . map ( n = > parseInt ( n , 10 ) ) ; var a = inputs [ 0 ] ; var b = inputs [ 1 ] ; if ( ( a + b ) % 2 = = = 0 ) { console . log ( ( a + b ) / 2 ) ; } else { console . log ( Math . ceil ( ( a + b ) / 2 ) ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( input ) { const list = input . split ( " " ) . map ( v = > Number ( v ) ) ; const result = { true : " YES " , false : " NO " } ; const is575 = list = > { const syllable575 = new Map ( ) ; syllable575 . set ( 5 , 2 ) ; syllable575 . set ( 7 , 1 ) ; for ( const syllable of syllable575 . keys ( ) ) { if ( list . filter ( v = > v = = = syllable ? true : false ) . length ! = = syllable575 . get ( syllable ) ) { return ( false ) ; } } return ( true ) ; } console . log ( result [ is575 ( list ) ] ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var lines = [ ] var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; reader . on ( ' line ' , ( line ) = > { lines . push ( line ) ; } ) ; reader . on ( ' close ' , ( ) = > { for ( var line of lines ) { if ( line = = = " 0 " ) { break ; } console . log ( aux ( line ) ) ; } } ) ; function aux ( s ) { return ( s . split ( ' ' ) . map ( Number ) . reduce ( ( s , x ) = > { return s + x } ) ) } function Picker ( input ) { var lines = input . split ( ' \ n ' ) ; var fields = lines . reduce ( function ( all , line ) { return all . concat ( line . split ( ' ' ) ) ; } , [ ] ) ; var p = 0 ; return { int : function ( ) { return parseInt ( fields [ p + + ] , 10 ) ; } , float : function ( ) { return parseFloat ( fields [ p + + ] ) ; } , str : function ( ) { return fields [ p + + ] ; } } ; } function Main ( input ) { var pick = Picker ( input ) ; var l = [ pick . int ( ) , pick . int ( ) , pick . int ( ) , pick . int ( ) , pick . int ( ) ] . sort ( function ( a , b ) { return a - b ; } ) ; var k = pick . int ( ) ; var min = l [ 0 ] ; var max = l [ l . length - 1 ] ; console . log ( max - min < = k ? ' Yay ! ' : ' : ( ' ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ' use strict ' function main ( input ) { input = input . trim ( ) . split ( ' ' ) . map ( v = > Number ( v ) ) let ans = input [ 0 ] - input [ 1 ] if ( input [ 1 ] = = = 1 ) ans = 0 console . log ( ans ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . trim ( ) ; input = input . trim ( ) . split ( " " ) . map ( ( a ) = > Number ( a ) ) ; var A = input [ 0 ] ; var B = input [ 1 ] ; if ( A = = 1 & & B = = 1 ) { console . log ( " Draw " ) ; } else if ( A = = 1 & & B ! = 1 ) { console . log ( " Alice " ) ; } else if ( A ! = 1 & & B = = 1 ) { console . log ( " Bob " ) ; } else if ( A > B ) { console . log ( " Alice " ) ; } else if ( A < B ) { console . log ( " Bob " ) ; } else { console . log ( " Draw " ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( input ) { const args = input . split ( ' ' ) ; const a = parseInt ( args [ 0 ] , 10 ) ; console . log ( a * a * a ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function myin ( ) { return require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) ; } function myout ( t ) { console . log ( t ) ; } function myconv ( i , no ) { switch ( no ) { case 0 : return i ; case 1 : return parseInt ( i ) ; case 2 : return i . split ( " " ) ; case 3 : return i . split ( " \ n " ) ; case 4 : return i . split ( " " ) . map ( ( a ) = > Number ( a ) ) ; case 5 : return i . split ( " \ n " ) . map ( ( a ) = > Number ( a ) ) ; case 6 : return i . split ( " " ) ; case 7 : return i . split ( " " ) . map ( ( a ) = > Number ( a ) ) ; } } function Main ( input ) { input = myconv ( input , 1 ) ; if ( input % 2 = = 0 ) { myout ( input + " " + input + " " + input / 2 ) ; return ; } else { for ( var i = 1 ; i < = 3500 ; i + + ) { for ( var j = 1 ; j < = 3500 ; j + + ) { var a = input * i * j / ( 4 * i * j - input * ( i + j ) ) ; if ( Number . isInteger ( a ) & & a > = 1 & & a ! = Infinity ) { myout ( a + " " + i + " " + j ) ; return ; } } } } } Main ( myin ( ) ) ; ' use strict ' const main = ( input ) = > { let tasks = input . split ( ' \ n ' ) [ 0 ] . split ( ' ' ) . map ( i = > parseInt ( i ) ) const ans = Math . max ( ... tasks ) - Math . min ( ... tasks ) console . log ( ans ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf-8 ' ) ) process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { var x = parseInt ( chunk . trim ( ) , 10 ) ; console . log ( Math . pow ( x , 3 ) ) ; } ) ; ' use strict ' ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( line ) { var x = parseInt ( line . trim ( ) , 10 ) ; console . log ( Math . pow ( x , 3 ) ) ; } ) ; function main ( a ) { a = a . split ( " " ) ; a = stn ( a ) ; function Actor ( name , card ) { this . name = name ; this . card = card ; } var Alice = new Actor ( " Alice " , a [ 0 ] ) ; var Bob = new Actor ( " Bob " , a [ 1 ] ) ; console . log ( poker ( Alice , Bob ) ) ; } function poker ( Alice , Bob ) { if ( Alice . card = = Bob . card ) return " Draw " ; if ( Alice . card = = 1 ) return Alice . name ; if ( Bob . card = = 1 ) return Bob . name ; if ( Alice . card > Bob . card ) { return Alice . name ; } else { return Bob . name ; } } function stn ( a ) { return a . map ( function ( x ) { return parseInt ( x , 10 ) ; } ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; i = 0 ; x = [ ] ; counter = 0 ; N = 1000000 ; D = 0 ; for ( i = 0 ; i < = N ; i + + ) { num = input [ i ] . split ( / \ s + / ) ; littleX = [ ] ; if ( i = = 0 ) { N = num [ 0 ] ; D = num [ 1 ] ; } else { for ( j = 0 ; j < D ; j + + ) { littleX . push ( num [ j ] ) ; } x . push ( littleX ) ; } } for ( i = 0 ; i < N ; i + + ) { for ( k = i + 1 ; k < N ; k + + ) { sum = 0 ; for ( j = 0 ; j < D ; j + + ) { sum + = Math . abs ( ( x [ i ] [ j ] - x [ k ] [ j ] ) * ( x [ i ] [ j ] - x [ k ] [ j ] ) ) ; } if ( Number . isInteger ( Math . sqrt ( sum ) ) = = = true ) { counter + + ; } } } console . log ( counter ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var data = ' ' ; var readable = process . stdin ; readable . setEncoding ( ' utf-8 ' ) ; readable . on ( ' data ' , function ( chunk ) { data + = chunk ; } ) readable . resume ( ) ; readable . on ( ' end ' , function ( ) { var x = parseInt ( data ) ; console . log ( ' % d ' , Math . pow ( x , 3 ) ) ; } ) function Main ( input ) { input = input . trim ( ) in put = input . split ( " " ) ; if ( input [ 1 ] ! = 1 ) console . log ( input [ 0 ] - input [ 1 ] ) ; else console . log ( 0 ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function D166 ( _ input ) { var lines = _ input . split ( " \ n " ) ; var x = lines . shift ( ) * 1 ; for ( var i = 119 ; i > - 118 ; i -- ) { for ( var j = 118 ; j > - 119 ; j -- ) { const fi = i * i * i * i * i ; const fj = j * j * j * j * j ; if ( fi - fj = = = x ) { console . log ( ` $ { i } $ { j } ` ) ; return ; } } } } D166 ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; Array . prototype . aggregate = function ( ) { return this . reduce ( ( a , b ) = > ( a [ b ] = ( a [ b ] | | 0 ) + 1 ) & & a , { } ) ; } function Main ( input ) { input = input . split ( " \ n " ) ; var a = input [ 1 ] . split ( " " ) ; var b = a . aggregate ( ) ; var cnt = 0 ; for ( var c in b ) { cnt + + ; } return cnt = = 3 ? " Three " : " Four " ; } ( ( b , c , d ) = > " undefined " ! = typeof require ? console . log ( Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ) : [ b = b . split ( " \ n " ) . slice ( 1 , - 1 ) . join ( " \ n " ) , c = function ( ) { try { return Main ( b ) } catch ( f ) { return f . stack | | f . message } } ( ) , d = typeof c , " string " = = d | | ( c = JSON . stringify ( c ) ) , $ ( " < form > " ) . append ( [ [ 10 , b ] , 0 , [ 1 , d ] , 0 , [ 10 , c ] ] . map ( f = > $ ( f ? " < textarea > " : " < br > " , f & & { rows : f [ 0 ] , cols : 40 , text : f [ 1 ] } ) ) ) . appendTo ( " body " ) ] ) ( ` ` ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var N = parseInt ( input [ 0 ] . split ( " " ) [ 0 ] ) ; var K = parseInt ( input [ 0 ] . split ( " " ) [ 1 ] ) ; if ( K = = 1 ) { var ans = 0 ; } else { var ans = N - K ; } console . log ( ' % s ' , ans ) ; return ans ; } function debug ( n ) { var input = document . getElementById ( " input " + n ) . value ; var ans = Main ( input ) ; var result = " WA " ; if ( ans = = document . getElementById ( " output " + n ) . value . split ( " \ n " ) [ 0 ] ) { result = " AC " ; } document . getElementById ( " result " + n ) . innerHTML = result ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var soroban = [ " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) , " * = * * * * " . split ( " " ) ] ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var Arr = ( input . replace ( / \ n $ / , " " ) ) . split ( " \ n " ) . map ( Number ) ; Arr . forEach ( function ( v , i ) { if ( i ! = = 0 ) console . log ( " " ) ; var str = ( " 00000 " + v ) . slice ( - 5 ) ; var arr = [ " " , " " , " " , " " , " " , " " , " " , " " ] ; for ( var i = 0 ; i < 5 ; i + + ) { var s = soroban [ ( str [ i ] - 0 ) ] ; s . forEach ( function ( v , index ) { arr [ index ] + = v ; } ) ; } console . log ( arr . join ( " \ n " ) ) ; } ) ; function Main ( input ) { input = input . split ( " " ) ; var a = parseInt ( input [ 0 ] , 10 ) ; var b = parseInt ( input [ 1 ] , 10 ) ; var c = parseInt ( input [ 2 ] , 10 ) ; if ( a + b - c < 0 ) { console . log ( " No " ) ; } else { console . log ( " Yes " ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " function main ( arg ) { var data = arg . split ( " \ n " ) [ 1 ] . split ( " " ) . map ( Number ) var min _ i = 0 var min _ v = data [ 0 ] var count = 1 for ( var i = 1 ; i < data . length ; i + + ) { if ( min _ v > = data [ i ] ) { count + + min _ v = data [ i ] } } console . log ( count ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( " utf8 " ) ; const reader = require ( " readline " ) . createInterface ( { input : process . stdin , output : process . stdout , } ) ; const lines = [ ] ; reader . on ( " line " , ( line ) = > { lines . push ( line ) ; } ) ; reader . on ( " close " , ( ) = > { for ( let i = 0 ; i < lines . length ; i + + ) { let n = lines [ i ] ; if ( n = = = " 0 " ) break ; console . log ( n . split ( " " ) . map ( Number ) . reduce ( ( a , b ) = > a + b ) ) ; } } ) ; " use strict " ; function I ( s , f ) { this . _ s = s . split ( " \ n " ) ; this . _ c = 0 ; this . _ l = 0 ; this . _ f = f | | Number } I . prototype . a = function ( ) { var l = this . _ s [ this . _ l ] ; if ( ! l ) return ; var t = l . trim ( ) . split ( " " ) ; var a = t [ this . _ c ] ; this . _ c + + ; if ( t . length = = = this . _ c ) { this . _ c = 0 ; this . _ l + + } return this . _ f ( a ) } ; I . prototype . l = function ( ) { var l = this . _ s [ this . _ l ] ; if ( ! l ) return ; this . _ c = 0 ; this . _ l + + ; return l . split ( " " ) . map ( this . _ f ) } ; function main ( input ) { const o = new I ( input ) ; var arr = [ ] ; var mod = 10 ; for ( var i = 0 ; i < 5 ; i + + ) { var m = o . a ( ) ; var mm = m % 10 ; if ( mm < mod & & mm > 0 ) { mod = mm ; } arr . push ( m ) ; } if ( mod = = = 10 ) { console . log ( arr . reduce ( ( acc , cur ) = > acc + cur ) ) ; } else { var sum = 0 ; for ( var i = 0 ; i < 5 ; i + + ) { if ( arr [ i ] % 10 = = = 0 ) { sum + = arr [ i ] ; } else { sum + = arr [ i ] - arr [ i ] % 10 + 10 ; } } console . log ( sum - 10 + mod ) ; } } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { console . log ( Math . pow ( chunk , 3 ) ) ; } ) ; function main ( lines ) { const phrases = na ( ) ; let cnt5 = cnt7 = 0 ; phrases . forEach ( n = > { if ( n = = 5 ) cnt5 + + ; if ( n = = 7 ) cnt7 + + ; } ) const ans = cnt5 = = 2 & & cnt7 = = 1 ? ' YES ' : ' NO ' ; return ans ; } const lines = require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) . split ( " \ n " ) ; let lineCount = 0 ; const s = ( ) = > lines [ lineCount + + ] ; const n = ( ) = > Number ( s ( ) ) ; const b = ( ) = > BigInt ( s ( ) ) ; const sa = ( ) = > s ( ) . split ( ' ' ) ; const na = ( ) = > sa ( ) . map ( Number ) ; const ba = ( ) = > sa ( ) . map ( BigInt ) ; const ans = main ( lines ) ; console . log ( ans ) ; const main = ( N , D , X ) = > { var count = 0 for ( var i = 0 ; i < N ; i + + ) { for ( var k = i + 1 ; k < N ; k + + ) { var tmp = 0 for ( var j = 0 ; j < D ; j + + ) { tmp + = Math . pow ( X [ i ] [ j ] - X [ k ] [ j ] , 2 ) } if ( Number . isInteger ( Math . sqrt ( tmp ) ) ) { count + + } } } return count } const input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) . split ( " \ n " ) . filter ( i = > i ! = = ' ' ) const lst = input . map ( i = > i . split ( " " ) . map ( x = > Number ( x ) ) ) const N = lst [ 0 ] [ 0 ] const D = lst [ 0 ] [ 1 ] const X = lst . slice ( 1 , lst . length ) console . log ( main ( N , D , X ) ) process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var lines = [ ] ; var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; reader . on ( ' line ' , ( line ) = > { lines . push ( line . split ( " " ) ) ; } ) ; reader . on ( ' close ' , solve ) ; function getInt ( strArr ) { var rtn = [ ] ; for ( elem of strArr ) rtn . push ( parseInt ( elem ) ) ; return rtn ; } function getFloat ( strArr ) { var rtn = [ ] ; for ( elem of strArr ) rtn . push ( parseFloat ( elem ) ) ; return rtn ; } function solve ( ) { var [ N ] = getInt ( lines [ 0 ] ) ; var P = getInt ( lines [ 1 ] ) ; var m = 200001 , ans = 0 ; for ( i = 0 ; i < N ; i + + ) { if ( P [ i ] < m ) ans + + ; m = Math . min ( m , P [ i ] ) ; } console . log ( ans ) ; } function main ( sti ) { let items = sti ; console . log ( Math . pow ( sti , 3 ) ) ; } var input = require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ; main ( input ) ; const main = stdin = > { const input = stdin . trim ( ) . split ( ' \ n ' ) const S = input [ 0 ] const date = S . split ( ' / ' ) if ( date [ 1 ] > 4 ) { console . log ( ' TBD ' ) } else { console . log ( ' Heisei ' ) } } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) function main ( a ) { console . log ( a * 800 - parseInt ( a / 15 ) * 200 ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var lines = [ ] ; var readline = require ( ' readline ' ) var rl = readline . createInterface ( { input : process . stdin , output : process . stdout , } ) ; rl . on ( ' line ' , ( x ) = > { lines . push ( x ) } ) ; rl . on ( ' close ' , ( ) = > { var A = Number ( lines [ 0 ] . split ( " " ) [ 0 ] ) var B = Number ( lines [ 0 ] . split ( " " ) [ 1 ] ) if ( 13 < = A ) { console . log ( B ) } else if ( 6 < = A & & A < = 12 ) { console . log ( B / 2 ) } else { console . log ( 0 ) } } ) ; const a = + ( ' ' + require ( ' fs ' ) . readFileSync ( 0 ) ) console . log ( a * a * a ) function Main ( input ) { input = input . split ( " " ) ; for ( var i = 0 ; i < 3 ; i + + ) { input [ i ] = parseInt ( input [ i ] , 10 ) ; if ( input [ i ] = = 5 | | input [ i ] = = 7 ) { continue ; } else { console . log ( ' NO ' ) ; return ; } } var b = input [ 0 ] + input [ 1 ] + input [ 2 ] ; if ( b = = 17 ) { console . log ( ' YES ' ) ; } else { console . log ( ' NO ' ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; const main = arg = > { arg = arg . split ( " \ n " ) ; const k = parseInt ( arg [ 5 ] ) ; const antennas = arg . slice ( 0 , 5 ) . map ( n = > ~ ~ n ) ; console . log ( antennas [ 4 ] - antennas [ 0 ] > k ? " : ( " : " Yay ! " ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; " use strict " ; function main ( input ) { var line = input . split ( " " ) ; let a = parseInt ( line [ 0 ] ) ; let b = parseInt ( line [ 1 ] ) ; let h = parseInt ( line [ 2 ] ) ; let m = parseInt ( line [ 3 ] ) ; var angle = 0.5 * ( 60 * h - 11 * m ) ; if ( angle > 180 ) angle = angle - 360 ; angle = ( angle * 3.14159265359 ) / 180 ; var cost = Math . cos ( angle ) ; var sqs = ( a * a ) + ( b * b ) - ( 2 * a * b * ( cost ) ) ; var ans = Math . sqrt ( sqs ) ; console . log ( ans . toPrecision ( 20 ) ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; console . log ( Math . pow ( input , 3 ) ) ; const input = require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) const lines = input . split ( ' \ n ' ) const X = lines [ 0 ] - 0 let five = [ 0 , 1 ] const max = X * X for ( let i = 2 ; five [ five . length - 1 ] < max ; i + + ) { five . push ( Math . pow ( i , 5 ) ) } ; ( ( ) = > { for ( let i = 0 ; i < five . length ; i + + ) { for ( let j = 0 ; j < five . length ; j + + ) { if ( five [ i ] - five [ j ] = = = X ) { console . log ( i , j ) return } else if ( five [ i ] + five [ j ] = = = X ) { console . log ( i , - j ) return } } } } ) ( ) process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { var lines = chunk . toString ( ) . split ( ' \ n ' ) ; var x = lines [ 0 ] ; var kaitou = x * x * x ; console . log ( kaitou ) ; } ) ; var input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var arr = input . trim ( ) . split ( " \ n " ) . map ( Number ) ; arr . some ( function ( v ) { if ( v = = 0 ) return true ; var cnt = 0 ; for ( var a = 1 ; a < = 181 ; a + + ) { var A = a * a ; if ( v < A ) break ; if ( A = = v ) cnt + + ; for ( var b = a ; b < = 181 ; b + + ) { var B = A + b * b ; if ( v < B ) break ; if ( B = = v ) cnt + + ; for ( var c = b ; c < = 181 ; c + + ) { var C = B + c * c ; if ( v < C ) break ; if ( C = = v ) cnt + + ; for ( var d = c ; d < = 181 ; d + + ) { var D = C + d * d ; if ( v < D ) break ; if ( D = = v ) cnt + + ; } } } } console . log ( cnt ) ; } ) ; ' use strict ' function Main ( input ) { input = input . trim ( ) . split ( ' \ n ' ) const N = parseInt ( input [ 0 ] ) let X = input [ 1 ] . split ( ' ' ) . map ( s = > parseInt ( s ) ) X = X . sort ( ) const MAX = 100 let result = Infinity for ( let i = 1 ; i < = MAX ; + + i ) { let total = 0 for ( let j = 0 ; j < N ; + + j ) { const n = X [ j ] - i total + = n * n } result = Math . min ( result , total ) } if ( result = = = Infinity ) result = 1 console . log ( result ) } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; log = console . log ; var stdin = require ( " fs " ) . readFileSync ( " / dev / stdin " , " UTF-8 " ) ; var lines = stdin . split ( " " ) . map ( Number ) ; var N = lines [ 0 ] var K = lines [ 1 ] var diff = N - K if ( K = = = 1 ) { log ( 0 ) } else { log ( diff ) } ' use strict ' function main ( s ) { s = s . split ( ' \ n ' ) [ 0 ] . split ( ' ' ) . map ( n = > Number ( n ) ) ; const a = s [ 0 ] ; const b = s [ 1 ] ; const c = s [ 2 ] ; const d = s [ 3 ] ; const ans = Math . max ( a * b , c * d ) ; console . log ( ans ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; const input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; const n = Number ( input ) ; console . log ( n * n * n ) ; ' use strict ' const translate = ( num ) = > { if ( num = = 1 ) return num = 14 ; else return num - 0 ; } function main ( arg ) { arg = arg . split ( ' ' ) ; const a = translate ( arg [ 0 ] ) ; const b = translate ( arg [ 1 ] ) ; if ( a = = b ) return console . log ( ' Draw ' ) ; if ( a > b ) { console . log ( ' Alice ' ) ; } else { console . log ( ' Bob ' ) ; } } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { var input = input . split ( ' \ n ' ) ; var nidan = input [ 1 ] . split ( ' ' ) . map ( n = > parseInt ( n , 10 ) ) . sort ( ( a , b ) = > a < b ? - 1 : 1 ) ; console . log ( nidan [ nidan . length - 1 ] - nidan [ 0 ] ) ; } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ' use strict ' const Main = ( input ) = > { let tmp = input . split ( ' \ n ' ) ; let Age = tmp [ 0 ] . split ( ' ' ) . map ( Number ) [ 0 ] ; let Cost = tmp [ 0 ] . split ( ' ' ) . map ( Number ) [ 1 ] ; if ( 6 < = Age & & Age < = 12 ) { Cost = Cost / 2 ; } else if ( Age < = 5 ) { Cost = 0 ; } console . log ( Cost ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; const n = input [ 0 ] . split ( " " ) [ 0 ] ; const d = input [ 0 ] . split ( " " ) [ 1 ] ; var array = [ ] ; for ( var i = 1 ; i < = n ; i + + ) { array . push ( input [ i ] . split ( " " ) ) ; } var square = 0 ; var distance = [ ] ; for ( var i = 0 ; i < = n - 2 ; i + + ) { for ( var j = i + 1 ; j < = n - 1 ; j + + ) { for ( var k = 0 ; k < = d - 1 ; k + + ) { square = square + Math . pow ( ( array [ i ] [ k ] - array [ j ] [ k ] ) , 2 ) ; } distance . push ( Math . pow ( square , 1 / 2 ) ) ; square = 0 ; } } var intDistance = distance . filter ( function ( value ) { return Number . isInteger ( value ) ; } ) console . log ( intDistance . length ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var A = parseInt ( input [ 0 ] . split ( " " ) [ 0 ] ) ; var B = parseInt ( input [ 0 ] . split ( " " ) [ 1 ] ) ; var ans = 0 ; if ( A > = 13 ) { ans = B ; } else if ( A > = 6 ) { ans = B / 2 ; } console . log ( ' % s ' , ans ) ; return ans ; } function debug ( n ) { var input = document . getElementById ( " input " + n ) . value ; var ans = Main ( input ) ; var result = " WA " ; if ( ans = = document . getElementById ( " output " + n ) . value . split ( " \ n " ) [ 0 ] ) { result = " AC " ; } document . getElementById ( " result " + n ) . innerHTML = result ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ' use strict ' ; ( function ( stdin ) { var inputs = stdin . toString ( ) . trim ( ) . split ( ' \ n ' ) ; ( function ( x ) { console . log ( Math . pow ( x , 3 ) ) ; } ) ( parseInt ( inputs [ 0 ] , 10 ) ) ; } ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ) ; function main ( input ) { console . log ( Math . pow ( input [ 0 ] , 3 ) ) ; } var input = ' ' ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { input + = chunk ; } ) ; process . stdin . on ( ' end ' , function ( ) { input = input . split ( ' ' ) ; main ( input ) ; } ) ; ' use strict ' const main = arg = > { var input = arg . trim ( ) . split ( " \ n " ) ; const endIndex = input . indexOf ( " 0 " ) ; input = input . slice ( 0 , endIndex ) ; const result = [ ] ; input . forEach ( str = > { const sum = str . split ( " " ) . map ( num = > parseInt ( num , 10 ) ) . reduce ( ( a , b ) = > a + b ) ; result . push ( sum ) ; } ) ; console . log ( result . join ( " \ n " ) ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var lines = [ ] var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; reader . on ( ' line ' , ( line ) = > { lines . push ( line ) ; } ) ; reader . on ( ' close ' , ( ) = > { var abhm = lines [ 0 ] . split ( ' ' ) ; var a = Number ( abhm [ 0 ] ) ; var b = Number ( abhm [ 1 ] ) ; var h = Number ( abhm [ 2 ] ) ; var m = Number ( abhm [ 3 ] ) ; var hkaku = h * 30 + m * 0.5 ; var mkaku = m * 6 ; var kaku = Math . abs ( hkaku - mkaku ) ; var kaku2 = 360 - Math . abs ( hkaku - mkaku ) ; kaku = Math . min ( kaku2 , kaku ) ; kaku = Math . cos ( kaku * ( Math . PI / 180 ) ) ; var ans = ( a * a ) + ( b * b ) - ( 2 * a * b * kaku ) ; console . log ( Math . sqrt ( ans ) ) ; } ) ; ' use strict ' const main = ( input ) = > { input = input . split ( ' ' ) . map ( i = > parseInt ( i ) ) let c5 = 0 let c7 = 0 in put . forEach ( i = > { if ( i = = = 5 ) { c5 + + } else { c7 + + } } ) if ( c5 = = = 2 & & c7 = = = 1 ) { console . log ( ' YES ' ) } else { console . log ( ' NO ' ) } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf-8 ' ) ) input = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) lines = input . split ( ' \ n ' ) N = lines . shift ( ) * 1 lines . pop ( ) c = lines . map ( x = > x . split ( ' ' ) . map ( y = > y * 1 ) ) d = [ ] r = 1 p = 2 for ( i = 0 ; i < N - 1 ; i + + ) { for ( j = i + 1 ; j < N ; j + + ) { d . push ( Math . sqrt ( Math . pow ( c [ i ] [ 0 ] - c [ j ] [ 0 ] , 2 ) + Math . pow ( c [ i ] [ 1 ] - c [ j ] [ 1 ] , 2 ) ) ) } r * = i + 2 p * = i + 1 } sum = 0 for ( i = 0 ; i < d . length ; i + + ) { sum + = d [ i ] * p } console . log ( ( sum / r ) . toFixed ( 10 ) ) inp = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) . split ( ' \ n ' ) l = inp . shift ( ) . split ( ' ' ) K = l [ 0 ] * 1 S = l [ 1 ] * 1 cnt = 0 for ( i = 0 ; i < = K ; i + + ) { for ( j = 0 ; j < = K ; j + + ) { t = S - ( i + j ) if ( t > = 0 & & t < = K ) { cnt + + } } } console . log ( cnt ) const factorization = ( n ) = > { let primes = [ ] for ( let i = 2 ; i * i < = n ; i + + ) { let e = 0 while ( n % i = = = 0 ) { e + + n / = i } if ( e ) { primes . push ( i ) } } if ( n > 1 ) { primes . push ( n ) } return primes } const getGCD = ( a , b ) = > { if ( b = = = 0 ) return a else if ( a = = = 0 ) return b return getGCD ( b , a % b ) } const main = ( arg ) = > { const N = Number ( arg . split ( " \ n " ) [ 0 ] ) const a = arg . split ( " \ n " ) [ 1 ] . split ( " " ) . map ( Number ) const MAX _ A = 10 * * 6 + 1 let set = [ ... new Array ( MAX _ A ) ] . fill ( 0 ) isPairCoprime = true for ( let i = 0 ; i < N ; i + + ) { const factors = factorization ( a [ i ] ) for ( let j = 0 ; j < factors . length ; j + + ) { if ( set [ factors [ j ] ] = = = 1 ) { isPairCoprime = false } set [ factors [ j ] ] = 1 } } if ( isPairCoprime ) { console . log ( " pairwise coprime " ) return } let gcd = 0 for ( let i = 0 ; i < a . length ; i + + ) { gcd = getGCD ( gcd , a [ i ] ) } if ( gcd = = = 1 ) { console . log ( " setwise coprime " ) return } console . log ( " not coprime " ) } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ' use strict ' function main ( input ) { const n = input . trim ( ) . split ( / \ s / ) . map ( str = > ~ ~ str ) const deg = Math . abs ( ( 360 * n [ 2 ] / 12 ) + 30 * n [ 3 ] / 60 - ( 360 * n [ 3 ] / 60 ) ) % 360 console . log ( Math . sqrt ( n [ 0 ] * * 2 + n [ 1 ] * * 2 - 2 * n [ 0 ] * n [ 1 ] * Math . cos ( deg * Math . PI / 180 ) ) ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ' use strict ' const main = input = > { const args = input . split ( ' \ n ' ) [ 0 ] . split ( ' ' ) const a = parseInt ( args [ 0 ] , 10 ) const b = parseInt ( args [ 1 ] , 10 ) if ( a > = 13 ) console . log ( b ) else if ( a > = 6 ) console . log ( b / 2 ) else console . log ( 0 ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) function Main ( input ) { input = input . split ( " " ) ; for ( var cnt = 0 ; cnt < input . length ; cnt + + ) { input [ cnt ] = parseFloat ( input [ cnt ] ) ; } var degH = ( input [ 2 ] / 12.0 + input [ 3 ] / ( 12.0 * 60.0 ) - input [ 3 ] / 60.0 ) * Math . PI * 2 ; var ans = Math . pow ( input [ 0 ] , 2 ) + Math . pow ( input [ 1 ] , 2 ) - ( 2 * input [ 0 ] * input [ 1 ] ) * Math . cos ( degH ) ; var ans = Math . sqrt ( ans ) ; console . log ( ans ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; tmp = input [ 0 ] . split ( " " ) ; var K = parseInt ( tmp [ 0 ] , 10 ) ; var S = parseInt ( tmp [ 1 ] , 10 ) ; var x , y , z ; var count = 0 ; for ( var i = 0 ; i < = K ; i + + ) { x = i ; for ( var j = 0 ; j < = K ; j + + ) { y = j ; z = S - ( x + y ) ; if ( 0 < = z & & z < = K ) { count + = 1 ; } } } console . log ( ' % d ' , count ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { var tmp = input . trim ( ) . split ( ' \ n ' ) var N = parseInt ( tmp [ 0 ] ) var Xarr = tmp [ 1 ] . split ( ' ' ) var Xsum = 0 for ( var i = 0 ; i < Xarr . length ; i + + ) { Xsum + = parseInt ( Xarr [ i ] ) } var avg = Math . floor ( Xsum / N ) var tmp = [ ] for ( var j = avg - 25 ; j < = avg + 25 ; j + + ) { var sum = 0 for ( var i = 0 ; i < Xarr . length ; i + + ) { sum = sum + Math . abs ( Math . pow ( j - parseInt ( Xarr [ i ] ) , 2 ) ) } tmp . push ( sum ) } var result = Math . min . apply ( null , tmp ) console . log ( result ) return result } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) line = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' ascii ' ) . split ( ' \ n ' ) ; res = [ ] ; for ( i in line ) { str = line [ i ] ; if ( str = = = ' 0 ' ) break ; sum = 0 ; for ( j in str ) sum + = parseInt ( str [ j ] ) ; res . push ( sum ) ; } console . log ( res . join ( ' \ n ' ) ) ; inp = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) . split ( ' \ n ' ) N = inp . shift ( ) * 1 A = inp . shift ( ) . split ( ' ' ) B = inp . shift ( ) . split ( ' ' ) sumA = 0 sumB = 0 s = 0 t = [ ] cnt = 0 for ( i = 0 ; i < N ; i + + ) { a = A [ i ] * 1 b = B [ i ] * 1 d = a - b if ( d < 0 ) { cnt + + s + = d } else { t . push ( d ) } sumA + = a sumB + = b } if ( sumA > = sumB ) { t . sort ( ( a , b ) = > b - a ) j = 0 while ( s < 0 ) { s + = t [ j ] j + + } console . log ( cnt + j ) } else { console . log ( - 1 ) } " use strict " ; const Main = ( input ) = > { let xs = input . trim ( ) . split ( ' ' ) . map ( v = > parseInt ( v , 10 ) ) ; let ans0 = xs [ 0 ] ; let ans1 = xs [ 1 ] ; if ( xs [ 0 ] = = 1 ) { ans0 = xs [ 0 ] + 13 ; } if ( xs [ 1 ] = = 1 ) { ans1 = xs [ 1 ] + 13 ; } if ( ans0 = = ans1 ) { console . log ( ' Draw ' ) ; } else if ( ans0 > ans1 ) { console . log ( ' Alice ' ) ; } else { console . log ( ' Bob ' ) ; } } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; var m = input = > { var a = input . split ( ' ' ) ; var K = parseInt ( a [ 0 ] ) ; var S = parseInt ( a [ 1 ] ) ; var s = 0 ; for ( let i = 0 ; i < = K ; i + + ) { for ( let j = 0 ; j < = K ; j + + ) { var v = S - ( i + j ) ; if ( v > = 0 & & v < = K ) { s + + ; } } } console . log ( s ) ; } m ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var lines = [ ] var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; reader . on ( ' line ' , ( line ) = > { lines . push ( line ) ; } ) ; reader . on ( ' close ' , ( ) = > { var a = Number ( lines [ 0 ] . split ( ' ' ) [ 0 ] ) ; var v = Number ( lines [ 0 ] . split ( ' ' ) [ 1 ] ) ; var b = Number ( lines [ 1 ] . split ( ' ' ) [ 0 ] ) ; var w = Number ( lines [ 1 ] . split ( ' ' ) [ 1 ] ) ; var t = Number ( lines [ 2 ] ) ; var ichisa = a - b ; var hayasa = v - w ; var ans = ' ' ; if ( hayasa < = 0 ) { ans = ' NO ' ; } else { if ( Math . abs ( ichisa ) / hayasa < = t ) { ans = " YES " ; } else { ans = " NO " ; } } console . log ( ans ) ; } ) ; " use strict " ; const input = require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) ; const inputs = input . split ( " \ n " ) . map ( i = > + i ) ; const exec = ( inputs ) = > { const k = inputs . pop ( ) ; const yay = ( inputs [ inputs . length - 1 ] - inputs [ 0 ] ) < = k ; console . log ( yay ? " Yay ! " : " : ( " ) ; } exec ( inputs ) ; console . log ( ( args = > { const [ [ N , M ] , ... tmp ] = args . trim ( ) . split ( ' \ n ' ) . map ( r = > r . split ( ' ' ) . map ( v = > v | 0 ) ) ; const p = Array . from ( { length : N } , _ = > [ ] ) ; for ( let i = 0 ; i < M ; i + + ) { const [ P , Y ] = tmp [ i ] ; p [ P - 1 ] . push ( [ i , Y ] ) ; } p . forEach ( r = > r . sort ( ( a , b ) = > a [ 1 ] - b [ 1 ] ) ) ; const a = Array . from ( tmp , ( [ p ] ) = > ` $ { p } ` . padStart ( 6 , 0 ) ) ; p . forEach ( r = > r . forEach ( ( [ i ] , j ) = > a [ i ] + = ` $ { j + 1 } ` . padStart ( 6 , 0 ) ) ) return a . join ` \ n ` ; } ) ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var tmp = input [ 0 ] . split ( ' ' ) ; var h1 = parseInt ( tmp [ 0 ] ) ; var m1 = parseInt ( tmp [ 1 ] ) ; var h2 = parseInt ( tmp [ 2 ] ) ; var m2 = parseInt ( tmp [ 3 ] ) ; var k = parseInt ( tmp [ 4 ] ) ; var min1 = 60 * h1 + m1 ; var min2 = 60 * h2 + m2 ; var a = min2 - min1 - k ; console . log ( a ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; const main = arg = > { const S = arg . split ( " \ n " ) [ 1 ] . split ( " " ) ; const set = new Set ( S ) ; console . log ( set . size = = 4 ? " Four " : " Three " ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; ' use strict ' const main = input = > { const args = input . trim ( ) . split ( ' ' ) . map ( Number ) const t1 = args [ 0 ] * args [ 1 ] const t2 = args [ 2 ] * args [ 3 ] if ( t1 > = t2 ) console . log ( t1 ) else console . log ( t2 ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) " use strict " ; function main ( input ) { const line = input . split ( " \ n " ) ; let arr = line [ 0 ] . split ( " " ) ; const N = parseInt ( arr [ 0 ] ) ; const D = parseInt ( arr [ 1 ] ) ; let X = [ ] ; for ( let i = 1 ; i < N + 1 ; i + + ) X . push ( line [ i ] . split ( " " ) . map ( Number ) ) ; let ans = 0 ; for ( let i = 0 ; i < N ; i + + ) { for ( let j = i + 1 ; j < N ; j + + ) { let num = 0 ; for ( let k = 0 ; k < D ; k + + ) num + = Math . pow ( ( X [ j ] [ k ] - X [ i ] [ k ] ) , 2 ) ; if ( Number . isInteger ( Math . sqrt ( num ) ) ) ans + + ; } } console . log ( ans ) ; return ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; const x = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' UTF-8 ' ) ; console . log ( Math . pow ( x , 3 ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var input0 = input [ 0 ] . split ( " " ) ; const N = parseInt ( input0 [ 0 ] ) ; const K = parseInt ( input0 [ 1 ] ) ; if ( K = = 1 ) { console . log ( 0 ) ; } else { console . log ( N - K ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; var lines = [ ] ; var readline = require ( ' readline ' ) ; var rl = readline . createInterface ( { input : process . stdin , output : process . stdout , } ) ; rl . on ( ' line ' , function ( x ) { lines . push ( x ) ; } ) ; rl . on ( ' close ' , function ( ) { var v = [ ] ; for ( var i = 0 ; i < 5 ; i + + ) { v [ i ] = Number ( lines [ i ] ) ; } var k = Number ( lines [ 5 ] ) ; for ( var i = 0 ; i < 4 ; i + + ) { for ( var j = i + 1 ; j < 5 ; j + + ) { if ( k < Math . abs ( v [ i ] - v [ j ] ) ) { console . log ( " : ( " ) ; return ( 0 ) ; } } } console . log ( " Yay ! " ) ; } ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var a = parseInt ( input [ 0 ] , 10 ) ; var b = parseInt ( input [ 1 ] , 10 ) ; var c = parseInt ( input [ 2 ] , 10 ) ; var d = parseInt ( input [ 3 ] , 10 ) ; var e = parseInt ( input [ 4 ] , 10 ) ; var k = parseInt ( input [ 5 ] , 10 ) ; var message = " Yay ! " ; for ( var i = 0 ; i < 4 ; i + + ) { for ( var j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( input [ i ] - input [ j ] ) > k ) message = " : ( " } } console . log ( message ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; const main = arg = > { arg = arg . trim ( ) . split ( " \ n " ) ; const H1 = parseInt ( arg [ 0 ] . split ( " " ) [ 0 ] ) ; const M1 = parseInt ( arg [ 0 ] . split ( " " ) [ 1 ] ) ; const H2 = parseInt ( arg [ 0 ] . split ( " " ) [ 2 ] ) ; const M2 = parseInt ( arg [ 0 ] . split ( " " ) [ 3 ] ) ; const K = parseInt ( arg [ 0 ] . split ( " " ) [ 4 ] ) ; const first = 60 - M1 ; const time1 = H2 - ( H1 + 1 ) ; const rest = M2 ; let answer = first + ( 60 * time1 ) + M2 - K ; console . log ( answer ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function cube ( x ) { return x * x * x ; } var input = ' ' ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { input + = chunk ; } ) ; process . stdin . on ( ' end ' , function ( ) { input = input . split ( ' \ n ' ) ; console . log ( cube ( input [ 0 ] ) ) ; } ) ; function main ( input ) { input = input . trim ( ) ; const a = parseInt ( input . split ( " " ) [ 0 ] , 10 ) ; const b = parseInt ( input . split ( " " ) [ 1 ] , 10 ) ; const c = parseInt ( input . split ( " " ) [ 2 ] , 10 ) ; if ( a + b > = c ) { console . log ( " Yes " ) ; } else { console . log ( " No " ) ; } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input ; list = [ 64 , 32 , 16 , 8 , 4 , 2 , 1 ] ; for ( i = 0 ; i < list . length ; i + + ) { if ( list [ i ] < = input ) { console . log ( list [ i ] ) ; break ; } } } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var N = input [ 0 ] ; var arr = input [ 1 ] . split ( " " ) . map ( Number ) ; var ans = Number . MAX _ SAFE _ INTEGER ; var max = Math . max . apply ( null , arr ) ; for ( var i = 1 ; i < = max ; i + + ) { var sum = 0 ; for ( var j = 0 ; j < arr . length ; j + + ) { sum + = Math . pow ( Math . abs ( arr [ j ] - i ) , 2 ) ; } if ( sum < ans ) ans = sum ; } console . log ( ans ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) ) ; function main ( arg ) { arg = arg . split ( " " ) . sort ( ( a , b ) = > a - b ) ; console . log ( arg [ 2 ] - arg [ 0 ] ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { const abcde = input . split ( " \ n " ) . map ( n = > parseInt ( n ) ) ; const len = abcde . length ; var total _ time = 0 ; var last _ cal _ num = 10 ; var last _ cal _ num _ index = 0 ; for ( var i = 0 ; i < 5 ; i + + ) { var j = abcde [ i ] % 10 if ( 0 < j & & j < last _ cal _ num ) { last _ cal _ num = j ; last _ cal _ num _ index = i ; } } for ( var i = 0 ; i < 5 ; i + + ) { if ( i ! = = last _ cal _ num _ index ) { var j = abcde [ i ] ; var k = j % 10 ; j = k ? j + ( 10 - k ) : j ; total _ time + = j ; } } total _ time + = abcde [ last _ cal _ num _ index ] ; console . log ( String ( total _ time ) . trim ( ) ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf-8 " ) ) ; ' use strict ' const main = input = > { const args = input . trim ( ) . split ( ' ' ) . map ( Number ) if ( args [ 0 ] = = = 1 ) args [ 0 ] + = 13 if ( args [ 1 ] = = = 1 ) args [ 1 ] + = 13 if ( args [ 0 ] > args [ 1 ] ) console . log ( ' Alice ' ) else if ( args [ 1 ] > args [ 0 ] ) console . log ( ' Bob ' ) else console . log ( ' Draw ' ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) var square = function ( x ) { return x * x * x ; } process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( x ) { console . log ( square ( x ) ) ; } ) ; function main ( input ) { input = input . split ( " \ n " ) ; temp = input [ 1 ] . split ( " " ) ; len = input [ 0 ] ; min = 1001 ; max = 0 ; for ( var i = 0 ; i < len ; i + = 1 ) { if ( min > temp [ i ] ) { min = temp [ i ] ; } if ( max < temp [ i ] ) { max = temp [ i ] ; } } console . log ( max - min ) ; } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function main ( input ) { const points = input . slice ( 1 ) . map ( x = > x . split ( ' ' ) . map ( Number ) ) ; var sum = 0 ; for ( var i = 0 ; i < points . length ; i + + ) { for ( var j = i + 1 ; j < points . length ; j + + ) { var len = length ( sub ( points [ i ] , points [ j ] ) ) ; if ( isInteger ( len ) ) { sum + + ; } } } console . log ( sum ) ; } const sub = ( p1 , p2 ) = > { return p1 . map ( ( x , i ) = > x - p2 [ i ] ) ; } ; const length = ( p ) = > { return Math . sqrt ( p . map ( x = > x * x ) . reduce ( ( acc , x ) = > acc + x , 0 ) ) ; } ; const isInteger = ( n ) = > { const i = Math . floor ( n ) ; const eps = 0.0000001 ; return n - i < eps ; } ; main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) . trim ( ) . split ( ' \ n ' ) ) ; function Main ( input ) { var N = parseInt ( input [ 0 ] , 10 ) ; var P = input [ 1 ] . split ( / \ s / ) . map ( p = > parseInt ( p , 10 ) ) var min = P [ 0 ] ; var result = 0 ; for ( var i = 0 ; i < N ; i + + ) { if ( min > = P [ i ] ) { result + + ; min = P [ i ] ; } } console . log ( result ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) . split ( / \ n / ) ) ; function Main ( input ) { var str = input ; var ans = 0 ; var str = str . split ( " \ n " ) [ 0 ] ; var num = str . split ( " " ) ; var a = Number ( num [ 0 ] ) ; var b = Number ( num [ 1 ] ) ; var h = Number ( num [ 2 ] ) ; var m = Number ( num [ 3 ] ) ; var dega = 0.5 * ( m + 60 * h ) ; var degb = 6 * m ; var rada = dega * ( Math . PI / 180 ) ; var radb = degb * ( Math . PI / 180 ) ; var ax = a * Math . sin ( rada ) ; var ay = a * Math . cos ( rada ) ; var bx = b * Math . sin ( radb ) ; var by = b * Math . cos ( radb ) ; ans = Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ; ans = Math . round ( ans * ( 10 * * 10 ) ) / ( 10 * * 10 ) ; console . log ( ans ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function myout ( text ) { console . log ( text ) ; } function Main ( input ) { input = input . split ( " " ) . map ( ( a ) = > Number ( a ) ) ; var K = input [ 0 ] ; var S = input [ 1 ] ; var output = 0 ; for ( var i = 0 ; i < = K ; i + + ) { for ( var j = 0 ; j < = K ; j + + ) { var Z = S - ( i + j ) ; if ( Z > = 0 & & Z < = K ) { output + + ; } } } myout ( output ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) ) ; function main ( ) { console . log ( input [ 0 ] * input [ 0 ] * input [ 0 ] ) ; } var input = ' ' ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { input + = chunk ; } ) ; process . stdin . on ( ' end ' , function ( ) { input = input . split ( ' \ n ' ) ; main ( ) ; } ) ; console . log ( ( args = > { const [ [ K , S ] ] = args . trim ( ) . split ( ' \ n ' ) . map ( r = > r . split ( ' ' ) . map ( v = > v | 0 ) ) ; let count = 0 ; for ( let x = Math . min ( K , S ) ; x > = 0 ; x -- ) { for ( let y = Math . min ( K , S - x ) ; y > = Math . max ( 0 , S - x - K ) ; y -- ) count + + ; } return count . toString ( ) ; } ) ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ) ; function Main ( input ) { var inp = input . split ( ' ' ) ; var a = parseInt ( inp [ 0 ] ) ; var b = parseInt ( inp [ 1 ] ) ; var total = a + b ; var average = Math . round ( total / 2 ) ; console . log ( average ) ; } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . trim ( ) . split ( " \ n " ) . map ( function ( x ) { return x . split ( " " ) } ) ; let T1 = parseInt ( input [ 0 ] [ 0 ] , 10 ) ; let T2 = parseInt ( input [ 0 ] [ 1 ] , 10 ) ; let A1 = parseInt ( input [ 1 ] [ 0 ] , 10 ) ; let A2 = parseInt ( input [ 1 ] [ 1 ] , 10 ) ; let B1 = parseInt ( input [ 2 ] [ 0 ] , 10 ) ; let B2 = parseInt ( input [ 2 ] [ 1 ] , 10 ) ; let d1 = BigInt ( A1 - B1 ) * BigInt ( T1 ) ; let d2 = BigInt ( A2 - B2 ) * BigInt ( T2 ) + d1 ; let ans = 0n ; let tmp ; if ( d2 = = = 0n ) ans = ' infinity ' ; else if ( d1 * d2 < 0n ) { d2 = d2 * - 1n ; tmp = ( d1 / d2 ) ; ans = ( tmp * d2 = = = d1 ) ? tmp * 2n : tmp * 2n + 1n ; } else ans = 0 ; console . log ( ans . toString ( ) ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; const numList0 = input [ 0 ] . split ( ' ' ) . map ( x = > parseInt ( x , 10 ) ) ; const N = numList0 [ 0 ] ; const D = numList0 [ 1 ] ; const xListList = [ ] ; for ( var i = 0 ; i < N ; i + + ) { var xList = input [ i + 1 ] . split ( ' ' ) . map ( x = > parseInt ( x , 10 ) ) ; xListList . push ( xList ) ; } var count = 0 ; for ( var i = 0 ; i < N - 1 ; i + + ) { var xBaseList = xListList [ i ] ; for ( var j = i + 1 ; j < N ; j + + ) { var doubleDistance = 0 ; xTargetList = xListList [ j ] ; for ( var k = 0 ; k < D ; k + + ) { var y = xBaseList [ k ] ; var z = xTargetList [ k ] ; doubleDistance + = ( y - z ) * ( y - z ) ; } if ( Number . isInteger ( Math . sqrt ( doubleDistance ) ) ) { count + + ; } } } console . log ( count ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " const create = ( ) = > { const input = require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) . trim ( ) . split ( " \ n " ) ; const res = { " list " : input , " index " : 0 , " max " : input . length , " hasNext " : function ( ) { return this . index < this . max } , " next " : function ( ) { if ( ! this . hasNext ( ) ) { throw " ArrayIndexOutOfBoundsException " ; } else { return this . list [ this . index + + ] ; } } } ; return res ; } const o = create ( ) ; const next = ( ) = > o . next ( ) const nextInt = ( ) = > parseInt ( o . next ( ) ) const nextStrArray = ( ) = > o . next ( ) . split ( " " ) const nextIntArray = ( ) = > o . next ( ) . split ( " " ) . map ( el = > parseInt ( el ) ) const nextCharArray = ( ) = > o . next ( ) . split ( " " ) const hasNext = ( ) = > o . hasNext ( ) const myout = ( ... x ) = > console . log ( ... x ) const Main = ( ) = > { const n = nextInt ( ) let x = nextIntArray ( ) let min = Number . POSITIVE _ INFINITY for ( let p = 1 ; p < = 100 ; p + + ) { let curr = 0 for ( let i = 0 ; i < n ; i + + ) { curr + = ( x [ i ] - p ) * ( x [ i ] - p ) } min = Math . min ( min , curr ) } console . log ( min ) } Main ( ) process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( chunk ) { console . log ( Math . pow ( chunk . trim ( ) , 3 ) ) ; } ) ; ' use strict ' function main ( input ) { const n = Number ( input ) let ans = 0 if ( n = = 1 ) { console . log ( 1 ) return } let i = 0 while ( Math . pow ( 2 , i + 1 ) < = n ) { i + + ans = Math . pow ( 2 , i ) } console . log ( ans ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) function Main ( input ) { var inputs = input . split ( " \ n " ) ; var N = inputs [ 0 ] . split ( " " ) [ 0 ] ; var D = inputs [ 0 ] . split ( " " ) [ 1 ] ; var a = [ ] ; for ( i = 1 ; i < = N ; i + + ) { a [ i - 1 ] = inputs [ i ] . split ( " " ) ; } var n = 0 ; for ( j = 0 ; j < = ( N - 1 ) ; j + + ) { for ( l = 0 ; l < = ( N - 1 ) ; l + + ) { var b = 0 ; var k = 0 ; var s ; if ( j < = l ) { continue ; } for ( m = 0 ; m < = ( D - 1 ) ; m + + ) { b = a [ j ] [ m ] - a [ l ] [ m ] ; k + = Math . pow ( b , 2 ) ; } s = Number . isInteger ( Math . pow ( k , 1 / 2 ) ) ; if ( s = = true ) { n + = 1 ; } } } console . log ( n ) ; } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; var calc = function ( x ) { return x * x * x ; } process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , function ( x ) { console . log ( calc ( x ) ) ; } ) ; function main ( input ) { const formatted _ input = input . split ( ' \ n ' ) . map ( x = > parseInt ( x ) ) ; if ( formatted _ input [ 4 ] - formatted _ input [ 0 ] > formatted _ input [ 5 ] ) { console . log ( ' : ( ' ) } else { console . log ( ' Yay ! ' ) } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; var x = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; console . log ( x * x * x ) ; var stdin = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ; var x = parseInt ( stdin , 10 ) ; console . log ( x * x * x ) ; ' use strict ' function main ( inp ) { inp = inp . trim ( ) . split ( ' \ n ' ) ; let N = inp [ 0 ] * 1 ; let nums = inp [ 1 ] . split ( ' ' ) . map ( x = > x * 1 ) ; let ava = Math . round ( nums . reduce ( ( x , a ) = > a + = x ) / N ) ; let ans = 0 ; for ( let i = 0 ; i < N ; i + + ) { ans + = ( nums [ i ] - ava ) * ( nums [ i ] - ava ) ; } console . log ( ans ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function main ( arg ) { var xzahyo = [ ] ; var yzahyo = [ ] ; for ( i = 1 ; i < ( arg . split ( / \ s | \ r / g ) . length ) / 2 ; i + + ) { xzahyo . push ( arg . split ( / \ s | \ r / g ) [ 2 * i - 1 ] ) ; yzahyo . push ( arg . split ( / \ s | \ r / g ) [ 2 * i ] ) ; } var nagasanowa = 0 ; for ( j = 0 ; j < xzahyo . length - 1 ; j + + ) { for ( k = j + 1 ; k < xzahyo . length ; k + + ) { nagasanowa + = Math . sqrt ( Math . pow ( xzahyo [ k ] - xzahyo [ j ] , 2 ) + Math . pow ( yzahyo [ k ] - yzahyo [ j ] , 2 ) ) ; } } console . log ( nagasanowa * 2 / arg . split ( / \ s | \ r / g ) [ 0 ] ) ; } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function main ( input ) { var num = [ 1 , 2 , 4 , 8 , 16 , 32 , 64 ] ; for ( var i = num . length - 1 ; i > = 0 ; i -- ) { if ( input > = num [ i ] ) { console . log ( num [ i ] ) ; return ; } } } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ' use strict ' ; ( function ( input ) { input = input . trim ( ) . split ( / \ s + / ) . map ( x = > x - 0 ) ; console . log ( input [ 0 ] > = 13 ? input [ 1 ] : input [ 0 ] > = 6 ? input [ 1 ] / 2 : 0 ) ; } ) ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function print ( data ) { process . stdout . write ( data + ' \ n ' ) } const cube = x = > x * x * x const readLine = require ( ' readline ' ) const rl = readLine . createInterface ( { input : process . stdin , output : process . stdout } ) rl . on ( ' line ' , ( line ) = > { print ( cube ( parseInt ( line ) ) ) } ) ' use strict ' function main ( input ) { const [ a , b , t ] = input . trim ( ) . split ( ' \ n ' ) . map ( ( x ) = > x . split ( ' ' ) . map ( ( v ) = > Number ( v ) ) ) const distance = Math . abs ( a [ 0 ] - b [ 0 ] ) const distance2 = ( a [ 1 ] - b [ 1 ] ) * t [ 0 ] console . log ( distance < = distance2 ? ' YES ' : ' NO ' ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; var lines = [ ] var reader = require ( ' readline ' ) . createInterface ( { input : process . stdin , output : process . stdout } ) ; reader . on ( ' line ' , ( line ) = > { lines . push ( line ) ; } ) ; reader . on ( ' close ' , ( ) = > { var a = Number ( lines [ 0 ] ) ; var b = Number ( lines [ 1 ] ) ; var c = Number ( lines [ 2 ] ) ; var d = Number ( lines [ 3 ] ) ; var e = Number ( lines [ 4 ] ) ; var ans = 0 ; var info = [ ] ; info . push ( a ) ; info . push ( b ) ; info . push ( c ) ; info . push ( d ) ; info . push ( e ) ; var amari = [ ] ; amari . push ( a % 10 ) ; amari . push ( b % 10 ) ; amari . push ( c % 10 ) ; amari . push ( d % 10 ) ; amari . push ( e % 10 ) ; var amari _ t = amari . filter ( function ( value ) { return ! ( value = = 0 ) ; } ) ; var min = Math . min ( ... amari _ t ) ; var index = amari . indexOf ( min ) ; for ( i = 0 ; i < 5 ; i + + ) { if ( i = = index ) { continue ; console . log ( ' A ' ) ; } ans + = info [ i ] if ( ans % 10 ! = = 0 ) { while ( ans % 10 ! = = 0 ) { ans + + ; } } } ans + = info [ index ] ; if ( Number . isNaN ( ans ) ) { ans = 0 ; ans = a + b + c + d + e ; } console . log ( ans ) ; } ) ; main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' UTF-8 ' ) ) ; function main ( N ) { var T = N . trim ( ) ; var a = T . charAt ( 0 ) ; var b = T . charAt ( 2 ) ; var c = T . charAt ( 4 ) ; if ( ( a = = " 7 " & & b = = " 5 " & & c = = " 5 " ) | | ( a = = " 5 " & & b = = " 7 " & & c = = " 5 " ) | | ( a = = " 5 " & & b = = " 5 " & & c = = " 7 " ) ) { console . log ( " YES " ) ; } else { console . log ( " NO " ) ; } } let content = ' ' ; process . stdin . resume ( ) ; process . stdin . setEncoding ( ' utf8 ' ) ; process . stdin . on ( ' data ' , buf = > { content + = buf ; } ) ; process . stdin . on ( ' end ' , ( ) = > { const lines = content . trim ( ) . split ( ' \ n ' ) . slice ( 0 , - 1 ) ; const result = lines . map ( num = > num . split ( ' ' ) . map ( n = > parseInt ( n , 10 ) ) . reduce ( ( prev , cur ) = > prev + cur ) ) ; console . log ( result . join ( ' \ n ' ) ) ; } ) ; function * main ( ) { const N = + ( yield ) ; const A = ( yield ) . split ( " " ) . map ( s = > + s ) ; const avg = A . reduce ( ( a , b ) = > a + b ) / N ; const P = Math . round ( avg ) ; const sum = A . reduce ( ( t , x ) = > t + ( x - P ) * * 2 , 0 ) ; console . log ( sum ) ; } const iter = main ( ) ; iter . next ( ) ; require ( " readline " ) . createInterface ( { input : process . stdin } ) . on ( " line " , s = > iter . next ( s ) ) ; ' use strict ' ; function Main ( input ) { const tmp = input . split ( ' ' ) ; let five = 0 ; let seven = 0 ; for ( let i = 0 ; i < tmp . length ; i + + ) { if ( tmp [ i ] = = 5 ) { five + + ; } else if ( tmp [ i ] = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { console . log ( " YES " ) ; } else { console . log ( " NO " ) ; } } Main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . trim ( ) ; if ( input . indexOf ( " 1 " ) ! = - 1 & & input . indexOf ( " 9 " ) ! = - 1 & & input . indexOf ( " 7 " ) ! = - 1 & & input . indexOf ( " 4 " ) ! = - 1 ) { console . log ( " YES " ) ; } else { console . log ( " NO " ) ; } } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; function zeroPadding ( str ) { return ( ' 000000 ' + str ) . slice ( - 6 ) } function Main ( input ) { const data = input . trim ( ) . split ( ' \ n ' ) const temp = data [ 0 ] . split ( ' ' ) . map ( s = > parseInt ( s ) ) const N = temp [ 0 ] const M = temp [ 1 ] const rest = data . slice ( 1 ) . map ( s = > { return s . split ( ' ' ) . map ( x = > parseInt ( x ) ) } ) var ans = { } rest . forEach ( ( d , index ) = > { if ( ! ans [ d [ 0 ] ] ) ans [ d [ 0 ] ] = [ ] ans [ d [ 0 ] ] . push ( { index : index , p : d [ 0 ] , t : d [ 1 ] , s : ' ' } ) } ) for ( var i in ans ) { ans [ i ] = ans [ i ] . sort ( ( a , b ) = > a . t - b . t ) } var res = Array ( M ) for ( var i in ans ) { for ( var j = 0 ; j < ans [ i ] . length ; + + j ) { var d = ans [ i ] [ j ] var str = zeroPadding ( d . p ) + zeroPadding ( ( j + 1 ) . toString ( ) ) res [ d . index ] = str } } var output = res . reduce ( ( p , c ) = > p + ' \ n ' + c ) console . log ( output ) } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; ' use strict ' const main = ( input ) = > { const arr = input . split ( ' ' ) . map ( m = > Number ( m ) ) const sum = arr . reduce ( ( p , c ) = > p * c ) console . log ( ( sum = = = 175 ) ? ' YES ' : ' NO ' ) } main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) function Main ( input ) { input = input . split ( " \ n " ) ; tmp = input [ 1 ] . split ( " " ) ; all = Number ( input [ 0 ] ) ; var maxest = Number ( tmp [ 0 ] ) ; ans = 1 ; for ( i = 2 ; i < = all ; i + + ) { the _ Num = Number ( tmp [ i - 1 ] ) ; if ( maxest > = the _ Num ) { ans + + ; } if ( maxest > the _ Num ) maxest = the _ Num ; } console . log ( ans ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; const main = i = > { const input = i . split ( / \ s / ) . map ( n = > parseInt ( n , 10 ) ) . sort ( ( a , b ) = > a - b ) console . log ( input [ 2 ] - input [ 0 ] ) } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf-8 ' ) ) var x = require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) console . log ( x * x * x ) function main ( input ) { var a = input . split ( " " ) [ 0 ] - 0 , b = input . split ( " " ) [ 1 ] - 0 ; if ( a < = 5 ) { console . log ( 0 ) ; } else if ( a < = 12 ) { console . log ( b / 2 ) ; } else { console . log ( b ) ; } } main ( require ( ' fs ' ) . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ' use strict ' ; const fs = require ( ' fs ' ) ; let N = 0 ; let X = [ ] ; let Y = [ ] ; function distance ( i , j ) { return Math . sqrt ( Math . pow ( X [ i ] - X [ j ] , 2 ) + Math . pow ( Y [ i ] - Y [ j ] , 2 ) ) ; } function calcTotalRouteDistance ( ) { let result = 0 ; for ( let i = 0 ; i < N - 1 ; + + i ) { for ( let j = i + 1 ; j < N ; + + j ) { result + = distance ( i , j ) ; } } return result ; } function calcAverageDistance ( ) { return 2 * calcTotalRouteDistance ( ) / N ; } function main ( arg ) { const lines = arg . split ( ' \ n ' ) ; N = parseInt ( lines [ 0 ] , 10 ) ; for ( let i = 0 ; i < N ; + + i ) { let line = lines [ i + 1 ] . split ( / \ s / ) ; X [ i ] = parseInt ( line [ 0 ] , 10 ) ; Y [ i ] = parseInt ( line [ 1 ] , 10 ) ; } console . log ( calcAverageDistance ( ) ) ; } main ( fs . readFileSync ( ' / dev / stdin ' , ' utf8 ' ) ) ; function Main ( input ) { input = input . split ( " \ n " ) ; var array = input [ 0 ] . split ( " " ) ; array . sort ( ) ; console . log ( ( array [ 0 ] = = = " 5 " & & array [ 1 ] = = = " 5 " & & array [ 2 ] = = = " 7 " ) ? " YES " : " NO " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; " use strict " ; function Main ( input ) { input = input . split ( " \ n " ) ; var args = input [ 0 ] . split ( " " ) ; var sum = 0 ; args . forEach ( function ( a ) { sum = sum + Number ( a ) ; } ) ; sum = = 17 ? console . log ( " YES " ) : console . log ( " NO " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; < ? php $ N = trim ( fgets ( STDIN ) ) ; for ( $ i = 0 ; $ i < $ N ; $ i + + ) { list ( $ x [ ] , $ y [ ] ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; } $ t = 0.0 ; for ( $ i = 0 ; $ i < $ N ; $ i + + ) { for ( $ j = $ i ; $ j < $ N ; $ j + + ) { if ( $ j = = $ i ) continue ; $ t = sqrt ( pow ( $ x [ $ j ] - $ x [ $ i ] , 2 ) + pow ( $ y [ $ j ] - $ y [ $ i ] , 2 ) ) ; $ tot + = $ t ; } } for ( $ i = 0 ; $ i < $ N ; $ i + + ) { for ( $ j = $ i ; $ j < $ N ; $ j + + ) { if ( $ j = = $ i ) continue ; $ t = sqrt ( pow ( $ x [ $ i ] - $ x [ $ j ] , 2 ) + pow ( $ y [ $ i ] - $ y [ $ j ] , 2 ) ) ; $ tot + = $ t ; } } printf ( " % f \ n " , $ tot / $ N ) ; < ? php fscanf ( STDIN , " % d % d " , $ n , $ m ) ; $ citys = array ( ) ; for ( $ i = 0 ; $ i < $ m ; $ i + + ) { $ p _ y = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ pref [ $ p _ y [ 0 ] ] [ ] = $ p _ y [ 1 ] ; $ py _ li [ ] = $ p _ y ; } $ p _ y _ key _ li = array _ keys ( $ pref ) ; for ( $ i = 0 ; $ i < count ( $ p _ y _ key _ li ) ; $ i + + ) { sort ( $ pref [ $ p _ y _ key _ li [ $ i ] ] ) ; } $ memo = array ( ) ; foreach ( $ pref as $ c ) { foreach ( $ c as $ x = > $ year ) { $ memo [ $ year ] = $ x ; } } foreach ( $ py _ li as $ py ) { $ x = $ memo [ $ py [ 1 ] ] + 1 ; for ( $ i = 0 ; $ i < 6 - strlen ( $ py [ 0 ] ) ; $ i + + ) { echo " 0 " ; } echo $ py [ 0 ] ; for ( $ i = 0 ; $ i < 6 - strlen ( $ x ) ; $ i + + ) { echo " 0 " ; } echo ( $ x ) . " \ n " ; } < ? php fscanf ( STDIN , " % d " , $ n ) ; $ numbers = fgets ( STDIN ) ; $ exploded _ numbers = explode ( ' ' , $ numbers ) ; $ count = 0 ; $ min = $ exploded _ numbers [ 0 ] ; foreach ( $ exploded _ numbers as $ key = > $ val ) { if ( $ key - 1 > = 0 ) { if ( $ val < = $ min ) { $ min = $ val ; $ count + + ; } } else { $ count + + ; } } echo $ count ; < ? php $ a = trim ( fgets ( STDIN ) ) ; $ b = trim ( fgets ( STDIN ) ) ; $ c = trim ( fgets ( STDIN ) ) ; $ vallance = trim ( fgets ( STDIN ) ) ; $ ans = 0 ; for ( $ i = 0 ; $ i < = $ a ; + + $ i ) { for ( $ j = 0 ; $ j < = $ b ; + + $ j ) { for ( $ k = 0 ; $ k < = $ c ; + + $ k ) { if ( $ i * 500 + $ j * 100 + $ k * 50 = = $ vallance ) { $ ans + + ; } } } } echo $ ans ; < ? php fscanf ( STDIN , " % d % d " , $ k , $ s ) ; $ cnt = 0 ; for ( $ x = 0 ; $ x < = $ k ; $ x + + ) { for ( $ y = 0 ; $ y < = $ k ; $ y + + ) { $ z = $ s - $ x - $ y ; if ( ( $ z > = 0 ) & & ( $ z < = $ k ) ) { $ cnt + + ; } } } echo $ cnt ; < ? php $ input = trim ( fgets ( STDIN ) ) ; $ result = pow ( $ input , 3 ) ; echo $ result ; ? > < ? php $ x = trim ( fgets ( STDIN ) ) ; echo pow ( $ x , 3 ) , PHP _ EOL ; < ? php fscanf ( STDIN , ' % d % d ' , $ a , $ b ) ; if ( $ a = = $ b ) { echo ' Draw ' ; } elseif ( $ a = = 1 ) { echo ' Alice ' ; } elseif ( $ b = = 1 ) { echo ' Bob ' ; } elseif ( $ a > $ b ) { echo ' Alice ' ; } else { echo ' Bob ' ; } < ? php list ( $ a , $ b , $ h , $ m ) = fscanf ( STDIN , ' % d % d % d % d ' ) ; $ xa = sin ( 2 * pi ( ) * ( $ h + ( $ m / 60 ) ) / 12.0 ) * $ a ; $ ya = cos ( 2 * pi ( ) * ( $ h + ( $ m / 60 ) ) / 12.0 ) * $ a ; $ xb = sin ( 2 * pi ( ) * $ m / 60.0 ) * $ b ; $ yb = cos ( 2 * pi ( ) * $ m / 60.0 ) * $ b ; $ l = sqrt ( ( $ xa - $ xb ) * ( $ xa - $ xb ) + ( $ ya - $ yb ) * ( $ ya - $ yb ) ) ; echo $ l ; < ? php $ n = intval ( trim ( fgets ( STDIN ) ) ) ; $ a = array _ map ( " intval " , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; $ sum = 0 ; $ mod = 10 * * 9 + 7 ; for ( $ i = 0 ; $ i < = 60 ; $ i + + ) { $ c = 0 ; foreach ( $ a as $ b ) { $ c + = ( $ b > > $ i ) & 1 ; } $ c * = $ n - $ c ; $ c % = $ mod ; $ c * = ( 1 < < $ i ) % $ mod ; $ c % = $ mod ; $ sum + = $ c ; $ sum % = $ mod ; } echo $ sum ; < ? php while ( 1 ) { $ N = trim ( fgets ( STDIN ) ) ; if ( $ N = = ' 0 ' ) break ; $ s = 0 ; foreach ( str _ split ( $ N ) as $ n ) $ s + = ( int ) $ n ; echo $ s , PHP _ EOL ; } < ? php fscanf ( STDIN , ' % d % d ' , $ a , $ b ) ; if ( $ a = = 1 ) { $ a = 14 ; } if ( $ b = = 1 ) { $ b = 14 ; } if ( $ a > $ b ) { print ' Alice ' ; } elseif ( $ a = = $ b ) { print ' Draw ' ; } else { print ' Bob ' ; } < ? php $ bunsetus = trim ( fgets ( STDIN ) ) ; $ bunsetu = explode ( " " , $ bunsetus ) ; $ seven _ count = 0 ; $ five _ count = 0 ; for ( $ i = 0 ; $ i < count ( $ bunsetu ) ; $ i + + ) { if ( $ bunsetu [ $ i ] = = 7 ) { $ seven _ count + = 1 ; } } for ( $ j = 0 ; $ j < count ( $ bunsetu ) ; $ j + + ) { if ( $ bunsetu [ $ j ] = = 5 ) { $ five _ count + = 1 ; } } if ( $ five _ count = = 2 & & $ seven _ count = = 1 ) { echo " YES " ; } else { echo " NO " ; } ? > < ? php $ n = trim ( fgets ( STDIN ) ) ; echo ( $ n * $ n ) . PHP _ EOL ; < ? php fscanf ( STDIN , ' % d ' , $ A ) ; fscanf ( STDIN , ' % d ' , $ B ) ; fscanf ( STDIN , ' % d ' , $ C ) ; fscanf ( STDIN , ' % d ' , $ D ) ; fscanf ( STDIN , ' % d ' , $ E ) ; $ Q = [ $ A , $ B , $ C , $ D , $ E ] ; $ Ap = $ A % 10 ; $ Bp = $ B % 10 ; $ Cp = $ C % 10 ; $ Dp = $ D % 10 ; $ Ep = $ E % 10 ; $ P = [ $ Ap , $ Bp , $ Cp , $ Dp , $ Ep ] ; $ min ; $ sum = 0 ; if ( array _ sum ( $ P ) = = 0 ) { echo array _ sum ( $ Q ) ; } else { for ( $ i = 0 ; $ i < = 4 ; $ i + + ) { if ( $ P [ $ i ] = = 0 ) { $ P [ $ i ] = 10 ; } } $ min = min ( $ P ) ; for ( $ i = 0 ; $ i < = 4 ; $ i + + ) { if ( $ Q [ $ i ] % 10 = = 0 ) { $ sum + = $ Q [ $ i ] ; } else { $ sum + = ceil ( $ Q [ $ i ] / 10 ) * 10 ; } } echo $ sum - 10 + $ min ; } echo " \ n " ; ? > < ? php fscanf ( STDIN , ' % d % d % d ' , $ a [ ] , $ a [ ] , $ a [ ] ) ; sort ( $ a ) ; $ cost = 0 ; $ total = 0 ; foreach ( $ a as $ value ) { if ( $ cost = = 0 ) { $ total + = 0 ; } else { $ total + = abs ( $ value - $ cost ) ; } $ cost = $ value ; } echo $ total ; < ? php $ n = intval ( trim ( fgets ( STDIN ) ) ) ; $ x = array _ map ( " intval " , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; $ pos = round ( array _ sum ( $ x ) / sizeof ( $ x ) ) ; $ i = 0 ; foreach ( $ x as $ val ) { $ i + = pow ( $ val - $ pos , 2 ) ; } echo $ i . PHP _ EOL ; < ? php fscanf ( STDIN , " % d % d " , $ n , $ m ) ; $ citys = array ( ) ; for ( $ i = 0 ; $ i < $ m ; $ i + + ) { $ p _ y = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ pref [ $ p _ y [ 0 ] ] [ ] = $ p _ y [ 1 ] ; $ py _ li [ ] = $ p _ y ; } $ p _ y _ key _ li = array _ keys ( $ pref ) ; for ( $ i = 0 ; $ i < count ( $ p _ y _ key _ li ) ; $ i + + ) { sort ( $ pref [ $ p _ y _ key _ li [ $ i ] ] ) ; } $ memo = array ( ) ; $ memo = [ ] ; foreach ( $ pref as $ key = > $ list ) { foreach ( $ pref [ $ key ] as $ num = > $ year ) { $ memo [ $ year ] = $ num + 1 ; } } foreach ( $ py _ li as $ py ) { $ x = $ memo [ $ py [ 1 ] ] ; for ( $ i = 0 ; $ i < 6 - strlen ( $ py [ 0 ] ) ; $ i + + ) { echo " 0 " ; } echo $ py [ 0 ] ; for ( $ i = 0 ; $ i < 6 - strlen ( $ x ) ; $ i + + ) { echo " 0 " ; } echo ( $ x ) . " \ n " ; } < ? php $ sum = 0 ; $ amax = 0 ; for ( $ i = 0 ; $ i < 5 ; $ i + + ) { fscanf ( STDIN , " % d " , $ a ) ; $ sum + = ( int ) ( ( $ a + 9 ) / 10 ) * 10 ; if ( $ a % 10 ! = 0 ) { $ amax = max ( $ amax , 10 - $ a % 10 ) ; } } echo $ sum - $ amax . " \ n " ; ? > < ? php fscanf ( STDIN , " % d % d " , $ a , $ b ) ; if ( $ a > 8 | | $ b > 8 ) { echo ( " : ( " ) ; } else { echo ( " Yay ! " ) ; } < ? php error _ reporting ( 0 ) ; list ( $ A , $ B ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; printf ( " % d \ n " , ceil ( ( $ A + $ B ) / 2 ) ) ; < ? php $ n = ( int ) trim ( fgets ( STDIN ) ) ; $ points = [ ] ; for ( $ i = 1 ; $ i < = $ n ; $ i + + ) { $ input = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ ps = [ ] ; foreach ( $ input as $ v ) { $ ps [ ] = ( int ) $ v ; } $ points [ ] = $ ps ; } if ( $ n = = = 2 ) { echo dist ( $ points [ 0 ] , $ points [ 1 ] ) ; exit ( ) ; } $ sum = 0 ; foreach ( $ points as $ k1 = > $ p1 ) { foreach ( $ points as $ k2 = > $ p2 ) { if ( $ k1 = = = $ k2 ) { continue ; } $ sum + = dist ( $ p1 , $ p2 ) * fact ( $ n - 1 ) ; } } echo $ sum / fact ( $ n ) ; function dist ( $ p1 , $ p2 ) { return sqrt ( pow ( $ p1 [ 0 ] - $ p2 [ 0 ] , 2 ) + pow ( $ p1 [ 1 ] - $ p2 [ 1 ] , 2 ) ) ; } function fact ( $ n ) { $ result = 1 ; for ( $ i = 1 ; $ i < = $ n ; $ i + + ) { $ result * = $ i ; } return $ result ; } < ? php fscanf ( STDIN , " % d % d " , $ k , $ s ) ; $ count = 0 ; for ( $ x = 0 ; $ x < = $ k ; $ x + + ) { for ( $ y = 0 ; $ y < = $ k ; $ y + + ) { $ z = $ s - ( $ x + $ y ) ; if ( $ z > = 0 & & $ z < = $ k ) { if ( $ z + $ x + $ y = = $ s ) { $ count + + ; } } } } echo $ count ; < ? php $ r = ( int ) trim ( fgets ( STDIN ) ) ; print ( int ) pow ( $ r , 2 ) ; ? > < ? php $ nums = explode ( ' ' , fgets ( STDIN ) ) ; echo ceil ( ( $ nums [ 0 ] + $ nums [ 1 ] ) / 2 ) ; ? > < ? php $ is _ honban = 1 ; if ( $ is _ honban ) { $ sc = new Scanner ( ) ; $ a = $ sc - > nextInt ( ) ; $ b = $ sc - > nextInt ( ) ; $ c = $ sc - > nextInt ( ) ; $ d = $ sc - > nextInt ( ) ; $ e = $ sc - > nextInt ( ) ; $ k = $ sc - > nextInt ( ) ; } else { error _ reporting ( E _ ERROR | E _ WARNING | E _ PARSE ) ; $ n = 8 ; $ q = 3 ; $ s = ' AABCBDBA ' ; $ t = array ( ' A ' , ' B ' , ' A ' ) ; $ d = array ( ' L ' , ' R ' , ' R ' ) ; } $ ans = 0 ; $ ans = ( $ e - $ a < = $ k ? " Yay ! " : " : ( " ) ; out : : println ( $ ans ) ; class Scanner { private $ arr = array ( ) ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( double ) $ this - > next ( ) ; } } class out { public static function println ( $ str = " " ) { echo $ str . PHP _ EOL ; } } ? > < ? php fscanf ( STDIN , ' % d % d ' , $ a , $ b ) ; if ( $ a < = 12 & & $ a > = 6 ) { echo $ b / 2 ; } elseif ( $ a < = 5 ) { echo 0 ; } else { echo $ b ; } echo PHP _ EOL ; < ? php $ input = fgets ( STDIN ) ; print ( pow ( $ input , 3 ) ) ; ? > < ? php list ( $ a , $ b ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; if ( $ a < = 5 ) { $ b = 0 ; } elseif ( $ a < = 12 ) { $ b / = 2 ; } echo $ b ; < ? php $ a = intval ( fgets ( STDIN ) ) ; $ b = intval ( fgets ( STDIN ) ) ; $ c = intval ( fgets ( STDIN ) ) ; $ x = intval ( fgets ( STDIN ) ) ; $ ans = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ j = 0 ; $ j < = $ b ; $ j + + ) { for ( $ k = 0 ; $ k < = $ c ; $ k + + ) { $ ammount = $ i * 500 + $ j * 100 + $ k * 50 ; if ( $ ammount = = $ x ) { $ ans + + ; } } } } print $ ans ; ? > < ? php fscanf ( STDIN , " % d % d % d " , $ c1 , $ c2 , $ c3 ) ; fscanf ( STDIN , " % d % d % d " , $ c21 , $ c22 , $ c23 ) ; fscanf ( STDIN , " % d % d % d " , $ c31 , $ c32 , $ c33 ) ; $ diff _ 11 = $ c1 - $ c2 ; $ diff _ 21 = $ c21 - $ c22 ; $ diff _ 31 = $ c31 - $ c32 ; $ diff _ 1 = $ c2 - $ c3 ; $ diff _ 2 = $ c22 - $ c23 ; $ diff _ 3 = $ c32 - $ c33 ; if ( $ diff _ 11 = = $ diff _ 21 & & $ diff _ 21 = = $ diff _ 31 & & $ diff _ 1 = = $ diff _ 2 & & $ diff _ 2 = = $ diff _ 3 ) { echo " Yes \ n " ; } else { echo " No \ n " ; } < ? php $ t = fgets ( STDIN ) ; $ t = preg _ replace ( " / \ ? / " , " D " , $ t ) ; echo $ t ; < ? php $ s = trim ( fgets ( STDIN ) ) ; if ( substr ( $ s , 2 , 1 ) = = substr ( $ s , 3 , 1 ) & & substr ( $ s , 4 , 1 ) = = substr ( $ s , 5 , 1 ) ) { echo ' Yes ' ; } else { echo ' No ' ; } ? > < ? php $ r = intval ( trim ( fgets ( STDIN ) ) ) ; echo $ r * * 2 ; ? > < ? php $ sum = 0 ; $ min = 10 ; for ( $ i = 0 ; $ i < 5 ; $ i + + ) { list ( $ t ) = fscanf ( STDIN , ' % d ' ) ; if ( $ t % 10 = = = 0 ) $ sum + = $ t ; else if ( substr ( $ t , - 1 ) < $ min ) { $ sum + = ceil ( $ t / 10 ) * 10 ; $ min = substr ( $ t , - 1 ) ; } else $ sum + = ceil ( $ t / 10 ) * 10 ; } $ sum - = ( 10 - $ min ) ; echo $ sum ; < ? php fscanf ( STDIN , " % d % d " , $ n , $ m ) ; $ citys = array ( ) ; for ( $ i = 0 ; $ i < $ m ; $ i + + ) { $ p _ y = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ pref [ $ p _ y [ 0 ] ] [ ] = $ p _ y [ 1 ] ; $ py _ li [ ] = $ p _ y ; } $ p _ y _ key _ li = array _ keys ( $ pref ) ; for ( $ i = 0 ; $ i < count ( $ p _ y _ key _ li ) ; $ i + + ) { sort ( $ pref [ $ p _ y _ key _ li [ $ i ] ] ) ; } $ memo = [ ] ; foreach ( $ pref as $ key = > $ list ) { foreach ( $ pref [ $ key ] as $ num = > $ year ) { $ memo [ $ year ] = $ num + 1 ; } } foreach ( $ py _ li as $ py ) { $ x = $ memo [ $ py [ 1 ] ] ; for ( $ i = 0 ; $ i < 6 - strlen ( $ py [ 0 ] ) ; $ i + + ) { echo " 0 " ; } echo $ py [ 0 ] ; for ( $ i = 0 ; $ i < 6 - strlen ( $ x ) ; $ i + + ) { echo " 0 " ; } echo $ x . " \ n " ; } < ? php $ S = trim ( fgets ( STDIN ) ) ; $ answer = " No " ; if ( ( $ S [ 2 ] = = = $ S [ 3 ] ) & & ( $ S [ 4 ] = = = $ S [ 5 ] ) ) { $ answer = " Yes " ; } echo $ answer ; < ? php $ inputs = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ K = $ inputs [ 0 ] ; $ S = $ inputs [ 1 ] ; $ ans = 0 ; for ( $ x = 0 ; $ x < = $ K ; $ x + + ) { for ( $ y = 0 ; $ y < = $ K ; $ y + + ) { $ z = $ S - $ x - $ y ; if ( 0 < = $ z & & $ z < = $ K ) $ ans + + ; } } echo $ ans ; ? > < ? php list ( $ n ) = ints ( ) ; $ s = strs ( ) ; for ( $ i = 0 ; $ i < $ n ; $ i + + ) { if ( $ s [ $ i ] = = = ' Y ' ) exit ( ' Four ' ) ; } echo ' Three ' ; function ints ( ) { return array _ map ( ' intval ' , explode ( ' ' , trim ( fgets ( STDIN ) ) ) ) ; } function strs ( ) { return explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; } < ? php fscanf ( STDIN , ' % d ' , $ A ) ; fscanf ( STDIN , ' % d ' , $ B ) ; fscanf ( STDIN , ' % d ' , $ C ) ; fscanf ( STDIN , ' % d ' , $ D ) ; fscanf ( STDIN , ' % d ' , $ E ) ; fscanf ( STDIN , ' % d ' , $ K ) ; $ L = max ( $ A , $ B , $ C , $ D , $ E ) - min ( $ A , $ B , $ C , $ D , $ E ) ; if ( $ L < = $ K ) { echo " Yay ! " ; } else { echo " : ( " ; } echo " \ n " ; ? > < ? php $ input = trim ( fgets ( STDIN ) ) ; if ( $ input = = = ' 5 7 5 ' ) { echo " YES \ n " ; } elseif ( $ input = = = ' 5 5 7 ' ) { echo " YES \ n " ; } elseif ( $ input = = = ' 7 5 5 ' ) { echo " YES \ n " ; } else echo " NO \ n " ; < ? php list ( $ a , $ b ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; echo ceil ( ( $ a + $ b ) / 2 ) ; < ? php $ t = new temp ( ) ; $ t - > main ( ) ; unset ( $ t ) ; class temp { private function lineIn ( ) { return fgets ( STDIN ) ; } private function arrayIn ( ) { return explode ( " " , fgets ( STDIN ) ) ; } public function main ( ) { $ hinaMax = $ this - > lineIn ( ) ; $ hinaArare = $ this - > arrayIn ( ) ; $ type = " Three " ; foreach ( $ hinaArare as $ arare ) { if ( " Y " = = $ arare ) { $ type = " Four " ; break ; } } unset ( $ arare ) ; echo $ type ; } } ? > < ? php $ x = trim ( fgets ( STDIN ) ) ; print $ x * $ x * $ x . " \ n " ; ? > < ? php $ stdin = trim ( fgets ( STDIN ) ) ; $ array = explode ( ' ' , $ stdin ) ; $ alice = $ array [ 0 ] ; $ bob = $ array [ 1 ] ; if ( $ alice = = $ bob ) { echo " Draw " ; return ; } if ( $ alice = = 1 ) { echo " Alice " ; return ; } if ( $ bob = = 1 ) { echo " Bob " ; return ; } if ( $ alice < $ bob ) { echo " Bob " ; return ; } else { echo " Alice " ; return ; } < ? php fscanf ( STDIN , " % d % d % d % d " , $ a , $ b , $ h , $ m ) ; $ arg _ h = $ h * - 2 * M _ PI / 12 + $ m * - 2 * M _ PI / 12 / 60 ; $ arg _ m = $ m * - 2 * M _ PI / 60 ; function crd ( $ r , $ arg ) { return [ $ r * cos ( $ arg ) , $ r * sin ( $ arg ) ] ; } ; $ arr _ h = crd ( $ a , $ arg _ h ) ; $ arr _ m = crd ( $ b , $ arg _ m ) ; $ x = $ arr _ h [ 0 ] - $ arr _ m [ 0 ] ; $ y = $ arr _ h [ 1 ] - $ arr _ m [ 1 ] ; echo sqrt ( $ x * * 2 + $ y * * 2 ) ; ? > < ? php fscanf ( STDIN , " % d % d % d " , $ a , $ b , $ c ) ; if ( ( $ a + $ b ) > = $ c ) { echo ' Yes ' ; } else { echo ' No ' ; } < ? php while ( true ) { fscanf ( STDIN , " % d " , $ a ) ; if ( feof ( STDIN ) ) break ; echo $ a * $ a * $ a , PHP _ EOL ; } < ? php $ at = new Atcoder ( ) ; $ at - > main ( ) ; unset ( $ at ) ; class Atcoder { private function arrayIn ( ) { $ buf = explode ( " " , fgets ( STDIN ) ) ; return $ this - > killNewLine ( $ buf ) ; } private function killNewLine ( $ buf = null ) { $ buf = str _ replace ( " \ r \ n " , " " , $ buf ) ; $ buf = str _ replace ( " \ n " , " " , $ buf ) ; $ buf = str _ replace ( " \ r " , " " , $ buf ) ; return $ buf ; } public function main ( ) { $ s = $ this - > arrayIn ( ) ; $ a = $ s [ 0 ] ; $ b = $ s [ 1 ] ; if ( 8 < $ a | | 8 < $ b ) { echo " : ( \ n " ; } else { echo " Yay ! \ n " ; } } } ? > < ? php $ a = trim ( fgets ( STDIN ) ) ; $ b = trim ( fgets ( STDIN ) ) ; $ c = trim ( fgets ( STDIN ) ) ; $ d = trim ( fgets ( STDIN ) ) ; $ count = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ j = 0 ; $ j < = $ b ; $ j + + ) { for ( $ k = 0 ; $ k < = $ c ; $ k + + ) { $ sum = 500 * $ i + 100 * $ j + 50 * $ k ; if ( $ sum = = $ d ) { $ count + + ; } } } } echo $ count ; ? > < ? php $ pos [ ] = stdin ( ) ; $ pos [ ] = stdin ( ) ; $ pos [ ] = stdin ( ) ; $ pos [ ] = stdin ( ) ; $ pos [ ] = stdin ( ) ; echo max ( $ pos ) - min ( $ pos ) < = ( int ) stdin ( ) ? ' Yay ! ' : ' : ( ' , PHP _ EOL ; function stdin ( ) { return trim ( fgets ( STDIN ) ) ; } < ? php $ input _ num = intval ( fgets ( STDIN ) ) ; echo $ input _ num * $ input _ num * $ input _ num . " \ n " ; < ? php $ input = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ n = ( int ) $ input [ 0 ] ; $ m = ( int ) $ input [ 1 ] ; $ infinit = 10001 ; $ shortest = [ ] ; for ( $ i = 1 ; $ i < = $ n ; $ i + + ) { for ( $ j = 1 ; $ j < = $ n ; $ j + + ) { if ( $ i = = = $ j ) { $ shortest [ $ i ] [ $ j ] = 0 ; } else { $ shortest [ $ i ] [ $ j ] = $ infinit ; } } } $ path = [ ] ; for ( $ i = 0 ; $ i < $ m ; $ i + + ) { $ input = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ fr = ( int ) $ input [ 0 ] ; $ to = ( int ) $ input [ 1 ] ; $ dist = ( int ) $ input [ 2 ] ; $ path [ ] = [ $ fr , $ to , $ dist ] ; $ shortest [ $ fr ] [ $ to ] = $ dist ; $ shortest [ $ to ] [ $ fr ] = $ dist ; } for ( $ a = 1 ; $ a < = $ n ; $ a + + ) { for ( $ b = 1 ; $ b < = $ n ; $ b + + ) { for ( $ c = 1 ; $ c < = $ n ; $ c + + ) { $ shortest [ $ b ] [ $ c ] = min ( $ shortest [ $ b ] [ $ c ] , $ shortest [ $ a ] [ $ b ] + $ shortest [ $ a ] [ $ c ] ) ; } } } $ count = 0 ; foreach ( $ path as $ v ) { if ( $ shortest [ $ v [ 0 ] ] [ $ v [ 1 ] ] < $ v [ 2 ] ) { + + $ count ; } } echo $ count ; < ? php fscanf ( STDIN , " % d % d % d " , $ a , $ b , $ c ) ; $ args = [ ] ; $ args [ 0 ] = $ a ; $ args [ 1 ] = $ b ; $ args [ 2 ] = $ c ; $ i = NULL ; switch ( $ a ) { case 5.7 : $ a = $ args [ 0 ] ; break ; default : break ; } switch ( $ b ) { case 5.7 : $ b = $ args [ 0 ] ; break ; default : break ; } switch ( $ c ) { case 5.7 : $ c = $ args [ 0 ] ; break ; default : break ; } $ i = $ args [ 0 ] + $ args [ 1 ] + $ args [ 2 ] ; if ( $ i = = 17 ) { echo " YES " ; } else { echo " NO " ; } ? > < ? php fscanf ( STDIN , " % d " , $ N ) ; $ total = 800 * $ N ; $ discount = ( int ) ( $ N / 15 ) * 200 ; echo $ total - $ discount ; ? > < ? php $ is _ honban = 1 ; if ( $ is _ honban ) { $ sc = new Scanner ( ) ; $ a = $ sc - > nextInt ( ) ; $ b = $ sc - > nextInt ( ) ; $ c = $ sc - > nextInt ( ) ; $ x = $ sc - > nextInt ( ) ; } else { error _ reporting ( E _ ERROR | E _ WARNING | E _ PARSE ) ; $ a = 30 ; $ b = 40 ; $ c = 50 ; $ x = 6000 ; } $ ans = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ j = 0 ; $ j < = $ b ; $ j + + ) { for ( $ k = 0 ; $ k < = $ c ; $ k + + ) { if ( $ i * 500 + $ j * 100 + $ k * 50 = = $ x ) { $ ans + + ; } } } } out : : println ( $ ans ) ; class Scanner { private $ arr = array ( ) ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( double ) $ this - > next ( ) ; } } class out { public static function println ( $ str = " " ) { echo $ str . PHP _ EOL ; } } ? > < ? php list ( $ a , $ v ) = ints ( ) ; list ( $ b , $ w ) = ints ( ) ; list ( $ t ) = ints ( ) ; $ D = abs ( $ a - $ b ) ; $ V = $ v - $ w ; if ( $ D = = = 0 ) exit ( ' YES ' ) ; if ( $ V < = 0 ) exit ( ' NO ' ) ; echo $ D / $ V < = $ t ? ' YES ' : ' NO ' ; function ints ( ) { return array _ map ( ' intval ' , explode ( ' ' , trim ( fgets ( STDIN ) ) ) ) ; } < ? php list ( $ n , $ d ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ numbers = [ ] ; $ answer = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i + + ) { $ numbers [ ] = explode ( " " , trim ( fgets ( STDIN ) ) ) ; } for ( $ i = 0 ; $ i < $ n ; $ i + + ) { for ( $ j = $ n - 1 ; $ j > $ i ; $ j -- ) { $ number = 0 ; for ( $ s = 0 ; $ s < $ d ; $ s + + ) { $ number + = pow ( $ numbers [ $ i ] [ $ s ] - $ numbers [ $ j ] [ $ s ] , 2 ) ; } if ( is _ seisuu ( $ number ) ) { $ answer + = 1 ; } } } function is _ seisuu ( $ number ) { $ heihoukon = ( string ) sqrt ( $ number ) ; return ctype _ digit ( $ heihoukon ) ? true : false ; } echo $ answer ; echo " \ n " ; ? > < ? php fscanf ( STDIN , ' % d ' , $ A ) ; fscanf ( STDIN , ' % d ' , $ B ) ; fscanf ( STDIN , ' % d ' , $ C ) ; fscanf ( STDIN , ' % d ' , $ D ) ; fscanf ( STDIN , ' % d ' , $ E ) ; fscanf ( STDIN , ' % d ' , $ k ) ; if ( $ E - $ A > $ k ) { echo ' : ( ' . PHP _ EOL ; } else { echo ' Yay ! ' . PHP _ EOL ; } < ? php define ( " inf " , 10 * * 15 ) ; list ( $ n , $ m ) = array _ map ( " intval " , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; for ( $ i = 2 ; $ i < = $ n ; $ i + + ) { $ map [ $ i ] [ ] = [ $ i - 1 , 0 ] ; } for ( $ i = 0 ; $ i < $ m ; $ i + + ) { list ( $ from , $ to , $ d ) = array _ map ( " intval " , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; $ map [ $ from ] [ ] = [ $ to , $ d ] ; } $ D [ 1 ] = 0 ; for ( $ i = 2 ; $ i < = $ n ; $ i + + ) { $ D [ $ i ] = inf ; } $ pq = new SplPriorityQueue ( ) ; $ pq - > insert ( 1 , 0 ) ; while ( $ pq - > count ( ) ) { $ f = $ pq - > extract ( ) ; if ( ! isset ( $ map [ $ f ] ) ) continue ; foreach ( $ map [ $ f ] as list ( $ t , $ dist ) ) { $ new = $ D [ $ f ] + $ dist ; if ( $ D [ $ t ] > $ new ) { $ D [ $ t ] = $ new ; $ pq - > insert ( $ t , - $ new ) ; } } } printf ( " % d " , $ D [ $ n ] = = inf ? - 1 : $ D [ $ n ] ) ; < ? php while ( $ sum = array _ sum ( str _ split ( trim ( fgets ( STDIN ) ) ) ) ) printf ( " % d \ n " , $ sum ) ; < ? php error _ reporting ( 0 ) ; $ stdin = file _ get _ contents ( ' php : $ line = explode ( " \ n " , $ stdin ) ; $ fi = 0 ; $ cnt = 0 ; $ list = array ( ) ; $ key = new stdclass ( ) ; foreach ( $ line as $ l ) { if ( strlen ( $ l ) = = 0 ) continue ; if ( $ fi = = 0 ) { $ a = explode ( " " , $ l ) ; $ key- > A = $ a ; $ fi + + ; continue ; } if ( $ fi > 0 ) { $ a = explode ( " " , $ l ) ; $ key- > X [ ] = $ a ; } } $ A = $ key- > A [ 0 ] ; $ B = $ key- > A [ 1 ] ; $ C = $ key- > A [ 2 ] ; $ D = $ key- > A [ 3 ] ; printf ( " % d \ n " , max ( $ A * $ B , $ C * $ D ) ) ; < ? php $ n = intval ( trim ( fgets ( STDIN ) ) ) ; echo 2 * * floor ( log ( $ n , 2 ) ) ; < ? php While ( $ line = fgets ( STDIN ) ) { $ stdin [ ] = trim ( $ line ) ; } $ v = explode ( " " , $ stdin [ 0 ] ) ; fscanf ( STDIN , " % d % d " , $ n , $ d ) ; $ ans = 0 ; for ( $ i = 0 ; $ i < $ v [ 0 ] ; $ i + + ) { $ a = explode ( " " , $ stdin [ $ i + 1 ] ) ; for ( $ j = $ i + 1 ; $ j < $ v [ 0 ] ; $ j + + ) { $ b = explode ( " " , $ stdin [ $ j + 1 ] ) ; $ r = 0 ; for ( $ k = 0 ; $ k < $ v [ 1 ] ; $ k + + ) { $ r + = pow ( ( $ a [ $ k ] - $ b [ $ k ] ) , 2 ) ; } if ( preg _ match ( ' / ^ [ 0-9 ] + $ / ' , sqrt ( $ r ) ) ) { $ ans + + ; } } } echo $ ans ; < ? php $ n = trim ( fgets ( STDIN ) ) ; $ p = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ point = $ p [ 0 ] ; $ count = 1 ; for ( $ i = 0 ; $ i < $ n ; $ i + + ) { if ( $ p [ $ i ] < $ point ) { $ point = $ p [ $ i ] ; $ count + + ; } } echo $ count . " \ n " ; < ? php fscanf ( STDIN , " % d " , $ N ) ; $ sum = $ N * 800 - floor ( $ N / 15 ) * 200 ; echo $ sum ; ? > < ? php fscanf ( STDIN , " % d % d % d % d % d " , $ h1 , $ m1 , $ h2 , $ m2 , $ k ) ; $ start _ time = $ h1 * 60 + $ m1 ; $ end _ time = $ h2 * 60 + $ m2 ; $ possble _ end = $ end _ time - $ k ; echo ( $ possble _ end - $ start _ time ) ; < ? php define ( ' DEBUG ' , false ) ; ini _ set ( ' error _ reporting ' , E _ ALL & ~ E _ NOTICE ) ; fscanf ( STDIN , " % d " , $ N ) ; $ log = ( int ) floor ( log ( $ N , 2 ) ) ; echo pow ( 2 , $ log ) . " \ n " ; < ? php list ( $ k , $ s ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; if ( $ s = = 0 ) { echo 1 ; } elseif ( $ s = = $ k * 3 ) { echo 1 ; } else { $ ans = 0 ; $ x = max ( 0 , $ s - $ k * 2 ) ; while ( $ x < = $ k ) { $ y = max ( 0 , $ s - $ x - $ k ) ; $ ym = min ( $ k , $ s - $ x ) ; while ( $ y < = $ ym ) { $ z = $ s - $ x - $ y ; $ zm = min ( $ k , $ s - $ x - $ y ) ; if ( $ z < = $ zm ) { + + $ ans ; } + + $ y ; } + + $ x ; } echo $ ans ; } ? > < ? php while ( ! feof ( STDIN ) ) { $ stdin = trim ( fgets ( STDIN ) ) ; $ values = explode ( ' , ' , $ stdin ) ; if ( count ( $ values ) ! = 5 ) { } else { $ temp = array ( ) ; foreach ( $ values as $ value ) { if ( ! isset ( $ temp [ $ value ] ) ) { $ temp [ $ value ] = 1 ; } else { $ temp [ $ value ] + + ; } } ksort ( $ temp ) ; $ ret = ' null ' ; foreach ( $ temp as $ t ) { if ( $ t = = 4 ) { $ ret = ' four card ' ; } elseif ( $ t = = 3 ) { if ( $ ret = = ' one pair ' ) { $ ret = ' full house ' ; } else { $ ret = ' three card ' ; } } elseif ( $ t = = 2 ) { if ( $ ret = = ' one pair ' ) { $ ret = ' two pair ' ; } elseif ( $ ret = = ' three card ' ) { $ ret = ' full house ' ; } else { $ ret = ' one pair ' ; } } } $ temp = array _ keys ( $ temp ) ; if ( count ( $ temp ) = = 5 & & $ temp [ 4 ] - $ temp [ 0 ] = = 4 ) { $ ret = ' straight ' ; } $ temp2 = array ( ) ; foreach ( $ temp as $ t ) { if ( $ t = = 1 ) { $ temp2 [ ] = 14 ; } else { $ temp2 [ ] = $ t ; } } sort ( $ temp2 ) ; if ( count ( $ temp2 ) = = 5 & & $ temp2 [ 4 ] - $ temp2 [ 0 ] = = 4 ) { $ ret = ' straight ' ; } echo $ ret . " \ n " ; } } < ? php list ( $ N , $ W ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; While ( $ str = trim ( fgets ( STDIN ) ) ) { $ wv [ ] = explode ( " " , $ str ) ; } $ memo = [ ] ; $ max = 0 ; function dp ( $ i , $ maxW ) { global $ N , $ wv , $ memo ; if ( isset ( $ memo [ $ i ] [ $ maxW ] ) ) { return $ memo [ $ i ] [ $ maxW ] ; } if ( $ i = = $ N ) { $ max = 0 ; } else if ( $ maxW < $ wv [ $ i ] [ 0 ] ) { $ max = dp ( $ i + 1 , $ maxW ) ; } else { $ max = max ( dp ( $ i + 1 , $ maxW ) , dp ( $ i + 1 , $ maxW - $ wv [ $ i ] [ 0 ] ) + $ wv [ $ i ] [ 1 ] ) ; } $ memo [ $ i ] [ $ maxW ] = $ max ; return $ max ; } echo dp ( 0 , $ W ) ; < ? php $ a = trim ( fgets ( STDIN ) ) ; $ b = trim ( fgets ( STDIN ) ) ; $ c = trim ( fgets ( STDIN ) ) ; $ x = trim ( fgets ( STDIN ) ) ; $ count = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ j = 0 ; $ j < = $ b ; $ j + + ) { for ( $ k = 0 ; $ k < = $ c ; $ k + + ) { $ result = 0 ; $ result + = $ i * 500 ; $ result + = $ j * 100 ; $ result + = $ k * 50 ; if ( $ result = = $ x ) { $ count + + ; } } } } echo $ count ; < ? php $ a = fgets ( STDIN ) ; $ b = fgets ( STDIN ) ; $ c = fgets ( STDIN ) ; $ d = fgets ( STDIN ) ; $ e = fgets ( STDIN ) ; $ k = fgets ( STDIN ) ; if ( ( $ e - $ a ) > $ k ) { echo " : ( " ; } else { echo " Yay ! " ; } < ? php list ( $ k , $ s ) = ints ( ) ; $ cnt = 0 ; for ( $ x = 0 ; $ x < = $ k ; + + $ x ) { for ( $ y = 0 ; $ y < = min ( $ s - $ x , $ k ) ; + + $ y ) { $ z = $ s - $ x - $ y ; if ( $ z > = 0 & & $ z < = $ k ) $ cnt + + ; } } echo $ cnt ; function ints ( ) { return array _ map ( ' intval ' , explode ( ' ' , trim ( fgets ( STDIN ) ) ) ) ; } < ? php class Scanner { private $ arr = [ ] ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( double ) $ this - > next ( ) ; } } function be _ able _ to _ reach ( $ from , $ to ) { $ time = $ to [ 0 ] - $ from [ 0 ] ; $ distance = abs ( $ to [ 1 ] - $ from [ 1 ] ) + abs ( $ to [ 2 ] - $ from [ 2 ] ) ; # var _ dump ( $ time , $ distance ) ; if ( $ distance > $ time ) return false ; if ( $ distance % 2 = = 0 & & $ time % 2 = = 0 ) return true ; if ( $ distance % 2 = = 1 & & $ time % 2 = = 1 ) return true ; return false ; } $ scan = new Scanner ( ) ; $ A = $ scan- > nextInt ( ) ; $ B = $ scan- > nextInt ( ) ; $ cost = 0 ; if ( $ A > = 13 ) $ cost = $ B ; elseif ( $ A > = 6 ) $ cost = $ B / 2 ; else $ cost = 0 ; print ( $ cost ) ; < ? php $ N = trim ( fgets ( STDIN ) ) ; $ X = array _ map ( ' intval ' , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; $ mx = max ( $ X ) ; $ mi = min ( $ X ) ; $ res = 10 * * 9 ; for ( $ i = $ mi ; $ i < = $ mx ; $ i + + ) { $ sum = 0 ; for ( $ j = 0 ; $ j < $ N ; $ j + + ) { $ sum + = ( $ X [ $ j ] - $ i ) * * 2 ; } $ res = min ( $ res , $ sum ) ; } printf ( " % d \ n " , $ res ) ; < ? php $ input = trim ( fgets ( STDIN ) ) ; $ input = str _ replace ( array ( " \ r \ n " , " \ r " , " \ n " ) , ' ' , $ input ) ; $ array = explode ( " " , $ input ) ; $ result1 = $ array [ 0 ] * $ array [ 1 ] ; $ result2 = $ array [ 2 ] * $ array [ 3 ] ; if ( $ result1 > $ result2 ) { echo $ result1 . " \ n " ; } else { echo $ result2 . " \ n " ; } ? > < ? php $ ans = 0 ; fscanf ( STDIN , " % d " , $ N ) ; for ( $ i = 0 ; $ i < $ N ; $ i + + ) { fscanf ( STDIN , " % d % d " , $ x [ $ i ] , $ y [ $ i ] ) ; } for ( $ i = 0 ; $ i < $ N - 1 ; $ i + + ) { for ( $ j = $ i + 1 ; $ j < $ N ; $ j + + ) { $ ans + = sqrt ( pow ( $ x [ $ i ] - $ x [ $ j ] , 2 ) + pow ( $ y [ $ i ] - $ y [ $ j ] , 2 ) ) ; } } $ toori = f ( $ N ) ; $ toori _ path = $ toori * ( $ N - 1 ) ; $ pattern = $ N * ( $ N - 1 ) / 2 ; $ unit = $ toori _ path / $ pattern ; $ total = $ unit * $ ans ; echo $ total / $ toori ; function f ( $ N ) { $ ret = 1 ; for ( $ i = 1 ; $ i < = $ N ; $ i + + ) { $ ret * = $ i ; } return $ ret ; } < ? php fscanf ( STDIN , " % d " , $ a ) ; fscanf ( STDIN , " % d " , $ b ) ; fscanf ( STDIN , " % d " , $ c ) ; fscanf ( STDIN , " % d " , $ d ) ; fscanf ( STDIN , " % d " , $ e ) ; fscanf ( STDIN , " % d " , $ k ) ; $ s = max ( $ a , $ b , $ c , $ d , $ e ) - min ( $ a , $ b , $ c , $ d , $ e ) ; if ( $ s < = $ k ) { echo " Yay ! " ; } else { echo " : ( " ; } echo " \ n " ; ? > < ? php list ( $ h1 , $ m1 , $ h2 , $ m2 , $ k ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ hun = 0 ; if ( $ m2 < $ m1 ) { $ h2 = $ h2 - 1 ; $ hun = ( $ m2 + 60 ) - $ m1 ; } else { $ hun = $ m2 - $ m1 ; } $ zikan = ( ( $ h2 - $ h1 ) * 60 ) ; echo ( $ zikan + $ hun ) - $ k ; < ? php fscanf ( STDIN , " % d " , $ x ) ; $ a = - 118 ; $ b = - 119 ; for ( $ i = $ a ; $ i < 119 ; $ i + + ) { for ( $ j = $ b ; $ j < 118 ; $ j + + ) { if ( pow ( $ i , 5 ) - pow ( $ j , 5 ) = = $ x ) { echo $ i . ' ' . $ j ; exit ; } } } < ? php define ( ' DEBUG ' , false ) ; fscanf ( STDIN , " % s " , $ s ) ; $ arrayMoji = array ( ' dream ' , ' dreamer ' , ' erase ' , ' eraser ' ) ; $ jobs = array ( 0 ) ; while ( $ jobs ) { $ pos = array _ pop ( $ jobs ) ; $ partial = substr ( $ s , $ pos ) ; foreach ( $ arrayMoji as $ moji ) { $ len = strlen ( $ moji ) ; $ partial _ partial = substr ( $ partial , 0 , $ len ) ; if ( $ partial _ partial = = $ moji ) { $ newLoc = $ pos + $ len ; if ( $ newLoc = = strlen ( $ s ) ) { exit ( " YES \ n " ) ; } array _ push ( $ jobs , $ pos + $ len ) ; } } } echo " NO \ n " ; < ? php $ s = in ( ) ; if ( substr ( $ s , 2 , 1 ) = = substr ( $ s , 3 , 1 ) & & substr ( $ s , 4 , 1 ) = = substr ( $ s , 5 , 1 ) ) { Yes ( ) ; } else { No ( ) ; } function in ( ) { return trim ( fgets ( STDIN ) ) ; } function in _ int ( ) { return ( int ) in ( ) ; } function in _ vals ( ) { return explode ( ' ' , in ( ) ) ; } function in _ ints ( ) { return array _ map ( ' intval ' , in _ vals ( ) ) ; } function out ( $ s ) { echo $ s . PHP _ EOL ; } function yes ( ) { out ( ' Yes ' ) ; } function no ( ) { out ( ' No ' ) ; } function factorial ( $ n ) { if ( $ n > 0 ) { return $ n * = factorial ( $ n - 1 ) ; } return 1 ; } function is _ palindrome ( $ s ) { return $ s = = strrev ( $ s ) ; } < ? php fscanf ( STDIN , ' % d ' , $ N ) ; $ S = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ Scount = array _ count _ values ( $ S ) ; if ( count ( $ Scount ) = = 3 ) { echo ' Three ' ; } else { echo ' Four ' ; } ? > < ? php ini _ set ( ' error _ reporting ' , E _ ALL & ~ E _ NOTICE ) ; $ answer = " Yes " ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) { $ c [ $ i ] = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ mmin = min ( $ c [ $ i ] ) ; foreach ( $ c [ $ i ] as $ k = > $ v ) { $ c [ $ i ] [ $ k ] - = $ mmin ; } } for ( $ i = 0 ; $ i < 3 ; $ i + + ) { if ( $ c [ 0 ] [ $ i ] ! = $ c [ 1 ] [ $ i ] | | $ c [ 1 ] [ $ i ] ! = $ c [ 2 ] [ $ i ] ) { $ answer = " No " ; } } echo $ answer . PHP _ EOL ; < ? php $ a = trim ( fgets ( STDIN ) ) ; echo $ a * $ a * $ a ; ? > < ? php $ str _ arr = str _ split ( fgets ( STDIN ) ) ; if ( $ str _ arr [ 2 ] = = $ str _ arr [ 3 ] & & $ str _ arr [ 4 ] = = $ str _ arr [ 5 ] ) print ( " Yes \ n " ) ; else print ( " No \ n " ) ; ? > < ? php $ hanter = fgets ( STDIN ) ; $ hanter = str _ replace ( PHP _ EOL , ' ' , $ hanter ) ; list ( $ hanterZ , $ hanterV ) = preg _ split ( ' / \ s + / ' , $ hanter ) ; $ runner = fgets ( STDIN ) ; $ runner = str _ replace ( PHP _ EOL , ' ' , $ runner ) ; list ( $ runnerZ , $ runnerV ) = preg _ split ( ' / \ s + / ' , $ runner ) ; $ distance = abs ( $ hanterZ - $ runnerZ ) ; $ V = $ hanterV - $ runnerV ; $ chaceTime = fgets ( STDIN ) ; if ( $ V < = 0 & & $ distance > 0 ) { echo " NO " ; exit ( ) ; } $ tijimaruKyori = ( int ) $ chaceTime * ( int ) $ V ; if ( $ tijimaruKyori > = $ distance ) { echo " YES " ; exit ( ) ; } echo " NO " ; < ? php $ stdn = trim ( fgets ( STDIN ) ) ; $ ans = $ stdn * $ stdn * $ stdn ; echo $ ans . " \ n " ; < ? php fscanf ( STDIN , " % d " , $ a ) ; echo $ a * $ a ; < ? php fscanf ( STDIN , " % d % d % d % d % d " , $ H1 , $ M1 , $ H2 , $ M2 , $ K ) ; $ up = $ H1 * 60 + $ M1 ; $ down = $ H2 * 60 + $ M2 ; $ answer = $ down - $ up - $ K ; print _ r ( $ answer ) ; ? > < ? php fscanf ( STDIN , " % d % d " , $ a , $ b ) ; echo ceil ( ( $ a + $ b ) / 2 ) ; ? > < ? php define ( ' DEBUG ' , false ) ; fscanf ( STDIN , " % d " , $ N ) ; for ( $ h = 1 ; $ h < = 3500 ; $ h + + ) { for ( $ n = 1 ; $ n < = 3500 ; $ n + + ) { $ base = 4 * $ h * $ n - $ N * $ n - $ N * $ h ; if ( $ base = = 0 ) continue ; $ w = ( $ N * $ h * $ n ) / $ base ; if ( $ w = = intval ( $ w ) & & $ w > 0 ) { echo " { $ h } { $ n } { $ w } \ n " ; exit ; } } } < ? php $ n = explode ( ' ' , fgets ( STDIN ) ) ; $ seven = 0 ; $ five = 0 ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) { if ( $ n [ $ i ] = = 5 ) { $ five + + ; continue ; } if ( $ n [ $ i ] = = 7 ) { $ seven + + ; continue ; } } if ( $ seven = = = 1 & & $ five = = = 2 ) { echo ' YES ' . PHP _ EOL ; } else { echo ' NO ' . PHP _ EOL ; } < ? php $ a = fgets ( STDIN ) ; $ b = fgets ( STDIN ) ; $ c = fgets ( STDIN ) ; $ x = fgets ( STDIN ) ; $ result = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ t = 0 ; $ t < = $ b ; $ t + + ) { for ( $ r = 0 ; $ r < = $ c ; $ r + + ) { if ( 500 * $ i + 100 * $ t + 50 * $ r = = $ x ) { $ result + + ; } } } } echo $ result ; ? > < ? php $ input = trim ( fgets ( STDIN ) ) ; $ ans = $ input * $ input * $ input ; echo $ ans . " \ n " ; ? > < ? php fscanf ( STDIN , " % d % d " , $ n , $ k ) ; if ( $ k = = 1 ) { echo ' 0 ' ; } else { $ ans = $ n - $ k ; echo $ ans ; } < ? php $ s = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ ans = 0 ; if ( $ s [ 0 ] > = 13 ) { $ ans = $ s [ 1 ] ; } elseif ( $ s [ 0 ] < = 12 & & $ s [ 0 ] > = 6 ) { $ ans = $ s [ 1 ] / 2 ; } elseif ( $ s [ 0 ] < = 5 ) { $ ans = 0 ; } echo $ ans ; ? > < ? php $ input = trim ( fgets ( STDIN ) ) ; $ a = $ input ; $ input = str _ split ( $ input ) ; $ i = array _ sum ( $ input ) ; if ( $ a % $ i = = " 0 " ) { echo " Yes " ; } else { echo " No " ; } < ? php ini _ set ( ' memory _ limit ' , ' 1024M ' ) ; $ sc = new Scanner ( ) ; $ N = $ sc - > nextInt ( ) ; $ P = $ sc - > nextInt ( ) ; if ( $ N = = 1 ) { echo $ P . PHP _ EOL ; exit ; } if ( $ P = = 1 ) { echo 1 . PHP _ EOL ; exit ; } $ result = get _ prime _ factors ( $ P ) ; $ ans = 1 ; foreach ( $ result as $ k = > $ v ) { $ ans * = pow ( $ k , ( int ) ( $ v / $ N ) ) ; } echo $ ans . PHP _ EOL ; class Scanner { private $ arr = [ ] ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( double ) $ this - > next ( ) ; } } function get _ prime _ factors ( $ N ) { $ result = [ ] ; for ( $ i = 2 ; $ i * $ i < = $ N ; $ i + + ) { if ( $ N % $ i = = 0 ) { while ( $ N % $ i = = 0 ) { $ result [ $ i ] + + ; $ N / = $ i ; } } } if ( $ N > 1 ) { $ result [ $ N ] + + ; $ N / = $ N ; } return $ result ; } < ? php fscanf ( STDIN , ' % d ' , $ r ) ; echo $ r * $ r . PHP _ EOL ; < ? php fscanf ( STDIN , " % d % d % d " , $ a , $ b , $ c ) ; if ( ( $ a + $ b + $ c = = = 17 ) & & ( $ a = = = 5 | | 7 ) & & ( $ b = = = 5 | | 7 ) & & ( $ c = = = 5 | | 7 ) ) { echo ' YES ' ; } else { echo ' NO ' ; } < ? php $ a = ( int ) trim ( fgets ( STDIN ) ) ; $ b = ( int ) trim ( fgets ( STDIN ) ) ; $ c = ( int ) trim ( fgets ( STDIN ) ) ; $ x = ( int ) trim ( fgets ( STDIN ) ) ; $ ans = 0 ; for ( $ tmp = 0 ; $ tmp < = $ a ; $ tmp + + ) { for ( $ tmp2 = 0 ; $ tmp2 < = $ b ; $ tmp2 + + ) { for ( $ tmp3 = 0 ; $ tmp3 < = $ c ; $ tmp3 + + ) { if ( 500 * $ tmp + 100 * $ tmp2 + 50 * $ tmp3 = = $ x ) { $ ans + + ; } } } } echo ( $ ans ) . " \ n " ; ? > < ? php $ server = " php : $ handle = fopen ( $ server , " r " ) ; $ t = trim ( fgets ( $ handle ) ) ; $ a = trim ( fgets ( $ handle ) ) ; $ a = explode ( ' ' , $ a ) ; $ i = 100 ; $ last = 1000000009 ; $ num = 0 ; while ( $ i > 0 ) { $ sum = 0 ; for ( $ k = 0 ; $ k < $ t ; $ k + + ) { $ sum + = pow ( ( $ a [ $ k ] - $ i ) , 2 ) ; } if ( $ sum < $ last ) { $ last = $ sum ; } $ i -- ; } echo $ last . " \ n " ; < ? php $ string = str _ replace ( array ( " " , " \ n " ) , " " , fgets ( STDIN ) ) ; $ splited _ string = str _ split ( $ string ) ; if ( $ splited _ string [ ' 2 ' ] = = $ splited _ string [ ' 3 ' ] & & $ splited _ string [ ' 4 ' ] = = $ splited _ string [ ' 5 ' ] ) { echo " Yes " ; } else { echo " No " ; } < ? php list ( $ a , $ b , $ c , $ d ) = explode ( ' ' , rtrim ( fgets ( STDIN ) ) ) ; $ ab = $ a * $ b ; $ cd = $ c * $ d ; if ( $ ab > = $ cd ) { echo $ ab ; } else { echo $ cd ; } < ? php $ a = fgets ( STDIN ) ; $ b = fgets ( STDIN ) ; $ c = fgets ( STDIN ) ; $ d = fgets ( STDIN ) ; $ e = fgets ( STDIN ) ; $ k = fgets ( STDIN ) ; if ( $ e - $ a > $ k ) { echo " : ( " ; } else { echo " Yay ! " ; } ? > < ? php $ sc = new Scanner ( ) ; $ n = $ sc - > nextInt ( ) ; $ m = $ sc - > nextInt ( ) ; $ list = [ ] ; for ( $ i = 0 ; $ i < $ m ; $ i + + ) { $ p = $ sc - > nextInt ( ) ; $ y = $ sc - > nextInt ( ) ; $ list [ $ p ] [ $ y ] = $ i + 1 ; } $ ans _ list = [ ] ; foreach ( $ list as $ k = > $ v ) { ksort ( $ v ) ; $ first _ id = str _ pad ( $ k , 6 , ' 0 ' , STR _ PAD _ LEFT ) ; $ i = 1 ; foreach ( $ v as $ a ) { $ last _ id = str _ pad ( $ i + + , 6 , ' 0 ' , STR _ PAD _ LEFT ) ; $ ans _ list [ $ a ] = $ first _ id . $ last _ id ; } } ksort ( $ ans _ list ) ; echo implode ( PHP _ EOL , $ ans _ list ) . PHP _ EOL ; class Scanner { private $ arr = [ ] ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( double ) $ this - > next ( ) ; } } < ? php fscanf ( STDIN , " % d % d % d " , $ a , $ b , $ c ) ; $ array1 = array ( $ a , $ b , $ c ) ; $ count5 = array _ count _ values ( $ array1 ) ; if ( $ count5 [ 5 ] = = 2 & & $ count5 [ 7 ] = = 1 ) { echo ' YES ' ; } else { echo ' NO ' ; } < ? php class Scanner { private $ arr = [ ] ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( float ) $ this - > next ( ) ; } } $ sc = new Scanner ( ) ; $ h1 = $ sc - > nextInt ( ) ; $ m1 = $ sc - > nextInt ( ) ; $ h2 = $ sc - > nextInt ( ) ; $ m2 = $ sc - > nextInt ( ) ; $ k = $ sc - > nextInt ( ) ; $ a = $ h1 * 60 ; $ b = $ h2 * 60 ; $ a1 = $ a + $ m1 ; $ b1 = $ b + $ m2 ; $ calc = $ b1 - $ a1 - $ k ; echo $ calc ; < ? php $ n = trim ( fgets ( STDIN ) ) ; $ sum = 0 ; for ( $ i = 0 ; $ i < strlen ( $ n ) ; $ i + + ) { $ sum + = $ n [ $ i ] ; } echo $ n % $ sum = = 0 ? ' Yes ' : ' No ' ; ? > < ? php $ a = trim ( fgets ( STDIN ) ) ; $ result = pow ( $ a , 3 ) ; echo $ result . " \ n " ; < ? php $ s = fgets ( STDIN ) ; echo $ s [ 2 ] = = $ s [ 3 ] & & $ s [ 4 ] = = $ s [ 5 ] ? Yes : No ; < ? php $ p = explode ( " " , fgets ( STDIN ) ) ; if ( $ p [ 0 ] > 8 or $ p [ 1 ] > 8 ) { echo ' : ( ' ; } else { echo ' Yay ! ' ; } < ? php $ x = trim ( fgets ( STDIN ) ) ; echo pow ( $ x , 3 ) ; ? > < ? php $ n = int ( ) ; echo $ n * $ n ; function str ( ) { return trim ( fgets ( STDIN ) ) ; } function ints ( ) { return array _ map ( " intval " , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; } function int ( ) { return intval ( trim ( fgets ( STDIN ) ) ) ; } function o ( ... $ val ) { if ( count ( $ val ) = = 1 ) $ val = array _ shift ( $ val ) ; $ trace = debug _ backtrace ( ) ; echo $ trace [ 0 ] [ ' line ' ] . " ) " ; if ( is _ array ( $ val ) ) { if ( count ( $ val ) = = 0 ) { echo " empty array " ; } elseif ( ! is _ array ( current ( $ val ) ) ) { echo " array : " ; echo implode ( " " , $ val ) . " \ n " ; } else { echo " array : array \ n " ; foreach ( $ val as $ row ) { echo implode ( " " , $ row ) . " \ n " ; } } } else { echo $ val . " \ n " ; } } < ? php $ m = [ ] ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) { $ m [ $ i ] = array _ map ( ' intval ' , explode ( ' ' , fgets ( STDIN ) ) ) ; } $ a [ 0 ] = 0 ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) $ b [ $ i ] = $ m [ 0 ] [ $ i ] - $ a [ 0 ] ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) $ a [ $ i ] = $ m [ $ i ] [ 0 ] - $ b [ 0 ] ; $ jdge = ' Yes ' ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) { for ( $ j = 0 ; $ j < 3 ; $ j + + ) { if ( $ a [ $ i ] + $ b [ $ j ] ! = $ m [ $ i ] [ $ j ] ) $ jdge = ' No ' ; } } echo $ jdge ; < ? php namespace Track ; function main ( $ lines ) { $ sum = 0 ; $ ans = [ ] ; foreach ( $ lines as $ index = > $ value ) { if ( $ value = = " 0 " ) { break ; } for ( $ i = 0 ; $ i < strlen ( $ value ) ; $ i + + ) { $ sum + = $ value [ $ i ] ; } $ ans [ ] = $ sum ; $ sum = 0 ; } echo implode ( PHP _ EOL , $ ans ) ; } $ array = array ( ) ; while ( true ) { $ stdin = fgets ( STDIN ) ; if ( $ stdin = = " " ) { break ; } $ array [ ] = rtrim ( $ stdin ) ; } main ( $ array ) ; echo PHP _ EOL ; < ? php fscanf ( STDIN , " % d % d " , $ a , $ b ) ; if ( $ a > = 13 ) echo $ b ; else if ( $ a > = 6 ) echo $ b / 2 ; else echo " 0 " ; < ? php fscanf ( STDIN , " % d % d % d % d " , $ a , $ b , $ h , $ m ) ; $ kakudo _ hour = 30 * $ h + $ m * 0.5 ; $ kakudo _ minute = 6 * $ m ; if ( $ kakudo _ hour = = 0 ) { $ kakudo _ hour = 360 ; } if ( $ kakudo _ minute = = 0 ) { $ kakudo _ minute = 360 ; } $ Theta = abs ( $ kakudo _ hour - $ kakudo _ minute ) ; $ distan = ( $ a * * 2 + $ b * * 2 ) - ( 2 * $ a * $ b * cos ( deg2rad ( $ Theta ) ) ) ; $ distan = sqrt ( $ distan ) ; echo $ distan . " \ n " ; < ? php fscanf ( STDIN , " % s " , $ t ) ; echo str _ replace ( ' ? ' , ' D ' , $ t ) ; < ? php $ n = trim ( fgets ( STDIN ) ) ; $ max = 0 ; $ max _ i = 0 ; for ( $ i = 1 ; $ i < = $ n ; $ i + + ) { $ j = $ i ; $ count = 0 ; while ( $ j % 2 = = = 0 ) { $ j = $ j / 2 ; $ count + + ; } if ( $ count > = $ max ) { $ max = $ count ; $ max _ i = $ i ; } } print $ max _ i ; < ? php fscanf ( STDIN , " % d " , $ r ) ; echo $ r * $ r ; ? > < ? php list ( $ a , $ b ) = ints ( ) ; echo ( int ) ceil ( ( $ a + $ b ) / 2 ) ; function ints ( ) { return array _ map ( ' intval ' , explode ( ' ' , trim ( fgets ( STDIN ) ) ) ) ; } < ? php fscanf ( STDIN , " % d % d " , $ A , $ B ) ; if ( $ A = = = $ B ) { echo ' Draw ' ; } else if ( $ A = = = 1 | | $ A > $ B & & $ B ! = = 1 ) { echo ' Alice ' ; } else { echo ' Bob ' ; } ? > < ? php fscanf ( STDIN , " % d % d " , $ k , $ z ) ; $ count = 0 ; for ( $ a = 0 ; $ a < = $ k ; $ a + + ) { for ( $ b = 0 ; $ b < = $ k ; $ b + + ) { $ c = $ z - ( $ a + $ b ) ; if ( 0 < = $ c & & $ c < = $ k ) { $ count + + ; } } } echo $ count ; ? > < ? php $ N = intval ( trim ( fgets ( STDIN ) ) ) ; for ( $ i = 0 ; $ i < $ N ; $ i + + ) { list ( $ x , $ y ) = array _ map ( ' intval ' , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; $ X [ ] = $ x ; $ Y [ ] = $ y ; } for ( $ i = 0 ; $ i < $ N ; $ i + + ) { for ( $ j = 0 ; $ j < $ N ; $ j + + ) { if ( $ i = = $ j ) continue ; $ dis [ ] = sqrt ( ( ( ( $ X [ $ i ] - $ X [ $ j ] ) * * 2 ) + ( ( $ Y [ $ i ] - $ Y [ $ j ] ) * * 2 ) ) ) ; } } echo ( $ N - 1 ) * ( array _ sum ( $ dis ) / count ( $ dis ) ) . " \ n " ; ? > < ? php fscanf ( STDIN , " % s " , $ t ) ; $ c = 0 ; for ( $ i = 0 ; $ i < strlen ( $ t ) ; $ i + + ) { if ( $ t [ $ i ] = = ' ? ' ) { $ t [ $ i ] = ' D ' ; } } echo $ t ; < ? php $ n = trim ( fgets ( STDIN ) ) ; echo $ n * 800 - floor ( $ n / 15 ) * 200 ; < ? php fscanf ( STDIN , ' % d ' , $ A ) ; fscanf ( STDIN , ' % d ' , $ B ) ; fscanf ( STDIN , ' % d ' , $ C ) ; fscanf ( STDIN , ' % d ' , $ D ) ; fscanf ( STDIN , ' % d ' , $ E ) ; $ amariLast = 10 ; $ last = $ A ; foreach ( [ $ A , $ B , $ C , $ D , $ E ] as $ val ) { $ amari = $ val % 10 ; if ( $ amari < $ amariLast & & $ amari ! = = 0 ) { $ last = $ val ; $ amariLast = $ amari ; } } $ ans = 0 ; foreach ( [ $ A , $ B , $ C , $ D , $ E ] as $ val ) { if ( $ val < 10 ) { $ ans + = 10 ; } else { $ ans + = ( ceil ( $ val / 10 ) * 10 ) ; } } $ ans - = ( 10 - $ amariLast ) ; echo intval ( $ ans ) . PHP _ EOL ; < ? php while ( 1 ) { $ N = trim ( fgets ( STDIN ) ) ; if ( ! $ N ) break ; $ s = 0 ; foreach ( str _ split ( $ N ) as $ n ) $ s + = $ n ; echo $ s , PHP _ EOL ; } < ? php $ num = 0 ; while ( $ line = fgets ( STDIN ) ) { $ num + = ceil ( ( int ) trim ( $ line ) / 10 ) * 10 ; if ( substr ( trim ( $ line ) , - 1 ) ! = ' 0 ' ) { $ rest [ ] = substr ( trim ( $ line ) , - 1 ) ; } } $ d = min ( $ rest ) ; $ t = 10 ; if ( $ d = = 0 ) { $ t = 0 ; } echo $ num - $ t + $ d ; < ? php $ input = fgets ( STDIN ) ; $ input _ array = str _ split ( $ input ) ; $ ans = " " ; foreach ( $ input _ array as $ i = > $ char ) { if ( $ char = = = " ? " ) { $ ans = $ ans . " D " ; } else { $ ans = $ ans . $ char ; } } echo $ ans ; < ? php $ n = trim ( fgets ( STDIN ) ) ; $ a = $ n % 500 ; $ p = $ n - $ a ; echo $ p . PHP _ EOL ; ? > < ? php $ baseDate = 20190430 ; $ date = fgets ( STDIN ) ; $ date = str _ replace ( " / " , " " , $ date ) ; if ( $ date < = $ baseDate ) { echo " Heisei " ; } else { echo " TBD " ; } < ? php fscanf ( STDIN , " % s " , $ a ) ; if ( $ a [ 2 ] = = $ a [ 3 ] & & $ a [ 4 ] = = $ a [ 5 ] ) { echo ( " Yes " ) . PHP _ EOL ; } else { echo ( " No " ) . PHP _ EOL ; } < ? php fscanf ( STDIN , " % d % d " , $ N , $ D ) ; $ integerCount = 0 ; $ points = array ( ) ; for ( $ i = 0 ; $ i < $ N ; $ i + + ) { $ points [ ] = explode ( " " , trim ( fgets ( STDIN ) ) ) ; } for ( $ i = 0 ; $ i < $ N ; $ i + + ) { $ point _ y = $ points [ $ i ] ; for ( $ j = $ i + 1 ; $ j < $ N ; $ j + + ) { $ point _ z = $ points [ $ j ] ; $ distance = 0 ; foreach ( $ point _ y as $ index = > $ coordinate ) { $ distance + = pow ( abs ( $ point _ y [ $ index ] - $ point _ z [ $ index ] ) , 2 ) ; } if ( intval ( sqrt ( $ distance ) ) = = sqrt ( $ distance ) ) { $ integerCount + + ; } } } echo $ integerCount ; < ? php fscanf ( STDIN , " % d " , $ r ) ; echo pow ( $ r , 2 ) ; < ? php fscanf ( STDIN , ' % d % d ' , $ ball , $ person ) ; if ( $ person = = 1 ) { echo 0 ; } else { echo $ ball - $ person ; } < ? php $ a = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ b = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; fscanf ( STDIN , " % d " , $ t ) ; $ dis = abs ( $ b [ 0 ] - $ a [ 0 ] ) ; $ dis _ a = bcmul ( $ a [ 1 ] , $ t ) ; $ dis _ b = bcadd ( $ dis , bcmul ( $ b [ 1 ] , $ t ) ) ; if ( $ dis _ a > = $ dis _ b ) { echo ' YES ' ; } else { echo ' NO ' ; } < ? php fscanf ( STDIN , " % d " , $ n ) ; $ inputs = trim ( fgets ( STDIN ) ) ; $ x = array _ map ( " intval " , explode ( " " , $ inputs ) ) ; $ sum _ min = 0 ; for ( $ p = 1 ; $ p < 100 ; $ p + + ) { $ sum = 0 ; for ( $ i = 0 ; $ i < count ( $ x ) ; $ i + + ) { $ sum + = pow ( $ x [ $ i ] - $ p , 2 ) ; } if ( $ p = = 1 | | $ sum _ min > $ sum ) { $ sum _ min = $ sum ; } } echo $ sum _ min . " \ n " ; < ? php $ s = str _ split ( trim ( fgets ( STDIN ) ) ) ; if ( $ s [ 2 ] = = = $ s [ 3 ] & & $ s [ 4 ] = = = $ s [ 5 ] ) { echo ' Yes ' ; } else { echo ' No ' ; } < ? php $ string = trim ( fgets ( STDIN ) ) ; if ( ( $ string [ 2 ] = = = $ string [ 3 ] ) and ( $ string [ 4 ] = = = $ string [ 5 ] ) ) { echo " Yes " ; } else { echo " No " ; } ? > < ? php $ n = trim ( fgets ( STDIN ) ) ; $ arr = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ min = $ arr [ 0 ] ; $ count = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i + + ) { if ( $ min > = $ arr [ $ i ] ) { $ min = $ arr [ $ i ] ; $ count + + ; } } echo $ count . " \ n " ; < ? php $ n = 5 ; while ( $ n -- ) fscanf ( STDIN , " % d " , $ p [ ] ) ; fscanf ( STDIN , " % d " , $ k ) ; echo $ p [ 4 ] - $ p [ 0 ] > $ k ? ' : ( ' : ' Yay ! ' ; < ? php $ s = trim ( fgets ( STDIN ) ) ; if ( $ s [ 2 ] = = $ s [ 3 ] & & $ s [ 4 ] = = $ s [ 5 ] ) { echo " Yes " ; } else { echo " No " ; } < ? php $ A [ 0 ] = trim ( fgets ( STDIN ) ) ; $ A [ 1 ] = trim ( fgets ( STDIN ) ) ; $ A [ 2 ] = trim ( fgets ( STDIN ) ) ; $ A [ 3 ] = trim ( fgets ( STDIN ) ) ; $ A [ 4 ] = trim ( fgets ( STDIN ) ) ; $ result = 0 ; ; for ( $ i = 0 ; $ i < = 4 ; $ i + + ) { $ res = $ A [ $ i ] % 10 ; if ( $ res = = 0 ) { $ res = 10 ; } $ a1 [ $ i ] = $ res ; } $ min = min ( $ a1 ) ; foreach ( $ A as $ v ) { $ aa = ceil ( ( $ v / 10 ) ) * 10 ; $ result + = $ aa ; } $ result - = 10 - $ min ; print ( $ result ) ; < ? php $ number = trim ( fgets ( STDIN ) ) ; print sub _ func ( $ number ) ; function sub _ func ( $ a ) { return $ a * $ a * $ a ; } ? > < ? php print pow ( trim ( fgets ( STDIN ) ) , 3 ) ; ? > < ? php while ( true ) { $ str = trim ( fgets ( STDIN ) ) ; if ( $ str = = 0 ) { return ; } $ sum = 0 ; for ( $ i = 0 ; $ i < strlen ( $ str ) ; $ i + + ) { $ sum + = $ str [ $ i ] ; } print ( $ sum . " \ n " ) ; } ? > < ? php $ a = fgets ( STDIN ) ; $ b = $ a * $ a * $ a ; echo $ b , PHP _ EOL ; < ? php $ n = fgets ( STDIN ) ; echo pow ( $ n , 3 ) . " \ n " ; < ? php fscanf ( STDIN , " % d % d " , $ A , $ B ) ; if ( $ A < 9 & & $ B < 9 ) { echo " Yay ! " . " \ n " ; } else { echo " : ( " . " \ n " ; } ? > < ? php $ yen500 = trim ( fgets ( STDIN ) ) ; $ yen100 = trim ( fgets ( STDIN ) ) ; $ yen50 = trim ( fgets ( STDIN ) ) ; $ money = trim ( fgets ( STDIN ) ) ; $ array = str _ split ( trim ( fgets ( STDIN ) ) ) ; $ count = 0 ; for ( $ i = 0 ; $ i < = $ yen500 ; $ i + + ) { for ( $ j = 0 ; $ j < = $ yen100 ; $ j + + ) { for ( $ k = 0 ; $ k < = $ yen50 ; $ k + + ) { $ result = $ i * 500 + $ j * 100 + $ k * 50 ; if ( $ result = = $ money ) { $ count + + ; } } } } echo $ count ; ? > < ? php $ n = intval ( trim ( fgets ( STDIN ) ) ) ; $ a = array _ map ( " intval " , explode ( " " , trim ( fgets ( STDIN ) ) ) ) ; $ sum = 0 ; $ mod = 10 * * 9 + 7 ; for ( $ i = 0 ; $ i < 60 ; $ i + + ) { $ c = 0 ; foreach ( $ a as $ b ) { $ c + = ( $ b > > $ i ) & 1 ; } $ c * = $ n - $ c ; $ c % = $ mod ; $ c * = ( 1 < < $ i ) % $ mod ; $ c % = $ mod ; $ sum + = $ c ; $ sum % = $ mod ; } echo $ sum ; < ? php list ( $ a , $ b , $ c ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; if ( $ c < = $ a + $ b ) { echo " Yes " ; } else { echo " No " ; } < ? php fscanf ( STDIN , " % d " , $ a ) ; fscanf ( STDIN , " % d " , $ b ) ; fscanf ( STDIN , " % d " , $ c ) ; fscanf ( STDIN , " % d " , $ d ) ; fscanf ( STDIN , " % d " , $ e ) ; fscanf ( STDIN , " % d " , $ k ) ; echo ( $ e - $ a < = $ k ) ? ' Yay ! ' : ' : ( ' ; < ? php $ a = fgets ( STDIN ) ; echo ( pow ( $ a , 3 ) ) ; ? > < ? php fscanf ( STDIN , ' % d % d ' , $ a , $ b ) ; echo ( abs ( $ a - $ b ) > 1 ) ? ' : ( ' : ' Yay ! ' ; < ? php $ n = ( fgets ( STDIN ) ) ; echo pow ( $ n , 2 ) ; < ? php fscanf ( STDIN , " % d " , $ n ) ; $ ps = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; $ cnt = 1 ; $ min = $ ps [ 0 ] ; for ( $ i = 1 ; $ i < $ n ; $ i + + ) { if ( $ ps [ $ i ] < $ min ) { $ min = $ ps [ $ i ] ; $ cnt + + ; } } echo $ cnt ; < ? php $ N = trim ( fgets ( STDIN ) ) ; $ result [ ' P ' ] = 0 ; $ result [ ' W ' ] = 0 ; $ result [ ' G ' ] = 0 ; $ result [ ' Y ' ] = 0 ; $ arare _ arr = explode ( ' ' , trim ( fgets ( STDIN ) ) ) ; foreach ( $ arare _ arr as $ val ) { $ result [ $ val ] = 1 ; } echo ( array _ sum ( $ result ) = = 3 ) ? ' Three ' : ' Four ' ; < ? php fscanf ( STDIN , " % d " , $ a ) ; fscanf ( STDIN , " % d " , $ b ) ; fscanf ( STDIN , " % d " , $ c ) ; fscanf ( STDIN , " % d " , $ x ) ; $ ans = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ j = 0 ; $ j < = $ b ; $ j + + ) { for ( $ k = 0 ; $ k < = $ c ; $ k + + ) { if ( $ i * 500 + $ j * 100 + 50 * $ k = = $ x ) $ ans + + ; } } } echo $ ans , " \ n " ; < ? php fscanf ( STDIN , " % d % d % d " , $ a , $ b , $ c ) ; $ cnt5 = 0 ; $ cnt7 = 0 ; for ( $ i = 0 ; $ i < 3 ; $ i + + ) { if ( $ { chr ( ord ( " a " ) + $ i ) } = = 5 ) { $ cnt5 + + ; } elseif ( $ { chr ( ord ( " a " ) + $ i ) } = = 7 ) { $ cnt7 + + ; } } if ( $ cnt5 = = 2 & & $ cnt7 = = 1 ) { echo " YES " ; } else { echo " NO " ; } ? > < ? php $ a = explode ( " " , trim ( fgets ( STDIN ) ) ) ; sort ( $ a ) ; printf ( " % d \ n " , abs ( $ a [ 2 ] - $ a [ 1 ] ) + abs ( $ a [ 1 ] - $ a [ 0 ] ) ) ; < ? php $ x = ( int ) trim ( fgets ( STDIN ) ) ; echo $ x * * 3 ; echo " \ n " ; < ? php fscanf ( STDIN , ' % d % d % d % d ' , $ a , $ b , $ c , $ d ) ; if ( $ a * $ b > = $ c * $ d ) { print $ a * $ b ; } else { print $ c * $ d ; } < ? php fscanf ( STDIN , " % d % d % d " , $ a [ 0 ] , $ a [ 1 ] , $ a [ 2 ] ) ; sort ( $ a ) ; if ( $ a [ 0 ] = = = 5 & & $ a [ 1 ] = = = 5 & & $ a [ 2 ] = = = 7 ) { echo " YES " ; } else { echo " NO " ; } < ? php fscanf ( STDIN , " % d % d % d " , $ a [ 0 ] , $ a [ 1 ] , $ a [ 2 ] ) ; sort ( $ a ) ; if ( $ a [ 0 ] = = = 5 & & $ a [ 1 ] = = = 5 & & $ a [ 2 ] = = = 7 ) { echo " YES " ; } else { echo " NO " ; } < ? php $ x = trim ( fgets ( STDIN ) ) ; echo pow ( $ x , 3 ) . " \ n " ; < ? php fscanf ( STDIN , " % d " , $ n ) ; printf ( " % d \ n " , $ n * * 3 ) ; < ? php $ result = array ( ) ; while ( ! feof ( STDIN ) ) { $ line = trim ( fgets ( STDIN ) ) ; sscanf ( $ line , ' % d , % f , % f ' , $ n , $ kg , $ m ) ; if ( $ kg / ( $ m * $ m ) > = 25.0 ) { $ result [ ] = $ n ; } } echo implode ( " \ n " , $ result ) . " \ n " ; < ? php $ in = trim ( fgets ( STDIN ) ) ; $ v = explode ( " " , $ in ) ; if ( $ v [ 0 ] + $ v [ 1 ] > = $ v [ 2 ] ) { echo ( " Yes " ) ; } else { echo ( " No " ) ; } < ? php fscanf ( STDIN , " % d % d % d % d " , $ a , $ b , $ h , $ m ) ; $ angle = abs ( $ m * 6 - ( ( 30 * $ h ) + ( 30 * $ m / 60 ) ) ) ; echo sqrt ( $ a * $ a + $ b * $ b - 2 * $ a * $ b * cos ( deg2rad ( $ angle ) ) ) ; ? > < ? php list ( $ n ) = ints ( ) ; $ p = [ 1 , 1 ] ; for ( $ i = 0 ; $ i < $ n ; + + $ i ) { $ a = ints ( ) ; if ( $ a [ 0 ] > = $ p [ 0 ] & & $ a [ 1 ] > = $ p [ 1 ] ) { $ p = $ a ; continue ; } $ m = max ( intdivceil ( $ p [ 0 ] , $ a [ 0 ] ) , intdivceil ( $ p [ 1 ] , $ a [ 1 ] ) ) ; $ p = [ $ a [ 0 ] * $ m , $ a [ 1 ] * $ m ] ; } echo array _ sum ( $ p ) ; function ints ( ) { return array _ map ( ' intval ' , explode ( ' ' , trim ( fgets ( STDIN ) ) ) ) ; } function intdivceil ( $ a , $ b ) { return $ a % $ b ? intdiv ( $ a , $ b ) + 1 : intdiv ( $ a , $ b ) ; } < ? php error _ reporting ( 0 ) ; $ stdin = file _ get _ contents ( ' php : $ line = explode ( " \ n " , $ stdin ) ; $ fi = 0 ; $ cnt = 0 ; $ list = array ( ) ; $ key = new stdclass ( ) ; foreach ( $ line as $ l ) { if ( strlen ( $ l ) = = 0 ) continue ; if ( $ fi = = 0 ) { $ a = explode ( " " , $ l ) ; $ key- > A = $ a ; $ fi + + ; continue ; } if ( $ fi > 0 ) { $ a = explode ( " " , $ l ) ; $ key- > X [ ] = $ a ; } } $ a = $ key- > A [ 0 ] ; $ b = $ key- > A [ 1 ] ; if ( $ a = = $ b ) { printf ( " Draw \ n " ) ; exit ; } if ( $ a = = 1 ) $ a = 14 ; if ( $ b = = 1 ) $ b = 14 ; if ( $ a > $ b ) { printf ( " Alice \ n " ) ; } else { printf ( " Bob \ n " ) ; } < ? php list ( $ a , $ b , $ c , $ d ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; echo max ( $ a * $ b , $ c * $ d ) ; < ? php $ a = intval ( fgets ( STDIN ) ) ; $ b = intval ( fgets ( STDIN ) ) ; $ c = intval ( fgets ( STDIN ) ) ; $ x = intval ( fgets ( STDIN ) ) ; $ sumCount = 0 ; for ( $ i = 0 ; $ i < = $ a ; $ i + + ) { for ( $ j = 0 ; $ j < = $ b ; $ j + + ) { for ( $ k = 0 ; $ k < = $ c ; $ k + + ) { $ result = 500 * $ i + 100 * $ j + 50 * $ k ; if ( $ result = = = $ x ) { $ sumCount + + ; } } } } echo $ sumCount ; < ? php list ( $ y , $ m , $ d ) = explode ( " / " , trim ( fgets ( STDIN ) ) ) ; if ( $ y > 2019 ) { echo " TBD " ; } else if ( $ y < 2019 ) { echo " Heisei " ; } else { if ( $ m > 4 ) { echo " TBD " ; } else if ( $ m < = 4 ) { echo " Heisei " ; } } < ? php $ n = fgets ( STDIN ) ; $ t = $ n ; while ( $ t > 0 ) { $ m + = $ t % 10 ; $ t = floor ( $ t / 10 ) ; } echo $ n % $ m ? No : Yes ; < ? php class Scanner { private $ arr = [ ] ; private $ count = 0 ; private $ pointer = 0 ; public function next ( ) { if ( $ this - > pointer > = $ this - > count ) { $ str = trim ( fgets ( STDIN ) ) ; $ this - > arr = explode ( ' ' , $ str ) ; $ this - > count = count ( $ this - > arr ) ; $ this - > pointer = 0 ; } $ result = $ this - > arr [ $ this - > pointer ] ; $ this - > pointer + + ; return $ result ; } public function hasNext ( ) { return $ this - > pointer < $ this - > count ; } public function nextInt ( ) { return ( int ) $ this - > next ( ) ; } public function nextDouble ( ) { return ( double ) $ this - > next ( ) ; } } list ( $ N , $ D ) = sscanf ( trim ( fgets ( STDIN ) ) , " % d % d " ) ; $ X = array ( ) ; for ( $ j = 1 ; $ j < = $ N ; $ j + + ) { $ sc = new Scanner ( ) ; for ( $ i = 1 ; $ i < = $ D ; $ i + + ) { $ X [ $ j ] [ $ i ] = $ sc - > nextInt ( ) ; } } $ sum = 0 ; $ cnt = 0 ; for ( $ i = 1 ; $ i < = $ N ; $ i + + ) { for ( $ j = $ i + 1 ; $ j < = $ N ; $ j + + ) { for ( $ k = 1 ; $ k < = $ D ; $ k + + ) { $ sum + = pow ( ( $ X [ $ i ] [ $ k ] - $ X [ $ j ] [ $ k ] ) , 2 ) ; } $ sum = sqrt ( $ sum ) ; if ( preg _ match ( ' / ^ [ 0-9 ] + $ / ' , $ sum ) ) { $ cnt + + ; } $ sum = 0 ; } } printf ( $ cnt ) ; < ? php fscanf ( STDIN , " % d " , $ n ) ; if ( $ n = = = 1 ) echo 1 ; else if ( $ n < 4 ) echo 2 ; else if ( $ n < 8 ) echo 4 ; else if ( $ n < 16 ) echo 8 ; else if ( $ n < 32 ) echo 16 ; else if ( $ n < 64 ) echo 32 ; else echo 64 ; < ? php $ a = trim ( fgets ( STDIN ) ) ; $ b = trim ( fgets ( STDIN ) ) ; $ c = trim ( fgets ( STDIN ) ) ; $ d = trim ( fgets ( STDIN ) ) ; $ e = trim ( fgets ( STDIN ) ) ; $ k = trim ( fgets ( STDIN ) ) ; $ diff [ ] = $ b - $ a ; $ diff [ ] = $ c - $ a ; $ diff [ ] = $ d - $ a ; $ diff [ ] = $ e - $ a ; $ diff [ ] = $ c - $ b ; $ diff [ ] = $ d - $ b ; $ diff [ ] = $ e - $ b ; $ diff [ ] = $ d - $ c ; $ diff [ ] = $ e - $ c ; $ diff [ ] = $ e - $ d ; if ( max ( $ diff ) < = $ k ) { printf ( " Yay ! \ n " ) ; } else { printf ( " : ( \ n " ) ; } < ? php $ x = trim ( fgets ( STDIN ) ) ; for ( $ j = - 119 ; $ j < = 118 ; $ j + + ) { for ( $ i = - 118 ; $ i < = 119 ; $ i + + ) { if ( pow ( $ i , 5 ) - pow ( $ j , 5 ) = = $ x ) { echo $ i . " " . $ j . " \ n " ; exit ; } } } < ? php $ x = trim ( fgets ( STDIN ) ) ; echo pow ( $ x , 3 ) , PHP _ EOL ; < ? php $ in = fgets ( STDIN ) ; echo $ in * $ in * $ in . " \ n " ; < ? php $ array = [ ] ; for ( $ i = 0 ; $ i < 5 ; $ i + + ) { $ array [ ] = trim ( fgets ( STDIN ) ) ; } $ k = trim ( fgets ( STDIN ) ) ; echo ( $ array [ 4 ] - $ array [ 0 ] > $ k ? ' : ( ' : ' Yay ! ' ) , PHP _ EOL ; < ? php list ( $ a , $ b ) = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ ans = ceil ( ( $ a + $ b ) / 2 ) ; echo $ ans ; ? > < ? php fscanf ( STDIN , " % d % d " , $ a , $ b ) ; echo ( $ a > = 13 ) ? $ b : ( ( $ a < = 5 ) ? 0 : $ b / 2 ) ; ? > < ? php fscanf ( STDIN , ' % d ' , $ input ) ; echo $ input * $ input . " \ n " ; < ? php $ input = fgets ( STDIN ) ; echo $ output = pow ( $ input , 3 ) ; ? > < ? php fscanf ( STDIN , " % d " , $ x ) ; echo pow ( $ x , 3 ) , PHP _ EOL ; < ? php $ stdin = trim ( fgets ( STDIN ) ) ; $ result = pow ( $ stdin , 3 ) ; echo ( $ result ) ; ? > < ? php $ s = trim ( fgets ( STDIN ) ) ; $ array = explode ( ' / ' , $ s ) ; if ( ( int ) $ array [ 0 ] < 2019 ) { echo ' Heisei ' ; } elseif ( ( int ) $ array [ 0 ] = = 2019 & & ( int ) $ array [ 1 ] < 5 & & ( int ) $ array [ 2 ] < 31 ) { echo ' Heisei ' ; } else { echo ' TBD ' ; } < ? php list ( $ n , $ m ) = explode ( " " , fgets ( STDIN ) ) ; $ array = [ ] ; $ country _ array = array _ fill ( 1 , $ n , 1 ) ; for ( $ i = 0 ; $ i < $ m ; $ i + + ) { $ ar = explode ( " " , trim ( fgets ( STDIN ) ) ) ; $ array [ ] = $ ar ; } asort ( $ array ) ; foreach ( $ array as $ key = > $ value ) { $ num1 = $ value [ 0 ] ; $ num2 = $ value [ 1 ] ; $ num3 = $ country _ array [ $ num1 ] ; $ country _ array [ $ num1 ] + = 1 ; $ array [ $ key ] [ ] = make _ ans _ num ( $ num1 , $ num3 ) ; } ksort ( $ array ) ; foreach ( $ array as $ value ) { echo $ value [ 2 ] . " \ n " ; } function make _ ans _ num ( $ num1 , $ num2 ) { $ leftnum = sprintf ( ' % 06d ' , $ num1 ) ; $ rightnum = sprintf ( ' % 06d ' , $ num2 ) ; return $ leftnum . $ rightnum ; } < ? php $ n = trim ( fgets ( STDIN ) ) ; $ ca = [ ] ; for ( $ i = 1 ; $ i < = $ n ; $ i + + ) { $ c = 0 ; $ t = $ i ; while ( $ t > 0 ) { if ( $ t % 2 ! = = 0 ) { break ; } else if ( $ t % 2 = = 0 ) { $ c + + ; $ t = $ t / 2 ; } } $ ca = $ ca + array ( $ i = > $ c ) ; } $ max = max ( $ ca ) ; echo array _ keys ( $ ca , $ max ) [ 0 ] ; ? > < ? php $ abcde = [ ] ; for ( $ i = 0 ; $ i < 5 ; $ i + + ) { fscanf ( STDIN , " % d " , $ abcde [ $ i ] ) ; } fscanf ( STDIN , " % d " , $ k ) ; if ( ( $ abcde [ 4 ] - $ abcde [ 0 ] ) > $ k ) { echo " : ( " ; } else { echo " Yay ! " ; } < ? php $ cost = explode ( " " , fgets ( STDIN ) ) ; sort ( $ cost ) ; $ answer [ ] = $ cost [ 1 ] + $ cost [ 2 ] - $ cost [ 0 ] * 2 ; $ answer [ ] = $ cost [ 2 ] - $ cost [ 0 ] ; $ answer [ ] = $ cost [ 2 ] * 2 - $ cost [ 1 ] - $ cost [ 0 ] ; sort ( $ answer ) ; if ( $ answer [ 0 ] < 0 ) { $ answer [ 0 ] = - $ answer [ 0 ] ; } echo $ answer [ 0 ] ; < ? php $ x = trim ( fgets ( STDIN ) ) ; echo $ x * $ x * $ x , PHP _ EOL ; < ? php fscanf ( STDIN , ' % d % d % d ' , $ a , $ b , $ c ) ; $ aaa = [ $ a , $ b , $ c ] ; $ counter = array _ count _ values ( $ aaa ) ; if ( $ counter [ 5 ] = = = 2 & & $ counter [ 7 ] = = = 1 ) { echo ' YES ' ; } else { echo ' NO ' ; } echo PHP _ EOL ; package main import ( " " " fmt " " math " " os " " reflect " " sort " " strconv " " strings " " " package main import ( " " " fmt " " os " " strconv " package main import ( " " " fmt " " math " " os " " sort " " strconv " package main import ( " " " fmt " " math " " os " " strconv " " strings " " " package main import " " func main ( ) { m : = make ( map [ int ] int ) var t int for i : = 0 ; i < 4 ; i + + { fmt . Scan ( & t ) m [ t ] + + } if m [ 1 ] > = 1 & & m [ 9 ] > = 1 & & m [ 7 ] > = 1 & & m [ 4 ] > = 1 { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import " " func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a ) fmt . Scan ( & b ) fmt . Scan ( & c ) fmt . Scan ( & d ) fmt . Scan ( & e ) fmt . Scan ( & k ) if k > = ( e - a ) { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " os " " strconv " package main import ( " " " fmt " " log " " os " " strconv " " Three " " Four " package main import ( " " " fmt " " os " " strconv " " infinity " package main import ( " " " fmt " " os " " YES " " NO " package main import ( " " ) func main ( ) { n : = 0 fmt . Scan ( & n ) arr : = make ( [ ] int , n ) for i : = range arr { fmt . Scan ( & arr [ i ] ) } min : = - 1 cnt : = 0 for _ , v : = range arr { if min = = - 1 { min = v cnt + + continue } if min < v { continue } min = v cnt + + continue } fmt . Println ( cnt ) } package main import ( " " ) func main ( ) { var N int fmt . Scanf ( " % d \ n " , & N ) var hh , nn , ww int for h : = 1 ; h < = 3500 ; h + + { for n : = 1 ; n < = 3500 ; n + + { if 4 * h * n - h * N - n * N < = 0 { continue } if ( h * n * N ) % ( 4 * h * n - h * N - n * N ) = = 0 { hh = h nn = n ww = ( h * n * N ) / ( 4 * h * n - h * N - n * N ) } } } fmt . Printf ( " \ n " , hh , nn , ww ) } package main import " " func main ( ) { var a , b , c int fmt . Scan ( & a , & b , & c ) ok : = a * b * c = = 5 * 5 * 7 & & a + b + c = = 5 + 5 + 7 if ok { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " ) func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a ) fmt . Scan ( & b ) fmt . Scan ( & c ) fmt . Scan ( & d ) fmt . Scan ( & e ) fmt . Scan ( & k ) if e - a < = k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " math " " os " " reflect " " sort " " strconv " " strings " " % .12 f " " " package main import ( " " " fmt " " math " " os " " strconv " " strings " " unsafe " " " " % # v \ n " , v ) } } func yes ( ) { fmt . Println ( " Yes " ) } func no ( ) { fmt . Println ( " No " ) } package main import ( " " ) func main ( ) { var N int fmt . Scan ( & N ) P : = make ( [ ] int , N ) for i : = 0 ; i < N ; i + + { fmt . Scan ( & P [ i ] ) } min : = P [ 0 ] var count int for i : = 0 ; i < N ; i + + { if min > = P [ i ] { min = P [ i ] count + + } } fmt . Println ( count ) } package main import ( " " " fmt " " log " " os " " strconv " package main import " " func main ( ) { var K , S int fmt . Scanf ( " % d % d " package main import ( " " " fmt " " os " " Yes " " No " package main import ( " " " " ) func main ( ) { a : = make ( [ ] int , 3 ) fmt . Scan ( & a [ 0 ] , & a [ 1 ] , & a [ 2 ] ) sort . Ints ( a ) fmt . Println ( a [ 2 ] - a [ 0 ] ) } package main import ( " " " " ) func main ( ) { var x float64 fmt . Scan ( & x ) fmt . Println ( int ( math . Pow ( x , 3.0 ) ) ) } package main import ( " " " errors " " fmt " " io " " math " " os " " strconv " " Scan failed " " % b " " [ argument error ] : Strtoi only accepts integer string " " diff : % d \ n " , ( a1 * t1 + a2 * t2 ) - ( b1 * t1 + b2 * t2 ) ) if AbsInt ( ( a1 * t1 + a2 * t2 ) - ( b1 * t1 + b2 * t2 ) ) = = 0 { fmt . Println ( " " ) return } if a1 > b1 & & a2 > b2 { fmt . Println ( 0 ) return } if a1 < b1 & & a2 < b2 { fmt . Println ( 0 ) return } if a1 < b1 { a1 , b1 = b1 , a1 a2 , b2 = b2 , a2 } diff1 , diff2 : = a1 - b1 , a2 - b2 dist1 , dist2 : = diff1 * t1 , diff2 * t2 if dist1 + dist2 > 0 { fmt . Println ( 0 ) return } ans : = 1 delta : = dist1 + dist2 absDelta : = AbsInt ( delta ) i : = dist1 / absDelta ans + = i * 2 if dist1 % absDelta = = 0 { ans + = 1 - 2 } fmt . Println ( ans ) } func AbsInt ( a int ) int { if a < 0 { return - a } return a } package main import ( " " " fmt " " os " " strconv " " Three " " Four " package main import ( " " " " ) func main ( ) { var A1 , A2 , A3 int _ , _ = fmt . Scan ( & A1 , & A2 , & A3 ) A : = [ ] int { A1 , A2 , A3 } sort . Ints ( A ) ans : = ( A [ 2 ] - A [ 1 ] ) + ( A [ 1 ] - A [ 0 ] ) fmt . Println ( ans ) } package main import ( " " " fmt " " os " " strconv " package main import ( " " ) func main ( ) { var x int fmt . Scan ( & x ) fmt . Println ( x * x * x ) } package main import ( " " " fmt " " os " package main import ( " " " fmt " " math " " os " " strconv " package main import ( " " ) func main ( ) { var a , b , c int fmt . Scan ( & a , & b , & c ) n : = a * b * c if n = = 5 * 5 * 7 { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } func min32 ( a , b int ) int { if a > = b { return b } return a } func max32 ( a , b int ) int { if a > = b { return a } return b } func min64 ( a , b int64 ) int64 { if a > = b { return b } return a } func max64 ( a , b int64 ) int64 { if a > = b { return a } return b } func gcd ( a , b int64 ) int64 { if a % b = = 0 { return b } else { return gcd ( b , a % b ) } } func lcm ( a , b int64 ) int64 { return a / gcd ( a , b ) * b } package main import ( " " " " ) func abs ( x float64 ) float64 { if x < 0 { return - x } return x } func main ( ) { var a , b , h , m float64 fmt . Scan ( & a , & b , & h , & m ) l : = 360 * ( m / 60 ) s : = 30 * h + 30 * ( m / 60 ) ang : = abs ( l - s ) if ang > = 180 { ang = 360 - ang } fmt . Println ( math . Sqrt ( a * a + b * b - 2 * a * b * math . Cos ( math . Pi * ang / 180 ) ) ) } package main import ( " " " math " " % d % d " " % d " package main import ( " " " " ) func main ( ) { var n , m int fmt . Scan ( & n ) m = 4 for x : = n / m + 1 ; x < = ( 3 * n ) / m ; x + + { var p , q int p = x * n q = m * x - n for y : = p / q + 1 ; y < = ( 2 * p ) / q ; y + + { var a , b int a = y * p b = q * y - p if a % b = = 0 { fmt . Println ( x , y , a / b ) os . Exit ( 0 ) } } } } package main import ( " " " fmt " " math " " os " " strconv " package main import ( " " " fmt " " io " " os " " strconv " " strings " " " " " " \ r \ n " ) } func checkError ( err error ) { if err ! = nil { panic ( err ) } } package main import ( " " ) func main ( ) { var n int fmt . Scan ( & n ) var s string flg : = false for i : = 0 ; i < n ; i + + { fmt . Scan ( & s ) if s = = " " { flg = true } } if flg { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " math " " sort " package main import " " func main ( ) { var css [ 3 ] [ 3 ] int for i , cs : = range css { for j : = range cs { fmt . Scan ( & css [ i ] [ j ] ) } } as : = make ( [ ] int , 3 ) bs : = make ( [ ] int , 3 ) as [ 0 ] = 0 as [ 1 ] = css [ 1 ] [ 0 ] - css [ 0 ] [ 0 ] as [ 2 ] = css [ 2 ] [ 0 ] - css [ 0 ] [ 0 ] bs [ 0 ] = css [ 0 ] [ 0 ] bs [ 1 ] = css [ 0 ] [ 1 ] bs [ 2 ] = css [ 0 ] [ 2 ] for i , cs : = range css { for j , c : = range cs { if c ! = as [ i ] + bs [ j ] { fmt . Println ( " " ) return } } } fmt . Println ( " " ) } package main import ( " " " os " " strconv " " fmt " package main import ( " " " fmt " " os " " strconv " package main import ( " " " fmt " " os " " sort " " strconv " package main import ( " " " os " " Yay ! " " : ( " package main import ( " " " os " " strconv " " math " " fmt " " % .15 f \ n " , ans ) } package main import ( " " ) func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a , & b , & c , & d , & e , & k ) diff : = e - a if diff < = k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " math " " os " " reflect " " sort " " strconv " " strings " " " package main import ( " " " math " " sort " " % g " package main import " " func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a , & b , & c , & d , & e , & k ) if e - a > k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " os " " reflect " " strconv " " Yes " " No " " % v " " % s " " orz " " orz " package main import " " func main ( ) { var A , B int fmt . Scan ( & A , & B ) if B % 2 = = 0 { if A > = 13 { fmt . Print ( B ) } else if A > = 6 & & A < = 12 { fmt . Print ( B / 2 ) } else if A < = 5 { fmt . Print ( " " ) } } } package main import ( " " " fmt " " math " " os " " strconv " package main import " " func main ( ) { var a int fmt . Scan ( & a ) fmt . Println ( a * a * a ) } package main import ( " " ) func main ( ) { var ant [ 5 ] int var k int for i : = 0 ; i < 5 ; i + + { fmt . Scanf ( " " , & ant [ i ] ) } fmt . Scanf ( " " , & k ) ans : = " " for i : = 0 ; i < 5 ; i + + { for j : = i ; j < 5 ; j + + { if ant [ j ] - ant [ i ] > k { ans = " " } } } fmt . Printf ( " \ n " , ans ) } package main import ( " " " fmt " " io " " math " " os " " strconv " package main import " " func main ( ) { var ( a , b , c int ) fmt . Scan ( & a ) fmt . Scan ( & b ) fmt . Scan ( & c ) if ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) { fmt . Println ( " YES " " NO " ) } } package main import " " func main ( ) { var ( k int ) array : = make ( [ ] int , 5 ) fmt . Scan ( & array [ 0 ] , & array [ 1 ] , & array [ 2 ] , & array [ 3 ] , & array [ 4 ] , & k ) var isEnabed bool = true for i : = 0 ; i < 5 ; i + + { for j : = i + 1 ; j < 5 ; j + + { d : = array [ j ] - array [ i ] if d > k { isEnabed = false } } } if isEnabed { fmt . Print ( " " ) } else { fmt . Print ( " " ) } } package main import ( " " " " ) func main ( ) { var a , b , c , d , e string fmt . Scan ( & a , & b , & c , & d , & e ) sHou , _ : = strconv . Atoi ( a ) sMin , _ : = strconv . Atoi ( b ) eHou , _ : = strconv . Atoi ( c ) eMin , _ : = strconv . Atoi ( d ) time , _ : = strconv . Atoi ( e ) sta : = sHou * 60 + sMin end : = eHou * 60 + eMin fmt . Println ( end - sta - time ) } package main import ( " " " fmt " " os " " strconv " " strings " package main import ( " " " " ) func main ( ) { var n int fmt . Scan ( & n ) xlist : = IntSlice ( n ) total : = SumSlice ( xlist ) avg : = total / n p1 , p2 : = avg , avg + 1 dsum1 , dsum2 : = 0 , 0 for i : = 0 ; i < n ; i + + { dsum1 + = IntPow ( p1 - xlist [ i ] , 2 ) dsum2 + = IntPow ( p2 - xlist [ i ] , 2 ) } fmt . Println ( Min ( dsum1 , dsum2 ) ) } func IntSlice ( n int ) [ ] int { slice : = make ( [ ] int , n ) for i : = 0 ; i < n ; i + + { fmt . Scan ( & slice [ i ] ) } return slice } func SumSlice ( slice [ ] int ) int { total : = 0 for i : = 0 ; i < len ( slice ) ; i + + { total + = slice [ i ] } return total } func Min ( x , y int ) int { if x > y { return y } else { return x } } func IntPow ( x , pow int ) int { return int ( math . Pow ( float64 ( x ) , float64 ( pow ) ) ) } package main import ( " " ) func main ( ) { var n int var a string mame : = map [ string ] int { " " : 0 , " " : 0 , " " : 0 , " " : 0 } fmt . Scan ( & n ) for i : = 0 ; i < n ; i + + { fmt . Scan ( & a ) mame [ a ] + + } if mame [ " " ] ! = 0 & & mame [ " " ] ! = 0 & & mame [ " " ] ! = 0 & & mame [ " " ] ! = 0 { fmt . Print ( " \ n " ) } else { fmt . Print ( " \ n " ) } } package main import ( " " " fmt " " os " " infinity " package main import " " func main ( ) { var N int fmt . Scan ( & N ) for h : = 1 ; h < = 3500 ; h + + { for n : = 1 ; n < = 3500 ; n + + { if 4 * n * h - N * n - N * h > 0 & & ( n * h * N ) % ( 4 * n * h - N * n - N * h ) = = 0 { w : = ( n * h * N ) / ( 4 * n * h - N * n - N * h ) fmt . Println ( h , w , n ) return } } } } package main import ( " " " fmt " " os " " strconv " package main import ( " " ) func main ( ) { var a [ 5 ] int var k int for i : = 0 ; i < 5 ; i + + { fmt . Scanf ( " " , & a [ i ] ) } fmt . Scanf ( " " , & k ) var f bool f = true for i : = 0 ; i < 5 ; i + + { for j : = i + 1 ; j < 5 ; j + + { f = f & & ( ( a [ j ] - a [ i ] ) < = k ) } } if f { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " os " " bufio " " strconv " " : ( " " Yay ! " package main import ( " " ) func main ( ) { var k , s int fmt . Scan ( & k , & s ) ans : = 0 for x : = 0 ; x < = k ; x + + { for y : = 0 ; y < = k ; y + + { if 0 < = s - ( x + y ) & & s - ( x + y ) < = k { ans + + } } } fmt . Println ( ans ) } package main import " " func main ( ) { var N int fmt . Scan ( & N ) v : = N & - N for N - v > 0 { N - = v v = N & - N } fmt . Println ( N ) } package main import ( " " " bufio " " os " " strconv " " " " : ( " " Yay ! " ) } package main import ( " " " fmt " " math " " os " " strconv " " % g \ n " , ans ) } package main import " " func main ( ) { var c1 _ 1 , c1 _ 2 , c1 _ 3 , c2 _ 1 , c2 _ 2 , c2 _ 3 , c3 _ 1 , c3 _ 2 , c3 _ 3 int fmt . Scan ( & c1 _ 1 , & c1 _ 2 , & c1 _ 3 , & c2 _ 1 , & c2 _ 2 , & c2 _ 3 , & c3 _ 1 , & c3 _ 2 , & c3 _ 3 ) d1 : = c2 _ 1 - c1 _ 1 d2 : = c2 _ 2 - c1 _ 2 d3 : = c2 _ 3 - c1 _ 3 if d1 ! = d2 | | d2 ! = d3 | | d3 ! = d1 { fmt . Println ( " " ) return } d1 = c3 _ 1 - c2 _ 1 d2 = c3 _ 2 - c2 _ 2 d3 = c3 _ 3 - c2 _ 3 if d1 ! = d2 | | d2 ! = d3 | | d3 ! = d1 { fmt . Println ( " " ) return } d1 = c1 _ 1 - c3 _ 1 d2 = c1 _ 2 - c3 _ 2 d3 = c1 _ 3 - c3 _ 3 if d1 ! = d2 | | d2 ! = d3 | | d3 ! = d1 { fmt . Println ( " " ) return } fmt . Println ( " " ) } package main import ( " " " fmt " " os " " strconv " " strings " " % d \ n " , sum ) } func getStdin ( ) string { sc . Scan ( ) return sc . Text ( ) } func getStdinInt ( ) int { sc . Scan ( ) rtn , _ : = strconv . Atoi ( sc . Text ( ) ) return rtn } func getStdinIntArr ( ) [ ] int { sc . Scan ( ) str : = sc . Text ( ) list : = strings . Split ( str , " " ) rtn : = make ( [ ] int , len ( list ) ) for idx , val : = range list { rtn [ idx ] , _ = strconv . Atoi ( val ) } return rtn } package main import ( " " " fmt " " bufio " " strings " " sort " " " " " " 557 " { fmt . Println ( " YES " " NO " package main import " " import " " func main ( ) { var n int fmt . Scan ( & n ) t : = make ( [ ] int , n ) for i : = 0 ; i < n ; i + + { fmt . Scan ( & t [ i ] ) } sum : = 0 for i : = 0 ; i < n ; i + + { sum + = t [ i ] } f : = float64 ( sum ) / float64 ( n ) b : = f - float64 ( int ( f ) ) var y int if b > = 0.5 { y = int ( math . Ceil ( f ) ) } else { y = int ( math . Floor ( f ) ) } csum : = 0 for i : = 0 ; i < n ; i + + { csum + = ( t [ i ] - y ) * ( t [ i ] - y ) } fmt . Println ( csum ) } package main import ( " " ) func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a ) fmt . Scan ( & b ) fmt . Scan ( & c ) fmt . Scan ( & d ) fmt . Scan ( & e ) fmt . Scan ( & k ) if e - a < = k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import " " func main ( ) { var k , s int fmt . Scan ( & k , & s ) var cnt int for x : = 0 ; x < = k ; x + + { for y : = 0 ; y < = k ; y + + { z : = s - ( x + y ) if x + y < = s & & z < = k { cnt + = 1 } } } fmt . Println ( cnt ) } package main import " " func main ( ) { a : = make ( [ ] int , 5 ) for i : = 0 ; i < 5 ; i + + { fmt . Scan ( & a [ i ] ) } var k int fmt . Scan ( & k ) for i : = 0 ; i < 4 ; i + + { for j : = i + 1 ; j < 5 ; j + + { if v : = a [ j ] - a [ i ] ; v > k { fmt . Println ( " " ) return } } } fmt . Println ( " " ) } package main import ( " " ) func main ( ) { var k , s , ans int fmt . Scan ( & k , & s ) for i : = 0 ; i < k + 1 ; i + + { for j : = 0 ; j < k + 1 ; j + + { t : = s - i - j if 0 < = t & & t < = k { ans + + } } } if ans ! = 0 { fmt . Println ( ans ) } } package main import ( " " " fmt " " os " " strconv " package main import ( " " " fmt " " io " " os " " strconv " package main import ( " " " fmt " " math " " os " " strconv " package main import " " func main ( ) { var i int fmt . Scan ( & i ) fmt . Println ( i * i * i ) } package main import ( " " " fmt " " os " " strconv " package main import ( " " ) func main ( ) { var s _ 1 , s _ 2 , s _ 3 int fmt . Scanf ( " % d % d % d " " NO " ) } else if s _ 2 ! = 5 & & s _ 2 ! = 7 { fmt . Println ( " " ) } else if s _ 3 ! = 5 & & s _ 3 ! = 7 { fmt . Println ( " " ) } fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import " " func main ( ) { var x int fmt . Scan ( & x ) fmt . Println ( x * x * x ) } package main import ( " " " fmt " " os " " strconv " " online " " local " package main import ( " " " os " " strconv " " fmt " package main import " " func main ( ) { var n int fmt . Scan ( & n ) ps : = make ( [ ] int , n ) for i : = 0 ; i < n ; i + + { fmt . Scan ( & ps [ i ] ) } cnt : = 0 min : = ps [ 0 ] for i , p : = range ps { if i = = 0 { continue } if p > min { cnt + + } if min > p { min = p } } fmt . Println ( n - cnt ) } package main import " " func main ( ) { var i int fmt . Scan ( & i ) fmt . Println ( i * i * i ) } package main import ( " " ) func main ( ) { var n int num : = make ( [ ] int , 10 ) for i : = 0 ; i < 4 ; i + + { fmt . Scanf ( " " , & n ) num [ n ] + + } ans : = " " if num [ 1 ] ! = 1 { ans = " " } if num [ 9 ] ! = 1 { ans = " " } if num [ 7 ] ! = 1 { ans = " " } if num [ 4 ] ! = 1 { ans = " " } fmt . Printf ( " \ n " , ans ) } package main import " " import " " func main ( ) { var A , B , H , M float64 var theta float64 = 0 var temp float64 fmt . Scan ( & A , & B , & H , & M ) temp = 60 * H + M theta = temp / 720 - M / 60 fmt . Println ( math . Sqrt ( A * A + B * B - 2 * A * B * ( math . Cos ( 2 * math . Pi * theta ) ) ) ) } package main import ( " " " " ) type BreakCount map [ int ] int func main ( ) { var N int fmt . Scan ( & N ) result : = 0 count : = 0 for { if float64 ( N ) < math . Pow ( 2.0 , float64 ( count ) ) { result = int ( math . Pow ( 2.0 , float64 ( count - 1 ) ) ) break } count + + } fmt . Println ( result ) } package main import . " " import . " " func main ( ) { var n int var s string Scan ( & n ) for i : = 0 ; i < n ; i + + { Scanf ( " " , & s ) if s = = " " { Println ( " " ) Exit ( 0 ) } } Println ( " " ) } package main import ( " " ) func main ( ) { var n [ 3 ] int var s = [ ] int { 5 , 7 , 5 } for i : = 0 ; i < 3 ; i + + { fmt . Scan ( & n [ i ] ) } for i : = 0 ; i < 3 ; i + + { for j : = 0 ; j < len ( s ) ; j + + { if n [ i ] = = s [ j ] { s = append ( s [ : j ] , s [ j + 1 : ] ... ) break } } } if len ( s ) = = 0 { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import " " func main ( ) { a : = make ( [ ] int , 3 ) for i : = range a { fmt . Scan ( & a [ i ] ) } mincost : = abs ( a [ 1 ] - a [ 0 ] ) + abs ( a [ 2 ] - a [ 1 ] ) for i : = 0 ; i < 6 ; i + + { b : = [ ] int { a [ i / 2 ] , a [ ( i / 2 + i % 2 + 1 ) % 3 ] , a [ ( i / 2 + ( i + 1 ) % 2 + 1 ) % 3 ] , } cost : = abs ( b [ 1 ] - b [ 0 ] ) + abs ( b [ 2 ] - b [ 1 ] ) if cost < mincost { mincost = cost } } fmt . Println ( mincost ) } func abs ( x int ) int { if x < 0 { return - x } return x } package main import ( " " " fmt " " os " " strconv " " Yes " " No " package main import ( " " ) func main ( ) { var num int fmt . Scan ( & num ) fmt . Println ( num * num * num ) } package main import " " func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a , & b , & c , & d , & e , & k ) if e - a > k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " os " " strconv " " math " package main import ( " " ) func main ( ) { var a int fmt . Scan ( & a ) min : = a max : = a for i : = 1 ; i < 5 ; i + + { var o int fmt . Scan ( & o ) if min > o { min = o } if max < o { max = o } } var k int fmt . Scan ( & k ) if max - min > k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import " " func main ( ) { var a , b , c , d , e , k int fmt . Scanf ( " % d " " % d " " % d " " % d " " % d " " % d " " : ( " " Yay ! " package main import " " func main ( ) { var a , b , c int fmt . Scan ( & a , & b , & c ) if a * b * c = = 5 * 7 * 5 { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " " ) func main ( ) { var a , b , h , m float64 fmt . Scan ( & a , & b , & h , & m ) if h > = 12 { h - = 12 } l : = 360 * ( float64 ( m ) / 60 ) s : = 30 * float64 ( h ) + 30 * ( float64 ( m ) / 60 ) var ang float64 if l > s { ang = l - s } else { ang = s - l } if ang > = 180 { ang = 360 - ang } fmt . Println ( math . Sqrt ( a * a + b * b - 2 * a * b * math . Cos ( math . Pi * ang / 180 ) ) ) } package main import ( " " " sort " " Yay ! " } return " " } package main import ( " " ) var N int var S [ ] string func main ( ) { fmt . Scanf ( " " , & N ) S = make ( [ ] string , N ) for i : = 0 ; i < N ; i + + { fmt . Scanf ( " " , & S [ i ] ) } m : = make ( map [ string ] bool ) for i : = 0 ; i < len ( S ) ; i + + { m [ S [ i ] ] = true } ans : = 0 for _ , v : = range m { if v { ans + + } } if ans = = 4 { fmt . Println ( " " ) } else if ans = = 3 { fmt . Println ( " " ) } } package main import " " func main ( ) { var a , b , c , d , e int var k int fmt . Scan ( & a ) fmt . Scan ( & b ) fmt . Scan ( & c ) fmt . Scan ( & d ) fmt . Scan ( & e ) fmt . Scan ( & k ) ab : = b - a ac : = c - a ad : = d - a ae : = e - a bc : = c - b bd : = d - b be : = e - b cd : = d - c ce : = e - c de : = e - d if ab > k | | ac > k | | ad > k | | ae > k | | bc > k | | bd > k | | be > k | | cd > k | | ce > k | | de > k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " ) var D , N int type cloth struct { A , B , C int } func abs ( a int ) int { if a > 0 { return a } return - a } func max ( a , b int ) int { if a < b { return b } return a } func main ( ) { fmt . Scan ( & D , & N ) thermals : = make ( [ ] int , D + 1 ) for i : = 1 ; i < = D ; i + + { fmt . Scan ( & thermals [ i ] ) } clothes : = make ( [ ] cloth , N ) for i : = 0 ; i < N ; i + + { fmt . Scan ( & clothes [ i ] . A , & clothes [ i ] . B , & clothes [ i ] . C ) } dp : = make ( [ ] [ ] int , D + 1 ) for i : = range dp { dp [ i ] = make ( [ ] int , N ) } for i : = 1 ; i < D ; i + + { for j : = 0 ; j < N ; j + + { for k : = 0 ; k < N ; k + + { t1 : = thermals [ i ] t2 : = thermals [ i + 1 ] if clothes [ j ] . A < = t2 & & t2 < = clothes [ j ] . B & & clothes [ k ] . A < = t1 & & t1 < = clothes [ k ] . B { dp [ i + 1 ] [ j ] = max ( dp [ i + 1 ] [ j ] , dp [ i ] [ k ] + abs ( clothes [ j ] . C - clothes [ k ] . C ) ) } } } } val : = 0 for _ , v : = range dp [ D ] { val = max ( val , v ) } fmt . Println ( val ) } package main import " " func main ( ) { k , s : = 0 , 0 _ , _ = fmt . Scan ( & k , & s ) count : = 0 for i : = 0 ; i < = k ; i + + { for j : = 0 ; j < = k ; j + + { z : = s - i - j if z > = 0 & & z < = k { count + + } } } fmt . Println ( count ) } package main import ( " " " io " " os " " strconv " " infinity " package main import " " func scanIntSlice ( N int ) [ ] int { _ slice : = make ( [ ] int , N ) for i : = 0 ; i < N ; i + + { fmt . Scan ( & _ slice [ i ] ) } return _ slice } func getMostCommonCountWithIgnore ( m map [ int ] int , ignore int ) ( maxKey , maxCount int ) { for key , value : = range m { if value > maxCount & & key ! = ignore { maxCount = value maxKey = key } } return } func main ( ) { n : = 0 ; fmt . Scan ( & n ) v : = scanIntSlice ( n ) evens : = make ( map [ int ] int ) odds : = make ( map [ int ] int ) for i : = 0 ; i < n / 2 ; i + + { evens [ v [ 2 * i ] ] + + odds [ v [ 2 * i + 1 ] ] + + } ans : = n evenMostKey , evenMostCount : = getMostCommonCountWithIgnore ( evens , - 1 ) _ , even2ndCount : = getMostCommonCountWithIgnore ( evens , evenMostKey ) oddsMostKey , oddsMostCount : = getMostCommonCountWithIgnore ( odds , - 1 ) _ , odds2ndCount : = getMostCommonCountWithIgnore ( odds , oddsMostKey ) if evenMostKey ! = oddsMostKey { ans - = evenMostCount + oddsMostCount } else { a : = evenMostCount + odds2ndCount b : = even2ndCount + oddsMostCount if b > a { a = b } ans - = a } fmt . Println ( ans ) } package main import " " func main ( ) { var n int fmt . Scan ( & n ) for i : = n ; i > = 1 ; i -- { if i & ( i - 1 ) = = 0 { fmt . Println ( i ) return } } } package main import ( " " " fmt " " math " " os " " sort " " strconv " package main import ( " " ) func main ( ) { var k , s int fmt . Scan ( & k , & s ) var cnt int for x : = 0 ; x < = k ; x + + { for y : = 0 ; y < = k ; y + + { z : = s - ( x + y ) if x + y < = s & & z < = k { cnt + + } } } fmt . Println ( cnt ) } package main import ( " " " fmt " " os " package main import ( " " " fmt " " os " " strconv " package main import ( " " " os " " strconv " " strings " " fmt " " " " " " P " " Y " " G " " W " " Three " " Four " package main import ( " " ) func main ( ) { var N , P int fmt . Scanf ( " % d " " % d " package main import ( " " " fmt " " io " " math / big " " os " " strconv " package main import ( " " " fmt " " os " " strconv " package main import " " import " " func main ( ) { var A , B , H , M int fmt . Scanf ( " % d % d % d % d " package main import ( " " " fmt " " math " " os " " sort " " strconv " package main import ( " " " errors " " fmt " " io " " math " " os " " strconv " " Scan failed " " % b " " [ argument error ] : Strtoi only accepts integer string " package main import ( " " " fmt " " os " package main import " " func main ( ) { var a int fmt . Scan ( & a ) fmt . Printf ( " % d \ n " , a * a * a ) } package main import ( " " " fmt " " math " " os " " strconv " package main import ( " " ) func main ( ) { var a , b , c int five : = 0 seven : = 0 fmt . Scanf ( " % d " " % d " " % d " " NO " if five = = 2 & & seven = = 1 { ans = " " } fmt . Printf ( " " , ans ) } package main import ( " " " fmt " " os " " strconv " " strings " " Yes " " No " " " package main import ( " " " fmt " " os " " strconv " package main import ( " " " fmt " " os " " strconv " " No " " Yes " package main import ( " " " fmt " " os " " strconv " " MASPY " " ますピ " { fp , T HE _ HARMONY _ OF _ PERFECT " ) ) cn t P Y " ) = = " " { wfp , _ = os . C U S10 " ) ) } scanner : = - -- -- -- -- -- -- -- -- -- - " ) so lv e ( sc an ne r , package main import " " func main ( ) { var N int fmt . Scan ( & N ) A : = make ( [ ] int , N ) for i : = range A { fmt . Scan ( & A [ i ] ) } ans : = 0 for i : = 1 ; i < = 100 ; i + + { totalLoss : = 0 for j : = range A { totalLoss + = ( A [ j ] - i ) * ( A [ j ] - i ) } if i = = 1 { ans = totalLoss } if totalLoss < ans { ans = totalLoss } } fmt . Println ( ans ) } package main import " " func StdInInt ( ) int { var N int fmt . Scan ( & N ) return N } func main ( ) { n : = StdInInt ( ) fmt . Println ( n * n * n ) } package main import ( " " " sort " " strings " " " " " package main import " " func main ( ) { var a int fmt . Scan ( & a ) i : = a * a * a fmt . Println ( i ) } package main import ( " " " fmt " " os " " sort " " strconv " " strings " " " package main import ( " " " fmt " " os " " strconv " " % d % d % d % d " " YES " " NO " package main import " " func main ( ) { var k , s int fmt . Scan ( & k , & s ) var numOfSatisfied int for x : = 0 ; x < = k ; x + + { for y : = 0 ; y < = k ; y + + { rest : = s - ( x + y ) if rest > = 0 & & rest < = k { numOfSatisfied + + } } } fmt . Printf ( " \ n " , numOfSatisfied ) } package main import " " func main ( ) { var K , S int fmt . Scanf ( " % d % d " package main import " " var N int var P [ ] int func main ( ) { fmt . Scan ( & N ) num : = 0 if N = = 0 { fmt . Println ( " " ) } tmp : = 0 min : = 0 fmt . Scan ( & min ) for i : = 1 ; i < N ; i + + { fmt . Scan ( & tmp ) if tmp > min { num + + } if min > tmp { min = tmp } } fmt . Println ( N - num ) } package main import ( " " " fmt " " os " " sort " " strconv " package main import " " func main ( ) { var K , S , r int fmt . Scan ( & K , & S ) for x : = 0 ; x < = K ; x + + { for y : = 0 ; y < = K ; y + + { z : = S - x - y if 0 < = z & & z < = K { r + + } } } fmt . Println ( r ) } package main import ( " " " fmt " " os " " strconv " package main import " " func main ( ) { var a , b int fmt . Scan ( & a ) b = 1 for i : = 0 ; i < 3 ; i + + { b * = a } fmt . Println ( b ) } package main import " " func main ( ) { var K , S int fmt . Scan ( & K , & S ) ans : = 0 for x : = 0 ; x < = K ; x + + { for y : = 0 ; y < = K ; y + + { z : = S - x - y if 0 < = z & & z < = K { ans + + } } } fmt . Println ( ans ) } package main import ( " " ) func main ( ) { var n int fmt . Scan ( & n ) for i : = 0 ; i < n ; i + + { var s string fmt . Scan ( & s ) if s = = " " { fmt . Println ( " " ) return } } fmt . Println ( " " ) } package main import ( " " " sort " " % d " " % d " " % d " " % d " " % d " " % d " " Yay ! " " : ( " package main import ( " " ) func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a , & b , & c , & d , & e , & k ) if e - a > k { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " math " " math / cmplx " " os " " strconv " " MASPY " " ますピ " { fp , T HE _ HARMONY _ OF _ PERFECT " ) ) cn t P Y " ) = = " " { wfp , _ = os . C U S10 " ) ) } scanner : = - -- -- -- -- -- -- -- -- -- - " ) so lv e ( sc an ne r , package main import " " func main ( ) { var h1 , m1 , h2 , m2 , k int fmt . Scan ( & h1 , & m1 , & h2 , & m2 , & k ) ans : = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) - k fmt . Println ( ans ) } package main import ( " " " fmt " " io " " os " package main import ( " " " fmt " " os " " sort " " strconv " " scan failed " " I " " IronMan " " END _ GAME " " -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - " package main import " " var a , b , c , d , e , k int func check ( ) bool { if e - d < = k & & e - c < = k & & e - b < = k & & e - a < = k { if d - c < = k & & d - b < = k & & d - a < = k { if c - a < = k & & b - a < = k { return true } } } return false } func main ( ) { fmt . Scan ( & a , & b , & c , & d , & e , & k ) if check ( ) { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " os " " strconv " " No " " Yes " package main import ( " " ) func main ( ) { var ( K int S int ) var count = 0 fmt . Scan ( & K , & S ) for x : = 0 ; x < = K ; x + + { for y : = 0 ; y < = K ; y + + { z : = S - x - y if 0 < = z & & z < = K { count + = 1 } } } fmt . Println ( count ) } package main import " " func main ( ) { var x int fmt . Scan ( & x ) fmt . Println ( x * x * x ) } package main import ( " " " sort " " strings " " " " " package main import ( " " " math " " % d % d " " % d \ n " , P ) return } for ord , i : = 0 , 2 ; ; { if P % i ! = 0 { if P = = 1 | | i > A { break } ord = 0 i + = 1 + i % 2 } else { ord + + if ord % N = = 0 { ans * = i } P / = i } } fmt . Printf ( " \ n " , ans ) } package main import ( " " " " ) func round ( f float64 ) float64 { return math . Floor ( f + .5 ) } func main ( ) { var N int fmt . Scan ( & N ) X : = make ( [ ] int , N ) sum : = 0 for i , _ : = range X { fmt . Scan ( & X [ i ] ) sum + = X [ i ] } avg : = int ( round ( float64 ( sum ) / float64 ( N ) ) ) result : = 0 for _ , x : = range X { result + = ( x - avg ) * ( x - avg ) } fmt . Println ( result ) } package main import ( " " " fmt " " os " " strconv " " Yes " " No " package main import ( " " ) func main ( ) { var k int A : = make ( [ ] int , 5 ) for i : = 0 ; i < 5 ; i + + { fmt . Scan ( & A [ i ] ) } fmt . Scan ( & k ) for i : = 4 ; i > 1 ; i -- { if A [ i ] - A [ 0 ] > k { fmt . Println ( " " ) return } } fmt . Println ( " " ) } package main import ( " " ) func main ( ) { var n , k int fmt . Scan ( & n , & k ) if k = = 1 { fmt . Println ( 0 ) } else { fmt . Println ( n - k ) } } package main import ( " " " fmt " " math " " os " package main import ( " " " math " " math / cmplx " package main import ( " " " fmt " " os " " strconv " package main import ( " " " fmt " " os " " strconv " package main import " " func main ( ) { var x [ 5 ] int var k int for i : = range x { fmt . Scanf ( " " , & x [ i ] ) } fmt . Scanf ( " " , & k ) ok : = true for _ , x1 : = range x { for _ , x2 : = range x { d : = x1 - x2 if d < 0 { d = - d } if d > k { ok = false } } } if ok { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " io " " os " " strconv " " Scan failed " package main import ( " " " " ) func main ( ) { var a , b , h , m float64 fmt . Scan ( & a , & b , & h , & m ) mnt : = h * 60 + m ap : = mnt * math . Pi / 360 bp : = mnt * math . Pi / 30 x : = a * math . Cos ( ap ) - b * math . Cos ( bp ) y : = a * math . Sin ( ap ) - b * math . Sin ( bp ) fmt . Println ( math . Sqrt ( x * x + y * y ) ) } func min ( a , b int ) int { if a < b { return a } return b } func max ( a , b int ) int { if a > b { return a } return b } func abs ( a int ) int { if a < 0 { return - a } return a } package main import ( " " " os " " bufio " " strconv " " : ( " " Yay ! " ) } } package main import ( " " ) func main ( ) { var a , b , c int fmt . Scan ( & a , & b , & c ) if a + b + c = = 17 { fmt . Println ( " " ) return } fmt . Println ( " " ) } package main import ( " " ) func main ( ) { var n int fmt . Scan ( & n ) sl : = [ ] int { 64 , 32 , 16 , 8 , 4 , 2 , 1 } for _ , s : = range sl { if s < = n { fmt . Println ( s ) return } } } package main import " " const inf = 1 < < 60 func chmin ( a * int , b int ) bool { if * a > b { * a = b return true } return false } func main ( ) { var n int fmt . Scan ( & n ) ps : = make ( [ ] int , n ) for i : = 0 ; i < n ; i + + { fmt . Scan ( & ps [ i ] ) } ct : = 0 mn : = inf for _ , p : = range ps { if chmin ( & mn , p ) { ct + + } } fmt . Println ( ct ) } package main import " " func main ( ) { var N , M int var w string fmt . Scan ( & N , & M ) a : = make ( [ ] [ ] string , N ) for i : = 0 ; i < N ; i + + { fmt . Scan ( & w ) wa : = make ( [ ] string , N ) for i , v : = range w { wa [ i ] = string ( v ) } a [ i ] = wa } b : = make ( [ ] [ ] string , M ) for i : = 0 ; i < M ; i + + { fmt . Scan ( & w ) wa : = make ( [ ] string , M ) for i , v : = range w { wa [ i ] = string ( v ) } b [ i ] = wa } for i : = 0 ; i < N ; i + + { for j : = 0 ; j < N ; j + + { flg : = true for y : = 0 ; y < M ; y + + { if i + y > = N { fmt . Println ( " " ) return } for x : = 0 ; x < M ; x + + { if j + x > = N { flg = false break } if a [ i + y ] [ j + x ] = = b [ y ] [ x ] { continue } else { flg = false break } } if ! flg { break } } if flg { fmt . Println ( " " ) return } } } fmt . Println ( " " ) } package main import ( " " " sort " " YES " " NO " package main import ( " " ) func solution ( c [ 3 ] [ 3 ] int ) string { var a , b [ 3 ] int a [ 0 ] = 0 for i : = 0 ; i < 3 ; i + + { b [ i ] = c [ 0 ] [ i ] } for i : = 1 ; i < 3 ; i + + { a [ i ] = c [ i ] [ 0 ] - b [ 0 ] } for i : = range c { for j : = range c [ i ] { if c [ i ] [ j ] ! = a [ i ] + b [ j ] { return " " } } } return " " } func main ( ) { var c [ 3 ] [ 3 ] int for i : = 0 ; i < 3 ; i + + { for j : = 0 ; j < 3 ; j + + { fmt . Scan ( & c [ i ] [ j ] ) } } fmt . Println ( solution ( c ) ) } package main import ( " " " fmt " " os " " strconv " " : ( " " : ( " " : ( " " : ( " " : ( " " : ( " " : ( " " : ( " " : ( " " : ( " " : ( " " Yay ! " package main import ( " " " fmt " " os " " strconv " " math / cmplx " " math " package main import ( " " " sort " " YES " " NO " package main import ( " " ) func main ( ) { var k , s int fmt . Scanf ( " % d % d " package main import ( " " " fmt " " io " " os " " strconv " " : ( " " Yay ! " " empty ! " " empty ! " " empty ! " " Scan failed " package main import ( " " ) func main ( ) { var h1 , m1 , h2 , m2 , k int fmt . Scan ( & h1 , & m1 , & h2 , & m2 , & k ) time : = ( 60 * h2 + m2 ) - ( 60 * h1 + m1 ) res : = time - k fmt . Println ( res ) } package main import ( " " " fmt " " os " " sort " " strconv " package main import ( " " " fmt " " os " " strconv " " strings " " " " " " 7 " ) = = 1 & & strings . Count ( s , " " ) = = 2 { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } func nextInt ( ) int { sc . Scan ( ) nextI , err : = strconv . Atoi ( sc . Text ( ) ) if err ! = nil { panic ( err ) } return nextI } func readLine ( ) string { buf : = make ( [ ] byte , 0 , 1000000 ) for { line , isPrefix , err : = rdr . ReadLine ( ) if err ! = nil { panic ( err ) } buf = append ( buf , line ... ) if ! isPrefix { break } } return string ( buf ) } package main import ( " " " fmt " " os " " strconv " " strings " " " package main import ( " " " fmt " " os " " strconv " " Yes " " No " " Yes " " No " package main import ( " " " fmt " " math " " os " " reflect " " sort " " strconv " " strings " " " package main import ( " " ) func main ( ) { var a , b , c int fmt . Scan ( & a , & b , & c ) if a + b + c ! = 17 | | ( a ! = 5 & & a ! = 7 ) | | ( b ! = 5 & & b ! = 7 ) | | ( c ! = 5 & & c ! = 7 ) { fmt . Println ( " " ) } else { fmt . Println ( " " ) } } package main import ( " " ) func main ( ) { var nn int fmt . Scanf ( " % d " " % d " " % v \ n " , result ) } package main import ( " " ) func main ( ) { var ( n int color string ) fmt . Scan ( & n ) table : = make ( map [ string ] int ) for i : = 0 ; i < n ; i + + { fmt . Scan ( & color ) table [ color ] + = 1 } if len ( table ) = = 3 { fmt . Println ( " " ) } else { fmt . Println ( " Four " ) } } package main import ( " " " fmt " " os " " strconv " " Yay ! " ) } else { fmt . Println ( " : ( " package main import ( " " ) func main ( ) { var n int fmt . Scanf ( " % d " " % d " " % d " " % d " package main import ( " " " fmt " " math " " os " " strconv " package main import ( " " ) func min3500 ( x int ) int { if x < 3500 { return x } else { return 3500 } } func main ( ) { var N int fmt . Scan ( & N ) if N % 2 = = 0 { fmt . Println ( N / 2 , N , N ) } else if N % 3 = = 0 { fmt . Println ( N / 3 , 2 * N , 2 * N ) } else { w : = 0 for h : = N / 4 ; h < = min3500 ( 3 * N / 4 ) ; h + + { for n : = ( N * h ) / ( 4 * h - N ) ; n < = min3500 ( ( 2 * N * h ) / ( 4 * h - N ) ) ; n + + { if 4 * h * n - N * ( h + n ) < = 0 { continue } if N * h * n % ( 4 * h * n - N * ( h + n ) ) ! = 0 { continue } w = N * h * n / ( 4 * h * n - N * ( h + n ) ) fmt . Println ( h , n , w ) break } if w ! = 0 { break } } } } package main import ( " " " " ) func round ( f float64 ) float64 { return math . Floor ( f + .5 ) } func main ( ) { var N int fmt . Scan ( & N ) X : = make ( [ ] int , N ) sum : = 0 for i , _ : = range X { fmt . Scan ( & X [ i ] ) sum + = X [ i ] } avg : = int ( round ( float64 ( sum ) / float64 ( N ) ) ) result : = 0 for _ , x : = range X { result + = ( x - avg ) * ( x - avg ) } fmt . Println ( result ) } package main import " " func main ( ) { var a , b , c , d , e , k int fmt . Scan ( & a , & b , & c , & d , & e , & k ) if ( b - a ) < = k & & ( c - a ) < = k & & ( d - a ) < = k & & ( e - a ) < = k & & ( c - b ) < = k & & ( d - b ) < = k & & ( e - b ) < = k & & ( d - c ) < = k & & ( e - c ) < = k & & ( e - d ) < = k { fmt . Println ( " " ) return } fmt . Println ( " " ) } package main import ( " " " fmt " " os " " strconv " package main import ( " " ) func solution ( h1 , m1 , h2 , m2 , k int ) int { return 60 * ( h2 - h1 ) + ( m2 - m1 ) - k } func main ( ) { var h1 , m1 , h2 , m2 , k int fmt . Scan ( & h1 , & m1 , & h2 , & m2 , & k ) fmt . Println ( solution ( h1 , m1 , h2 , m2 , k ) ) } package main import ( " " ) func main ( ) { var n int fmt . Scan ( & n ) p : = make ( [ ] int , n ) for i : = range p { fmt . Scan ( & p [ i ] ) } ans : = 1 min : = p [ 0 ] for i : = 1 ; i < n ; i + + { if p [ i ] < min { ans + + min = p [ i ] } } fmt . Println ( ans ) } package main import ( " " ) func main ( ) { var x , y , z int fmt . Scanf ( " % d % d % d " " YES " ) } else { fmt . Println ( " " ) } } package main import ( " " " fmt " " math " " os " " strconv " " no values " " no values " package main import ( " " " " ) func main ( ) { a : = make ( [ ] int , 3 ) fmt . Scan ( & a [ 0 ] , & a [ 1 ] , & a [ 2 ] ) sort . Ints ( a ) fmt . Println ( a [ 2 ] - a [ 1 ] + a [ 1 ] - a [ 0 ] ) } package main import ( " " " fmt " " os " " strconv " " strings " " scan string failed " " scan string failed " " " c = ( 1 .. 3 ) . map do gets . chomp . split . map ( & : to _ i ) end x = ( 0 .. 1 ) . map do | i | ( 0 .. 1 ) . map do | j | c [ i + 1 ] [ j ] - c [ i ] [ j ] = = c [ i + 1 ] [ j + 1 ] - c [ i ] [ j + 1 ] end . all ? end . all ? y = ( 0 .. 1 ) . map do | i | ( 0 .. 1 ) . map do | j | c [ j + 1 ] [ i ] - c [ j ] [ i ] = = c [ j + 1 ] [ i + 1 ] - c [ j ] [ i + 1 ] end . all ? end . all ? puts x & & y ? : Yes : : No puts ` dd ` . split . uniq . size > 4 ? : Four : : Three n = STDIN . gets . to _ i pn = STDIN . gets . split . map ( & : to _ i ) min = pn . first count = 0 pn . each do | i | if i < = min min = i count = count + 1 end end puts count c11 , c12 , c13 = gets . chomp . split . map ( & : to _ i ) c21 , c22 , c23 = gets . chomp . split . map ( & : to _ i ) c31 , c32 , c33 = gets . chomp . split . map ( & : to _ i ) 0 . upto ( c11 ) do | a1 | a2 = a1 - ( c11 - c21 ) a3 = a1 - ( c11 - c31 ) b1 = c11 - a1 b2 = c12 - a1 b3 = c13 - a1 if [ a2 , a3 , b1 , b2 , b3 ] . all ? { | e | e > = 0 & & e < = 100 } if a2 + b1 = = c21 & & a2 + b2 = = c22 & & a2 + b3 = = c23 & & a3 + b1 = = c31 & & a3 + b2 = = c32 & & a3 + b3 = = c33 puts ' Yes ' exit end end end puts ' No ' n = gets . to _ i a = gets . split . map ( & : to _ i ) b = gets . split . map ( & : to _ i ) count = 0 sum = 0 c = [ ] ( 0 ... n ) . each do | i | e = a [ i ] - b [ i ] if e . negative ? count + = 1 sum + = e e = 0 end c . push e end c . sort . reverse . each do | d | break if sum > = 0 sum + = d count + = 1 end puts count > n ? ' -1 ' : count gets puts gets = ~ / Y / ? : Four : : Three antenas = 5 . times . map { gets . to _ i } k = gets . to _ i if antenas . max - antenas . min < = k puts " Yay ! " else puts " : ( " end ARG _ N = gets . to _ i ARG _ P = gets . split . map ( & : to _ i ) smallest = 2 * ( 10 * * 5 ) + 1 result = 0 ARG _ P . each do | x | if x < = smallest smallest = x result + = 1 end end puts result arrays = [ ] 3 . times { | i | arrays < < gets . chomp . split ( ' ' ) . map ( & : to _ i ) } a = Array . new ( 3 , nil ) b = Array . new ( 3 , nil ) 101 . times do | i | a [ 0 ] = i b [ 0 ] = arrays [ 0 ] [ 0 ] - a [ 0 ] b [ 1 ] = arrays [ 0 ] [ 1 ] - a [ 0 ] b [ 2 ] = arrays [ 0 ] [ 2 ] - a [ 0 ] a [ 1 ] = arrays [ 1 ] [ 1 ] - b [ 1 ] a [ 2 ] = arrays [ 2 ] [ 2 ] - b [ 2 ] next if a . any ? { | t | t < 0 } | | b . any ? { | t | t < 0 } corrects = [ ] 3 . times do | j | 3 . times do | k | corrects < < ( arrays [ j ] [ k ] = = ( a [ j ] + b [ k ] ) ) end end if corrects . all ? puts ' Yes ' exit end end puts ' No ' gets r = gets . to _ i - 1 x = 1 $ < . each { | _ | e = _ . to _ i if e = = x + 1 x + = 1 elsif e ! = x r + = ( e - 1 ) / ( x + 1 ) end } p r a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i if e - a > k puts " : ( " else puts " Yay ! " end h = Hash . new ( 0 ) num = gets . to _ i st = gets . chomp ! . split ( " " ) st . each do | s | h [ s ] + = 1 end h . delete ( " " ) if h . keys . length = = 3 puts " Three " elsif h . keys . length = = 4 puts " Four " end require ' prime ' n , q = gets . split . map ( & : to _ i ) ans = 1 q . prime _ division . each { | k , v | ans * = k * * ( v / n ) } p ans n = gets . to _ i a = gets . split . map ( & : to _ i ) b = gets . split . map ( & : to _ i ) num = 0 x = 0 y = [ ] n . times do | i | if a [ i ] < b [ i ] num + = 1 x + = b [ i ] - a [ i ] else y < < a [ i ] - b [ i ] end end if num > 0 y . sort . reverse . each do | z | num + = 1 x - = z break if x < = 0 end end if x > 0 puts " -1 " else puts num end n = gets . to _ i array = gets . chop . split . map ( & : to _ i ) count = 0 ary = [ ] tmp = 1000000000000000 array . each do | num | if tmp > num tmp = num end if tmp > = num count + = 1 end end puts count grid = Array . new ( 3 ) . map { Array . new ( 3 ) } ( 0 .. 2 ) . each do | i | str = gets . chomp . split ( " " ) . map { | str | str . to _ i } grid [ i ] = str end p = Array . new ( ) q = Array . new ( ) r = Array . new ( ) ( 0 .. 2 ) . each do | i | p < < grid [ i ] [ 0 ] - grid [ i ] [ 1 ] q < < grid [ i ] [ 1 ] - grid [ i ] [ 2 ] r < < grid [ i ] [ 2 ] - grid [ i ] [ 0 ] end flag1 = p [ 0 ] = = p [ 1 ] & & p [ 1 ] = = p [ 2 ] & & p [ 0 ] = = p [ 2 ] flag2 = q [ 0 ] = = q [ 1 ] & & q [ 1 ] = = q [ 2 ] & & p [ 0 ] = = p [ 2 ] flag3 = r [ 0 ] = = r [ 1 ] & & r [ 1 ] = = r [ 2 ] & & p [ 0 ] = = p [ 2 ] if flag1 & & flag2 & & flag3 then puts " Yes " else puts " No " end gets puts gets . index ( ' Y ' ) ? " Four " : " Three " K , S = gets . chomp . split . map ( & : to _ i ) cnt = 0 ( 0 .. K ) . each do | x | ( 0 .. K ) . each do | y | if 0 < = S - x - y & & S - x - y < = K cnt + = 1 end end end puts cnt data = STDIN . read . split ( / \ s + / ) . map ( & : to _ i ) k , a , b = data . pop , data . shift , data . pop puts ( b - a < = k ) ? ' Yay ! ' : ' : ( ' gets ; puts gets . split . uniq . size = = 3 ? : Three : : Four require ' matrix ' class Polygon attr _ accessor : points def initialize @ points = [ ] end end def cross ( p1 , p2 ) return p1 [ 0 ] * p2 [ 1 ] - p1 [ 1 ] * p2 [ 0 ] end poly = Polygon . new gets . to _ i . times do x , y = gets . split . map & : to _ i point = Vector [ x , y ] poly . points < < point end gets . to _ i . times do x , y = gets . split . map & : to _ i q = Vector [ x , y ] n = 0 on _ segment = false poly . points . each _ with _ index do | v , i | a = poly . points [ i ] - q b = poly . points [ ( i + 1 ) % poly . points . size ] - q if cross ( a , b ) = = 0 & & a . inner _ product ( b ) < = 0 on _ segment = true break end a , b = b , a if a [ 1 ] > b [ 1 ] n + = 1 if a [ 1 ] < = 0 & & b [ 1 ] > 0 & & cross ( a , b ) > 0 end if on _ segment puts 1 else puts n . odd ? ? 2 : 0 end end N = gets . chomp . to _ i a = Array . new ( N ) str = gets . split for i in 0 ... N do a [ i ] = str [ i ] . to _ i end answer = 1 min = a [ 0 ] for i in 1 ... N do if a [ i ] < min min = a [ i ] answer + = 1 end end puts answer x = 5 . times . map { gets . to _ i } k = gets . to _ i puts x [ 4 ] - x [ 0 ] > k ? ' : ( ' : ' Yay ! ' k , s = gets . split . map ( & : to _ i ) cnt = 0 for x in 0 .. k for y in 0 .. k z = s - ( x + y ) if z > = 0 & & z < = k & & s = = x + y + z cnt + = 1 end end end puts cnt antennas = [ ] 5 . times do antennas < < STDIN . gets . chomp . to _ i end k = STDIN . gets . chomp . to _ i flg = true antennas . combination ( 2 ) . to _ a . each do | c | if ( c [ 0 ] - c [ 1 ] ) . abs > k flg = false end end if flg puts ' Yay ! ' else puts ' : ( ' end arr = [ ] a = [ 0 ] b = [ ] 3 . times do arr < < gets . split ( " " ) . map ( & : to _ i ) end for i in 0 .. 2 do b < < arr [ 0 ] [ i ] - a [ 0 ] end for i in 1 .. 2 do a < < arr [ i ] [ 0 ] - b [ 0 ] end for i in 0 .. 2 do for j in 0 .. 2 do unless arr [ i ] [ j ] = = a [ i ] + b [ j ] puts " No " exit end end end puts " Yes " a = gets . to _ i gets gets gets e = gets . to _ i k = gets . to _ i puts ( e - a ) < = k ? ' Yay ! ' : ' : ( ' a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i if e - a > k puts " : ( " else puts " Yay ! " end def get _ i ( ) return gets . chomp . split ( " " ) . map ( & : to _ i ) end def get _ f ( ) return gets . chomp . split ( " " ) . map ( & : to _ f ) end def get ( ) return gets . chomp . split ( " " ) end def get _ nsp ( ) return gets . chomp . split ( " " ) end def yn _ judge ( bool , y = " Yes " , n = " No " ) return bool ? y : n end def array ( size1 , init = nil , size2 = - 1 ) if size2 = = - 1 return Array . new ( size1 ) { init } else return Array . new ( size2 ) { Array . new ( size1 ) { init } } end end c = array ( 3 ) 3 . times do | i | c [ i ] = get _ i end flag = true 1 . upto ( 100 ) do | a1 | b = array ( 3 ) 3 . times do | i | b [ i ] = c [ 0 ] [ i ] - a1 end flag = true 2 . times do | i | unless c [ i + 1 ] [ 0 ] - b [ 0 ] = = c [ i + 1 ] [ 1 ] - b [ 1 ] and c [ i + 1 ] [ 1 ] - b [ 1 ] = = c [ i + 1 ] [ 2 ] - b [ 2 ] flag = false break end end if flag break end end puts yn _ judge ( flag ) def mydiv ( n , cnt = 0 ) n % 2 = = 0 ? mydiv ( n . div ( 2 ) , cnt . next ) : cnt end N = gets . to _ i max _ cnt = 0 max _ n = 1 1 . upto ( N ) do | n | cnt = mydiv ( n ) if max _ cnt < cnt max _ cnt = cnt max _ n = n end end puts max _ n a = 6 . times . map { gets . to _ i } if a [ 4 ] - a [ 0 ] > a [ 5 ] puts " : ( " else puts " Yay ! " end n = gets . to _ i p = gets . split . map ( & : to _ i ) min = 10 * * 6 count = 0 n . times do | i | if min > p [ i ] count + = 1 min = p [ i ] end end puts count k , s = gets . chomp . split ( " " ) . map ( & : to _ i ) ; ans = 0 x = 0 while x < = k y = 0 while y < = k z = s - x - y if 0 < = z & & z < = k ans = ans + 1 end y = y + 1 end x = x + 1 end puts ( ans ) n = gets . to _ i ans = 0 max _ val = 0 1 . upto ( n ) do | i | cnt = 1 while i % ( 2 * * cnt ) = = 0 cnt + = 1 end ans = i if cnt > max _ val max _ val = cnt if cnt > max _ val end puts ans N = gets . to _ i P = gets . chomp . split . map ( & : to _ i ) s = 0 m = P [ 0 ] P . each do | p | if p < = m s + = 1 m = p end end puts s grid = [ [ 0 , 0 , 0 , 0 ] ] 3 . times do grid . push ( [ 0 ] + gets . split ( ' ' ) . map ( & : to _ i ) ) end a1 = 0 b1 = grid [ 1 ] [ 1 ] - a1 b2 = grid [ 2 ] [ 1 ] - a1 b3 = grid [ 3 ] [ 1 ] - a1 a2 = grid [ 1 ] [ 2 ] - b1 a3 = grid [ 1 ] [ 3 ] - b1 if a2 + b2 = = grid [ 2 ] [ 2 ] & & a2 + b3 = = grid [ 3 ] [ 2 ] & & a3 + b2 = = grid [ 2 ] [ 3 ] & & a3 + b3 = = grid [ 3 ] [ 3 ] puts ' Yes ' else puts ' No ' end n = gets . chomp . to _ i p _ arr = gets . chomp . split ( " " ) . map ( & : to _ i ) count = 0 min = 9999999999 p _ arr . each do | p | if p < min then min = p count + = 1 end end puts count k , s = gets . chomp ( ) . split ( ' ' ) . map ( & : to _ i ) answer = 0 for j in 0 .. k do for m in 0 .. k do ncheck = s - j - m if 0 < = ncheck and ncheck < = k answer = answer + 1 end end end puts ( answer ) points = readlines . map ( & : to _ i ) dist = points . pop puts points . max - points . min > dist ? ' : ( ' : ' Yay ! ' c = [ ] 3 . times do c < < gets . split . map ( & : to _ i ) end if c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] & & c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] & & c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] & & c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] & & c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] & & c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] puts " Yes " else puts " No " end a = gets . to _ i gets gets gets e = gets . to _ i k = gets . to _ i puts e - a < = k ? " Yay ! " : " : ( " t = 1 ; gets . split . map ( & : to _ i ) . zip ( $ < ) { | m , x | s = 0 ; x . split . map { | k | s + = k . to _ i * ~ ( m - = 2 ) } ; t * = s } ; p t . % 10 * * 9 + 7 a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i ary = [ b , c , d , e ] cnt = 0 ary . each do | x | cnt + = 1 if x > ( a + k ) end if cnt = = 0 puts " Yay ! " else puts " : ( " end w , * v = 0 ; eval ' N , * A = ' + ` dd ` . split * ? , ; c = ( 0 ... N ) . count { | i | d = A [ i + N ] - A [ i ] ; d > 0 ? w + = d : ! ( v < < d ) } + v . sort . count { | d | d < w + = d } ; p w > 0 ? - 1 : c k , s = gets . split . map & : to _ i cnt = 0 ( 0 .. k ) . each do | x | ( 0 .. k ) . each do | y | cnt + = 1 if x + y < = s & & s - x - y < = k end end puts cnt c = 3 . times . map { gets . chomp . split . map ( & : to _ i ) } b = [ ] flag = true 0 . upto ( c [ 0 ] [ 0 ] ) do | k | flag = true a = [ ] a . push ( k ) c [ 0 ] . each { | c | b . push ( c - k ) } a . push ( c [ 1 ] [ 0 ] - b [ 0 ] ) a . push ( c [ 2 ] [ 0 ] - b [ 0 ] ) b . each _ with _ index do | b , j | a . each _ with _ index do | a , i | flag = false unless a + b = = c [ i ] [ j ] end end break if flag = = true end puts flag ? " Yes " : " No " ary = [ ] 5 . times { ary < < gets . to _ i } k = gets . to _ i if ( ary [ 4 ] - ary [ 0 ] ) > k puts ' : ( ' else puts ' Yay ! ' end def aa a = gets . chomp . to _ i b = gets . chomp . to _ i c = gets . chomp . to _ i d = gets . chomp . to _ i e = gets . chomp . to _ i k = gets . chomp . to _ i if ( a - b ) . abs < = k and ( a - c ) . abs < = k and ( a - d ) . abs < = k and ( a - e ) . abs < = k and ( b - c ) . abs < = k and ( b - d ) . abs < = k and ( b - e ) . abs < = k and ( c - d ) . abs < = k and ( c - e ) . abs < = k and ( d - e ) . abs < = k puts ' Yay ! ' else puts ' : ( ' end end aa n , m , a , b , * d = $ < . read . split . map ( & : to _ i ) d = d . take _ while { | e | e > = a } . reverse d = d . drop _ while { | e | e < = b } if n - d . size < m p d . size Q = ' ? + ? ? + ? ? ? = = ? ? ? ' q0 = Q . size . times . select { | i | Q [ i ] = = ' ? ' } a = gets . split . map ( & : to _ i ) a . each _ with _ index { | e , i | Q [ q0 [ i ] ] = e . to _ s if e ! = - 1 } q1 = Q . size . times . select { | i | Q [ i ] = = ' ? ' } p ( [ * 1 .. 9 ] - a ) . permutation . count { | a | s = Q . dup a . each _ with _ index { | e , i | s [ q1 [ i ] ] = e . to _ s } eval s } d = readlines . map ( & : to _ i ) puts d [ 4 ] - d [ 0 ] < = d [ 5 ] ? " Yay ! " : " : ( " n = gets . to _ i p = gets . split . map & : to _ i min = 200001 r = 0 for i in 0 ... n if min > p [ i ] min = p [ i ] r + = 1 end end p r n , m = gets . chomp . split ( " " ) . map ( & : to _ i ) require ' prime ' pr = [ 1 ] if n = = 1 puts m exit end Prime . each ( 10 * * 7 ) do | prime | pr . push ( prime ) end pr2 = Array . new ( pr . length , 0 ) for i in 1 .. pr . length - 1 while m % pr [ i ] = = 0 m / = pr [ i ] pr2 [ i ] + = 1 end if m = = 1 break end end if m ! = 1 pr2 . push ( 1 ) end ans = 1 for i in 1 .. pr2 . length - 1 if pr2 [ i ] > = n ans * = ( pr [ i ] * * ( pr2 [ i ] / n ) ) end end puts ans lines = readlines . map { | line | line . split ( ' ' ) . map ( & : to _ i ) } a = 0 b = lines [ 0 ] [ 0 ] for i in 0 .. lines [ 0 ] [ 0 ] - 1 f = 0 b = b < = lines [ 1 ] [ i ] ? b : lines [ 1 ] [ i ] if b > = lines [ 1 ] [ i ] then a = a + 1 end end puts a require ' pp ' IS _ DEBUG = true def dputs str if ( IS _ DEBUG ) puts str end end def dpp str if ( IS _ DEBUG ) pp str end end require ' pp ' INT _ MAX = 999999999999999999999999 N , M = gets . chomp . split ( ' ' ) . map { | n | n . to _ i } X = gets . chomp . split ( ' ' ) . map { | n | n . to _ i } . sort Y = gets . chomp . split ( ' ' ) . map { | n | n . to _ i } . sort mod = 10 * * 9 + 7 xsum = 0 ysum = 0 X . each _ with _ index { | x , i | i = i + 1 ; xsum + = - ( N - i ) * x + ( i - 1 ) * x } Y . each _ with _ index { | y , i | i = i + 1 ; ysum + = - ( M - i ) * y + ( i - 1 ) * y } puts xsum * ysum % mod n = gets . strip . to _ i nums = gets . strip . split ( " " ) . map ( & : to _ i ) min = Float : : INFINITY count = 0 nums . each . with _ index do | n , i | if min > = n count + = 1 min = n end end puts count ns = gets . split puts ns . sort . join = = " 1479 " ? " YES " : " NO " n = gets . split . map & : to _ i puts n . include ? ( 1 ) & & n . include ? ( 7 ) & & n . include ? ( 9 ) & & n . include ? ( 4 ) ? : YES : : NO N = gets . chomp . to _ i S = gets . chomp puts S . include ? ( ' Y ' ) ? " Four " : " Three " data = STDIN . read . split ( / \ s + / ) . map ( & : to _ i ) k , a , e = data . pop , data . shift , data . pop puts k > = ( e - a ) ? ' Yay ! ' : ' : ( ' def sub _ a ( x , y ) ret = [ ] 3 . times { | i | ret < < x [ i ] - y [ i ] } ret end def eq3 ( x , y , z ) x = = y & & y = = z & & x = = z ? true : false end c = [ ] comp = [ ] 3 . times { c < < gets . split . map ( & : to _ i ) } comp < < sub _ a ( c [ 0 ] , c [ 1 ] ) comp < < sub _ a ( c [ 0 ] , c [ 2 ] ) comp < < sub _ a ( c [ 1 ] , c [ 2 ] ) d = c . transpose comp < < sub _ a ( d [ 0 ] , d [ 1 ] ) comp < < sub _ a ( d [ 0 ] , d [ 2 ] ) comp < < sub _ a ( d [ 1 ] , d [ 2 ] ) comp . each do | x | unless eq3 ( x [ 0 ] , x [ 1 ] , x [ 2 ] ) puts " No " exit end end puts " Yes " T1 , T2 , a1 , a2 , b1 , b2 = ` dd ` . split . map & : to _ i v1 = a1 - b1 v2 = a2 - b2 if v1 > 0 v1 = - v1 v2 = - v2 end d = v1 * T1 D = d + v2 * T2 if D = = 0 puts " infinity " exit end if ( d > 0 ) = = ( D > 0 ) p 0 exit end N = ( d . abs - 1 ) / D . abs + 1 p 2 * N + ( N * D . abs + d > 0 ? 0 : 1 ) - 1 a , b , c , d = gets . chomp . split ( ' ' ) . map ( & : to _ i ) array = [ a , b , c , d ] . sort if array = = [ 1 , 4 , 7 , 9 ] puts " YES " else puts " NO " end a = gets . to _ i _ = gets . to _ i _ = gets . to _ i _ = gets . to _ i e = gets . to _ i k = gets . to _ i if e - a > k puts " : ( " else puts " Yay ! " end a , _ , _ , _ , b , k = ( 1 .. 6 ) . map { gets . to _ i } puts b - a > k ? ' : ( ' : ' Yay ! ' a = 5 . times . map { gets . to _ i } k = gets . to _ i def can _ communicate ( a , k ) ( 0 .. 4 ) . each do | i | ( 0 .. 4 ) . each do | j | return false if ( a [ i ] - a [ j ] ) . abs > k end end true end puts can _ communicate ( a , k ) ? ' Yay ! ' : ' : ( ' c = [ ] flag = true 3 . times { | i | c [ i ] = gets . split ( ' ' ) . map ( & : to _ i ) } 2 . times { | j | bef = c [ 0 ] [ j + 1 ] - c [ 0 ] [ j ] 2 . times { | i | flag = false if c [ i + 1 ] [ j + 1 ] - c [ i + 1 ] [ j ] ! = bef } } 2 . times { | i | bef = c [ i + 1 ] [ 0 ] - c [ i ] [ 0 ] 2 . times { | j | flag = false if c [ i + 1 ] [ j + 1 ] - c [ i ] [ j + 1 ] ! = bef } } puts flag ? ' Yes ' : ' No ' n = gets . to _ i as = gets . split . map ( & : to _ i ) bs = gets . split . map ( & : to _ i ) count = 0 goods = [ ] rest = 0 n . times do | i | a = as [ i ] b = bs [ i ] if a < b count + = 1 rest + = b - a else goods < < [ a , b ] end end goods . sort _ by ! { | a , b | b - a } i = 0 loop do if rest < = 0 p count exit 0 elsif goods . length < = i p - 1 exit 0 end a , b = goods [ i ] rest - = a - b count + = 1 i + = 1 end c0 = gets . chomp . split ( " " ) . map ( & : to _ i ) c1 = gets . chomp . split ( " " ) . map ( & : to _ i ) c2 = gets . chomp . split ( " " ) . map ( & : to _ i ) a01 = c0 [ 0 ] - c0 [ 1 ] a02 = c0 [ 0 ] - c0 [ 2 ] a12 = c0 [ 1 ] - c0 [ 2 ] if c1 [ 0 ] - c1 [ 1 ] ! = a01 then puts " No " exit end if c1 [ 0 ] - c1 [ 2 ] ! = a02 then puts " No " exit end if c1 [ 1 ] - c1 [ 2 ] ! = a12 then puts " No " exit end if c2 [ 0 ] - c2 [ 1 ] ! = a01 then puts " No " exit end if c2 [ 0 ] - c2 [ 2 ] ! = a02 then puts " No " exit end if c2 [ 1 ] - c2 [ 2 ] ! = a12 then puts " No " exit end b01 = c0 [ 0 ] - c1 [ 0 ] b02 = c0 [ 0 ] - c2 [ 0 ] b12 = c1 [ 0 ] - c2 [ 0 ] if c0 [ 1 ] - c1 [ 1 ] ! = b01 then puts " No " exit end if c0 [ 1 ] - c2 [ 1 ] ! = b02 then puts " No " exit end if c1 [ 1 ] - c2 [ 1 ] ! = b12 then puts " No " exit end if c0 [ 2 ] - c1 [ 2 ] ! = b01 then puts " No " exit end if c0 [ 2 ] - c2 [ 2 ] ! = b02 then puts " No " exit end if c1 [ 2 ] - c2 [ 2 ] ! = b12 then puts " No " exit end puts " Yes " board = Array . new ( 3 ) do gets . split . map ( & : to _ i ) end delta = Array . new ( 4 ) do Array . new end 3 . times do | i | 3 . times do | j | if i + 1 < 3 then delta [ i ] < < board [ i + 1 ] [ j ] - board [ i ] [ j ] end if j + 1 < 3 then delta [ 2 + j ] < < board [ i ] [ j + 1 ] - board [ i ] [ j ] end end end delta . each do | a | if a . uniq . length ! = 1 then puts " No " exit 0 end end puts " Yes " K , S = gets . split . map { | i | i . to _ i } c = 0 ( 0 .. K ) . each { | x | next if x + K * 2 < S ( 0 .. K ) . each { | y | z = S - x - y next if z > K next if z < 0 c + = 1 } } puts c grids = 3 . times . map { gets . split ( ' ' ) . map ( & : to _ i ) } flag = false ( 0 .. grids . max . max ) . each do | i | a1 = i b1 = grids [ 0 ] [ 0 ] - a1 a2 = grids [ 1 ] [ 0 ] - b1 a3 = grids [ 2 ] [ 0 ] - b1 b2 = grids [ 0 ] [ 1 ] - a1 b3 = grids [ 0 ] [ 2 ] - a1 if a1 > = 0 & & a2 > = 0 & & a3 > = 0 & & b1 > = 0 & & b2 > = 0 & & b3 > = 0 & & grids [ 1 ] [ 1 ] = = a2 + b2 & & grids [ 1 ] [ 2 ] = = a2 + b3 & & grids [ 2 ] [ 1 ] = = a3 + b2 & & grids [ 2 ] [ 2 ] = = a3 + b3 flag = true puts " Yes " break end end puts " No " unless flag a = Array . new ( 5 ) 5 . times { | i | a [ i ] = gets . to _ i } k = gets . to _ i puts k < a [ 4 ] - a [ 0 ] ? " : ( " : " Yay ! " a = gets . chomp . to _ i b = gets . chomp . to _ i c = gets . chomp . to _ i d = gets . chomp . to _ i e = gets . chomp . to _ i k = gets . chomp . to _ i array = [ a , b , c , d , e ] array . each do | x | array . each do | y | next if x > = y if y - x > k puts ' : ( ' exit end end end puts ' Yay ! ' a = [ ] 6 . times { | i | a [ i ] = gets . to _ i } puts a [ 4 ] - a [ 0 ] > a [ 5 ] ? ' : ( ' : ' Yay ! ' k , s = gets . strip . split . map ( & : to _ i ) count = 0 ( 0 .. k ) . each do | x | ( 0 .. k ) . each do | y | z = s - x - y if z > = 0 & & k > = z count + = 1 end end end puts count n = gets . to _ i aa = gets . chomp . split ( " " ) . map { | a | a . to _ i } bb = gets . chomp . split ( " " ) . map { | a | a . to _ i } def counttotaldeficit ( n , a , b ) deficit = 0 j = 0 for i in ( 0 .. n - 1 ) if ( a [ i ] - b [ i ] ) < 0 j + = 1 deficit + = a [ i ] - b [ i ] end end return [ deficit , j ] end def sort ( n , a , b ) ab = [ ] for i in ( 0 .. n - 1 ) if a [ i ] - b [ i ] > 0 ab . push ( [ a [ i ] , b [ i ] ] ) end end ab . sort _ by ! { | ary | - ( ary [ 0 ] - ary [ 1 ] ) } return ab end def checker ( n , a , b ) answer = 0 a . each _ with _ index { | item , index | if item < b [ index ] answer = - 1 break else end } if answer = = 0 return answer end array = counttotaldeficit ( n , a , b ) deficit = array [ 0 ] j = array [ 1 ] answer = j ab = sort ( n , a , b ) k = 0 while deficit < 0 if k = = ab . size return - 1 end dictance = ab [ k ] [ 0 ] - ab [ k ] [ 1 ] deficit = deficit + dictance answer + = 1 k + = 1 end return answer end puts checker ( n , aa , bb ) N , * ps = $ < . read . split . map ( & : to _ i ) min = ps [ 0 ] ret = 0 ps . each do | p | if p < = min ret + = 1 min = p end end p ret eval " N , X , * A = " + ` dd ` . split * ? , p A . map { A = A . zip ( b = A . rotate ) . map & : min b . reduce ( : + ) + X * ~ - $ . + = 1 } . min module HinaArare def solve n = gets . to _ i s = gets . split ( " " ) for i in 1 .. n do if s [ i ] = = ' Y ' return ' Four ' end end return ' Three ' end end include HinaArare puts HinaArare . solve k , s = gets . chomp . split . map ( & : to _ i ) res = 0 ( 0 .. [ k , s ] . min ) . each do | x | ( 0 .. [ k , s - x ] . min ) . each do | y | res + = 1 if s - x - y < = k end end puts res k , s = gets . strip . split ( ' ' ) . map ( & : to _ i ) count = 0 0 . upto ( k ) do | x | 0 . upto ( k ) do | y | z = s - ( x + y ) if z > = 0 & & z < = k count + = 1 end end end puts count k , s = gets . chomp . split ( " " ) . map ( & : to _ i ) count = 0 for i in 0 .. k for j in 0 .. k if s - i - j < = k & & s - i - j > = 0 count + = 1 end end end puts count a , b , c , d , e , k = readlines . map ( & : to _ i ) puts e - a < = k ? " Yay ! " : " : ( " N = eval * $ < ; ( 1 .. M = 3500 ) . any ? { | i | ( i .. M ) . any ? { | j | n = 4 * i * j - N * ( i + j ) ; d = N * i * j ; n > 0 & & d % n < 1 & & $ > < < [ i , j , d / n ] * ? \ s } } a , b , c , d , e , k = 6 . times . map { gets . to _ i } puts e - a < = k ? " Yay ! " : " : ( " antainers = ( 1 .. 5 ) . map { gets . to _ i } k = gets . to _ i if antainers [ - 1 ] - antainers [ 0 ] < = k puts ' Yay ! ' else puts ' : ( ' end ARGF . each { | line | a = line . split . sort ! v = a . join . to _ i if v = = 1479 puts " YES " else puts " NO " end exit } gets puts ( gets . split . include ? ' Y ' ) ? ' Four ' : ' Three ' g = Array . new ( 3 ) do t = gets . strip . split ( " " ) . map ( & : to _ i ) [ t [ 0 ] - t [ 1 ] , t [ 0 ] - t [ 2 ] ] end if g [ 0 ] = = g [ 1 ] & & g [ 1 ] = = g [ 2 ] puts " Yes " else puts " No " end k , s = gets . strip . split . map ( & : to _ i ) cnt = 0 ( 0 .. k ) . each do | x | ( 0 .. k ) . each do | y | z = s - x - y cnt + = 1 if ( 0 .. k ) . include ? ( z ) end end puts cnt def test ( k , s ) cnt = 0 for x in 0 .. k for y in 0 .. k z = s - x - y if 0 < = z and z < = k cnt + = 1 end end end puts cnt end input = gets k , s = input . split ( ' ' ) . map { | n | n . to _ i } test ( k , s ) a = gets . chomp . split ( " " ) . map ( & : to _ i ) if a . include ? ( 1 ) & & a . include ? ( 9 ) & & a . include ? ( 7 ) & & a . include ? ( 4 ) puts " YES " else puts " NO " end N = gets . to _ i Ps = gets . split . map ( & : to _ i ) ans = 0 min = 0 Ps . each _ with _ index do | n , i | min = n if ( min = = 0 | | n < = min ) ans + = 1 if min > = n end puts ans * a , b = ` dd ` . split . map ( & : to _ i ) puts a . max - a . min > b ? ' : ( ' : ' Yay ! ' antennas = 5 . times . map { gets . to _ i } k = gets . to _ i puts antennas [ 4 ] - antennas [ 0 ] > k ? ' : ( ' : ' Yay ! ' N = gets . to _ i 10 . times do | i | if N < 2 * * ( i + 1 ) puts 2 * * i exit end end n = gets . to _ i puts gets . split . uniq . length = = 3 ? " Three " : " Four " k , s = gets . chomp . split ( ' ' ) . map ( & : to _ i ) ans = 0 x = 0 while x < = k y = 0 while y < = k z = s - x - y if z > = 0 & & z < = k ans + = 1 end y + = 1 end x + = 1 end puts ans N = gets . to _ i ( 1 .. 3500 ) . each do | a | ( 1 .. 3500 ) . each do | b | next if ( 4 * a * b - N * b - N * a ) < 1 c , m = ( N * a * b ) . divmod ( 4 * a * b - N * b - N * a ) next if m > 0 puts [ a , b , c ] . join ( ' ' ) exit end end n = gets . to _ i ans = [ ] if n > = 2 ( 1 .. 8 ) . each do | i | if n = = 2 ans < < 2 elsif 2 * * i > n ans < < 2 * * ( i - 1 ) end end puts ans . min elsif n = = 1 puts 1 else puts 0 end N = gets . to _ i p = gets . chomp . split . map ( & : to _ i ) min = 300000 ans = 0 p . each do | i | if i < min min = i ans + = 1 end end puts ans c = 3 . times . map { gets . split . map ( & : to _ i ) } if [ 1 , 2 ] . repeated _ permutation ( 2 ) . all ? { | i , j | c [ i ] [ 0 ] + c [ 0 ] [ j ] = = c [ i ] [ j ] + c [ 0 ] [ 0 ] } puts " Yes " else puts " No " end arr = [ ] 5 . times do | i | arr < < gets . to _ i end k = gets . to _ i sa = arr [ 4 ] - arr [ 0 ] if sa < = k puts " Yay ! " else puts " : ( " end N = gets . to _ i t = Rational ( 4 , N ) ( 1 .. 3500 ) . each do | h | ( 1 .. 3500 ) . each do | n | a = N * h * n b = 4 * h * n - N * n - N * h next if b < = 0 next if a < b next if a % b ! = 0 w = a / b puts [ h , n , w . to _ i ] . join ( ' ' ) exit end end t = [ ] 5 . times do | i | t . push ( gets . chomp . to _ i ) end k = gets . chomp . to _ i v = t . max - t . min puts v < = k ? ' Yay ! ' : ' : ( ' def lscan ; gets . split . map ( & : to _ i ) ; end puts lscan . sort = = [ 1 , 4 , 7 , 9 ] ? " YES " : " NO " n = gets . to _ i p = gets . split . map ( & : to _ i ) min _ p = 1000000 count = 0 for i in 0 ... n do if p [ i ] < = min _ p count + = 1 min _ p = p [ i ] end end puts count N = gets . chomp . to _ i P = gets . chomp . split . map ( & : to _ i ) ans = 1 minV = P [ 0 ] ( 1 . upto ( N - 1 ) ) . each do | i | if ( P [ i ] < minV ) ans + = 1 end if ( P [ i ] < minV ) minV = P [ i ] end end p ans n = gets puts gets . split . uniq . size = = 3 ? " Three " : " Four " k , s = gets . split . map ( & : to _ i ) count = 0 0 . upto ( k ) do | x | 0 . upto ( k ) do | y | z = s - x - y if z . between ? ( 0 , k ) count + = 1 end end end puts count a = gets . chomp . to _ i b = gets . chomp . to _ i c = gets . chomp . to _ i d = gets . chomp . to _ i e = gets . chomp . to _ i k = gets . chomp . to _ i puts ( e - a > k ) ? ' : ( ' : ' Yay ! ' class Node attr _ accessor : order , : parent , : child , : edges , : lowest , : visited , : isArticulation def initialize @ order = nil @ parent = - 1 @ child = [ ] @ edges = [ ] @ lowest = nil @ visited = false @ isArticulation = false end end def dfs ( root , g ) t = 1 stack = [ ] g [ root ] . order = g [ root ] . lowest = t g [ root ] . visited = true stack < < root while stack . size > 0 u = stack [ - 1 ] flag = true g [ u ] . edges . each { | x | if g [ x ] . visited = = false t + = 1 g [ x ] . order = g [ x ] . lowest = t g [ x ] . visited = true g [ x ] . parent = u g [ u ] . child < < x flag = false g [ u ] . lowest = [ g [ u ] . lowest , g [ x ] . lowest ] . min stack < < x break elsif x ! = g [ u ] . parent g [ u ] . lowest = [ g [ u ] . lowest , g [ x ] . order ] . min end } if flag stack . pop g [ u ] . child . each { | v | g [ u ] . lowest = [ g [ u ] . lowest , g [ v ] . lowest ] . min g [ u ] . isArticulation = true if ( u ! = root & & g [ u ] . order < = g [ v ] . lowest ) if g [ u ] . order < g [ v ] . lowest if u < v $ bridge < < [ u , v ] else $ bridge < < [ v , u ] end end } end end g [ root ] . isArticulation = true if g [ root ] . child . size > 1 end $ bridge = [ ] $ t = 1 v , e = gets . split . map ( & : to _ i ) graph = Array . new ( v ) { Node . new } e . times { s , t = gets . split . map ( & : to _ i ) graph [ s ] . edges < < t graph [ t ] . edges < < s } dfs ( 0 , graph ) $ bridge . sort . each { | a , b | puts " } N = gets . to _ i Ss = gets . split . map ( & : to _ s ) puts Ss . uniq . count = = 3 ? ' Three ' : ' Four ' require ' set ' class Hash def push ( key , value ) self [ key ] = [ ] if self [ key ] = = nil self [ key ] . push ( value ) end end class Array def lower _ bound ( value ) left = - 1 ; right = self . length ; while left + 1 < right mid = left + ( right - left ) / 2 ; if self [ mid ] > = value right = mid else left = mid end end right end def unique res = [ self . first ] each _ cons ( 2 ) do | a , b | if a ! = b res . push ( b ) end end res end end def get _ ints gets . split . map ( & : to _ i ) end def get _ ints _ minus _ one get _ ints . map { | x | x - 1 } end def get _ int gets . chomp . to _ i end N = get _ int P = get _ ints min = P [ 0 ] count = 1 P [ 1 .. ] . each do | p | if p < = min min = p count + = 1 end end puts count N = gets . to _ i ( 1 .. 3500 ) . each do | h | ( h .. 3500 ) . each do | n | d = 4 * h * n - n * N - h * N next if d < = 0 if h * n * N % d = = 0 w = h * n * N / d puts " exit end end end N = gets . to _ i S = gets . split if S . uniq . size = = 4 puts ' Four ' else puts ' Three ' end ary = gets . split . map ( & : to _ i ) . sort if ary [ 0 ] = = 1 ans = ( ( ary - [ 1 ] ) . reverse ) . insert ( 0 , 1 ) if ans . join . to _ i = = 1974 puts " YES " else puts " NO " end else puts " NO " end n = gets . chomp . to _ i ps = gets . chomp . split ( " " ) . map ( & : to _ i ) ; min = 10 * * 6 + 1 count = 0 ps . each do | p | if min > p min = p count + = 1 end end puts count arr = Array . new ( 5 ) 5 . times do | i | arr [ i ] = gets . chomp . to _ i end k = gets . chomp . to _ i puts arr . max - arr . min > k ? " : ( " : " Yay ! " css = Array . new ( 3 ) { gets . split . map ( & : to _ i ) } ans = [ 0 , 1 ] . all ? do | i | Array . new ( 3 ) { | j | css [ i + 1 ] [ j ] - css [ i ] [ j ] } . uniq . size = = 1 end puts ans ? ' Yes ' : ' No ' c = [ ] c < < gets . split . map ( & : to _ i ) c < < gets . split . map ( & : to _ i ) c < < gets . split . map ( & : to _ i ) ans = ' No ' if ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ) & & ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) if ( c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 2 ] ) & & ( c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 2 ] ) c . transpose if ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ) & & ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) if ( c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 2 ] ) & & ( c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 2 ] ) ans = ' Yes ' end end end end puts ans A = gets . to _ i B = gets . to _ i C = gets . to _ i D = gets . to _ i E = gets . to _ i K = gets . to _ i if E - A > K puts ' : ( ' else puts ' Yay ! ' end c = [ ] while s = gets c . push ( s . split . map ( & : to _ i ) ) end if ( c [ 4 ] [ 0 ] - c [ 0 ] [ 0 ] ) < = c [ - 1 ] [ 0 ] puts " Yay ! " else puts " : ( " end a = Array . new ( 3 , 0 ) b = Array . new ( 3 , 0 ) c = Array . new ( 3 ) . map { Array . new ( 3 , 0 ) } correct _ flag = true 3 . times do | i | c [ i ] = gets . split . map ( & : to _ i ) end b [ 0 ] = ( c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] ) / 2 b [ 1 ] = ( ( c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] ) / 2 ) - c [ 0 ] [ 0 ] + c [ 0 ] [ 1 ] b [ 2 ] = ( ( c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] ) / 2 ) - c [ 1 ] [ 0 ] + c [ 1 ] [ 2 ] a [ 0 ] = c [ 0 ] [ 0 ] - ( c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] ) / 2 a [ 1 ] = c [ 1 ] [ 0 ] - ( c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] ) / 2 a [ 2 ] = c [ 2 ] [ 0 ] - ( c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] ) / 2 for i in 0 .. 2 for j in 0 .. 2 if c [ i ] [ j ] ! = ( a [ i ] + b [ j ] ) correct _ flag = false end end end if correct _ flag puts " Yes " else puts " No " end n = gets . to _ i a = gets . split . map ( & : to _ i ) b = gets . split . map ( & : to _ i ) c = Array . new ( n ) { | i | a [ i ] - b [ i ] } . sort m = 0 ans = 0 for i in 0 .. n - 1 break if c [ i ] > = 0 m - = c [ i ] ans + = 1 end ( n - 1 ) . downto ( 0 ) do | i | break if m < = 0 m - = c [ i ] ans + = 1 end if c . inject ( : + ) > = 0 puts ans else puts " -1 " end k , s = $ stdin . gets . chomp . split ( ' ' ) . map ( & : to _ i ) ans = 0 ( k + 1 ) . times do | x | ( k + 1 ) . times do | y | if s > = x + y & & k > = ( s - ( x + y ) ) ans + = 1 end end end puts ans a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i ans = ' Yay ! ' [ a , b , c , d , e ] . each do | x | [ a , b , c , d , e ] . each do | y | if ( x - y ) . abs > k ans = ' : ( ' end end end puts ans ( a , b , c , d , e ) = 5 . times . map { | _ | gets . to _ i } k = gets . to _ i if e - a < = k puts " Yay ! " else puts " : ( " end N = gets . to _ i r = 1 while r * 2 < = N r * = 2 end puts r a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i if ( a - e ) . abs > k puts ' : ( ' else puts ' Yay ! ' end t = gets . split . map ( & : to _ i ) a = gets . split . map ( & : to _ i ) b = gets . split . map ( & : to _ i ) x = ( b [ 0 ] - a [ 0 ] ) * t [ 0 ] y = ( b [ 1 ] - a [ 1 ] ) * t [ 1 ] if x + y = = 0 puts x = = y ? 0 : " infinity " elsif x = = 0 | | y = = 0 | | ( x > 0 & & x + y > 0 ) | | ( x < 0 & & x + y < 0 ) puts 0 else s , t = x . abs . divmod ( ( x + y ) . abs ) puts t ! = 0 ? s * 2 + 1 : s * 2 end gets a = gets . split . map ( & : to _ i ) x = 0 min = a [ 0 ] a . each do | n | if n < = min x + = 1 min = n end end puts x k , s = gets . chomp . split ( " " ) . map ( & : to _ i ) ans = 0 ( k + 1 ) . times do | x | ( k + 1 ) . times do | y | z = s - x - y ans + = 1 if z < = k & & z > = 0 end end puts ans h , r = gets . split ( ' ' ) . map ( & : to _ i ) if h + r < 0 puts - 1 elsif h + r = = 0 puts 0 else puts 1 end c = [ ] while s = gets c . push ( s . split . map ( & : to _ i ) ) end if ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ) ! = ( c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ) | | ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ) ! = ( c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ) puts " No " exit elsif ( c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ) ! = ( c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] ) | | ( c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ) ! = ( c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ) puts " No " exit elsif ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ) ! = ( c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ) | | ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ) ! = ( c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) puts " No " exit elsif ( c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ) ! = ( c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ) | | ( c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ) ! = ( c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ) puts " No " exit end puts " Yes " k , s = gets . split . map & : to _ i ; v = 0 ; ( g = ( 0 .. k ) ) . each { | x | g . each { | y | r = s - x - y ; k > = r & & r > = 0 & & v + = 1 } } ; p v a = gets . chomp . to _ i b = gets . chomp . to _ i c = gets . chomp . to _ i d = gets . chomp . to _ i e = gets . chomp . to _ i k = gets . chomp . to _ i if e - a > k puts " : ( " else puts " Yay ! " end c = [ ] 3 . times do c . push gets . chomp . split ( ) . map ( & : to _ i ) end x = Array . new ( 3 ) y = Array . new ( 3 ) x [ 0 ] = 0 3 . times do | i | y [ i ] = c [ i ] [ 0 ] end 3 . times do | i | x [ i ] = c [ 0 ] [ i ] - y [ 0 ] end 1 . upto ( 2 ) . each do | i | 1 . upto ( 2 ) . each do | j | if c [ i ] [ j ] ! = y [ i ] + x [ j ] puts ' No ' exit end end end puts ' Yes ' lines = [ ] while line = gets lines < < line . chomp . split ( ' ' ) . map ( & : to _ i ) end N = lines [ 0 ] [ 0 ] min = 100000000000000000000 answer = 0 for i in 1 .. N do if lines [ 1 ] [ i - 1 ] < = min then answer + = 1 min = lines [ 1 ] [ i - 1 ] end end print answer array = gets . split . map ( & : to _ i ) def factorization ( m ) ary = [ ] s = Math . sqrt ( m . to _ f ) . to _ i for i in ( 2 .. s ) r = 0 while m % i = = 0 m = m / i r + = 1 end unless r = = 0 ary . push ( [ i , r ] ) end end if ( m > s ) ary . push ( [ m , 1 ] ) end return ary end n = array [ 0 ] p = array [ 1 ] factor _ s = factorization ( p ) ans = 1 factor _ s . each { | fs | while fs [ 1 ] > = n ans * = fs [ 0 ] fs [ 1 ] - = n end } p ans k , s = gets . split . map ( & : to _ i ) x = 0 y = 0 z = 0 ans = 0 ( 0 .. k ) . each do | x | ( 0 .. k ) . each do | y | break if x + y > s ans + = 1 if x + y + k > = s end end puts ans eval " N , X , * A = " + ` dd ` . split * ? , p A . map { A = A . zip ( b = A . rotate ) . map & : min b . sum + X * ~ $ . - = 1 } . min _ = $ stdin . gets kinds = $ stdin . gets . chomp . split ( ' ' ) . uniq . length print kinds = = 3 ? ' Three ' : ' Four ' array = [ ] array < < gets . chomp . to _ i array < < gets . chomp . to _ i array < < gets . chomp . to _ i array < < gets . chomp . to _ i array < < gets . chomp . to _ i k = gets . chomp . to _ i combinations = array . combination ( 2 ) . to _ a combinations . each do | c | if c [ 0 ] > c [ 1 ] then dist = c [ 0 ] - c [ 1 ] else dist = c [ 1 ] - c [ 0 ] end if dist > k then puts " : ( " exit ( ) end end puts " Yay ! " n = gets . to _ i ps = gets . split . map & : to _ i ps = ps . map . with _ index { | x , i | [ x , i ] } . sort { | a , b | a [ 0 ] < = > b [ 0 ] } count = 0 memo = n ps . each { | p | if p [ 1 ] < memo then count + = 1 memo = p [ 1 ] end } puts count a = STDIN . gets ( ) . to _ i b = STDIN . gets ( ) . to _ i c = STDIN . gets ( ) . to _ i d = STDIN . gets ( ) . to _ i e = STDIN . gets ( ) . to _ i k = STDIN . gets ( ) . to _ i if ( e - a ) < = k puts " Yay ! " else puts " : ( " end n , p = gets . chomp . split ( " " ) . map ( & : to _ i ) number = 2 if ( n = = 1 ) puts p else divisionNumber = 1 loop do temp _ number _ n = number * * n divisionNumber = number if ( p % temp _ number _ n = = 0 ) if ( ( p % temp _ number _ n = = 0 | | ( p % temp _ number _ n ! = 0 & & p > temp _ number _ n ) ) ) number + = 1 else break end end puts divisionNumber end k , s = gets . split . map & : to _ i w = 0 ( 0 .. k ) . each do | x | ( 0 .. k ) . each do | y | z = s - x - y w + = 1 if z . between ? ( 0 , k ) end end puts w antennas = Array . new ( 5 ) do gets . chomp . to _ i end k = gets . chomp . to _ i max _ diff = antennas . combination ( 2 ) . map { | a , b | ( a - b ) . abs } . sort . max if max _ diff < = k puts ' Yay ! ' else puts ' : ( ' end a = gets ( ) . to _ i b = gets ( ) . to _ i c = gets ( ) . to _ i d = gets ( ) . to _ i e = gets ( ) . to _ i k = gets ( ) . to _ i flag = true arr = [ a , b , c , d , e ] 0 . upto ( 3 ) { | i | ( i + 1 ) . upto ( 4 ) { | j | flag = false if arr [ j ] - arr [ i ] > k } } puts ( flag ? " Yay ! " : " : ( " ) n = gets . to _ i S = gets . chomp . to _ s if S . include ? ( " P " ) & & S . include ? ( " W " ) & & S . include ? ( " G " ) & & S . include ? ( " Y " ) puts " Four " else puts " Three " end a = gets . split . map ( & : to _ i ) . sort . uniq if a . size = = 4 & & ( a - [ 1 , 9 , 7 , 4 ] ) = = [ ] puts " YES " else puts " NO " end a = 5 . times . map { gets . to _ i } k = gets . to _ i if a [ 4 ] - a [ 0 ] < = k then puts " Yay ! " else puts " : ( " end k , s = gets . split . map & : to _ i ; p [ * 0 .. k ] . repeated _ permutation ( 2 ) . count { | x , y | z = s - x - y ; 0 < = z & & z < = k } n = gets . to _ i a = gets . split . map & : to _ i m = a [ 0 ] p a . count { | x | t = x < = m m = x if x < m t } n = gets . chomp . to _ i res = 1 while res < = n do break if res * 2 > n res = res * 2 end print res N = gets . to _ i ( 1 .. 3500 ) . each do | a | ( 1 .. 3500 ) . each do | b | next if ( 4 * a * b - N * b - N * a ) . zero ? c , m = ( N * a * b ) . divmod ( 4 * a * b - N * b - N * a ) next if m > 0 | | c < = 0 puts [ a , b , c ] . join ( ' ' ) exit end end class Main def self . main min = 123 max = 0 5 . times do a = read min = a if a < min max = a if a > max end k = read puts max - min < = k ? ' Yay ! ' : ' : ( ' end def self . read gets . chomp . to _ i end end Main . main x = ( 1 .. 5 ) . map { | e | gets . to _ i } k = gets . to _ i puts x [ 4 ] - x [ 0 ] > k ? ' : ( ' : ' Yay ! ' a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i if e - a < = k puts " Yay ! " else puts " : ( " end require ' prime ' N , P = gets . chomp . split . map ( & : to _ i ) prime _ div = P . prime _ division if prime _ div . count = = 0 puts 1 else ans = 1 prime _ div . each do | a | n = a [ 1 ] / N if n > = 1 n . times do ans * = a [ 0 ] end end end puts ans end r = [ ] res = " Yay ! " 5 . times do | i | r < < gets . to _ i end k = gets . to _ i for i in 0 .. 4 for j in 0 .. 4 if ( r [ i ] - r [ j ] ) . abs > k res = " : ( " end end end puts res module HinaArare def solve ( s ) for i in 1 .. s . size do if s [ i ] = = ' Y ' return ' Four ' end end return ' Three ' end end include HinaArare gets s = gets . split ( " " ) puts solve ( s ) count = 0 ans = 0 xmax , num = gets . split . map & : to _ i preans = 0 for i in 0 .. xmax jmax = [ num - i , xmax ] . min for j in 0 .. jmax if num - i - j > = 0 & & num - i - j < = xmax then ans + = 1 end end end puts ans require ' pp ' def gets _ i _ list ( ) gets . chomp . split ( " " ) . map ( & : to _ i ) end b = [ ] b . push ( gets _ i _ list ) b . push ( gets _ i _ list ) b . push ( gets _ i _ list ) b . each _ with _ index do | row , i | b1 , b2 , b3 = row bb1 , bb2 , bb3 = b [ i - 1 ] if b1 - bb1 = = b2 - bb2 & & b2 - bb2 = = b3 - bb3 & & b1 - bb1 = = b3 - bb3 else puts " No " exit end end puts " Yes " gets a , c = 0 , 1 $ < . each { | s | i = s . to _ i a + = ( i - 1 ) / c c + = 1 if c = = 1 | | i = = c } p a char = gets arr = char . split ( ' ' ) arr . sort ! if arr [ 0 ] . to _ i = = 1 & & arr [ 1 ] . to _ i = = 4 & & arr [ 2 ] . to _ i = = 7 & & arr [ 3 ] . to _ i = = 9 puts ' YES ' else puts ' NO ' end n = gets . to _ i as = gets . split . map & : to _ i bs = gets . split . map & : to _ i asum = as . sum bsum = bs . sum if asum < bsum puts - 1 exit end pos = [ ] neg = 0 cnt = 0 as . zip ( bs ) do | ( a , b ) | c = a - b if c < 0 neg + = c cnt + = 1 elsif c > 0 pos < < c end end pos = pos . sort . reverse while neg < 0 neg + = pos . shift cnt + = 1 end p cnt puts ( gets . split . sort * ' ' = = " 1479 " ? " YES " : " NO " ) C = Array . new ( 3 ) { gets . split . map ( & : to _ i ) } Y = [ 0 ] X = C [ 0 ] Y [ 1 ] = C [ 1 ] [ 0 ] - X [ 0 ] Y [ 2 ] = C [ 2 ] [ 0 ] - X [ 0 ] answer = true for i in 1 .. 2 for j in 1 .. 2 if C [ i ] [ j ] ! = X [ j ] + Y [ i ] answer = false end end end puts answer ? " Yes " : " No " n = gets . chomp . split puts n . permutation ( 4 ) . any ? { | a , b , c , d | a + b + c + d = = " 1794 " } ? : YES : : NO n = gets . to _ i s = gets . gsub ( " " , " " ) puts s [ " Y " ] ? " Four " : " Three " ret = 0 k , s = gets . split . map ( & : to _ i ) for i in 0 .. k for j in 0 .. k ret + = 1 if s - j - i < = k & & s - j - i > = 0 end end puts ret K , S = gets . split . map ( & : to _ i ) count = 0 ( K + 1 ) . times do | x | ( K + 1 ) . times do | y | z = S - x - y count + = 1 if z > = 0 & & z < = K end end puts count k , s = gets . split . map ( & : to _ i ) cnt = 0 f = [ s - k * 2 , 0 ] . max f . upto ( k ) do | x | f . upto ( k ) do | y | cnt + = 1 if 0 < = s - x - y & & s - x - y < = k end end p cnt n = gets . to _ i def create _ array ( n , ary ) return ary [ n ] = 1 if n = = 0 ary [ n ] = create _ array ( n - 1 , ary ) * 2 ary [ n ] end ary = [ ] create _ array ( 7 , ary ) ary . each _ cons ( 2 ) { | a , b | puts a if ( a ... b ) . include ? ( n ) } a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i isok = ( ( [ a , b , c , d , e ] . max ( ) - [ a , b , c , d , e ] . min ( ) ) < = k ) if isok puts " Yay ! " else puts " : ( " end k , s = gets . strip . split . map ( & : to _ i ) ans = 0 ( k + 1 ) . times { | x | ( k + 1 ) . times { | y | ans + = 1 if ( x + y < = s & & s - x - y < = k ) } } puts ans require ' prime ' n , x = gets . split . map ( & : to _ i ) a = Prime . prime _ division ( x ) ans = 1 a . each do | p , c | if n < = c ans * = p * * ( c / n ) end end puts ans a = ( gets ) . to _ i b = ( gets ) . to _ i c = ( gets ) . to _ i d = ( gets ) . to _ i e = ( gets ) . to _ i k = ( gets ) . to _ i antenas = [ a , b , c , d , e ] chk = true antenas . combination ( 2 ) do | p , q | if ( p - q ) . abs > k then chk = false break end end if chk then puts " Yay ! " else puts " : ( " end n = gets . chomp . split . map ( & : to _ i ) . sort ! x = " 1 9 7 4 " . chomp . split . map ( & : to _ i ) . sort ! if n = = x then puts " YES " else puts " NO " end N , M = gets . split . map & : to _ i Mod = 10 * * 9 + 7 Xs = gets . split . map ( & : to _ i ) Ys = gets . split . map ( & : to _ i ) xx = ( 0 ... N - 1 ) . map { | i | Xs [ i + 1 ] - Xs [ i ] } yy = ( 0 ... M - 1 ) . map { | i | Ys [ i + 1 ] - Ys [ i ] } x = ( 0 ... xx . size ) . reduce ( 0 ) { | a , i | b = ( i + 1 ) * ( xx . size - i ) % Mod * xx [ i ] % Mod ( a + b ) % Mod } y = ( 0 ... yy . size ) . reduce ( 0 ) { | a , i | b = ( i + 1 ) * ( yy . size - i ) % Mod * yy [ i ] % Mod ( a + b ) % Mod } p x * y % Mod N = gets . to _ i P = gets . chomp . split ( " " ) . map ( & : to _ i ) count = 0 min = P [ 0 ] P . each _ with _ index do | x , i | if i = = 0 count + = 1 elsif min > = x min = x count + = 1 end end puts " n = gets . chomp . to _ i s = gets . chomp . split ( " " ) count = 0 arr = Float : : INFINITY n . times do | i | mokuteki = s [ i ] arr = [ mokuteki . to _ i , arr ] . min if mokuteki . to _ i < = arr count + = 1 end end puts count N = gets . to _ i x = 3500 1 . upto ( x ) do | i | i . upto ( x ) do | j | r = Rational ( 4 * i * j - N * j - N * i , N * i * j ) if r . numerator = = 1 puts [ i , j , r . denominator ] . join ( ' ' ) exit end end end require ' prime ' n , q = gets . split . map & : to _ i ret = 1 ps = Prime . prime _ division ( q ) ps . each { | a | if a [ 1 ] > = n ( a [ 1 ] / n ) . times { ret * = a [ 0 ] } end } p ret N , P = gets . split . map & : to _ i require ' prime ' c = 1 Prime . prime _ division ( P ) . each { | x | if x [ 1 ] > = N then c * = x [ 0 ] * * ( x [ 1 ] / N ) end } p c n = gets . to _ i size = gets . split . uniq . size puts size = = 4 ? ' Four ' : ' Three ' k , s = gets . split . map ! ( & : to _ i ) if 3 * k < s then puts 0 elsif 3 * k = = s puts 1 else ans = 0 0 . upto ( k ) do | x | 0 . upto ( k ) do | y | break if x + y > s ans + = 1 if s - x - y < = k end end puts ans end K , S = gets . chomp . split . map ( & : to _ i ) sum = 0 ( K + 1 ) . times do | i | break if i > S ( K + 1 ) . times do | j | break if i + j > S sum + = 1 if K > = ( S - i - j ) end end puts sum t1 , t2 = gets . split . map ( & : to _ i ) a1 , a2 = gets . split . map ( & : to _ i ) b1 , b2 = gets . split . map ( & : to _ i ) x1 = ( a1 - b1 ) * t1 x2 = ( a2 - b2 ) * t2 if ( x1 > 0 ) ^ ( x2 > 0 ) then x1 , x2 = - x1 , - x2 if x1 < 0 sub = - ( x1 + x2 ) if sub = = 0 then puts " infinity " elsif sub < 0 puts 0 else ans = ( x1 / sub ) * 2 ans + = ( x1 % sub = = 0 ) ? 0 : 1 puts ans end else puts 0 end n = gets . to _ i a = gets . chomp . split . map ( & : to _ i ) cnt = 0 b = a . max n . times do | i | if b > = a [ i ] cnt + = 1 b = a [ i ] end end puts cnt N = gets . to _ i P = gets . split . map ( & : to _ i ) ans = 0 min = P [ 0 ] P . each do | pi | if pi < = min ans + = 1 min = pi end end puts ans n = gets . to _ i a = gets . chomp . split . map ( & : to _ i ) counter = 0 b = a . max n . times do | i | if b > = a [ i ] counter + = 1 b = a [ i ] end end p counter require ' pp ' n = gets . chomp ! . to _ i s _ n = gets . chomp ! . split ( " " ) puts s _ n . group _ by { | s | s } . length = = 4 ? ' Four ' : ' Three ' a = STDIN . gets . to _ i 3 . times { | _ | STDIN . gets } e = STDIN . gets . to _ i k = STDIN . gets . to _ i if e - a > k STDOUT . puts ' : ( ' else STDOUT . puts ' Yay ! ' end a = gets . to _ i b = gets . to _ i c = gets . to _ i d = gets . to _ i e = gets . to _ i k = gets . to _ i puts k > = e - a ? ' Yay ! ' : ' : ( ' n = gets . to _ i if n = = 1 puts n exit end ary = [ 2 ] 6 . times { ary < < ary [ - 1 ] * 2 } ary . each _ cons ( 2 ) do | a , b | if ( a ... b ) . include ? ( n ) puts a exit end end def ascan ; gets . split . map ( & : to _ i ) ; end field = ( 0 .. 2 ) . map { ascan } ok = true 2 . times do | y | 2 . times do | x | ok & = field [ y ] [ x + 1 ] - field [ y ] [ x ] = = field [ y + 1 ] [ x + 1 ] - field [ y + 1 ] [ x ] end end 2 . times do | x | 2 . times do | y | ok & = field [ y + 1 ] [ x ] - field [ y ] [ x ] = = field [ y + 1 ] [ x + 1 ] - field [ y ] [ x + 1 ] end end puts ok ? " Yes " : " No "