#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.