Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[100],se[100],ans[100];

	scanf("%d",&N);

	for(i=0;i<N;i++){

		scanf("%s",&fi);
		scanf("%s",&se);

		
		for(j=strlen(fi)-1,k=strlen(se)-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            ans[keta]=((math1+math2+kuri)%10)+'0';
			kuri=(math1+math2+kuri)/10;
		}
		if(kuri==1) printf("1");
		if(keta-1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int T; scanf("%d",&T);
	while(T--){
		char s[128],t[128]; scanf("%s%s",s,t);
		int m=strlen(s),n=strlen(t);

		int a[128]={},b[128]={};
		rep(i,m) a[i]=s[m-i-1]-'0';
		rep(i,n) b[i]=t[n-i-1]-'0';

		m=max(m,n);
		int c[128]={};
		rep(i,m){
			int tmp=a[i]+b[i]+c[i];
			c[i]=tmp%10;
			c[i+1]+=tmp/10;
		}
		if(c[m]!=0) m++;

		if(m>80) puts("overflow");
		else{
			rep(i,m) putchar(c[m-i-1]+'0');
			puts("");
		}
	}

	return 0;
}

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

int main()
{
  int N;
  char str1[81];
  char str2[81];
  int j = 0, k = 0, c;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    if(j > 80 || k > 80)
      cout << "overflow" << endl;
    else{
      int n1[41] = {};
      int n2[41] = {};
      int m1 = strlen(str1), m2 = strlen(str2);
      for(int i = 1, j = 40; (m1 - i - 1 >= 0) || (m1 - i >= 0); i += 2, j--)
	if(str1[m1 - i - 1] == '0')
	  if(str1[m1 - i] == '0')
	    n1[j] = 1000;
	  else 
	    n1[j] = str1[m1 - i] - '0';
	else
	  if(m1 - i - 1 < 0)
	    n1[j] = str1[m1 - i] - '0';
	  else
	    n1[j] = (str1[m1 - i] - '0') + (str1[m1 - i - 1] - '0') * 10; 
      for(int i = 1, j = 40; (m2 - i - 1 >= 0) || (m2 - i >= 0); i += 2, j--)
	if(str2[m2 - i - 1] == '0')
	  if(str2[m2 - i] == '0')
	    n2[j] = 1000;
	  else
	    n2[j] = (str2[m2 - i] - '0');
	else
	  if(m2 - i - 1 < 0)
	    n2[j] = str2[m2 - i] - '0';
	  else
	    n2[j] = (str2[m2 - i] - '0') + (str2[m2 - i - 1] - '0') * 10;
      int ans[41] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = 40; 39 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}

C++: #include <cstdio>
using namespace std;

int main(){
	int N;
	char str1[90], str2[90];
	int num1[80], num2[80], sum[80];
	int pos, pos2, up;
	
	scanf("%d", &N);
	for(int n = 0; n < N; n++){
		for(int i = 0; i < 90; i++){
			str1[i] = 0;
			str2[i] = 0;
		}
		for(int i = 0; i < 80; i++){
			num1[i] = 0;
			num2[i] = 0;
			sum[i] = 0;
		}
		scanf("%s", str1);
		scanf("%s", str2);
		
		pos = 89;
		while(pos >= 0 && str1[pos] == 0) pos--;
		pos2 = 0;
		while(pos >= 0 && pos2 < 80 && str1[pos] != 0){
			num1[pos2] = str1[pos] - 48;
			pos2++; pos--;
		}
		pos = 89;
		while(pos >= 0 && str2[pos] == 0) pos--;
		pos2 = 0;
		while(pos >= 0 && pos2 < 80 && str2[pos] != 0){
			num2[pos2] = str2[pos] - 48;
			pos2++; pos--;
		}
		
		/*for(int i = 0; i < 80; i++) printf("%d", num1[i]);
		printf("\n");
		for(int i = 0; i < 80; i++) printf("%d", num2[i]);
		printf("\n");*/
		
		up = 0;
		for(int i = 0; i < 80; i++){
			sum[i] = num1[i] + num2[i] + up;
			up = sum[i] / 10;
			sum[i] = sum[i] % 10;
		}
		
		if(up > 0 || sum[79] > 0) printf("overflow\n");
		else{
			pos = 79;
			while(pos >= 0 && sum[pos] == 0) pos--;
			if(pos < 0) printf("0");
			while(pos >= 0){
				printf("%d", sum[pos]);
				pos--;
			}
			printf("\n");
		}
	}
	
	return 0;
}

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

int main(void)
{
    int n;
    bool flag;
    scanf("%d", &n);
    
    while (n != 0){
        flag = true;
        
        int num1[81] = {0}, num2[81] = {0};
        int max_len;
        
        char in[3000];
        scanf("%s", in);
        // êUlðæèÞ
        int len = (int)strlen(in);
        if (80 < len) flag = false;
        // üÁ½lª80Èã¾Á½çAflagð0É·é
        else {
            max_len = len;
            int j = 0;
            for (int i = (len - 1); -1 < i; i--){
                num1[j] = in[i] - '0';
                j++;
            }
        }
        
        scanf("%s", in);
        // êUlðæèÞ
        len = (int)strlen(in);
        if (80 < len) flag = false;
        // üÁ½lª80Èã¾Á½çAflagð0É·é
        else {
            if (max_len < len) max_len = len;
            int j = 0;
            for (int i = (len - 1); -1 < i; i--){
                num2[j] = in[i] - '0';
                j++;
            }
        }
        
        // üÁ½lª80Èã¶áÈ¢Æ«ÉZ
        if (flag){
            for (int i = 0; i < 80; i++){
                num1[i] += num2[i];
                if (10 <= num1[i]){
                    num1[i + 1] += 1;
                    num1[i] %= 10;
                }
            }
            
            if (num1[80] != 0){
                flag = 0;
                // 81Úª0¶áÈ¢ = overflow
            }
            
            // overflowµÄÈ¢Æ«ÉoÍ
            if (flag == 1){
                // ÅãÌ«µã°ÅJèãªèµÄé©Ç¤©
                if (num1[max_len] == 0){
                    for (int i = max_len - 1; -1 < i; i--){
                        printf("%d", num1[i]);
                    }
                    printf("\n");
                }
                else {
                    for (int i = max_len; -1 < i; i--){
                        printf("%d", num1[i]);
                    }
                    printf("\n");
                }
            }
        }
        
        // ¡ÜÅÉflagª0ÉÈÁÄ½çoverflowI
        if (flag == 0){
            printf("overflow\n");
        }
        
        n--;
    }
    
}