Calculate stock span

#include <bits/stdc++.h>
#include
#include
using namespace std;
vectorspan(int p[],int n){
stackst;
vectorv;
v.push_back(1);
st.push(0);
for(int i=1;i<n;i++){
while(!st.empty() and st.top()<=p[i]){
st.pop();
}
if(st.empty())
{
v.push_back(i+1);
}
else{
v.push_back(st.top()-i);
}
st.push(i);
}
for(int i=0;i<n;i++){
cout<<v[i]<<endl;
}
}
int main()
{
int p[100],n;
cin>>n;
for(int i=0;i<n;i++){
cin>>p[i];
}

span(p, n); 

return 0; 

}

I’m not getting any output for my code.

kindly share link of your code

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.