#C4291. Integer Set Queries
Integer Set Queries
Integer Set Queries
You are given an initially empty set of integers. Your task is to process a sequence of queries to update or inspect the set. There are three types of queries:
- Add Operation: Query type 0. Add a given integer \(x\) to the set.
- Remove Operation: Query type 1. Remove a given integer \(x\) from the set if it exists.
- Check Operation: Query type 2. Determine if a given integer \(x\) is present in the set. If present, output \(\text{YES}\); otherwise, output \(\text{NO}\).
The operations are given one per line, and the check operations produce output which must be printed to standard output. The solution must read from standard input (stdin) and write to standard output (stdout).
inputFormat
The first line of input contains a single integer (Q), the number of queries. Each of the following (Q) lines contains a query in the format "command x", where command is an integer (0, 1, or 2) representing the operation type, and (x) is the integer value associated with the query.
outputFormat
For each query of type 2 (check operation), output a single line containing the string (YES) if (x) is in the set, or (NO) otherwise.## sample
6
0 5
0 10
1 5
2 5
1 15
2 10
NO
YES
</p>