#C2237. Find a Pair with a Given Sum

    ID: 45531 Type: Default 1000ms 256MiB

Find a Pair with a Given Sum

Find a Pair with a Given Sum

Given a list of integers and a target value \( t \), determine whether there exists a pair of distinct integers in the list whose sum equals \( t \). In other words, you need to check if there exist two different indices \( i \) and \( j \) such that \( nums[i] + nums[j] = t \).

The input is provided via standard input, and the output should be printed to standard output. If a valid pair exists, print 1; otherwise, print 0.

inputFormat

The first line contains two integers \( n \) and \( t \), where \( n \) is the number of integers in the list, and \( t \) is the target sum.

The second line contains \( n \) space-separated integers representing the list \( nums \).

Note: \( n \) can be zero, meaning the list is empty.

outputFormat

Output a single integer: 1 if there exists a pair of distinct integers whose sum is equal to \( t \), otherwise 0.

## sample
5 9
1 2 3 4 5
1