#C733. Avoiding Triplets in an n×n Grid
Avoiding Triplets in an n×n Grid
Avoiding Triplets in an n×n Grid
Alice and Bob are playing a game on an n×n grid. In each turn, they fill an empty cell with the symbol 'A'. Alice wants to avoid a situation where three 'A' symbols appear consecutively in a straight line (horizontally, vertically, or diagonally). It turns out that by following a careful strategy, Alice can always avoid forming such a triplet if the grid is large enough. In particular, it can be shown that if ( n \geq 4 ), then Alice can always prevent any three 'A's from aligning consecutively, for example by using a checkerboard pattern. For grids where ( n < 4 ), avoiding a triplet becomes impossible. Your task is to determine, given the side length ( n ) of the grid, whether Alice can avoid forming any triplet of 'A's. Output "YES" if she can, and "NO" otherwise.
inputFormat
The input consists of a single integer ( n ) ((1 \le n \le 10^9)), representing the side length of the grid. The input is read from standard input (stdin).
outputFormat
Print a single line with either "YES" if Alice can avoid forming any triplets, or "NO" if she cannot, to standard output (stdout).## sample
3
NO