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<iostream>
#include<string>
using namespace std;
int main(){
    int n,k=0;
    for(cin>>n;n--;){
        string a,b;
        cin >> a;
        cin >> b;
        if(a.size() < b.size()) swap(a,b);//????????????a>b?????????
        while(b.size() < a.size()) b = '0' + b;//????????????a==b?????????
        for(int i=a.size()-1;i>=0;i--){//???????????????????????????
            a[i] += b[i] - '0' + k;
            if(a[i] > '9'){
                a[i]-=10;
                k = 1;
            }
            else k = 0;
        }
        if(k)   a+="1";//??°??????????????????????????????????¶?????????¨???
        if(a.size() > 80)   cout << "overflow" << endl;
        else    cout << a << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	string s1, s2, sum;
	int n;
	cin >> n;
	while (n--) {
		cin >> s1 >> s2;
		int len = max(s1.size(), s2.size());
		for (int i = 0; i < len; i++) {
			sum += "0";
		}
		// ?????????????????????????????????????????????'0'??§??°????????????
		if (s1.size() < s2.size()) {
			// s1????????????????????§s2.size()-s1.size()?????????'0'?????°????????????
			// ??????s1??????????????????
			string r_s1 = "";
			for (int i = s1.size() - 1; i >= 0; i--) {
				r_s1 += s1[i];
			}
			// r_s1???s2.size()-s1.size()?????????'0'???????????°??????
			for (int i = 0; i < s2.size() - s1.size(); i++) {
				r_s1 += "0";
			}
			// r_s1????????????????????????
			s1 = "";
			for (int i = r_s1.size() - 1; i >= 0; i--) {
				s1 += r_s1[i];
			}
		}
		else {
			// ??????s2??????????????????
			string r_s2 = "";
			for (int i = s2.size() - 1; i >= 0; i--) {
				r_s2 += s2[i];
			}
			// s1.size()-s2.size()?????????'0'??§????????°??????
			for (int i = 0; i < s1.size() - s2.size(); i++) {
				r_s2 += "0";
			}
			// r_s2??????????????????
			s2 = "";
			for (int i = r_s2.size() - 1; i >= 0; i--) {
				s2 += r_s2[i];
			}
		}

		int carry = 0;
		char s;
		for (int i = 0; i < len; i++) {
			if (carry == 0) {
				s = s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0' + '0';
				if (s - '0' >= 10) {
					carry = 1;
					sum[len - 1 - i] = int((s - '0') % 10) + '0';
				}
				else {
					carry = 0;
					sum[len - 1 - i] = s;
				}
			}
			else {// carry over
				s = s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0' + '0' + 1;
				if (s - '0' >= 10) {
					carry = 1;
					sum[len - 1 - i] = int((s - '0') % 10) + '0';
				}
				else {
					carry = 0;
					sum[len - 1 - i] = s;
				}
			}
		}
		if (sum.size() > 80 || (sum.size() == 80 && carry == 1)) {
			cout << "overflow" << endl;
		}

		else {
			cout << (carry == 1 ? "1" : "");
			for (int i = 0; i < len; i++) {
				cout << sum[i] - '0';
			}
			cout << endl;
		}
	}
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    string a,b,c; char tmp;
    cin >> a >> b;
    if(a.size() > 80 || b.size() > 80){
      cout << "overflow" << endl;
      continue;
    }
    
    if(a.size() < b.size()){swap(a,b);}
    for(int k = 0;k< a.size();k++)
      c[k] = '0';
     for(int k = 0;k < b.size();k++){
       c[k] = b[b.size()-1-k];
     }
     b.resize(a.size());
     for(int k = 0;k < a.size();k++)
       {b[k] = c[k]; c[k] = a[k];} 
     for(int k = 0;k < a.size();k++){
      	a[a.size()-k-1] = c[k];
     }
	
     tmp = '0';
     for(int k = 0;k < a.size();k++){
       c[k] = a[k] + b[k] + tmp -'0' -'0';
	  if(c[k] > '9'){ tmp = '1'; c[k] = c[k] - ':' + '0'; }
     } 
     if(a.size() < 81 ){if(tmp == '1'){cout << tmp;}
       for(int k = a.size()-1;k >=0;k--){
	 cout << c[k]; 
	  }
       cout << endl;
     } else {cout <<"overflow"<<endl; } 
     
  }
}

C++: #include<cstdio>
#include<cmath>
using namespace std;

int main(){
	int n,t,i;
	char a[100],b[100],x[100],y[100];
	scanf("%d",&n);
	for(int o=0;o<n;o++){
		t=0;
		scanf("%s %s",a,b);
		for(i=0;a[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			x[j]=a[i-j-1];
		}
		for(;i<100;i++){
			x[i]='0';
		}
		for(i=0;b[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			y[j]=b[i-j-1];
		}
		for(;i<100;i++){
			y[i]='0';
		}
		for(i=0;i<99;i++){
			x[i]+=y[i]-'0';
			if(x[i]>'9'){
				x[i]-=10;
				x[i+1]+=1;
			}
		}
		for(i=99;i>=0;i--){
			if(x[i]!='0' || t){
				if(i>79){
					printf("overflow");
					break;
				}
				printf("%c",x[i]);
				t=1;
			}
		}
		printf("\n");
	}
	return 0;
}