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

void stlip(vector<int> &v, string &s) {
  for (auto i = s.rbegin(), e = s.rend(); i != e; i++) {
    v.push_back(*i - 48);
  }
}

void print(vector<int> &v) {
  int n;
  string s;
  for (auto i = v.rbegin(), e = v.rend(); i != e; i++) {
    s += to_string(*i);
  }
  if (s.size() > 80)
    cout << "overflow" << endl;
  else
    cout << s << endl;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    vector<int> v1, v2, ret;
    string a, b;
    bool flag = true;
    cin >> a >> b;
    if (a.size() > 80 || b.size() > 80) {
      cout << "overflow" << endl;
      continue;
    }
    if (a.size() < b.size())
      swap(a, b);
    stlip(v1, a);
    stlip(v2, b);
    v2.resize(v1.size());
    for (int i = 0; i < v1.size(); i++) {
      int tmp;
      tmp = v1[i] + v2[i];
      if (tmp > 9) {
        if (i == v1.size() - 1) {
          v1.resize(v1.size() + 1);
          v2.resize(v1.size() + 1);
        }
        v2[i + 1] += 1;
        tmp -= 10;
      }
      ret.push_back(tmp);
    }
    if (flag)
      print(ret);
  }

  return 0;
}

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

using namespace std;

int main(){
    
    string d[10000];
    string e[10000];
    
    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        cin>>d[i];
        cin>>e[i];
    }
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<(int)(d[i].size()); j++){
            st1.push(d[i][j]);
        }
        for(int j=0; j<(int)(e[i].size()); j++){
            st2.push(e[i][j]);
        }
        int temp=0;
        char temp_char;
        while(st1.empty()==false||st2.empty()==false){
            if(st1.empty()==false&&st2.empty()==false){
                temp_char=st1.top();
                temp+=atoi(&temp_char);
                temp_char=st2.top();
                temp+=atoi(&temp_char);
                st1.pop();
                st2.pop();
            }else if(st1.empty()==false&&st2.empty()==true){
                temp_char=st1.top();
                temp+=atoi(&temp_char);
                st1.pop();
            }else if(st1.empty()==true&&st2.empty()==false){
                temp_char=st2.top();
                temp+=atoi(&temp_char);
                st2.pop();
            }
            st3.push(temp%10);
            temp=temp/10;
        }
        
        if(temp!=0){
            st3.push(temp);
        }
        
        if(st3.size()>=80){
            printf("overflow");
        }else{
            while(st3.empty()==false){
                printf("%d",st3.top());
                st3.pop();
            }
        }
        printf("\n");
    }
    
}

C++: #include <iostream>
#include <cstring>

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		std::cin >> i2;
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
			continue;
		}
		char *p = res;
		while(*p++ == '0');
		std::cout << (p-1) << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){

	int n;

	string a, b;
	char N1[80], N2[80];
	char sum[80];

	cin >> n;

	for( int i=0;i<n;i++ ){

		cin >> a;
		
		if( a.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		cin >> b;

		if( b.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		for( int i=0;i<80;i++ ){
			N1[i] = -1; N2[i] = -1; sum[i] = 0;
		}

		for( int i=1;i<=a.length();i++ )
			N1[i] = a[a.length()-i] - '0';
		for( int i=1;i<=b.length();i++)
			N2[i] = b[b.length()-i] - '0';

		int over = 0;
		
		for( int i=0;i<80;i++ ){


			if( N1[i] == -1 && N2[i] == -1 ){
				if( over >= 10 ){
					sum[i] = over / 10;
					over = 0;
				}else
					sum[i] = -1;
				continue;
			}

			if( N1[i] != -1 )
				sum[i] += N1[i];
			if( N2[i] != -1 )
				sum[i] += N2[i];

			sum[i] += over / 10;

			over = floor((double)sum[i]/10)*10;

			sum[i] -= over;
			
		}

		if(over > 0)cout << "overflow" << endl;
		else{		
			for( int i=1;i<=80;i++ ){
				if( sum[80-i] >= 0 )
					cout << (int)sum[80-i];
			}
			cout << endl;
		}


	}
	return 0;
}