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;
int main(){
  char a[200];
  int n,k,l,i;
  cin>>n;
  while(n--){
    string s1,s2;
    cin>>s1>>s2;
    for(i=0;i<200;i++)a[i]='0';
    for(k=0,i=s2.size()-1;i>=0;i--)a[k++]=s2[i];
    for(l=0,i=s1.size()-1;i>=0;i--,l++){
      a[l]+=s1[i]-'0';
      if(a[l]>'9'){a[l+1]++;a[l]-=10;
        if(!i)l++;
      }
    }
    if(k>80||l>80)cout<<"overflow";
    else if(l<k)for(i=k-1;i>=0;i--)cout<<a[i];
    else for(i=l-1;i>=0;i--)cout<<a[i];
    cout<<endl;
  }
}

C++: #include <stdio.h>
#include <string.h>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	int num1[100];
	int num2[100];
	int sum[100];
	char str[100];
	int n;
	int i, j, k;
	
	fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
		printf("error");
	
	for (i=0; i<n; i++) {
		for (j=0; j<100; j++) {
			num1[j] = num2[j] = sum[j] = 0;
		}
		
		// first integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str)-1; j++)  ;
		for (k=0; j>=0; k++) {
			num1[k] = str[j] - '0';
			j--;
		}
		
		// second integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str)-1; j++)  ;
		for (k=0; j>0; k++) {
			num2[k] = str[j] - '0';
			j--;
		}
		
		// sum
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j]/10 >= 1) {
				sum[j+1] += sum[j]/10;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] > 0) {
			printf("overflow\n");
		}
		else {
			for (j=79; sum[j]==0 && j!=0; j--)  ;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>

#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int N;
  scanf(" %d ", &N);
  for (int i = 0; i < N; i++) {
    long long a, b;
    scanf(" %lld %lld ", &a, &b);
    if ((a + b) / 1e79 != 0) {
      printf("overflow\n");
      goto next;
    }
    printf("%lld\n", a + b);
  next:
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  for (int n = 0; n < N; ++n) {
    string A, B;
    cin >> A >> B;

    int A_size = A.size(), B_size = B.size(),
        ans_size = max(A_size, B_size) + 1;
    vector<int> ans(ans_size);
    for (int i = A_size - 1; i >= 0; --i)
      ans[ans_size - A_size + i] = A[i] - '0';
    for (int j = B_size - 1; j >= 0; --j) {
      ans[ans_size - B_size + j] += B[j] - '0';
      for (int k = ans_size - 1; k > 0; --k)
        if (ans[k] >= 10)
          ans[k] -= 10, ++ans[k - 1];
    }

    if (A_size > 80 || B_size > 80 || (ans_size == 81 && ans[0] != 0) ||
        ans_size > 81) {
      cout << "overflow" << endl;
    } else {
      for (int i = 0; i < ans_size; ++i) {
        if (i == 0 && ans[i] == 0)
          continue;
        cout << ans[i];
      }
      cout << endl;
    }
  }
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        char c1,c2;
        scanf("%s",&c1);
        scanf("%s",&c2);
        string s1,s2;
        s1=c1, s2=c2;
        if(s1=="0" && s2=="0"){
            printf("0\n");
            continue;
        }
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        int n=max(s1.size(),s2.size())+1;
        for(int i=s1.size();i<n;i++){
            s1+='0';
        }
        for(int i=s2.size();i<n;i++){
            s2+='0';
        }
        string res;
        int b=0;
        for(int i=0;i<max(s1.size(),s2.size());i++){
            int u=s1[i]-'0'+s2[i]-'0'+b;
            b=(u>=10); u%=10;
            res+=u+'0';
        }

        reverse(res.begin(),res.end());
        string res2;
        int j=0;
        while(res[j]=='0'){
            j++;
        }
        for(;j<res.size();j++){
            res2+=res[j];
        }

        if(res2.size()>80){
            printf("overflow\n");
        }else{
            printf("%s\n",res2.c_str());
        }
    }
    return 0;
}