#K55942. Pair With Sum

    ID: 30087 Type: Default 1000ms 256MiB

Pair With Sum

Pair With Sum

Given an array of integers and a target sum, determine whether there exists a pair of distinct elements in the array whose sum is exactly equal to the target sum. The same element cannot be used twice unless it appears multiple times in the array.

Formally, given an array \(A\) of \(n\) integers and an integer \(T\), find if there exist two indices \(i\) and \(j\) (with \(i \neq j\)) such that \(A_i + A_j = T\).

inputFormat

The first line contains two integers (n) and (T), where (n) is the number of elements in the array and (T) is the target sum. The second line contains (n) space-separated integers representing the array.

outputFormat

Output 'True' (without quotes) if there exist two distinct elements in the array whose sum equals (T), otherwise output 'False' (without quotes).## sample

4 5
1 2 3 4
True

</p>