Please help me with my code, I am getting wrong answer. Please tell me some cases where my code fails and suggest ways to improve it.

//My Code

#include <stdlib.h>

#include <stdio.h>

#include

using namespace std;

int min_positive(int *a, int size_a){
int m = 9, index;
for(int i = 1; i<size_a; i++){
if(m>a*){

m = a*;

index = i;

}

}

return index;

}

int min_all(int *a, int size_a){
int m = 9, index;
for(int i = 0; i<size_a; i++){
if(m>a*){

m = a*;

index = i;

}

}

return index;

}

int main(){

```
int t;
cin >> t;
while(t--){
int *a = new int[10];
for(int i = 0; i<10; i++){
cin >> a*;
}
int m,n;
m = min_positive(a,10);
if(a[m]==0){
cout << m << endl;
}
else{
a[m]--;
n = min_all(a,10);
m = m*10;
while(a[n]!=0){
m += n;
a[n]--;
n = min_all(a,10);
m *= 10;
}
cout << m+n << endl;
}
}
return 0;
```

}