Help me in solving LBC21 problem

My issue

My code

// Update the code below to solve this problem

#include <iostream>
#include <string>
using namespace std;

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int P;
  cin>>P;
  if(P%100==0){
      if(P/100<=10){
      cout<<P/100<<endl;
      }
      else{
          cout<<-1<<endl;
      }
  }
  else if(P>=100){
    int q=P/100;
    if(((P-100)+q)<=10){
    cout<<q+(P-100)<<endl;
    }
    else{
        cout<<-1<<endl;
    }
  }
  else{
      if(P<=10){
      cout<<P<<endl;
      }
      else{
          cout<<-1<<endl;
      }
  }
  
   }
return 0;
}

Learning course: Solve Programming problems using C++
Problem Link: CodeChef: Practical coding for everyone

@aditeepankaj
Have coded it in a much simpler way hope u get it.
// Update the code below to solve this problem

include
include
using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
int P;
cin>>P;
int r=P%100;
P=P/100;
if(P+r<=10)
cout<<P+r;
else
cout<<-1;
cout<<endl;
}
return 0;
}