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>
int main() {
    char first[85],second[85],ans[85];int left,right,i,last,N;scanf("%d",&N);while (N--) {
    left=0,right=0;scanf("%s",&ans);for (i=strlen(ans)-1;i>=0;i--) first[left++]=ans[i];scanf("%s",&ans);for (i=strlen(ans)-1;i>=0;i--) second[right++]=ans[i];
    for (i=left;i<85;first[i++]='0');for (i=0,last=0;i<right;i++) {last+=(first[i]+second[i]-96);if (last>=10) first[i]=last%10+48,last/=10; else first[i]=last+48,last=0;}
    while (last) {last+=first[i]-48;if (last>=10) first[i]=last%10+48,last/=10,i++; else first[i]=last+48,last=0;}
	for (i=84;i>=0 && first[i]=='0';i--);if (i<0) puts("0"); else {for (;i>=0;printf("%c",first[i--]));puts("");}} 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(){
    char in1[81], in2[81];
    int n;
    cin >> n;
    rep(k,n){
        cin >> in1 >> in2;
        if(strlen(in1) > 80 || strlen(in2) > 80){
            cout << "overflow" << endl;
            continue;
        }
        int ans[81] = {0};
        int j = 0;
        for(int i = strlen(in1); i > 0; i--){
            ans[81 - i]+= in1[j] - '0';
            j++;
        }
        j = 0;
        for(int i = strlen(in2); i > 0; i--){
            ans[81 - i]+= in2[j] - '0';
            j++;
        }
        for(int i = 80; i >= 0; i--){
            if(ans[i] >= 10){
                ans[i]-= 10;
                ans[i - 1]++;
            }
        }
        if(ans[0] != 0){
            cout << "overflow" << endl;
            continue;
        }
        int len = 80 - max(strlen(in1), strlen(in2)) + 1;
        if(ans[len - 1] != 0)
            cout << ans[len - 1];
        range(i, len, 81){
                cout << ans[i];
        }cout << endl;
    }
}

C++: #include<cstdio>
#include<algorithm>
#include<string.h>
//#include<string>

using namespace std;

#define MAX(x,y) ((x>y)? x:y)


int n;//データセットの数

char str[2][10000];//	入力される整数文字列
int n_str[2];//長さを収納

char answer[85];


int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{

		scanf("%s%s",&str[0],&str[1]);
		n_str[0]=strlen(str[0]);
		n_str[1]=strlen(str[1]);
		int max =0,min=1;
		if(n_str[1]>n_str[0])
		{
			max=1;
			min=0;
		}
		int s = n_str[max]-n_str[min];
		char cha[10000];
		fill(cha,cha+80,'0');
		for(int j=n_str[min];j>=0;j--)
		{
			cha[j+s]=str[min][j];
		}
		strcpy(str[min],cha);
		fill(answer,answer+85,0);
		for(int j=n_str[max]-1;j>=0;j--)
		{
			answer[j]=str[0][j]+str[1][j]-'0';
			if(answer[j]>'9')//繰り上がり時の処理
			{
				answer[j]-=10;
				if(j==0)
				{
					if(n_str[max]>=80)
					{
						n_str[max]=90;
					}

					else printf("1");
				}
				else str[0][j-1]++;
			}
		}
		if(n_str[max]>80)
		{
			printf("overflow\n");
		}
		else printf("%s\n",answer);
	}
	return 0;
}

C++: #include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N) {
		string a, b;
		string ans;
		cin >> a >> b;
		int a_tmp, b_tmp;
		int k = (a.size() > b.size()) ? a.size() : b.size();
		int tmp = abs(a.size() - b.size());
		rep(j, tmp) (a.size() > b.size()) ? b.insert(0, "0") : a.insert(0, "0");
		int keta = 0;
		repr(j, k - 1) {
			a_tmp = a[j] - 48; b_tmp = b[j] - 48;
			int sum = a_tmp + b_tmp + keta;
			if(sum < 10) {
				keta = 0;
				stringstream ss;
				ss << sum;
				ans.insert(0, ss.str());
			}
			else {
				keta = 1;
				sum = sum - 10;
				stringstream ss;
				ss << sum;
				ans.insert(0, ss.str());
			}
		}
		if(keta == 1) ans.insert(0, "1");
		if(ans.size() > 80) printf("overflow\n");
		else cout << ans << endl;
	}
	return 0;
}

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

string calc(string s1,string s2){
  int num1=s1.size()-1,num2=s2.size()-1;
  int tmp=0;
  string s;
  while(!(num1==-1&&num2==-1&&tmp==0)){
    if(num1!=-1&&num2!=-1){
      tmp+=int(s1[num1]-'0')+int(s2[num2]-'0');
      num1--;num2--;
    }else if(num1!=-1&&num2==-1){
      tmp+=int(s1[num1]-'0');
      num1--;
    }else if(num1==-1&&num2!=-1){
      tmp+=int(s2[num2]-'0');
      num2--;
    }
    s=to_string(tmp%10)+s;
    tmp/=10;
  }
  if(s.size()>80)s="overflow";
  return s;
}

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  int n;
  string s1,s2;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s1>>s2;
    cout<<calc(s1,s2)<<endl;
  }
  return 0;
}