Help me in solving CHMOD problem

My issue

Can u tell me whats wrong in my code:-
Chef and Segments:-

include <bits/stdc++.h>
using namespace std;
const int N = 1e5+7;
int pf[N];

int binExp(int a, int b, int m) {
int result = 1;
while(b > 0) {
if(b&1) {
result = (result * 1LL * a) % m;
}
a = (a * 1LL * a) % m;
b >>= 1;
}
return result;
}

int main() {
int n;
cin >> n;
int arr[n];
pf[0] = 1;
for(int i = 1; i <= n; ++i) {
cin >> arr[i];
pf[i] = pf[i - 1] * arr[i];
}

int t;
cin >> t;
while(t--) {
    int l, r, m;
    cin >> l >> r >> m;
    // ans = ((pf[r]/pf[l]) * l) % m;
    int ans = (l % m);
    int den = (pf[r] * 1LL * binExp(pf[l], m-2, m)) % m;
    ans = (ans * 1LL * den) % m;
    cout << ans << endl;
}

return 0;

}

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	return 0;
}

Problem Link: CHMOD Problem - CodeChef