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 <stdio.h>
#include <string.h>
char a[82];
char b[82];
char s[82];
int main()
{
  int n,i,j,c,d;
  scanf("%d",&n);
  while(n>0){
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    memset(s,0,sizeof(s));
    scanf("%s\n%s",&a,&b);
    i=strlen(a)-1;
    j=strlen(b)-1;
    c=0;
    d=0;
    while(i>=0 || j>=0) {
      if(i>=0 && j>=0){
	s[d++] = (((a[i]-'0')+(b[j]-'0')+c) % 10)+'0';
	c = ((a[i]-'0')+(b[j]-'0')+c) / 10;
	i--;j--;
      }else if(i>=0){
	s[d++] = (((a[i]-'0')+c) % 10)+'0';
	c = ((a[i]-'0')+c) / 10;
	i--;
      }else if(j>=0){
	s[d++] = (((b[j]-'0')+c) % 10)+'0';
	c = ((b[j]-'0')+c) / 10;
	j--;
      }
    }
    if(c!=0) s[d++] = c+'0';
    if(d>80) printf("overflow");
    else {
      for(d--;d>=0;d--){
	printf("%c",s[d]);
      }
    }
    printf("\n");
    n--;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>

using namespace std;

string add(string a, string b){
//    cout << a << endl;
//    cout << b << endl;
    while(a.size() < b.size()) a.insert(0, "0");
    while(b.size() < a.size()) b.insert(0, "0");
//    cout << a << endl;
//    cout << b << endl;
    int n = a.size();
    string res(n, ' ');
    for (int i = n - 1, d = 0; i >= 0; --i){
        int p = a[i] - '0';
        int q = b[i] - '0';
        int r = p + q + d;
        d = r / 10;
        res[i] = r % 10 + '0';
        if (i == 0 && d != 0) res.insert(0, string(1, d + '0'));
//        cout << res << endl;
    }
    return res;
}

int main(){
    int Tc;
    cin >> Tc;
    while(Tc--) {
        string a, b;
        cin >> a >> b;
        string tmp = add(a, b);
        if(tmp.size() > 80) cout << "overflow" << endl;
        else cout << tmp << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	string a,b;
	int c[100]={0};
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a.size()>80||b.size()>80)
			cout<<"overflow"<<endl;
		else{
			int t;
			if(a.size()>=b.size())
				t=a.size();
			if(a.size()<b.size())
				t=b.size();
			for(int j=0;j<t;j++){
				if(j<a.size())
					c[j]+=a[a.size()-j-1]-'0';
				if(j<b.size())
					c[j]+=b[b.size()-j-1]-'0';
				if(c[j]>=10){
					c[j]-=10;
					c[j+1]=1;
				}
			}
			bool h=true;
			if(c[t]==1){
				if(t==79){
					cout<<"overflow"<<endl;
					h=false;
				}
				else
				    cout<<"1";
			}
			if(h==true){
			for(int j=t-1;j>=0;j--)
				cout<<c[j];
			cout<<endl;
			}
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
	int sets;
	char input1[100], input2[100], out[100];
	int i1, i2, o, carry;
	int ic1, ic2;
	int i;

	cin >> sets;
	for(i=0;i<sets;i++) {
		scanf("%s", input1);
		scanf("%s", input2);
		for(i1=0;input1[i1] != '\0';i1++);
		for(i2=0;input2[i2] != '\0';i2++);
		i1--;i2--;o=0;carry=0;
		while(i1>=0 || i2>=0 || carry) {
			if(o > 80) { break; }
			if(i1>=0) { ic1 = input1[i1]-'0'; i1--; } else { ic1 = 0; }
			if(i2>=0) { ic2 = input2[i2]-'0'; i2--; } else { ic2 = 0; }
			if( ic1+ic2+carry < 10 ) { 
				out[o] = ic1+ic2+carry+'0';
				carry = 0;
			} else {
				out[o] = ic1+ic2+carry-10+'0';
				carry = 1;
			}
			o++;
		}
		if(o > 80) { printf("overflow"); }
		else { for(o--;o>=0;o--) { printf("%c", out[o]); } }
		printf("\n"); 
	}

	return 0;
}

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

int main(){

  string s,t,a,b;
  int n,k;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> s >> t;

    int z[1000] = {0},x[1000] = {0},c = 0,p = 0;

    for(int i=s.size()-1;i>=0;i--){
      x[p] = s[i] - 48;
      p++;
    }

    p = 0;
    for(int i=t.size()-1;i>=0;i--){
      z[p] = t[i] - 48;
      p++;
    }


    k = max(s.size(),t.size());

    for(int i=0;i<k;i++){
      x[i] += z[i];

      if(x[i] >= 10){
	if(i == k - 1) c = 1;
	x[i] -= 10;
	x[i + 1]++;
      }
    }

    cout << "a" << " " << k+c << endl;

    if(k+c > 80) cout << "overflow" << endl;

    else{
      for(int i=k+c-1;i>=0;i--) cout << x[i];
      cout << endl;
    }
  }
}

C++: #include <iostream>
#include <string>
using namespace std;
int main() {
	string L,R;int left,right,i,j,N;cin>>N;while (N--) {cin>>L>>R;left=L.length(),right=R.length();
		if (left>=right) {if (left>80) {cout<<"overflow"<<endl;continue;}R.resize(left);for (i=right-1,j=left-1;i>=0;i--,j--) R[j]=R[i];right=left;for (;j>=0;R[j--]='0');
		} else {if (right>80) {cout<<"overflow"<<endl;continue;}L.resize(right);for (i=right-1,j=left-1;j>=0;i--,j--) L[i]=L[j];left=right;for (;i>=0;L[i--]='0');}
		L[left]=0;for (i=left-1,j=0;i>=0;i--) {L[i]+=R[i]+j-48;if (L[i]>'9') j=1,L[i]-=10; else j=0;}i=L.length()+j;if (i>80) cout<<"overflow"<<endl; else {if (j) cout<<"1";cout<<L<<endl;}} return 0;}