Chewbacca and Number

#include
#include<math.h>
using namespace std;
typedef long long int ll;
int main()
{
ll n;
cin>>n;
ll a=0,b=0;
ll r=0,d=0,countt=0;
while (n>0)
{
r=n%10;
d=9-r;
if (d<r)
r=d;
n=n/10;
a=a10+r;
if (a==0)
countt++;
}
while (a>0)
{
r=a%10;
a=a/10;
b=b
10+r;
}
ll k=(int)(pow(10,countt)+0.5);
b=b*k;
cout<<b;
return 0;
}

Why this code is failing two test cases.

Please save your code on ide.codingblocks.com and then share its link.

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.