#K11641. Pair Sum Finder

    ID: 23514 Type: Default 1000ms 256MiB

Pair Sum Finder

Pair Sum Finder

Given an array arr of integers and an integer target, determine whether there exists a pair of distinct elements in the array whose sum is equal to target. Formally, find if there exist indices \(i\) and \(j\) with \(i \neq j\) such that

\[ arr[i] + arr[j] = target \]

If such a pair exists, output Yes; otherwise, output No.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer n representing the number of elements in the array.
  • If n > 0, the second line contains n space-separated integers, representing the array arr.
  • The next line contains an integer target representing the target sum.

outputFormat

Output a single line to standard output (stdout) containing either Yes if such a pair exists or No if it does not.

## sample
5
1 2 3 9 5
8
Yes