Can someone point out error int this question which was name bytelandian gold coins

#include
#include
using namespace std;
int main()
{
int temp,b=2;
cin>>temp;
vector a,result,res1;
while(!cin.fail())
{
a.push_back(temp);
cin>>temp;
}
for(unsigned int i=0;i<a.size();i++)
{
for(int j=0;j<3;j++)
{
int t;
t=a[i]/b;
b++;
result.push_back(t);
}
}
for(unsigned int i=0;i<result.size();i=i+3)
{
int sum=0;
for(int j=i;j<3;j++)
{
sum=sum+result[j];
}
res1.push_back(sum);
}
for(unsigned int i=0;i<res1.size();i++)
{
if(res1[i]>a[i]){
cout<<res1[i]<<endl;
}
else{
cout<<a[i]<<endl;
}
}
return 0;
}

//