# PROBLEM LINK:

**Setter:** Kanhaiya Mohan

**Tester:** Nishant Shah

**Editorialist:** Shivam Thakur

# DIFFICULTY

Cakewalk

# PREREQUISITES

Basic-implementation skills

# PROBLEM

Given two arrays A and B of length N, along with 2 integers X and K. You need to find if the number of indices for which abs(A[i] - B[i]) <= K exceeds X or not.

# EXPLANATION

This problem uses a simple implementation of comparing values.

You can use a for loop to count the number of indices for which abs(A[i] - B[i]) <= K. Then compare the count with X. If the count is greater than or equal to X, print “Yes”, else print “No”.

# TIME COMPLEXITY

O(N) where N is the size of arrays

# SOLUTIONS

## Setter's Solution

```
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while(t--){
int n, x, k;
cin >> n >> x >> k;
int a[n], b[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < n; i++){
cin >> b[i];
}
int cnt = 0;
for(int i = 0; i < n; i++){
if(abs(a[i] - b[i]) <= k){
cnt++;
}
}
if(cnt >= x){
cout << "YES\n";
}else{
cout << "NO\n";
}
}
return 0;
}
```