#K89317. Pair with Target Sum

    ID: 37504 Type: Default 1000ms 256MiB

Pair with Target Sum

Pair with Target Sum

Given an integer n, a list of n integers, and a target sum T, determine whether there exists a pair of distinct elements in the list whose sum equals T.

In mathematical terms, find two indices i and j (with i ≠ j) such that:

$$a_i + a_j = T$$

If such a pair exists, print "FOUND"; otherwise, print "NOT FOUND".

inputFormat

The input is given through stdin and consists of three lines:

  • The first line contains an integer n, the number of elements in the list.
  • The second line contains n space-separated integers representing the list elements.
  • The third line contains an integer target, the target sum.

outputFormat

Output a single line to stdout containing "FOUND" if there is a pair of numbers whose sum equals the target, otherwise output "NOT FOUND".

## sample
5
1 4 45 6 10
16
FOUND