C1. Distinguish zero state and plus state with minimum error
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given a qubit which is guaranteed to be either in state or in state.

Your task is to perform necessary operations and measurements to figure out which state it was and to return 0 if it was a state or 1 if it was state. The state of the qubit after the operations does not matter.

Note that these states are not orthogonal, and thus can not be distinguished perfectly. In each test your solution will be called 1000 times, and your goal is to get a correct answer at least 80% of the times. In each test and states will be provided with 50% probability.

You have to implement an operation which takes a qubit as an input and returns an integer.

Your code should have the following signature:

namespace Solution {
open Microsoft.Quantum.Primitive;
open Microsoft.Quantum.Canon;

operation Solve (q : Qubit) : Int
{
body
{
// your code here
}
}
}