i was solving problem MEOWIST
i dont the reason why i keep getting runtime error sisgev in this kind of problem
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
using namespace std;
int main()
{
string s;
int a[500];
for(int i=0;i<500;i++)
{
a[i]=-1;
}
vector<string> v;
vector<string>::iterator it;
int k=0;
while(cin>>s)
{
int age,i,check=0;
cin>>age;
for(i=k-1;i>=0;i--)
{
if(a[i]<age)
{
a[i+1]=age;
k++;
break;
}
if(a[i]==age)
{
check=1;
k++;
break;
}
else
{
a[i+1]=a[i];
}
}
if(i==-1)
{
a[0]=age;
k++;
}
if(check==1)
{
string s1=v[i];
if(s1>s)
{
i=i;
}
else{
i=i-1;
}
}
it=v.begin()+i+1;
// cout<<"to inseert at "<<i<<endl;
v.insert(it,1,s);
}
for(int i=k-1;i>=0;i--)
{
cout<<v[i]<<endl;
}
return 0;
}