C++ simple solution without DP :)
let us say we have pairs with index i and j , and ( i < j) ,,  \n what are we gonna do is ,, we will start our iteration from end of an array and lets suppose t
let us say we have pairs with index i and j , and ( i < j) ,,  \n what are we gonna do is ,, we will start our iteration from end of an array and lets suppose to understand that the second element (present on jth index) of the  pair you want to fulfill your needs is the last element as of now , and we will maintain a variable named as cur ,, which will be initially equal to value of last element (also the jth element we have chosen ) ,, then we wil start reverse iteration from back of our array ,,also at every step of iteration we will decrease value of cur by 1 (cur--) lets suppose we have found our first member of desired pair (we will understand afterwards while writing how we will get our first member )  and when we came to our first member you can realise that at present value of cur is the subtraction of  value of second member of our pair and difference between first member and second member (i.e j-i)  so in order to meet the need of our question ,, we just have to add the value of our first memeber ,, and we are good to go :)\n \n ```\n int maxScoreSightseeingPair(vector<int>& values) {\n     \n        int ans=INT_MIN;\n        int n=values.size();\n       \n        int cur=values[n-1]; // taking current as last element as we decided before\n        cur--;\n        for(int i=n-2;i>=0;i--){\n    ans=max(ans,cur+values[i]); // if we select the first member of our pair as current element of our iteration ,, if it brings out maximum ,, then we will update ans ,,else we wont update ans\n            \n            \n            \n            // now here twist comes in our story ,, if at any point we acheive element from our array whose value is greater than or equal to the current value we are carrying ,, then we will update cur with that element of array ,, this is we are doign becuase ,, there is no benefit of carrying forward our previous current because we want to acheive maximum value and we got element with whose value is greater than previous one //\n            if(cur<=values[i]){  \n                \n                cur=values[i];\n            }\n            \n            cur--;  // decreasing cur by 1 ,, as we decided it to do before \n        }\n        \n        return ans;\n    }\n\t```\n
['C']