WA in Playing with Matches

#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(void) {
int *arr=(int *)malloc(10*sizeof(int));
arr[48]=6;arr[49]=2;arr[50]=5;arr[51]=5;arr[52]=4;arr[53]=5;arr[54]=6;arr[55]=3;arr[56]=7;arr[57]=6;

int t;
scanf("%d",&t);
 char *str=(char *)malloc(sizeof(char) * (int)pow(10,6));
while(t--)
 {
      long long int a,b,c,i,k;
      scanf("%lld%lld",&a,&b);
      c=a+b;
      sprintf(str,"%lld",c);
  
        
      long long int count=0;
      for(i=0;i<strlen(str);++i)
       {
            k=(int)str[i];
           count+=arr[k];
       }
       printf("%lld\n",count);
   
 }
 free(arr);
 free(str);
 
	return 0;
}

Here is my code please help figure out what is wrong !