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 <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	string s1, s2;
	int n, n1[100], n2[100];cin >> n;
	for(int g = 0;g < n;g++){
		cin >> s1 >> s2;
		for(int i = 0;i < 100;i++)n1[i] = n2[i] = 0;
		if(s1.size()>80 || s2.size()>80){
			cout << "overflow" << endl;
			continue;
		}
		for(int i = 0;i < s1.size();i++)n1[i] = s1[s1.size()-i-1] - '0';
		for(int i = 0;i < s2.size();i++)n2[i] = s2[s2.size()-i-1] - '0';
		
		for(int i = 0;i < 90;i++){
			n1[i] += n2[i];
			if(n1[i] > 9){n1[i] = n1[i]%10;n1[i+1]++;}
		}
		int flag = 0;
		for(int i = 90;i >= 0;i--){
			if(!flag && i == 0){cout << n1[0];break;}
			if(flag && i >= 80){flag = 2;break;}
			if(flag)cout << n1[i];
			if(!flag && i > 0 && n1[i-1] != 0)flag = 1;
		}
		if(flag == 2)cout << "overflow";
		cout << endl;
	}
	return 0; 
}

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

int main(int argc, const char * argv[]) {
    int a[80];
    int b[80];
    char temp[80];
    int x, y;
    int s[80];
    int a_num, b_num, n, i;

    scanf("%d", &y);
    for (i=0; i<y; i++) {
        for (n = 0; n < 80; n++) {
            a[n] = 0;
            b[n] = 0;
            s[n] = 0;
        }
        
        a_num = 0;
        scanf("%s", temp);
        a_num = (int)strlen(temp) - 1;
        for (n = 0; n <= a_num; n++){
            a[a_num - n] = temp[n] - 48;
        }

        b_num = 0;
        scanf("%s", temp);
        b_num = (int)strlen(temp) - 1;
        for (n = 0; n <= b_num; n++) {
            b[b_num - n] = temp[n] - 48;
        }
        
        if (a_num > 80 || b_num > 80) {
            printf("overflow\n");
        } else {
            if (a_num >= b_num) {
                for (n=0; n <= a_num; n++) {
                    x = a[n] + b[n] + s[n];
                    if (x > 9) {
                        s[n+1]++;
                        x = x - 10;
                    }
                    s[n] = x;
                }
                if (s[a_num+1] > 0) printf("%d", s[a_num+1]);
                for (n=a_num; n >= 0; n--) {
                    printf("%d", s[n]);
                }
                printf("\n");
            } else {
                for (n=0; n <= b_num; n++) {
                    if ((x = a[n] + b[n] + s[n]) > 9) {
                        s[n+1]++;
                        x = x - 10;
                    }
                    s[n] = x;
                }
                if (s[b_num+1] > 0) printf("%d", s[b_num+1]);
                for (n=b_num; n >= 0; n--) {
                    printf("%d", s[n]);
                }
                printf("\n");
            }
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int DIGIT=9;

int main() {
  int n;
  char buf[81];
  int l, x[2], y, z;
  char buf_part[DIGIT+1];
  int a[2][9];
  int b[9];

  cin >> n;
  while (n--) {
    for (int i=0; i<2; i++) {
      cin >> buf;
      l = strlen(buf);
      x[i] = (l+DIGIT-1)/DIGIT;
      y = (l-1)%DIGIT+1;
      for (int j=0; j<9; j++) {
        a[i][j] = 0;
      }
      for (int j=0; j<x[i]; j++) {
        if (!j) {
          memcpy(buf_part, buf, y);
          buf_part[y] = '\0';
        } else {
          memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT);
          buf_part[DIGIT] = '\0';
        }
        a[i][x[i]-j-1] = atoi(buf_part);
      }
    }

    /*for (int i=0; i<9; i++) b[i] = 0;
    z = (x[0] > x[1]) ? x[0] : x[1];
    for (int i=0; i<z; i++) {
      b[i] = a[0][i] + a[1][i];
      if (b[i] >= 1000000000) {
        a[0][i+1]++;
        b[i] -= 1000000000;
      }
    }
    if (z<9 && a[0][z]) {
      b[z] = a[0][z]+a[1][z];
      ++z;
    }
    if (b[8] >= 100000000) {
      cout << "overflow" << endl;
    } else {
      cout << b[z-1];
      for (int i=z-2; i>=0; i--) {
        cout.fill('0');
        cout.width(DIGIT);
        cout << b[i];
      }
      cout << endl;
    }*/
  }
  return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int chrtoint(char a){
int i;
i=a-48;
 return i;
return 0;
}

int main(){
char n1[1000];
char n2[1000];
int rs[1000];
int c1, c2;

int i,j,m, cmax, sum,testcase;
scanf("%d",&testcase);
while(testcase--){
scanf("%s", &n1);
scanf("%s", &n2);
c1 = strlen(n1);
c2 = strlen(n2);

reverse(n1,n1+c1);
reverse(n2,n2+c2);

cmax = c1;
if(c1<c2){
cmax = c2;
}

m=0;
for(i=0; i< cmax; i++){
if(c1==c2 || (i < c1 && i < c2)){
sum = m+chrtoint(n1[i])+chrtoint(n2[i]);
}else if(i >=c1){
sum = m+chrtoint(n2[i]);
}else if(i >=c2){
sum = m+chrtoint(n1[i]);
}
if(sum>9){
m = 1;
rs[i] = sum-10;
}
else{
m=0;
rs[i] = sum;
}
}

if(m){
rs[i]=m;
i++;
}
if(i>80){
    printf("overflow\n");
    continue;
}
for(j=0; j < i; j++){
printf("%d", rs[i-j-1]);
}
}
return 0;
}