Why this is showing error for FLOW004

#include <bits/stdc++.h>
using namespace std;

int main() {
int T;
int num;

cin>>T;
while(T--){
    cin>>num;
    int last=num%10;
    int first;
    while(num>10){
        num=num/10;
    }
    first=num;
    cout<<first+last<<endl;
}
return 0;

}

Consider the test input:

1
10

the code works fine with same input in vs code but it is showing wrong answer in codechef why ??