Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

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--;
    }
    
}

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

int main()
{
  int N;
  char str1[81];
  char str2[81];
  char s1[81];
  char s2[81];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > 79 || m2 > 79)
      cout << "overflow" << endl;
    else if(atoi(str1) + atoi(str2) < 2147483647 && atoi(str1) + atoi(str2) > 0)
      cout << atoi(str1) + atoi(str2) << endl; 
    else{
      if(m1 > m2){
	for(int i = 0; i < m1 - m2 + 1; i++)
	  s1[i] = '0';
	s1[m1 - m2] = '\0';
	strcat(s1, str2);
	strcpy(s2, str1);
      }else if(m2 > m1){
	for(int i = 0; i < m2 - m1; i++)
	  s2[i] = '0';
	s2[m2 - m1] = '\0';
	strcat(s2, str1);
	strcpy(s1, str2);
      }else{
	strcpy(s1, str2);
	strcpy(s2, str1);
      }
      char ans[81];
      int n = 0;
      for(int i = ((m1 > m2) ? m1 : m2) - 1; i >= 0; i--, n++)
	if((s1[i] - '0') + (s2[i] - '0') >= 10){
	  s1[i - 1] = s1[i - 1] + 1;
	  ans[i] = (s1[i]- '0') + (s2[i] - '0') + 38;
	}else
	  ans[i] = (s1[i] - '0') + (s2[i] - '0') + 48;
      if(n > 79)
	cout << "overflow" << endl;
      else{
	if((s1[0] - '0') + (s2[0] - '0') >= 10)
	  cout << "1";
	cout << ans;
      }
    }
  }
}