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 s1, s2;
    int n;
    
    cin >> n;
    
    while( n-- ) {
    	
	cin >> s1 >> s2;
	
	if( s1.length() > 80 || s2.length() > 80)
  	cout << "overflow\n";
  	
  	else {
  	
  	int i1 = s1.length();
  	int i2 = s2.length();
  	
  	string ans;
    int tmp = 0;
    int up = 0;
  	
  	while( i1 > 0 && i2 > 0 ) {
  		
  		tmp = (s1[i1 - 1] + s2[i2 - 1]) - 2 * '0' + up;
  		
        up = tmp / 10;
        tmp %= 10;
        ans = char(tmp + '0') + ans;
  	
  		i1--;
  		i2--;
  		
	  }
	  if (i1 > 0) {
        while( i1 > 0  ) {
            tmp = s1[i1 - 1] - '0' + up;
            
            up = tmp / 10;
            tmp %= 10;
            ans = char(tmp + '0') + ans;
            
            i1--;
        }
    }
        else if (i2 > 0) {
            while( i2 > 0  ) {
            tmp = s2[i2 - 1] - '0' + up;
                
            up = tmp / 10;
            tmp %= 10;
            ans = char(tmp + '0') + ans;
                
            i2--;
        }
    }
 
        if (up > 0)
        ans = char(up + '0') + ans;
 
        if (ans.size() > 80)
        cout << "overflow" << endl;
        
        else
        cout << ans << endl;
  }
}
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>
#include <cstdlib>
#include <typeinfo>
using namespace std;



int main(){
	int n;
	string x, y;
	int a, b, c;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> y;
		if (x.length() > 80 || y.length() > 80)
		{
			cout << "overflow" << endl;
		}
		else
		{
			a = stoi(x);
			b = stoi(x);
			cout << a << b << endl;
			if (to_string(a + b).length() > 80)
			{
				cout << "overflow" << endl;
			}
			else cout << a + b << endl;
		}
	}
}