Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define all(a) a.begin(),a.end()
using namespace std;

/*int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		string s1,s2;
		cin>>s1>>s2;

		if(s1.size()<s2.size()) swap(s1,s2);

		for(int j=s1.size()-1,k=s2.size()-1;j>=0;j--,k--){
			if(k>=0) s1[j]+=s2[k]-'0';
			if(s1[j]>'9'){
				s1[j]-=10;
				if(s2)
			}
			ans[j]=a%10;
			ans[j+1]=a/10;
			//cout<<" "<<j<<" "<<ans[j]<<endl;
		}
		if(ans[80]>0){
			cout<<"overflow"<<endl; return 0;
		}
		bool f=0;
		for(int i=80;i>=0;i--){
			if(f==0 && ans[i]>0){
				f=1; cout<<ans[i];
			}else if(f) cout<<ans[i];
		}
		cout<<endl;
	}
}*/

int main(){
    int n;
    cin>>n;
    rep(i,0,n){
        int ans[85]={};
        vector<int> n1(80,0),n2(80,0);
        //rep(j,0,81)cout<<n1[j]<<" "<<n2[j]<<endl;
        string s1,s2; 
        cin>>s1>>s2;
        //cout<<s1<<" "<<s2<<endl;
        int sz1=s1.size(),sz2=s2.size();
 
        //rep(j,0,sz1) n1[j]=s1[sz1-1-j]-'0';
        //rep(j,0,sz2) n2[j]=s2[sz2-1-j]-'0';
 		
 		reverse(all(s1));
 		reverse(all(s2));

        rep(j,0,s1.size()) n1[j]=s1[j]-'0';
        rep(j,0,s2.size()) n2[j]=s2[j]-'0';

        reverse(all(n1));
        reverse(all(n2));

        for(int j=79;j>=0;j--){
           // cout<<"  "<<j<<" "<<n1[j]<<" "<<n2[j]<<endl;
            ans[j]+=n1[j]+n2[j];
            if(ans[j]>9){
            	if(j>0) {
            		ans[j-1]=1;
            		ans[j]-=10;
            	}
            }
            //cout<<" "<<j<<" "<<ans[j]<<endl;
        }
        if(ans[0]>9){
            cout<<"overflow"<<endl; break;
        }
        bool f=0;
        for(int j=0;j<80;j++){
            if(f==0 && ans[j]>0){
                f=1; cout<<ans[j];
            }else if(f||j==79) cout<<ans[j];
        }
        cout<<endl;
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){

    string s;
    int n, num1[101], num2[101], num3[102], ldigit;

    cin >> n;

    for(int i = 0; i < n; ++i){

        memset(num1, 0, sizeof(num1));
        memset(num2, 0, sizeof(num2));
        memset(num3, 0, sizeof(num3));

        cin >> s;

        for(int i = 0, len = s.size(); i < len; ++i){
            num1[i] = s[len - 1 - i] - '0';
        }

        cin >> s;

        for(int i = 0, len = s.size(); i < len; ++i){
            num2[i] = s[len - 1 - i] - '0';
        }

        for(int i = 0, num; i < 101; ++i){
            num = num1[i] + num2[i] + num3[i];
            num3[i] = num % 10;
            num3[i + 1] = num / 10;
        }

        for(int i = 101; i >= 0; i--){
            if(num3[i] != 0){
                ldigit = i;
                break;
            }
        }

        if((ldigit + 1) >= 80){
            cout << "overflow" << endl;
        } else {
            for(int i = ldigit; i >= 0; i--){
                cout << num3[i];
            }
            cout << endl;
        }

    }

}