Help me in solving TOOFAR problem

My issue

Pls help, I am new here and I am unable to figure out the solution.
Pls explain this with an example test case if possible

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here


Problem Link: Too Far For Comfort Practice Coding Problem

if you are new you have to start with easy level problem
and you are doing a question having rating over 2800
first start problem having rating less than 1000