#K70222. Pair Sum Finder

    ID: 33261 Type: Default 1000ms 256MiB

Pair Sum Finder

Pair Sum Finder

You are given a list of integers and a target integer (T). Your task is to determine if there exist two different elements in the list (at distinct positions) whose sum equals (T). In other words, find if there exist indices (i) and (j) with (i \neq j) such that (a_i + a_j = T). If such a pair exists, print True; otherwise, print False.

inputFormat

The input is given via standard input (stdin) in the following format:

Line 1: An integer (n) representing the number of elements in the list. Line 2: (n) space-separated integers representing the list elements. Line 3: An integer (T) representing the target sum.

It is guaranteed that (0 \le n \le 10^5) and the integers are within a reasonable range.

outputFormat

Output a single line to standard output (stdout) with True if there exists a pair of distinct numbers that add up to (T), otherwise output False.## sample

4
1 2 3 4
5
True