#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=b10+r;
}
ll k=(int)(pow(10,countt)+0.5);
b=b*k;
cout<<b;
return 0;
}
Why this code is failing two test cases.