Find permutation of numbers upto N with a specific sum in a specific range

#include using namespace std;  bool possible(int x, int S, int N){              int minSum = (x * (x + 1)) / 2;              int maxSum = (x * ((2 * N) – x + 1)) / 2;              if (S < minSum || S > maxSum) {        return false;    }    return true;}  void findPermutation(int N, int L,                     int R, int S){              int x = R – L + 1;              if (!possible(x, S, N)) {                  cout = 1; –i) {                                                  if ((S – i) >= 0                && possible(x – 1, S – i,                            i – 1)) {                                  S = S – i;                                                  x–;                                  v.push_back(i);            }                          if (S == 0) {                                  break;            }        }                  if (S != 0) {                          cout