#K56642. Two Sum Problem

    ID: 30244 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

You are given an array of integers and a target integer \(T\). Your task is to determine whether there exist two distinct elements \(a_i\) and \(a_j\) in the array such that their sum equals \(T\), i.e., \(a_i + a_j = T\) with \(i \neq j\).

The problem requires a simple yet efficient solution. Consider using a hash-based approach to achieve an average time complexity of \(O(n)\). Read the input from the standard input and output the result to the standard output.

inputFormat

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

outputFormat

Output a single line containing either True or False. Output True if there exist two distinct numbers in the array that add up to \(T\); otherwise, output False.

## sample
4 9
2 7 11 15
True