#C12334. Find a Pair with Given Sum

    ID: 41750 Type: Default 1000ms 256MiB

Find a Pair with Given Sum

Find a Pair with Given Sum

Given a list of integers and a target integer \(T\), your task is to determine whether there exist two distinct elements in the list whose sum equals \(T\).

You need to read the input from standard input and produce the result on standard output. The first line of input contains two integers: \(n\) (the number of elements in the list) and \(T\) (the target sum). The next line contains \(n\) integers separated by spaces. If there exists a pair of distinct elements \(a\) and \(b\) such that \(a+b=T\), output True. Otherwise, output False.

Note: A pair consists of two different elements in the list. Even if the same number appears more than once, you must choose two different occurrences.

inputFormat

The input consists of two lines:

  • The first line contains two integers \(n\) and \(T\), where \(n\) is the number of elements in the list and \(T\) is the target sum.
  • The second line contains \(n\) integers separated by spaces.

outputFormat

Output a single line to standard output: True if there exists a pair of distinct elements whose sum equals \(T\), otherwise output False.

## sample
6 6
3 5 1 7 4 2
True