Max M increment Problem https://hack.codingblocks.com/app/dcb/315

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

// Function to find the maximum element after
// m operations
int findMax(int n, int a[], int b[], int k[], int m)
{
int arr[n];
memset(arr, 0, sizeof(arr));

// start performing m operations 
for (int i = 0; i< m; i++) 
{ 
    // Store lower and upper index i.e. range 
    int lowerbound = a[i]; 
    int upperbound = b[i]; 

    // Add 'k[i]' value at this operation to 
    // whole range 
    for (int j=lowerbound; j<=upperbound; j++) 
        arr[j] += k[i]; 
} 

// Find maximum value after all operations and 
// return 
int res = INT_MIN; 
for (int i=0; i<n; i++) 
    res = max(res, arr[i]); 

return res; 

}

// Driver code
int main()
{
// Number of values
int m;
int n;
cin>>n>>" ">>m;

int a[n];
int b[n];
int k[m];
for(int i =0;i<n;i++)
{
cin>>a[i];
}
for(int i =0;i<n;i++)
{
cin>>b[i];
}
for(int i =0;i<m;i++)
{
cin>>k[i];
}

  cout  << findMax(n, a, b, k, m); 
return 0; 

}
SIR WHAT IS WRONG IN THE CODE PLEASE HELP.

save your code at https://ide.codingblocks.com/ and send the link generated


this is the link.

5 3
0 1 100
1 4 100
2 3 100.
these are three queries
why you store them in an array of size n=5 ??

you have write
for(int i =0;i<n;i++)

{

cin>>a[i];

}

this will store first 5 elements

what you want to do??
can you expain

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

https://ide.codingblocks.com/s/242387 sir this is the link of my code.