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<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int ix=0;ix<n;ix++){
        string s1,s2;
        cin>>s1>>s2;
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        if(s1.size()>80||s2.size()>80){
            printf("overflow\n");
            continue;
        }
        string res;
        int kuri=0;
        for(int i=0;i<80;i++){
            int now;
            if(i<s1.size()&&i<s2.size())now=(s1[i]-'0')+(s2[i]-'0')+kuri;
            else if(i<s1.size())now=(s1[i]-'0')+kuri;
            else if(i<s2.size())now=(s2[i]-'0')+kuri;
            else if(kuri==1)now=kuri;
            else break;
            res.append(1,(char)(now%10+'0'));
            kuri=now/10;
        }
        if(kuri==1)printf("overflow\n");
        else{
            reverse(res.begin(),res.end());
            printf("%s\n",res.c_str());
        }
    }
}

C++: #include <iostream>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int n, maxlen;
  char a[81], b[81];

  cin >> n;
  for(int ii = 0 ; ii < n ; ii++){
    string ans = "";
    scanf("%s%s", a, b);
    
    maxlen = max(strlen(a), strlen(b));

    reverse(a, a+strlen(a));
    reverse(b, b+strlen(b));
    
    for(int i = strlen(a) ; i < 81 ; i++){
      a[i] = '0';
    }
    for(int i = strlen(b) ; i < 81 ; i++){
      b[i] = '0';
    }

    int tmp, tmp2 = 0;
    bool flag = 0;

    for(int i = 0 ; i < maxlen ; i++){
      tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
      
      if(i == maxlen - 1){
	//cout << "OK" << endl;
	//tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
	if(tmp >= 10){
	  tmp2 = 1;
	  tmp -= 10;
	  ans += tmp + '0';
	  ans += '1';
	}
	else ans += tmp + '0';
      }

      else if(tmp >= 10){
	tmp2 = 1;
	tmp -= 10;
	ans += tmp + '0';
      }
      else if(tmp <= 9){
	ans += tmp + '0';
	tmp2 = 0;
      }
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stack>
using namespace std;

int main() {
	int k,a,b,c,d,i,j,s;
	stack<int> st[3];
	char n[2][1000];
	cin >> d;
	for (d;d>0;d--) {
	cin >> n[0] >> n[1];
	if (strlen(n[0])>80 || strlen(n[1])>80) { cout << "overflow" << endl; continue;}
	for (i=0;i<2;i++) for (j=0;n[i][j]!='\0';j++) st[i].push(n[i][j]-'0');
	k=0; c=0;
	while(!st[0].empty() || !st[1].empty()) {
		if (!st[0].empty()) {a=st[0].top(); st[0].pop();} else a=0;
		if (!st[1].empty()) {b=st[1].top(); st[1].pop();} else b=0;
		s=a+b+c; k++;
		if (s>9) { c=1; s-=10; } else c=0;
		st[2].push(s);
	}
	if ((c==1 && k==80) || k>80) { 
		cout << "overflow" << endl;
		while(!st[2].empty()) st[2].pop();
	}
	else {
		if (c==1) cout << 1;
		while(!st[2].empty()) { 
			cout << st[2].top();
			st[2].pop();
		}
		cout << endl;
	}
}
		return 0;
}

C++: #include<iostream>
#include<string>
#define max(a,b) a>b?a:b
using namespace std;
int che(char a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(a==i){
			return j;
		}
		j++;
	}
	return 0;
}
char cha(int a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(j==a){
			return i;
		}
		j++;
	}
}
int main(){
	string a,b;
	int c=0;
	int i,j,k,m,n;
	int x,y;
	char d[100];
	cin>>n;
	for(k=0;k<n;k++){
		cin>>a>>b;
		x=a.size();
		y=b.size();
		m=max(x,y);
		for(i=1;i<=m;i++){
			j=che(a[x-i])+che(b[y-i])+c;
			if(j>=10){
				c=1;
				j-=10;
			}else{
				c=0;
			}
			d[i]=cha(j);
		}
		if(c==1){
			d[i]=cha(1);
			c=0;
			i++;
		}
		for(j=i-1;j>0;j--){
			cout<<d[j];
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int N;
	string x, y, temp;
	int i, a[80];
	bool over = false;

	cin >> N;

	for(i = 0;i < 80;i++){
		a[i] = 0;
	}

	while(N != 0){
		if(N == 0) break;
		cin >> x >> y;
		N--;
		if(x.size() > 80 || y.size() > 80){
			cout << "overflow" << endl;
			continue;
		}

		if(x.size() < y.size()){
			temp = x;
			x = y;
			y = temp;
		}
		int xi = 0, yi = 0, sum = 0;
		for(i = 0;i < x.size();i++){
			xi = x[x.size() - 1 - i] - '0';
			//cout << "xi = " << xi << endl;
			if(i >= y.size()){
				yi = 0;
			}
			else {
				yi = y[y.size() - 1 - i] - '0';
				//cout << "yi = " << yi << endl;
			}
			a[i] += xi + yi;
			//cout << "xi + yi  = " << a[x.size() - 1 - i] << endl;
			if(a[i] > 9){
				if(i < 79){
					a[i] = a[i] - 10;
					a[i + 1] += 1;
				}
				else if(i >= 79){
					cout << "overflow"	<< endl;
					over = true;
					break;				
				}
			}

			
		}
		 
		if(!over){
			bool start = false;
			for(i = 79;i >= 0;i--){
				if(!start && a[i] > 0){
					start = true;
				}
				if(start){
					cout << a[i];
				}
			}
			cout << endl;
		}
		
		for(i = 0;i < 80;i++){
				a[i] = 0;
		}
		
	}
	return 0;
}