{-# LANGUAGE BlockArguments #-} {-# OPTIONS_GHC -Wno-unused-imports #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} import Control.Monad import Control.Monad.Reader import Control.Monad.State.Strict import Control.Applicative import Data.Bool import Data.Char import Data.Function import Data.List import Data.Maybe import Data.Ord import Data.Ix (inRange) import Data.List.Split import Debug.Trace import qualified Data.Char as C -- import qualified Data.Set as Set -- import qualified Data.Map.Strict as M import qualified Data.ByteString.Char8 as BS import qualified Data.Vector as V -- import Text.Printf input = getLine :: IO String ii = readLn :: IO Int li = unfoldr (BS.readInt . BS.dropWhile C.isSpace) <$> BS.getLine printYn b = putStrLn $ bool "No" "Yes" b printList :: Show a => [a] -> IO () printList = putStrLn . unwords . map show puts = putStrLn divmod x y = (x `div` y, x `mod` y) ceildiv a b = (a + b - 1) `div` b len :: Foldable t => t a -> Int len = length rep = replicate repM :: Applicative m => Int -> m a -> m [a] repM = replicateM repM_ :: Applicative m => Int -> m a -> m () repM_ = replicateM_ -- chunksOf chunkBy = groupBy fold :: Foldable t => (b -> a -> b) -> b -> t a -> b fold = foldl' pairwise :: [a] -> [(a, a)] pairwise xs = zip xs (drop 1 xs) windows :: Int -> [a] -> [[a]] windows size xs | length w < size = [] | otherwise = w : windows size (drop 1 xs) where w = take size xs countIf f = length . filter f minmax [] = error "minmax: empty list" minmax (x:xs) = foldl' f (x, x) xs where f (mi, ma) y = (min mi y, max ma y) takeEnd :: Int -> [a] -> [a] takeEnd n = reverse . take n . reverse class Indexable c where at :: Int -> c a -> a instance Indexable [] where at i xs = xs !! i instance Indexable V.Vector where at i v = v V.! i isqrt = floor . sqrt . fromIntegral main = do p <- ii let x = isqrt p let f x = a + b == p where a = x*x b = (p - a) ^ 2 let b = any f [1..x] printYn b