#K46802. Pair Sum Problem

    ID: 28057 Type: Default 1000ms 256MiB

Pair Sum Problem

Pair Sum Problem

Given an array of integers and a target sum, determine whether there exist two distinct elements in the array such that their sum is equal to the target. Two indices must be distinct even if the numbers are identical. If such a pair exists, output Yes, otherwise output No.

The answer should be implemented in a program that reads input from standard input (stdin) and writes the result to standard output (stdout). All formulas, if any, must be written in LaTeX format. For instance, if you need to reference the condition, you can note: \(a_i + a_j = \text{target}\) for some \(i \neq j\).

inputFormat

The input is given via standard input and has the following format:

<integer n>
<n space-separated integers>
<integer target>

Here, n denotes the number of elements in the array, followed by the array elements, and finally the target sum value.

outputFormat

The output is a single line containing either Yes if there exists a pair of distinct elements whose sum equals the target, or No if no such pair exists.

## sample
5
1 2 3 4 5
9
Yes