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>
using namespace std;

string ans;
string s1,s2;

void Calc(int up,int indx1,int indx2){


  if(indx1==-1){
    if(up!=0){ans.insert(ans.begin(),(char)(up+(int)'0'));}
    return;
  }


  if(indx2>=0){
    int work = s1[indx1]-'0' + s2[indx2]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }

  else{
    int work = s1[indx1]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }


  Calc(up,indx1-1,indx2-1);
}

int main(){

  char head1,head2;
  string tmp;
  int size;
  int n;


  cin >> n;

  for(int i=0; i<n; i++){
    ans="";
    cin >> s1;
    cin >> s2;
    if(s1.size()<s2.size()){ tmp=s1;s1=s2;s2=tmp; }

    if(s1.size()>=81 || s2.size()>=81)
      cout<<"overflow"<<endl;
    else if((s1.size()>=80 || s2.size()>=80) && s1[0]-'0'+s2[0]-'0'>=10)
      cout<<"overflow"<<endl;
    else{
      Calc(0,s1.size()-1,s2.size()-1);
      cout << ans << endl;
    }
  }

  return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k,l;
    bool check;

    cin >> n;
    rep(i,n){
        char c1[81], c2[81];
        int i1[81] = {0}, i2[81] = {0};
        int ans[82] = {0};
        check = false;
        k = 0; l = 0;
        cin >> c1 >> c2;
        for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k++] = c1[j] - '0';
            }
            if(j <= strlen(c2) - 1){
                i2[l++] = c2[j] - '0';
            }
        }
        /*rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }*/
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}

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

int main()
{
	int N;cin>>N;
	for(int i=0; i<N; i++)
	{
		string a,b;
		cin>>a>>b;
		if((int)a.length()<=80 && (int)b.length()<=80 )
		{
			while((int)a.length()<81)
				a = "0"+a;
			while((int)b.length()<81)
				b = "0"+b;
			string c(81,'0');
			for ( int i=80; i>=0; i-- )
			{
				int t = a[i]-'0'+b[i]-'0'+c[i]-'0';
				c[i]='0'+t%10;
				if(t>=10)
					c[i-1]=t/10+'0';
			}
			if ( c[0]=='0')
			{
				int p=0;
				while(c[p]=='0')
					p++;
				if(c[p]=='\0')
					cout << "0" <<endl;
				else
					cout<<c.c_str()+p<<endl;
			}
			else
				cout << "overflow" << endl;


		}
		else
			cout << "overflow" << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	bool flag = true;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(a.size() > 80 || b.size() > 80){
			cout << "overflow" << endl;
			flag = false;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(flag == true){
			if(ans.size() > 80){
				cout << "overflow" << endl;
				flag = false;
			}
			else{
				for(int j=ans.size()-1; j>=0; j--)
					cout << ans[j];
				cout << endl;
			}
		}
	}
	return 0;
}

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

int eval(char a)
{
    return a - '0';
}

int main(void)
{
    string a, b;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        stack<int> c;
        cin >> a >> b;
        auto ia = a.rbegin();
        auto ib = b.rbegin();
        int g = 0;
        while (true) {
            int e = 0, f = 0;
            if (ia != a.rend())
                e = eval((char)*ia++);
            if (ib != b.rend())
                f = eval((char)*ib++);
            c.push((e + f + g)%10);
            g = (e + f + g >=10)? 1 : 0;
            if (ia == a.rend() && ib == b.rend())
            {
                if (g == 1)
                    c.push(1);
                break;
            }
        }
        int l = c.size();
        if (l > 80) {
            cout << "overflow" << endl;
            continue;
        }
        for (int i = 0; i < l; ++i) {
            cout << c.top();
            c.pop();
        }
        cout << endl;
    }
    return 0;
}