#C3009. Miller-Rabin Primality Test
Miller-Rabin Primality Test
Miller-Rabin Primality Test
In this problem, you are required to determine whether given integers are prime or composite using the Miller-Rabin probabilistic primality test. The Miller-Rabin test is a fast and efficient algorithm that, with a fixed number of iterations, can decide if a number is prime with high probability.
Your program must read input from standard input (stdin) and write the results to standard output (stdout). For each integer, output 'YES' if the number is prime and 'NO' if it is not.
inputFormat
The input begins with a line containing a single integer N, representing the number of integers to test. The next line contains N space-separated integers.
outputFormat
Output a single line with N space-separated strings. For each integer, print 'YES' if it is prime (according to the Miller-Rabin test) or 'NO' if it is composite.## sample
5
2 17 18 19 20
YES YES NO YES NO
</p>