For this Question: Given an array of N integers that may contain duplicate elements and an integer K, find if there exists a pair of integers (i, j) such that i < j and arr[i]=arr[j] and i and j are exactly k distance apart i.e ( j - i ) = k.The first line of input contains two integers N and K, next line contains N space-separated integers.

<b>Constraints:-</b>
1 < = N < = 10<sup>5</sup>
1 < = K < = N
1 < = Arr[i] < = 10<sup>9</sup>Print 1 if there exist elements else print 0.Sample Input:
4 3
1 2 2 1

Sample Output:
1

<b>Explanation:- </b>
Pair at index 1, 4 is the required answer so output=1, I have written this Solution Code: 
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 10000001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main(){
     
int n,k;
cin>>n>>k;
ll a[n];
FOR(i,n){
cin>>a[i];}
FOR(i,n-k){
if(a[i]==a[i+k]){out(1);return 0;}
}
out(0);
}
/*
1
4 5
02_20
21212
_121_
__2__
*/
, In this Programming Language: C++, Now tell me if this Code is compilable or not?