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>
using namespace std;

int main(){
	string sx, sy, sans;
	int n;
	getline( cin, sx );
	sscanf( sx.c_str(), "%d", &n );
	for( int i=0; i<n; i++ ){
		getline( cin, sx );
		getline( cin, sy );
		if( sx.length()>80 || sy.length()>80 ){
			cout << "overflow" << endl;
		}else{
			string &s = (sx.length()>sy.length())?sx:sy;
			string &sa = (sx.length()>sy.length())?sy:sx;
			sans.resize( s.length()+1 );
			for( int j=0; j<sans.length(); j++ )
				sans[j] = 0;
			for( int j=0; j<sa.length(); j++ ){
				sans[j] += (sa[sa.length()-1-j]-'0') + (s[s.length()-1-j]-'0');
				if( sans[j] > 9 ){
					sans[j] -= 10;
					sans[j+1]++;
				}
			}
			for( int j=sa.length(); j<s.length(); j++ ){
				sans[j] += s[s.length()-1-j]-'0';
				if( sans[j] > 9 ){
					sans[j] -= 10;
					sans[j+1]++;
				}
			}
		}
		if( sans.length()>80 && sans[sans.length()-1]>0 ){
			cout << "overflow" << endl;
		}else{
			for( int j=(sans[sans.length()-1]==0?sans.length()-2:sans.length()-1); j>=0; j-- ){
				cout << (int)sans[j];
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][10000];
	char ans[100000];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
				
			}
			max10=0;
			if(in[NMin][ien[NMin]+1]>9){
				in[NMin][ien[NMin]+1]-=10;
				max10=1;
			}
			for(int i=0;i<2;i++){
				for(int j=0;j<ie[i]+1;j++){
					in[i][j]=in[i][j]+'0';
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdlib>
#include<string>

char iota(int n){
  switch (n) {
    case 0: return '0';
    case 1: return '1';
    case 2: return '2';
    case 3: return '3';
    case 4: return '4';
    case 5: return '5';
    case 6: return '6';
    case 7: return '7';
    case 8: return '8';
    case 9: return '9';
  }
  return '0';
}

int main(){
  std::string num1;
  std::string num2;
  char sum[102];
  int n,temp,flag=0,j;
  const char one = '1';

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> num1 >> num2;

    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    std::reverse(num1.begin(),num1.end());
    std::reverse(num2.begin(),num2.end());

    for(j=0;j<num2.size();j++){
      //std::cout << 1;
      temp = (num1[j] - '0') + (num2[j] - '0');
      if(flag){
        temp +=1;
        flag = 0;
      }
      if(temp > 9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
      //std::cout << temp << std::endl;
    }
    while(j<num1.size()){
      temp = num1[j] = '0';
      if(flag){
        temp += 1;
        flag = 0;
      }
      if(temp > 9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
    }
    if(flag){
      sum[j] = (char)one;
      sum[j+1] = '\0';
    }else{
      sum[j] = '\0';
    }
    std::string ssum = std::string(sum);
    //std::reverse(num1.begin(),num1.end());
    //std::reverse(num2.begin(),num2.end());
    std::reverse(ssum.begin(),ssum.end());
    //std::cout << num1 << std::endl;
    //std::cout << num2 << std::endl;
    std::cout << ssum << std::endl;
  }
}