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>
#include <cstdlib>
#include <algorithm>

#define MAX_DIGIT 80
#define ERROR ("Overflow")



int main(void){
	using namespace std;

	int N;
	cin >> N;

	for(int i=1; i<=N; i++){

		string slhs, srhs;
		cin >> slhs >> srhs;
		if(slhs.size()>MAX_DIGIT || srhs.size()>MAX_DIGIT){
			cout << ERROR << endl;
			continue;
		}

		reverse(slhs.begin(), slhs.end());
		reverse(srhs.begin(), srhs.end());

		int lhs[MAX_DIGIT], rhs[MAX_DIGIT], res[MAX_DIGIT];
		fill(lhs, lhs+MAX_DIGIT, 0);
		fill(rhs, rhs+MAX_DIGIT, 0);
		fill(res, res+MAX_DIGIT, 0);
		auto atoi_digit = [] (char x) -> int {
			return atoi(&x);
		};
		transform(slhs.begin(), slhs.end(), lhs, atoi_digit);
		transform(srhs.begin(), srhs.end(), rhs, atoi_digit);

		int headDigit;
		for (headDigit=MAX_DIGIT-1; headDigit>=0; headDigit--){
			if(lhs[headDigit]!=0 || rhs[headDigit]!=0){
				break;
			}
		}
		if(headDigit != MAX_DIGIT-1){
			headDigit++;
		}

		int carry = 0;
		for (int j=0; j<=headDigit; j++){
			auto d = div(lhs[j]+rhs[j]+carry,10);
			carry = d.quot;
			res[j] = d.rem;
		}
		if(headDigit==MAX_DIGIT-1 && carry !=0){
			cout << ERROR << endl;
			continue;
		}


		for (; headDigit>=1; headDigit--){
			if(res[headDigit]!=0){
				break;
			}
		}
		for (int j=headDigit; j>=0; j--){
			cout << res[j];
		}
		cout << endl;
	}
}

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

using namespace std;

int main(){
    string inp[2];
    int output[81],n;
    cin >> n;
    while(n--){
        cin >> inp[0] >> inp[1];
        if(inp[0].size()>80||inp[0].size()>80) cout << "overflow" << endl;
        else{
            fill(output,output+81,0);
            reverse(inp[0].begin(),inp[0].end());
            reverse(inp[1].begin(),inp[1].end());
            for(int i=0;i<81;i++){
                if(i<inp[0].size()) output[i]+=inp[0][i]-'0';
                if(i<inp[1].size()) output[i]+=inp[1][i]-'0';
                if(i!=80&&output[i]>9){
                    output[i+1]+=output[i]/10;
                    output[i]%=10;
                }
            }
            if(output[80]>0) cout << "overflow" << endl;
            else{
                bool flag=false;
                for(int i=79;i>=0;i--){
                    if((!flag&&output[i]!=0)||i==0) flag=true;
                    if(flag) cout << output[i];
                }
                cout << endl;
            }
        }
    }
    return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
int main(void)
{
	int y;
	scanf("%d",&y);
	for(int z = 0;z < y;z++)
	{
		char suji1[100000],suji2[100000];
		char ans[100000] = {0};

		for(int i = 0;i<82;i++)
		{
			suji1[i] = '0';
			suji2[i] ='0';
		}

		int overflow = 0;

		scanf("%s",suji1);
		scanf("%s",suji2);
		int suji1s = strlen(suji1);
		int suji2s = strlen(suji2);

		int anss;
		if(suji1s>suji2s)  anss = suji1s;
		else anss = suji2s;

		suji1[suji1s] = '0';
		suji2[suji2s] = '0';

		reverse(suji1,suji1+suji1s);
		reverse(suji2,suji2+suji2s);

		for(int i = 0;i < 81;i++)
		{
			ans[i] = suji1[i]+suji2[i] - '0';
			if(ans[i] >= ':')
			{
				ans[i]  = ans[i] - 10;
				suji2[i+1] = suji2[i+1]+1;
			}
		}
		if(ans[anss]> '0')
		{
			anss++;
		}
		
		if(anss > 80) overflow = 1;
		reverse(ans,ans+anss);
		ans[anss] = 0;
		if(overflow >= 1)
		{
			printf("overflow\n");
		}
		else
		{
			printf("%s",ans);
		}
		printf("\n");
		
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;


string solve(string s1, string s2){

while(s1.size()<85){
s1 = '0' + s1;
}
while(s2.size()<85){
s2 = '0' + s2;
}
string ret = "";
int kuri = 0;
for(int i=0;i<80;i++){
int r = (int)(s1[s1.size()-1-i]-'0' + s2[s2.size()-1-i]-'0') + kuri;
kuri = r/10;
r = r%10;
ret = ((char)('0'+r)) + ret;
}
if (kuri>0) return "overflow"; else return ret;
}

int main(void){
int N;
cin >> N;
for(int i=0;i<N;i++){
string s1, s2;
cin >> s1 >> s2;
cout << solve(s1, s2) << endl;
}
return 0;
}

C++: /* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
 		for(int i = 0; i < q; ++i){
 			BigInteger n1 = sc.nextBigInteger();
 			BigInteger n2 = sc.nextBigInteger();
 			BigInteger ans = n1.add(n2);
 			String sa = ans.toString();
 			if(sa.length() > 80){
 				System.out.println("overflow");	
 			}
 			else{
 				System.out.println(sa);
 			}
 		}	
	}
}