im a new problem solver. recently i came across this problem on codeforces website. i managed to get the two values required for each turn depending on the number of turn given by the user, but i cant find the highest number of passenger at stop out of all.
#include <iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int turn,get_off,get_on,total_passenger,highest_total;
cin>>turn;
int* stops=new int(turn);
for(int i=0;i<turn;i++){
cin>>get_off>>get_on;
total_passenger=get_on-get_off;
stops[i]=total_passenger;
}
for(int i=0;i<turn;i++){
if(stops[i]>stops[i+1]){
highest_total=stops[i];
}
}
cout<<highest_total<<endl;
return 0;
}