#C12462. Pair Difference Finder
Pair Difference Finder
Pair Difference Finder
Given a list of integers and a target integer, determine whether there exists a pair of elements in the list whose difference is exactly equal to the target value. Formally, for a given array \(A = [a_1, a_2, \ldots, a_n]\) and an integer \(d\), find if there exists a pair \((a_i, a_j)\) such that \(a_i - a_j = d\).
You are required to read input from standard input (stdin) and output your answer to standard output (stdout). The answer should be either True
or False
.
inputFormat
The first line contains two integers, (n) (the number of elements in the list) and (d) (the target difference). The second line contains (n) space-separated integers representing the list.
outputFormat
Output a single line with either True
if there exists at least one pair ((a_i, a_j)) in the list such that (a_i - a_j = d), or False
otherwise.## sample
4 2
1 4 5 7
True